Skip to content

Commit 79e5eac

Browse files
author
Sven Schnelle
authored
bus/hp_dio: Modernize all of the HP DIO cards to use anonymous namespaces (#12528)
1 parent 7c38ac0 commit 79e5eac

20 files changed

+563
-651
lines changed

src/devices/bus/hp_dio/hp98265a.cpp

+55-3
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,64 @@
1212
#include "machine/nscsi_bus.h"
1313
#include "bus/nscsi/devices.h"
1414
#include "machine/mb87030.h"
15+
#include "bus/scsi/scsi.h"
16+
#include "bus/scsi/scsicd.h"
1517

1618
#define VERBOSE 0
1719
#include "logmacro.h"
1820

21+
namespace {
1922

20-
DEFINE_DEVICE_TYPE(HPDIO_98265A, bus::hp_dio::dio16_98265a_device, "hp98265a", "HP98265A SCSI S16 Interface")
23+
class dio16_98265a_device :
24+
public device_t,
25+
public bus::hp_dio::device_dio32_card_interface
26+
{
27+
public:
28+
// construction/destruction
29+
dio16_98265a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
30+
31+
void mb87030(device_t *device);
32+
33+
protected:
34+
dio16_98265a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
35+
36+
37+
// device-level overrides
38+
virtual void device_start() override;
39+
virtual void device_reset() override;
40+
41+
virtual ioport_constructor device_input_ports() const override;
42+
virtual void device_add_mconfig(machine_config &config) override;
43+
44+
uint16_t io_r(offs_t offset);
45+
void io_w(offs_t offset, uint16_t data);
2146

22-
namespace bus::hp_dio {
47+
void dmack_w_in(int channel, uint8_t data) override;
48+
uint8_t dmack_r_in(int channel) override;
49+
50+
void dmar0_w(int state);
51+
52+
void irq_w(int state);
53+
54+
required_device<nscsi_bus_device> m_scsibus;
55+
required_device<mb87030_device> m_spc;
56+
private:
57+
58+
static constexpr int REG_CONTROL_DE0 = (1 << 0);
59+
static constexpr int REG_CONTROL_DE1 = (1 << 1);
60+
61+
static void mb87030_scsi_adapter(device_t *device);
62+
required_ioport m_sw1;
63+
required_ioport m_sw2;
64+
int get_int_level();
65+
void update_irq(bool state);
66+
void update_dma();
67+
bool m_installed_io;
68+
uint8_t m_control;
69+
70+
bool m_irq_state;
71+
bool m_dmar0;
72+
};
2373

2474
void dio16_98265a_device::mb87030_scsi_adapter(device_t *device)
2575
{
@@ -295,4 +345,6 @@ void dio16_98265a_device::dmar0_w(int state)
295345

296346
}
297347

298-
} // namespace bus::hp_dio
348+
} // anonymous namespace
349+
350+
DEFINE_DEVICE_TYPE_PRIVATE(HPDIO_98265A, bus::hp_dio::device_dio16_card_interface, dio16_98265a_device, "hp98265a", "HP98265A SCSI S16 Interface")

src/devices/bus/hp_dio/hp98265a.h

+1-59
Original file line numberDiff line numberDiff line change
@@ -7,65 +7,7 @@
77
#pragma once
88

99
#include "hp_dio.h"
10-
#include "machine/mb87030.h"
11-
#include "bus/scsi/scsi.h"
12-
#include "bus/scsi/scsicd.h"
1310

14-
namespace bus::hp_dio {
15-
16-
class dio16_98265a_device :
17-
public device_t,
18-
public device_dio32_card_interface
19-
{
20-
public:
21-
// construction/destruction
22-
dio16_98265a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
23-
24-
void mb87030(device_t *device);
25-
26-
protected:
27-
dio16_98265a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
28-
29-
30-
// device-level overrides
31-
virtual void device_start() override;
32-
virtual void device_reset() override;
33-
34-
virtual ioport_constructor device_input_ports() const override;
35-
virtual void device_add_mconfig(machine_config &config) override;
36-
37-
uint16_t io_r(offs_t offset);
38-
void io_w(offs_t offset, uint16_t data);
39-
40-
void dmack_w_in(int channel, uint8_t data) override;
41-
uint8_t dmack_r_in(int channel) override;
42-
43-
void dmar0_w(int state);
44-
45-
void irq_w(int state);
46-
47-
required_device<nscsi_bus_device> m_scsibus;
48-
required_device<mb87030_device> m_spc;
49-
private:
50-
51-
static constexpr int REG_CONTROL_DE0 = (1 << 0);
52-
static constexpr int REG_CONTROL_DE1 = (1 << 1);
53-
54-
static void mb87030_scsi_adapter(device_t *device);
55-
required_ioport m_sw1;
56-
required_ioport m_sw2;
57-
int get_int_level();
58-
void update_irq(bool state);
59-
void update_dma();
60-
bool m_installed_io;
61-
uint8_t m_control;
62-
63-
bool m_irq_state;
64-
bool m_dmar0;
65-
};
66-
67-
} // namespace bus::hp_dio
68-
69-
DECLARE_DEVICE_TYPE_NS(HPDIO_98265A, bus::hp_dio, dio16_98265a_device)
11+
DECLARE_DEVICE_TYPE_NS(HPDIO_98265A, bus::hp_dio, device_dio16_card_interface)
7012

7113
#endif // MAME_BUS_HPDIO_98265A_H

src/devices/bus/hp_dio/hp98543.cpp

+58-5
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,66 @@
1616
#define HP98543_SCREEN_NAME "98543_screen"
1717
#define HP98543_ROM_REGION "98543_rom"
1818

19+
namespace {
20+
21+
class dio16_98543_device :
22+
public device_t,
23+
public bus::hp_dio::device_dio16_card_interface,
24+
public device_memory_interface
25+
{
26+
public:
27+
dio16_98543_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
28+
29+
uint16_t rom_r(offs_t offset);
30+
void rom_w(offs_t offset, uint16_t data);
31+
32+
uint16_t ctrl_r(address_space &space, offs_t offset, uint16_t mem_mask = ~0);
33+
void ctrl_w(address_space &space, offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
34+
uint16_t vram_r(offs_t offset, uint16_t mem_mask = ~0);
35+
void vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
36+
37+
static constexpr int TOPCAT_COUNT = 4;
38+
39+
required_device_array<topcat_device, TOPCAT_COUNT> m_topcat;
40+
required_device<nereid_device> m_nereid;
41+
42+
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
43+
protected:
44+
dio16_98543_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
45+
46+
virtual void device_start() override;
47+
virtual void device_reset() override;
48+
49+
virtual void device_add_mconfig(machine_config &config) override;
50+
virtual const tiny_rom_entry *device_rom_region() const override;
51+
52+
virtual space_config_vector memory_space_config() const override;
53+
private:
54+
55+
void vblank_w(int state);
56+
void int0_w(int state);
57+
void int1_w(int state);
58+
void int2_w(int state);
59+
void int3_w(int state);
60+
61+
const address_space_config m_space_config;
62+
void map(address_map &map);
63+
void update_int();
64+
static constexpr int m_h_pix = 1024;
65+
static constexpr int m_v_pix = 400;
66+
67+
required_region_ptr<uint8_t> m_rom;
68+
required_shared_ptr<uint8_t> m_vram;
69+
70+
uint8_t m_intreg;
71+
bool m_ints[4];
72+
};
73+
1974
ROM_START(hp98543)
2075
ROM_REGION(0x2000, HP98543_ROM_REGION, 0)
2176
ROM_LOAD("1818-3907.bin", 0x000000, 0x002000, CRC(5e2bf02a) SHA1(9ba9391cf39624ef8027ce42c84e100344b2a2b8))
2277
ROM_END
2378

24-
DEFINE_DEVICE_TYPE(HPDIO_98543, bus::hp_dio::dio16_98543_device, "dio98543", "HP98543 medium-res color DIO video card")
25-
26-
namespace bus::hp_dio {
27-
2879
void dio16_98543_device::device_add_mconfig(machine_config &config)
2980
{
3081
screen_device &screen(SCREEN(config, HP98543_SCREEN_NAME, SCREEN_TYPE_RASTER));
@@ -251,4 +302,6 @@ uint32_t dio16_98543_device::screen_update(screen_device &screen, bitmap_rgb32 &
251302
return 0;
252303
}
253304

254-
} // namespace bus::hp_dio
305+
} // anonymous namespace
306+
307+
DEFINE_DEVICE_TYPE_PRIVATE(HPDIO_98543, bus::hp_dio::device_dio16_card_interface, dio16_98543_device, "dio98543", "HP98543 medium-res color DIO video card")

src/devices/bus/hp_dio/hp98543.h

+1-61
Original file line numberDiff line numberDiff line change
@@ -7,68 +7,8 @@
77
#pragma once
88

99
#include "hp_dio.h"
10-
#include "video/topcat.h"
11-
#include "video/nereid.h"
12-
#include "machine/ram.h"
13-
14-
namespace bus::hp_dio {
15-
16-
class dio16_98543_device :
17-
public device_t,
18-
public device_dio16_card_interface,
19-
public device_memory_interface
20-
{
21-
public:
22-
dio16_98543_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
23-
24-
uint16_t rom_r(offs_t offset);
25-
void rom_w(offs_t offset, uint16_t data);
26-
27-
uint16_t ctrl_r(address_space &space, offs_t offset, uint16_t mem_mask = ~0);
28-
void ctrl_w(address_space &space, offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
29-
uint16_t vram_r(offs_t offset, uint16_t mem_mask = ~0);
30-
void vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
31-
32-
static constexpr int TOPCAT_COUNT = 4;
33-
34-
required_device_array<topcat_device, TOPCAT_COUNT> m_topcat;
35-
required_device<nereid_device> m_nereid;
36-
37-
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
38-
protected:
39-
dio16_98543_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
40-
41-
virtual void device_start() override;
42-
virtual void device_reset() override;
43-
44-
virtual void device_add_mconfig(machine_config &config) override;
45-
virtual const tiny_rom_entry *device_rom_region() const override;
46-
47-
virtual space_config_vector memory_space_config() const override;
48-
private:
49-
50-
void vblank_w(int state);
51-
void int0_w(int state);
52-
void int1_w(int state);
53-
void int2_w(int state);
54-
void int3_w(int state);
55-
56-
const address_space_config m_space_config;
57-
void map(address_map &map);
58-
void update_int();
59-
static constexpr int m_h_pix = 1024;
60-
static constexpr int m_v_pix = 400;
61-
62-
required_region_ptr<uint8_t> m_rom;
63-
required_shared_ptr<uint8_t> m_vram;
64-
65-
uint8_t m_intreg;
66-
bool m_ints[4];
67-
};
68-
69-
} // namespace bus::hp_dio
7010

7111
// device type definition
72-
DECLARE_DEVICE_TYPE_NS(HPDIO_98543, bus::hp_dio, dio16_98543_device)
12+
DECLARE_DEVICE_TYPE_NS(HPDIO_98543, bus::hp_dio, device_dio16_card_interface)
7313

7414
#endif // MAME_BUS_HPDIO_98543_H

src/devices/bus/hp_dio/hp98544.cpp

+48-8
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,63 @@
1111
#include "emu.h"
1212
#include "hp98544.h"
1313
#include "screen.h"
14+
#include "video/topcat.h"
15+
#include "hp_dio.h"
1416

1517
#define HP98544_SCREEN_NAME "98544_screen"
1618
#define HP98544_ROM_REGION "98544_rom"
1719

20+
namespace {
21+
22+
class dio16_98544_device :
23+
public device_t,
24+
public bus::hp_dio::device_dio16_card_interface,
25+
public device_memory_interface
26+
{
27+
public:
28+
// construction/destruction
29+
dio16_98544_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
30+
31+
uint16_t rom_r(offs_t offset);
32+
void rom_w(offs_t offset, uint16_t data);
33+
34+
required_device<topcat_device> m_topcat;
35+
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
36+
protected:
37+
dio16_98544_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
38+
39+
// device-level overrides
40+
virtual void device_start() override;
41+
virtual void device_reset() override;
42+
43+
// optional information overrides
44+
virtual void device_add_mconfig(machine_config &config) override;
45+
virtual const tiny_rom_entry *device_rom_region() const override;
46+
virtual space_config_vector memory_space_config() const override;
47+
private:
48+
49+
void vblank_w(int state);
50+
void int_w(int state);
51+
52+
static constexpr int m_v_pix = 768;
53+
static constexpr int m_h_pix = 1024;
54+
55+
const address_space_config m_space_config;
56+
void map(address_map &map);
57+
required_region_ptr<uint8_t> m_rom;
58+
required_shared_ptr<uint8_t> m_vram;
59+
60+
uint8_t m_intreg;
61+
};
62+
1863
//*************************************************************************
1964
// GLOBAL VARIABLES
2065
//**************************************************************************
2166

22-
DEFINE_DEVICE_TYPE(HPDIO_98544, bus::hp_dio::dio16_98544_device, "dio98544", "HP98544 high-res monochrome DIO video card")
23-
24-
namespace bus::hp_dio {
25-
2667
ROM_START( hp98544 )
2768
ROM_REGION( 0x2000, HP98544_ROM_REGION, 0 )
2869
ROM_LOAD( "98544_1818-1999.bin", 0x000000, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) )
2970
ROM_END
30-
3171
//-------------------------------------------------
3272
// device_add_mconfig - add device configuration
3373
//-------------------------------------------------
@@ -50,8 +90,6 @@ void dio16_98544_device::device_add_mconfig(machine_config &config)
5090
// rom_region - device-specific ROM region
5191
//-------------------------------------------------
5292

53-
54-
5593
const tiny_rom_entry *dio16_98544_device::device_rom_region() const
5694
{
5795
return ROM_NAME( hp98544 );
@@ -184,4 +222,6 @@ uint32_t dio16_98544_device::screen_update(screen_device &screen, bitmap_rgb32 &
184222
return 0;
185223
}
186224

187-
} // namespace bus::hp_dio
225+
} // anonymous namespace
226+
227+
DEFINE_DEVICE_TYPE_PRIVATE(HPDIO_98544, bus::hp_dio::device_dio16_card_interface, dio16_98544_device, "dio98544", "HP98544 high-res monochrome DIO video card")

0 commit comments

Comments
 (0)