summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2018-05-31 12:41:53 +1000
committer Vas Crabb <vas@vastheman.com>2018-05-31 12:41:53 +1000
commitb8b20ffd5adde588a7f05e35872d11e54471ef03 (patch)
treec0b6d01acf2ebab1d73713811b1327205a833313
parent221b16bcbadd642874b18546ea49aaee71ac6990 (diff)
hp_dio: clean up (nw)
-rw-r--r--src/devices/bus/hp_dio/hp98543.cpp10
-rw-r--r--src/devices/bus/hp_dio/hp98544.cpp13
-rw-r--r--src/devices/bus/hp_dio/hp98603a.cpp8
-rw-r--r--src/devices/bus/hp_dio/hp98603b.cpp3
-rw-r--r--src/devices/bus/hp_dio/hp98644.cpp4
-rw-r--r--src/devices/bus/hp_dio/hp_dio.cpp110
-rw-r--r--src/devices/bus/hp_dio/hp_dio.h88
-rw-r--r--src/devices/video/topcat.cpp4
-rw-r--r--src/mame/drivers/hp9k_3xx.cpp120
9 files changed, 164 insertions, 196 deletions
diff --git a/src/devices/bus/hp_dio/hp98543.cpp b/src/devices/bus/hp_dio/hp98543.cpp
index 9aa9d99a08d..25a98439351 100644
--- a/src/devices/bus/hp_dio/hp98543.cpp
+++ b/src/devices/bus/hp_dio/hp98543.cpp
@@ -90,22 +90,20 @@ dio16_98543_device::dio16_98543_device(const machine_config &mconfig, device_typ
void dio16_98543_device::device_start()
{
- set_dio_device();
-
- m_dio->install_memory(
+ dio().install_memory(
0x200000, 0x27ffff,
read16_delegate(FUNC(dio16_98543_device::vram_r), this),
write16_delegate(FUNC(dio16_98543_device::vram_w), this));
- m_dio->install_memory(
+ dio().install_memory(
0x560000, 0x563fff,
read16_delegate(FUNC(dio16_98543_device::rom_r), this),
write16_delegate(FUNC(dio16_98543_device::rom_w), this));
- m_dio->install_memory(
+ dio().install_memory(
0x564000, 0x565fff,
read16_delegate(FUNC(dio16_98543_device::ctrl_r), this),
write16_delegate(FUNC(dio16_98543_device::ctrl_w), this));
- m_dio->install_memory(
+ dio().install_memory(
0x566000, 0x567fff,
read16_delegate(FUNC(nereid_device::ctrl_r), static_cast<nereid_device*>(m_nereid)),
write16_delegate(FUNC(nereid_device::ctrl_w), static_cast<nereid_device*>(m_nereid)));
diff --git a/src/devices/bus/hp_dio/hp98544.cpp b/src/devices/bus/hp_dio/hp98544.cpp
index 012793c726d..db790a89977 100644
--- a/src/devices/bus/hp_dio/hp98544.cpp
+++ b/src/devices/bus/hp_dio/hp98544.cpp
@@ -85,9 +85,7 @@ void dio16_98544_device::map(address_map& map)
device_memory_interface::space_config_vector dio16_98544_device::memory_space_config() const
{
- return space_config_vector {
- std::make_pair(0, &m_space_config)
- };
+ return space_config_vector{ std::make_pair(0, &m_space_config) };
}
//-------------------------------------------------
@@ -96,18 +94,15 @@ device_memory_interface::space_config_vector dio16_98544_device::memory_space_co
void dio16_98544_device::device_start()
{
- // set_nubus_device makes m_slot valid
- set_dio_device();
-
- m_dio->install_memory(
+ dio().install_memory(
0x200000, 0x2fffff,
read16_delegate(FUNC(topcat_device::vram_r), static_cast<topcat_device*>(m_topcat)),
write16_delegate(FUNC(topcat_device::vram_w), static_cast<topcat_device*>(m_topcat)));
- m_dio->install_memory(
+ dio().install_memory(
0x560000, 0x563fff,
read16_delegate(FUNC(dio16_98544_device::rom_r), this),
write16_delegate(FUNC(dio16_98544_device::rom_w), this));
- m_dio->install_memory(
+ dio().install_memory(
0x564000, 0x567fff,
read16_delegate(FUNC(topcat_device::ctrl_r), static_cast<topcat_device*>(m_topcat)),
write16_delegate(FUNC(topcat_device::ctrl_w), static_cast<topcat_device*>(m_topcat)));
diff --git a/src/devices/bus/hp_dio/hp98603a.cpp b/src/devices/bus/hp_dio/hp98603a.cpp
index c49f5e99dd6..330d051b735 100644
--- a/src/devices/bus/hp_dio/hp98603a.cpp
+++ b/src/devices/bus/hp_dio/hp98603a.cpp
@@ -57,14 +57,14 @@ dio16_98603a_device::dio16_98603a_device(const machine_config &mconfig, device_t
void dio16_98603a_device::device_start()
{
- set_dio_device();
}
void dio16_98603a_device::device_reset()
{
- m_rom = device().machine().root_device().memregion(this->subtag(HP98603A_ROM_REGION).c_str())->base();
- m_dio->install_memory(0x80000, 0xfffff, read16_delegate(FUNC(dio16_98603a_device::rom_r), this),
- write16_delegate(FUNC(dio16_98603a_device::rom_w), this));
+ m_rom = device().machine().root_device().memregion(this->subtag(HP98603A_ROM_REGION).c_str())->base();
+ dio().install_memory(0x80000, 0xfffff,
+ read16_delegate(FUNC(dio16_98603a_device::rom_r), this),
+ write16_delegate(FUNC(dio16_98603a_device::rom_w), this));
}
READ16_MEMBER(dio16_98603a_device::rom_r)
diff --git a/src/devices/bus/hp_dio/hp98603b.cpp b/src/devices/bus/hp_dio/hp98603b.cpp
index 41a49dc61e0..4a91ddcdb51 100644
--- a/src/devices/bus/hp_dio/hp98603b.cpp
+++ b/src/devices/bus/hp_dio/hp98603b.cpp
@@ -52,13 +52,12 @@ dio16_98603b_device::dio16_98603b_device(const machine_config &mconfig, device_t
void dio16_98603b_device::device_start()
{
- set_dio_device();
}
void dio16_98603b_device::device_reset()
{
m_rom = device().machine().root_device().memregion(this->subtag(HP98603B_ROM_REGION).c_str())->base();
- m_dio->install_memory(0x100000, 0x1fffff, read16_delegate(FUNC(dio16_98603b_device::rom_r), this),
+ dio().install_memory(0x100000, 0x1fffff, read16_delegate(FUNC(dio16_98603b_device::rom_r), this),
write16_delegate(FUNC(dio16_98603b_device::rom_w), this));
}
diff --git a/src/devices/bus/hp_dio/hp98644.cpp b/src/devices/bus/hp_dio/hp98644.cpp
index 6563ca47ca3..72129571c5e 100644
--- a/src/devices/bus/hp_dio/hp98644.cpp
+++ b/src/devices/bus/hp_dio/hp98644.cpp
@@ -138,8 +138,6 @@ ioport_constructor dio16_98644_device::device_input_ports() const
void dio16_98644_device::device_start()
{
- // set_nubus_device makes m_slot valid
- set_dio_device();
m_installed_io = false;
}
@@ -154,7 +152,7 @@ void dio16_98644_device::device_reset()
if (!m_installed_io)
{
- m_dio->install_memory(
+ dio().install_memory(
0x600000 + (code * 0x10000),
0x6007ff + (code * 0x10000),
read16_delegate(FUNC(dio16_98644_device::io_r), this),
diff --git a/src/devices/bus/hp_dio/hp_dio.cpp b/src/devices/bus/hp_dio/hp_dio.cpp
index 76e7f58b545..56eaa2a1d93 100644
--- a/src/devices/bus/hp_dio/hp_dio.cpp
+++ b/src/devices/bus/hp_dio/hp_dio.cpp
@@ -19,9 +19,6 @@ DEFINE_DEVICE_TYPE(DIO16_SLOT, dio16_slot_device, "dio16_slot", "16-bit DIO slot
// LIVE DEVICE
//**************************************************************************
-//-------------------------------------------------
-// dio16_slot_device - constructor
-//-------------------------------------------------
dio16_slot_device::dio16_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
dio16_slot_device(mconfig, DIO16_SLOT, tag, owner, clock)
{
@@ -30,25 +27,29 @@ dio16_slot_device::dio16_slot_device(const machine_config &mconfig, const char *
dio16_slot_device::dio16_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, type, tag, owner, clock),
device_slot_interface(mconfig, *this),
- m_owner(nullptr), m_dio_tag(nullptr)
+ m_dio(*this, finder_base::DUMMY_TAG)
{
}
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void dio16_slot_device::device_start()
+void dio16_slot_device::device_resolve_objects()
{
- device_dio16_card_interface *dev = dynamic_cast<device_dio16_card_interface *>(get_card_device());
+ device_dio16_card_interface *const card(dynamic_cast<device_dio16_card_interface *>(get_card_device()));
+ if (card && m_dio)
+ card->set_diobus(*m_dio);
+}
- const device_dio32_card_interface *intf;
- if (get_card_device() && get_card_device()->interface(intf))
- {
- fatalerror("DIO32 device in DIO16 slot\n");
- }
+void dio16_slot_device::device_validity_check(validity_checker &valid) const
+{
+ device_t *const card(get_card_device());
+ if (card && !dynamic_cast<device_dio16_card_interface *>(card))
+ osd_printf_error("Card device %s (%s) does not implement device_dio16_card_interface\n", card->tag(), card->name());
+}
- if (dev) dev->set_diobus(m_owner->subdevice(m_dio_tag));
+void dio16_slot_device::device_start()
+{
+ device_t *const card(get_card_device());
+ if (card && !dynamic_cast<device_dio16_card_interface *>(card))
+ throw emu_fatalerror("dio16_slot_device: card device %s (%s) does not implement device_dio16_card_interface\n", card->tag(), card->name());
}
@@ -77,8 +78,7 @@ dio32_slot_device::dio32_slot_device(const machine_config &mconfig, const char *
void dio32_slot_device::device_start()
{
- device_dio16_card_interface *dev = dynamic_cast<device_dio16_card_interface *>(get_card_device());
- if (dev) dev->set_diobus(m_owner->subdevice(m_dio_tag));
+ dio16_slot_device::device_start();
}
@@ -103,13 +103,12 @@ dio16_device::dio16_device(const machine_config &mconfig, const char *tag, devic
dio16_device::dio16_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, type, tag, owner, clock),
- m_maincpu(nullptr),
+ m_maincpu(*this, finder_base::DUMMY_TAG),
m_prgspace(nullptr),
m_out_irq3_cb(*this),
m_out_irq4_cb(*this),
m_out_irq5_cb(*this),
- m_out_irq6_cb(*this),
- m_cputag(nullptr)
+ m_out_irq6_cb(*this)
{
m_prgwidth = 0;
}
@@ -125,7 +124,6 @@ void dio16_device::device_start()
m_out_irq5_cb.resolve_safe();
m_out_irq6_cb.resolve_safe();
- m_maincpu = subdevice<cpu_device>(m_cputag);
m_prgspace = &m_maincpu->space(AS_PROGRAM);
m_prgwidth = m_maincpu->space_config(AS_PROGRAM)->m_data_width;
}
@@ -167,7 +165,7 @@ void dio16_device::unmap_bank(offs_t start, offs_t end)
void dio16_device::install_rom(offs_t start, offs_t end, const char *tag, uint8_t *data)
{
- m_prgspace->install_read_bank(start, end, 0, tag );
+ m_prgspace->install_read_bank(start, end, 0, tag);
machine().root_device().membank(m_prgspace->device().siblingtag(tag).c_str())->set_base(data);
}
@@ -176,86 +174,62 @@ void dio16_device::unmap_rom(offs_t start, offs_t end)
m_prgspace->unmap_read(start, end);
}
-// interrupt request from dio card
-WRITE_LINE_MEMBER( dio16_device::irq3_w ) { m_out_irq3_cb(state); }
-WRITE_LINE_MEMBER( dio16_device::irq4_w ) { m_out_irq4_cb(state); }
-WRITE_LINE_MEMBER( dio16_device::irq5_w ) { m_out_irq5_cb(state); }
-WRITE_LINE_MEMBER( dio16_device::irq6_w ) { m_out_irq6_cb(state); }
-
-//**************************************************************************
-// DEVICE CONFIG DIO16 CARD INTERFACE
-//**************************************************************************
-
//**************************************************************************
// DEVICE DIO16 CARD INTERFACE
//**************************************************************************
-//-------------------------------------------------
-// device_dio16_card_interface - constructor
-//-------------------------------------------------
-
-device_dio16_card_interface::device_dio16_card_interface(const machine_config &mconfig, device_t &device)
- : device_slot_card_interface(mconfig, device),
- m_dio(nullptr), m_dio_dev(nullptr), m_next(nullptr)
+device_dio16_card_interface::device_dio16_card_interface(const machine_config &mconfig, device_t &device) :
+ device_slot_card_interface(mconfig, device),
+ m_dio_dev(nullptr), m_next(nullptr)
{
}
-
-//-------------------------------------------------
-// ~device_dio16_card_interface - destructor
-//-------------------------------------------------
-
device_dio16_card_interface::~device_dio16_card_interface()
{
}
-void device_dio16_card_interface::set_dio_device()
+void device_dio16_card_interface::interface_pre_start()
{
- m_dio = dynamic_cast<dio16_device *>(m_dio_dev);
+ if (!m_dio_dev)
+ throw emu_fatalerror("device_dio16_card_interface: DIO bus not configured\n");
}
-DEFINE_DEVICE_TYPE(DIO32, dio32_device, "dio32", "32-bit DIO-II bus")
+//**************************************************************************
+// DIO32 DEVICE
+//**************************************************************************
-//-------------------------------------------------
-// dio32_device - constructor
-//-------------------------------------------------
+DEFINE_DEVICE_TYPE(DIO32, dio32_device, "dio32", "32-bit DIO-II bus")
dio32_device::dio32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
dio16_device(mconfig, DIO32, tag, owner, clock)
{
}
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
void dio32_device::device_start()
{
dio16_device::device_start();
}
-//-------------------------------------------------
-// device_dio32_card_interface - constructor
-//-------------------------------------------------
-device_dio32_card_interface::device_dio32_card_interface(const machine_config &mconfig, device_t &device)
- : device_dio16_card_interface(mconfig,device), m_dio(nullptr)
+//**************************************************************************
+// DEVICE DIO32 CARD INTERFACE
+//**************************************************************************
+
+device_dio32_card_interface::device_dio32_card_interface(const machine_config &mconfig, device_t &device) :
+ device_dio16_card_interface(mconfig, device)
{
}
-
-//-------------------------------------------------
-// ~device_dio32_card_interface - destructor
-//-------------------------------------------------
-
device_dio32_card_interface::~device_dio32_card_interface()
{
}
-void device_dio32_card_interface::set_dio_device()
+void device_dio32_card_interface::interface_pre_start()
{
- m_dio = dynamic_cast<dio32_device *>(m_dio_dev);
-}
+ device_dio16_card_interface::interface_pre_start();
+ if (m_dio_dev && !dynamic_cast<dio32_device *>(m_dio_dev))
+ throw emu_fatalerror("device_dio32_card_interface: DIO32 device %s (%s) in DIO16 slot %s\n", device().tag(), device().name(), m_dio_dev->name());
+}
diff --git a/src/devices/bus/hp_dio/hp_dio.h b/src/devices/bus/hp_dio/hp_dio.h
index dd8efada7ba..c11d6f8f7e0 100644
--- a/src/devices/bus/hp_dio/hp_dio.h
+++ b/src/devices/bus/hp_dio/hp_dio.h
@@ -23,16 +23,8 @@
#define MCFG_DIO16_CPU(_cputag) \
downcast<dio16_device &>(*device).set_cputag(_cputag);
-#define MCFG_DIO16_SLOT_ADD(_diotag, _tag, _slot_intf, _def_slot, _fixed) \
- MCFG_DEVICE_ADD(_tag, DIO16_SLOT, 0) \
- MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed) \
- downcast<dio16_slot_device &>(*device).set_dio16_slot(this, _diotag);
#define MCFG_DIO32_CPU(_cputag) \
downcast<dio32_device &>(*device).set_cputag(_cputag);
-#define MCFG_DIO32_SLOT_ADD(_diotag, _tag, _slot_intf, _def_slot, _fixed) \
- MCFG_DEVICE_ADD(_tag, DIO32_SLOT, 0) \
- MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed) \
- downcast<dio32_slot_device &>(*device).set_dio32_slot(this, _diotag);
#define MCFG_ISA_OUT_IRQ3_CB(_devcb) \
devcb = &downcast<dio16_device &>(*device).set_out_irq3_callback(DEVCB_##_devcb);
@@ -52,25 +44,35 @@
class dio16_device;
-class dio16_slot_device : public device_t,
- public device_slot_interface
+class dio16_slot_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
+ template <typename T, typename U>
+ dio16_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&dio_tag, U &&opts, const char *dflt, bool fixed) :
+ dio16_slot_device(mconfig, tag, owner, clock)
+ {
+ set_dio(std::forward<T>(dio_tag));
+ option_reset();
+ opts(*this);
+ set_default_option(dflt);
+ set_fixed(fixed);
+ }
dio16_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // device-level overrides
- virtual void device_start() override;
-
// inline configuration
- void set_dio16_slot(device_t *owner, const char *dio_tag) { m_owner = owner; m_dio_tag = dio_tag; }
+ template <typename T> void set_dio(T &&dio_tag) { m_dio.set_tag(std::forward<T>(dio_tag)); }
protected:
dio16_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+ // device-level overrides
+ virtual void device_resolve_objects() override;
+ virtual void device_validity_check(validity_checker &valid) const override;
+ virtual void device_start() override;
+
// configuration
- device_t *m_owner;
- const char *m_dio_tag;
+ required_device<dio16_device> m_dio;
};
// device type definition
@@ -84,7 +86,7 @@ public:
// construction/destruction
dio16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration
- void set_cputag(const char *tag) { m_cputag = tag; }
+ template <typename T> void set_cputag(T &&tag) { m_maincpu.set_tag(std::forward<T>(tag)); }
template <class Object> devcb_base &set_out_irq3_callback(Object &&cb) { return m_out_irq3_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_out_irq4_callback(Object &&cb) { return m_out_irq4_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_out_irq5_callback(Object &&cb) { return m_out_irq5_cb.set_callback(std::forward<Object>(cb)); }
@@ -103,10 +105,10 @@ public:
void unmap_rom(offs_t start, offs_t end);
// IRQs 1, 2, and 7 are reserved for non-bus usage.
- DECLARE_WRITE_LINE_MEMBER( irq3_w );
- DECLARE_WRITE_LINE_MEMBER( irq4_w );
- DECLARE_WRITE_LINE_MEMBER( irq5_w );
- DECLARE_WRITE_LINE_MEMBER( irq6_w );
+ DECLARE_WRITE_LINE_MEMBER( irq3_w ) { m_out_irq3_cb(state); }
+ DECLARE_WRITE_LINE_MEMBER( irq4_w ) { m_out_irq4_cb(state); }
+ DECLARE_WRITE_LINE_MEMBER( irq5_w ) { m_out_irq5_cb(state); }
+ DECLARE_WRITE_LINE_MEMBER( irq6_w ) { m_out_irq6_cb(state); }
int m_prgwidth;
@@ -120,7 +122,7 @@ protected:
virtual void device_reset() override;
// internal state
- cpu_device *m_maincpu;
+ required_device<cpu_device> m_maincpu;
// address spaces
address_space *m_prgspace;
@@ -129,10 +131,6 @@ protected:
devcb_write_line m_out_irq4_cb;
devcb_write_line m_out_irq5_cb;
devcb_write_line m_out_irq6_cb;
-
- const char *m_cputag;
-
-private:
};
@@ -152,16 +150,16 @@ public:
device_dio16_card_interface *next() const { return m_next; }
- void set_dio_device();
-
// inline configuration
- void set_diobus(device_t *dio_device) { m_dio_dev = dio_device; }
+ void set_diobus(dio16_device &dio_device) { m_dio_dev = &dio_device; }
-public:
+protected:
device_dio16_card_interface(const machine_config &mconfig, device_t &device);
+ dio16_device &dio() { assert(m_dio_dev); return *m_dio_dev; }
- dio16_device *m_dio;
- device_t *m_dio_dev;
+ virtual void interface_pre_start() override;
+
+ dio16_device *m_dio_dev;
private:
device_dio16_card_interface *m_next;
@@ -173,12 +171,21 @@ class dio32_slot_device : public dio16_slot_device
{
public:
// construction/destruction
+ template <typename T, typename U>
+ dio32_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&dio_tag, U &&opts, const char *dflt, bool fixed) :
+ dio32_slot_device(mconfig, tag, owner, clock)
+ {
+ set_dio(std::forward<T>(dio_tag));
+ option_reset();
+ opts(*this);
+ set_default_option(dflt);
+ set_fixed(fixed);
+ }
dio32_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // device-level overrides
- virtual void device_start() override;
- // inline configuration
- void set_dio32_slot(device_t *owner, const char *dio_tag) { m_owner = owner; m_dio_tag = dio_tag; }
+protected:
+ // device-level overrides
+ virtual void device_start() override;
};
@@ -194,12 +201,9 @@ public:
void install16_device(offs_t start, offs_t end, read16_delegate rhandler, write16_delegate whandler);
-
protected:
// device-level overrides
virtual void device_start() override;
-
-private:
};
@@ -216,12 +220,12 @@ public:
// construction/destruction
virtual ~device_dio32_card_interface();
- void set_dio_device();
-
protected:
device_dio32_card_interface(const machine_config &mconfig, device_t &device);
- dio32_device *m_dio;
+ virtual void interface_pre_start() override;
+
+ dio32_device &dio() { assert(m_dio_dev); return downcast<dio32_device &>(*m_dio_dev); }
};
#endif // MAME_BUS_HPDIO_HPDIO_H
diff --git a/src/devices/video/topcat.cpp b/src/devices/video/topcat.cpp
index cad6645335a..d4f4188623e 100644
--- a/src/devices/video/topcat.cpp
+++ b/src/devices/video/topcat.cpp
@@ -104,8 +104,8 @@ void topcat_device::update_cursor(int x, int y, uint8_t ctrl, uint8_t width)
modify_vram(m_cursor_x_pos+i, m_cursor_y_pos-1, false);
modify_vram(m_cursor_x_pos+i, m_cursor_y_pos-2, false);
}
- m_cursor_x_pos = std::min(x, m_fb_width - m_cursor_width);
- m_cursor_y_pos = std::max(std::min(y, m_fb_height), 2);
+ m_cursor_x_pos = (std::min)(x, m_fb_width - m_cursor_width);
+ m_cursor_y_pos = (std::max)((std::min)(y, m_fb_height), 2);
m_cursor_ctrl = ctrl;
m_cursor_width = width;
}
diff --git a/src/mame/drivers/hp9k_3xx.cpp b/src/mame/drivers/hp9k_3xx.cpp
index eddbb4cfc8f..552520d74b7 100644
--- a/src/mame/drivers/hp9k_3xx.cpp
+++ b/src/mame/drivers/hp9k_3xx.cpp
@@ -84,8 +84,8 @@
class hp9k3xx_state : public driver_device
{
public:
- hp9k3xx_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ hp9k3xx_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, MAINCPU_TAG),
m_iocpu(*this, IOCPU_TAG),
m_mlc(*this, MLC_TAG),
@@ -93,7 +93,7 @@ public:
m_tms9914(*this, "tms9914"),
m_vram16(*this, "vram16"),
m_vram(*this, "vram")
- { }
+ { }
required_device<cpu_device> m_maincpu;
optional_device<i8042_device> m_iocpu;
@@ -202,7 +202,7 @@ void hp9k3xx_state::hp9k3xx_common(address_map &map)
map(0x00000000, 0x0001ffff).rom().region("maincpu", 0).w(this, FUNC(hp9k3xx_state::led_w)); // writes to 1fffc are the LED
map(0x00428000, 0x00428003).rw(m_iocpu, FUNC(upi41_cpu_device::upi41_master_r), FUNC(upi41_cpu_device::upi41_master_w)).umask32(0x00ff00ff);
- map(0x00470000, 0x0047000f).mirror(0x0000fff0).rw(this, FUNC(hp9k3xx_state::gpib_r), FUNC(hp9k3xx_state::gpib_w)).umask16(0x00ff);
+ map(0x00470000, 0x0047001f).mirror(0x0000ffe0).rw(this, FUNC(hp9k3xx_state::gpib_r), FUNC(hp9k3xx_state::gpib_w)).umask16(0x00ff);
map(0x005f8000, 0x005f800f).rw(PTM6840_TAG, FUNC(ptm6840_device::read), FUNC(ptm6840_device::write)).umask32(0x00ff00ff);
@@ -216,7 +216,7 @@ void hp9k3xx_state::hp9k310_map(address_map &map)
map(0x000000, 0x01ffff).rom().region("maincpu", 0).nopw(); // writes to 1fffc are the LED
map(0x428000, 0x428003).rw(m_iocpu, FUNC(upi41_cpu_device::upi41_master_r), FUNC(upi41_cpu_device::upi41_master_w)).umask16(0x00ff);
- map(0x470000, 0x47000f).mirror(0x00fff0).rw(this, FUNC(hp9k3xx_state::gpib_r), FUNC(hp9k3xx_state::gpib_w)).umask16(0x00ff);
+ map(0x470000, 0x47001f).mirror(0x00ffe0).rw(this, FUNC(hp9k3xx_state::gpib_r), FUNC(hp9k3xx_state::gpib_w)).umask16(0x00ff);
map(0x510000, 0x510003).rw(this, FUNC(hp9k3xx_state::buserror16_r), FUNC(hp9k3xx_state::buserror16_w)); // no "Alpha display"
map(0x538000, 0x538003).rw(this, FUNC(hp9k3xx_state::buserror16_r), FUNC(hp9k3xx_state::buserror16_w)); // no "Graphics"
@@ -439,17 +439,17 @@ static void dio16_cards(device_slot_interface &device)
MACHINE_CONFIG_START(hp9k3xx_state::hp9k310)
/* basic machine hardware */
- MCFG_DEVICE_ADD(MAINCPU_TAG, M68010, 10000000)
+ MCFG_DEVICE_ADD(m_maincpu, M68010, 10000000)
MCFG_DEVICE_PROGRAM_MAP(hp9k310_map)
- MCFG_DEVICE_ADD(IOCPU_TAG, I8042, 5000000)
+ MCFG_DEVICE_ADD(m_iocpu, I8042, 5000000)
MCFG_DEVICE_PROGRAM_MAP(iocpu_map)
MCFG_MCS48_PORT_P1_OUT_CB(WRITE8(*this, hp9k3xx_state, iocpu_port1_w))
MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(*this, hp9k3xx_state, iocpu_port2_w))
MCFG_MCS48_PORT_P1_IN_CB(READ8(*this, hp9k3xx_state, iocpu_port1_r))
MCFG_MCS48_PORT_T0_IN_CB(READ8(*this, hp9k3xx_state, iocpu_test0_r))
- MCFG_DEVICE_ADD(MLC_TAG, HP_HIL_MLC, XTAL(15'920'000)/2)
+ MCFG_DEVICE_ADD(m_mlc, HP_HIL_MLC, XTAL(15'920'000)/2)
MCFG_HP_HIL_SLOT_ADD(MLC_TAG, "hil1", hp_hil_devices, "hp_46021a")
MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 250000) // from oscillator module next to the 6840
@@ -461,13 +461,13 @@ MACHINE_CONFIG_START(hp9k3xx_state::hp9k310)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
MCFG_DEVICE_ADD("diobus", DIO16, 0)
- MCFG_DIO16_CPU(":maincpu")
- MCFG_DIO16_SLOT_ADD("diobus", "sl1", dio16_cards, "98544", true)
- MCFG_DIO16_SLOT_ADD("diobus", "sl2", dio16_cards, "98603b", true)
- MCFG_DIO16_SLOT_ADD("diobus", "sl3", dio16_cards, "98644", true)
- MCFG_DIO16_SLOT_ADD("diobus", "sl4", dio16_cards, nullptr, false)
+ MCFG_DIO16_CPU(m_maincpu)
+ MCFG_DEVICE_ADD("sl1", DIO16_SLOT, 0, "diobus", dio16_cards, "98544", true)
+ MCFG_DEVICE_ADD("sl2", DIO16_SLOT, 0, "diobus", dio16_cards, "98603b", true)
+ MCFG_DEVICE_ADD("sl3", DIO16_SLOT, 0, "diobus", dio16_cards, "98644", true)
+ MCFG_DEVICE_ADD("sl4", DIO16_SLOT, 0, "diobus", dio16_cards, nullptr, false)
- MCFG_DEVICE_ADD("tms9914", TMS9914, XTAL(5000000))
+ MCFG_DEVICE_ADD(m_tms9914, TMS9914, XTAL(5000000))
MCFG_TMS9914_INT_WRITE_CB(WRITELINE(*this, hp9k3xx_state, gpib_irq));
MCFG_TMS9914_DIO_READWRITE_CB(READ8(IEEE488_TAG, ieee488_device, dio_r), WRITE8(IEEE488_TAG, ieee488_device, dio_w))
MCFG_TMS9914_EOI_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, eoi_w))
@@ -483,29 +483,29 @@ MACHINE_CONFIG_START(hp9k3xx_state::hp9k310)
MCFG_IEEE488_SLOT_ADD("ieee_rem", 0, remote488_devices, nullptr)
MCFG_IEEE488_BUS_ADD()
- MCFG_IEEE488_EOI_CALLBACK(WRITELINE("tms9914", tms9914_device, eoi_w))
- MCFG_IEEE488_DAV_CALLBACK(WRITELINE("tms9914", tms9914_device, dav_w))
- MCFG_IEEE488_NRFD_CALLBACK(WRITELINE("tms9914", tms9914_device, nrfd_w))
- MCFG_IEEE488_NDAC_CALLBACK(WRITELINE("tms9914", tms9914_device, ndac_w))
- MCFG_IEEE488_IFC_CALLBACK(WRITELINE("tms9914", tms9914_device, ifc_w))
- MCFG_IEEE488_SRQ_CALLBACK(WRITELINE("tms9914", tms9914_device, srq_w))
- MCFG_IEEE488_ATN_CALLBACK(WRITELINE("tms9914", tms9914_device, atn_w))
- MCFG_IEEE488_REN_CALLBACK(WRITELINE("tms9914", tms9914_device, ren_w))
+ MCFG_IEEE488_EOI_CALLBACK(WRITELINE(m_tms9914, tms9914_device, eoi_w))
+ MCFG_IEEE488_DAV_CALLBACK(WRITELINE(m_tms9914, tms9914_device, dav_w))
+ MCFG_IEEE488_NRFD_CALLBACK(WRITELINE(m_tms9914, tms9914_device, nrfd_w))
+ MCFG_IEEE488_NDAC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ndac_w))
+ MCFG_IEEE488_IFC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ifc_w))
+ MCFG_IEEE488_SRQ_CALLBACK(WRITELINE(m_tms9914, tms9914_device, srq_w))
+ MCFG_IEEE488_ATN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, atn_w))
+ MCFG_IEEE488_REN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ren_w))
MACHINE_CONFIG_END
MACHINE_CONFIG_START(hp9k3xx_state::hp9k320)
/* basic machine hardware */
- MCFG_DEVICE_ADD(MAINCPU_TAG, M68020FPU, 16670000)
+ MCFG_DEVICE_ADD(m_maincpu, M68020FPU, 16670000)
MCFG_DEVICE_PROGRAM_MAP(hp9k320_map)
- MCFG_DEVICE_ADD(IOCPU_TAG, I8042, 5000000)
+ MCFG_DEVICE_ADD(m_iocpu, I8042, 5000000)
MCFG_DEVICE_PROGRAM_MAP(iocpu_map)
MCFG_MCS48_PORT_P1_OUT_CB(WRITE8(*this, hp9k3xx_state, iocpu_port1_w))
MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(*this, hp9k3xx_state, iocpu_port2_w))
MCFG_MCS48_PORT_P1_IN_CB(READ8(*this, hp9k3xx_state, iocpu_port1_r))
MCFG_MCS48_PORT_T0_IN_CB(READ8(*this, hp9k3xx_state, iocpu_test0_r))
- MCFG_DEVICE_ADD(MLC_TAG, HP_HIL_MLC, XTAL(15'920'000)/2)
+ MCFG_DEVICE_ADD(m_mlc, HP_HIL_MLC, XTAL(15'920'000)/2)
MCFG_HP_HIL_SLOT_ADD(MLC_TAG, "hil1", hp_hil_devices, "hp_46021a")
MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 250000) // from oscillator module next to the 6840
@@ -516,13 +516,13 @@ MACHINE_CONFIG_START(hp9k3xx_state::hp9k320)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
MCFG_DEVICE_ADD("diobus", DIO32, 0)
- MCFG_DIO32_CPU(":maincpu")
- MCFG_DIO32_SLOT_ADD("diobus", "sl1", dio16_cards, "98544", true)
- MCFG_DIO16_SLOT_ADD("diobus", "sl2", dio16_cards, "98603b", true)
- MCFG_DIO16_SLOT_ADD("diobus", "sl3", dio16_cards, "98644", true)
- MCFG_DIO32_SLOT_ADD("diobus", "sl4", dio16_cards, nullptr, false)
+ MCFG_DIO32_CPU(m_maincpu)
+ MCFG_DEVICE_ADD("sl1", DIO32_SLOT, 0, "diobus", dio16_cards, "98544", true)
+ MCFG_DEVICE_ADD("sl2", DIO16_SLOT, 0, "diobus", dio16_cards, "98603b", true)
+ MCFG_DEVICE_ADD("sl3", DIO16_SLOT, 0, "diobus", dio16_cards, "98644", true)
+ MCFG_DEVICE_ADD("sl4", DIO32_SLOT, 0, "diobus", dio16_cards, nullptr, false)
- MCFG_DEVICE_ADD("tms9914", TMS9914, XTAL(5000000))
+ MCFG_DEVICE_ADD(m_tms9914, TMS9914, XTAL(5000000))
MCFG_TMS9914_INT_WRITE_CB(WRITELINE(*this, hp9k3xx_state, gpib_irq));
MCFG_TMS9914_DIO_READWRITE_CB(READ8(IEEE488_TAG, ieee488_device, dio_r), WRITE8(IEEE488_TAG, ieee488_device, dio_w))
MCFG_TMS9914_EOI_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, eoi_w))
@@ -538,14 +538,14 @@ MACHINE_CONFIG_START(hp9k3xx_state::hp9k320)
MCFG_IEEE488_SLOT_ADD("ieee_rem", 0, remote488_devices, nullptr)
MCFG_IEEE488_BUS_ADD()
- MCFG_IEEE488_EOI_CALLBACK(WRITELINE("tms9914", tms9914_device, eoi_w))
- MCFG_IEEE488_DAV_CALLBACK(WRITELINE("tms9914", tms9914_device, dav_w))
- MCFG_IEEE488_NRFD_CALLBACK(WRITELINE("tms9914", tms9914_device, nrfd_w))
- MCFG_IEEE488_NDAC_CALLBACK(WRITELINE("tms9914", tms9914_device, ndac_w))
- MCFG_IEEE488_IFC_CALLBACK(WRITELINE("tms9914", tms9914_device, ifc_w))
- MCFG_IEEE488_SRQ_CALLBACK(WRITELINE("tms9914", tms9914_device, srq_w))
- MCFG_IEEE488_ATN_CALLBACK(WRITELINE("tms9914", tms9914_device, atn_w))
- MCFG_IEEE488_REN_CALLBACK(WRITELINE("tms9914", tms9914_device, ren_w))
+ MCFG_IEEE488_EOI_CALLBACK(WRITELINE(m_tms9914, tms9914_device, eoi_w))
+ MCFG_IEEE488_DAV_CALLBACK(WRITELINE(m_tms9914, tms9914_device, dav_w))
+ MCFG_IEEE488_NRFD_CALLBACK(WRITELINE(m_tms9914, tms9914_device, nrfd_w))
+ MCFG_IEEE488_NDAC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ndac_w))
+ MCFG_IEEE488_IFC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ifc_w))
+ MCFG_IEEE488_SRQ_CALLBACK(WRITELINE(m_tms9914, tms9914_device, srq_w))
+ MCFG_IEEE488_ATN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, atn_w))
+ MCFG_IEEE488_REN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ren_w))
MACHINE_CONFIG_END
MACHINE_CONFIG_START(hp9k3xx_state::hp9k330)
@@ -557,17 +557,17 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(hp9k3xx_state::hp9k332)
/* basic machine hardware */
- MCFG_DEVICE_ADD(MAINCPU_TAG, M68020PMMU, 16670000)
+ MCFG_DEVICE_ADD(m_maincpu, M68020PMMU, 16670000)
MCFG_DEVICE_PROGRAM_MAP(hp9k332_map)
- MCFG_DEVICE_ADD(IOCPU_TAG, I8042, 5000000)
+ MCFG_DEVICE_ADD(m_iocpu, I8042, 5000000)
MCFG_DEVICE_PROGRAM_MAP(iocpu_map)
MCFG_MCS48_PORT_P1_OUT_CB(WRITE8(*this, hp9k3xx_state, iocpu_port1_w))
MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(*this, hp9k3xx_state, iocpu_port2_w))
MCFG_MCS48_PORT_P1_IN_CB(READ8(*this, hp9k3xx_state, iocpu_port1_r))
MCFG_MCS48_PORT_T0_IN_CB(READ8(*this, hp9k3xx_state, iocpu_test0_r))
- MCFG_DEVICE_ADD(MLC_TAG, HP_HIL_MLC, XTAL(15'920'000)/2)
+ MCFG_DEVICE_ADD(m_mlc, HP_HIL_MLC, XTAL(15'920'000)/2)
MCFG_HP_HIL_SLOT_ADD(MLC_TAG, "hil1", hp_hil_devices, "hp_46021a")
MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 250000) // from oscillator module next to the 6840
@@ -577,13 +577,13 @@ MACHINE_CONFIG_START(hp9k3xx_state::hp9k332)
MCFG_DEVICE_ADD(SN76494_TAG, SN76494, SN76494_CLOCK)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
- MCFG_SCREEN_ADD( "screen", RASTER)
+ MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_UPDATE_DRIVER(hp9k3xx_state, hp_medres_update)
MCFG_SCREEN_SIZE(512,390)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 390-1)
MCFG_SCREEN_REFRESH_RATE(70)
- MCFG_DEVICE_ADD("tms9914", TMS9914, XTAL(5000000))
+ MCFG_DEVICE_ADD(m_tms9914, TMS9914, XTAL(5000000))
MCFG_TMS9914_INT_WRITE_CB(WRITELINE(*this, hp9k3xx_state, gpib_irq));
MCFG_TMS9914_DIO_READWRITE_CB(READ8(IEEE488_TAG, ieee488_device, dio_r), WRITE8(IEEE488_TAG, ieee488_device, dio_w))
MCFG_TMS9914_EOI_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, eoi_w))
@@ -599,41 +599,41 @@ MACHINE_CONFIG_START(hp9k3xx_state::hp9k332)
MCFG_IEEE488_SLOT_ADD("ieee_rem", 0, remote488_devices, nullptr)
MCFG_IEEE488_BUS_ADD()
- MCFG_IEEE488_EOI_CALLBACK(WRITELINE("tms9914", tms9914_device, eoi_w))
- MCFG_IEEE488_DAV_CALLBACK(WRITELINE("tms9914", tms9914_device, dav_w))
- MCFG_IEEE488_NRFD_CALLBACK(WRITELINE("tms9914", tms9914_device, nrfd_w))
- MCFG_IEEE488_NDAC_CALLBACK(WRITELINE("tms9914", tms9914_device, ndac_w))
- MCFG_IEEE488_IFC_CALLBACK(WRITELINE("tms9914", tms9914_device, ifc_w))
- MCFG_IEEE488_SRQ_CALLBACK(WRITELINE("tms9914", tms9914_device, srq_w))
- MCFG_IEEE488_ATN_CALLBACK(WRITELINE("tms9914", tms9914_device, atn_w))
- MCFG_IEEE488_REN_CALLBACK(WRITELINE("tms9914", tms9914_device, ren_w))
+ MCFG_IEEE488_EOI_CALLBACK(WRITELINE(m_tms9914, tms9914_device, eoi_w))
+ MCFG_IEEE488_DAV_CALLBACK(WRITELINE(m_tms9914, tms9914_device, dav_w))
+ MCFG_IEEE488_NRFD_CALLBACK(WRITELINE(m_tms9914, tms9914_device, nrfd_w))
+ MCFG_IEEE488_NDAC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ndac_w))
+ MCFG_IEEE488_IFC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ifc_w))
+ MCFG_IEEE488_SRQ_CALLBACK(WRITELINE(m_tms9914, tms9914_device, srq_w))
+ MCFG_IEEE488_ATN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, atn_w))
+ MCFG_IEEE488_REN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ren_w))
MACHINE_CONFIG_END
MACHINE_CONFIG_START(hp9k3xx_state::hp9k340)
hp9k320(config);
- /* basic machine hardware */
- MCFG_DEVICE_REPLACE(MAINCPU_TAG, M68030, 16670000)
+
+ MCFG_DEVICE_REPLACE(m_maincpu, M68030, 16670000)
MCFG_DEVICE_PROGRAM_MAP(hp9k330_map)
MACHINE_CONFIG_END
MACHINE_CONFIG_START(hp9k3xx_state::hp9k370)
hp9k320(config);
- /* basic machine hardware */
- MCFG_DEVICE_REPLACE(MAINCPU_TAG, M68030, 33000000)
+
+ MCFG_DEVICE_REPLACE(m_maincpu, M68030, 33000000)
MCFG_DEVICE_PROGRAM_MAP(hp9k370_map)
MACHINE_CONFIG_END
MACHINE_CONFIG_START(hp9k3xx_state::hp9k380)
hp9k320(config);
- /* basic machine hardware */
- MCFG_DEVICE_REPLACE(MAINCPU_TAG, M68040, 25000000)
+
+ MCFG_DEVICE_REPLACE(m_maincpu, M68040, 25000000)
MCFG_DEVICE_PROGRAM_MAP(hp9k380_map)
MACHINE_CONFIG_END
MACHINE_CONFIG_START(hp9k3xx_state::hp9k382)
hp9k320(config);
- /* basic machine hardware */
- MCFG_DEVICE_REPLACE(MAINCPU_TAG, M68040, 25000000)
+
+ MCFG_DEVICE_REPLACE(m_maincpu, M68040, 25000000)
MCFG_DEVICE_PROGRAM_MAP(hp9k382_map)
MACHINE_CONFIG_END