mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
hp_hil: Removing MCFG macros doesn't just mean blindly expanding them (nw)
* The validation and slot registration still needs modernising, but the client code is prettier at least
This commit is contained in:
parent
fe3be00840
commit
9586346438
@ -36,15 +36,8 @@ void human_interface_device::device_add_mconfig(machine_config &config)
|
||||
iocpu.t1_in_cb().set_constant(1);
|
||||
|
||||
HP_HIL_MLC(config, m_mlc, XTAL(8'000'000));
|
||||
hp_hil_slot_device &keyboard(HP_HIL_SLOT(config, "hil1", 0));
|
||||
hp_hil_devices(keyboard);
|
||||
keyboard.set_default_option("hp_46021a");
|
||||
keyboard.set_hp_hil_slot(this, "mlc");
|
||||
|
||||
hp_hil_slot_device &mouse(HP_HIL_SLOT(config, "hil2", 0));
|
||||
hp_hil_devices(mouse);
|
||||
mouse.set_default_option("hp_46060b");
|
||||
mouse.set_hp_hil_slot(this, "mlc");
|
||||
HP_HIL_SLOT(config, "hil1", m_mlc, hp_hil_devices, "hp_46021a");
|
||||
HP_HIL_SLOT(config, "hil2", m_mlc, hp_hil_devices, "hp_46060b");
|
||||
|
||||
SPEAKER(config, "mono").front_center();
|
||||
sn76494_device &sound(SN76494(config, "sn76494", 333333));
|
||||
|
@ -28,6 +28,7 @@ DEFINE_DEVICE_TYPE(HP_HIL_SLOT, hp_hil_slot_device, "hp_hil_slot", "HP-HIL Slot"
|
||||
hp_hil_slot_device::hp_hil_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, HP_HIL_SLOT, tag, owner, clock)
|
||||
, device_slot_interface(mconfig, *this)
|
||||
, m_mlc(*this, finder_base::DUMMY_TAG)
|
||||
{
|
||||
}
|
||||
|
||||
@ -39,8 +40,8 @@ hp_hil_slot_device::hp_hil_slot_device(const machine_config &mconfig, const char
|
||||
void hp_hil_slot_device::device_start()
|
||||
{
|
||||
device_hp_hil_interface *dev = dynamic_cast<device_hp_hil_interface *>(get_card_device());
|
||||
|
||||
if (dev) dev->set_hp_hil_mlc(m_owner->subdevice(m_mlc_tag));
|
||||
if (dev)
|
||||
dev->set_hp_hil_mlc(*m_mlc);
|
||||
}
|
||||
|
||||
|
||||
@ -243,7 +244,6 @@ WRITE_LINE_MEMBER(hp_hil_mlc_device::ap_w)
|
||||
device_hp_hil_interface::device_hp_hil_interface(const machine_config &mconfig, device_t &device)
|
||||
: device_slot_card_interface(mconfig, device)
|
||||
, m_hp_hil_mlc(nullptr)
|
||||
, m_hp_hil_mlc_dev(nullptr)
|
||||
, m_next(nullptr)
|
||||
{
|
||||
}
|
||||
@ -259,6 +259,6 @@ device_hp_hil_interface::~device_hp_hil_interface()
|
||||
|
||||
void device_hp_hil_interface::set_hp_hil_mlc_device()
|
||||
{
|
||||
m_hp_hil_mlc = dynamic_cast<hp_hil_mlc_device *>(m_hp_hil_mlc_dev);
|
||||
assert(m_hp_hil_mlc);
|
||||
m_hp_hil_mlc->add_hp_hil_device(this);
|
||||
}
|
||||
|
@ -75,31 +75,35 @@
|
||||
*
|
||||
*/
|
||||
|
||||
//**************************************************************************
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
class hp_hil_mlc_device;
|
||||
|
||||
|
||||
class hp_hil_slot_device : public device_t, public device_slot_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
template <typename T, typename U>
|
||||
hp_hil_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&mlc_tag, U &&opts, const char *dflt)
|
||||
: hp_hil_slot_device(mconfig, tag, owner, 0)
|
||||
{
|
||||
m_mlc.set_tag(std::forward<T>(mlc_tag));
|
||||
option_reset();
|
||||
opts(*this);
|
||||
set_default_option(dflt);
|
||||
set_fixed(false);
|
||||
}
|
||||
hp_hil_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
// inline configuration
|
||||
void set_hp_hil_slot(device_t *owner, const char *mlc_tag) { m_owner = owner; m_mlc_tag = mlc_tag; }
|
||||
|
||||
protected:
|
||||
// configuration
|
||||
device_t *m_owner;
|
||||
const char *m_mlc_tag;
|
||||
required_device<hp_hil_mlc_device> m_mlc;
|
||||
};
|
||||
|
||||
|
||||
@ -116,8 +120,6 @@ public:
|
||||
hp_hil_mlc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
~hp_hil_mlc_device() { m_device_list.detach_all(); }
|
||||
|
||||
template <class Object> devcb_base &set_int_callback(Object &&cb) { return int_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_nmi_callback(Object &&cb) { return nmi_cb.set_callback(std::forward<Object>(cb)); }
|
||||
auto int_callback() { return int_cb.bind(); }
|
||||
auto nmi_callback() { return nmi_cb.bind(); }
|
||||
|
||||
@ -165,7 +167,7 @@ public:
|
||||
void set_hp_hil_mlc_device();
|
||||
|
||||
// inline configuration
|
||||
void set_hp_hil_mlc(device_t *mlc_device) { m_hp_hil_mlc_dev = mlc_device; }
|
||||
void set_hp_hil_mlc(hp_hil_mlc_device &mlc_device) { m_hp_hil_mlc = &mlc_device; }
|
||||
|
||||
virtual bool hil_write(uint16_t *data) { return true; };
|
||||
int device_id() { return m_device_id; };
|
||||
@ -176,7 +178,6 @@ protected:
|
||||
virtual void device_reset() { }
|
||||
|
||||
hp_hil_mlc_device *m_hp_hil_mlc;
|
||||
device_t *m_hp_hil_mlc_dev;
|
||||
|
||||
hp_hil_slot_device *m_slot;
|
||||
|
||||
|
@ -493,10 +493,7 @@ MACHINE_CONFIG_START(hp16500_state::hp16500)
|
||||
|
||||
// TODO: for now hook up the ipc hil keyboard - this might be replaced
|
||||
// later with a 16500b specific keyboard implementation
|
||||
hp_hil_slot_device &keyboard(HP_HIL_SLOT(config, "hil1", 0));
|
||||
hp_hil_devices(keyboard);
|
||||
keyboard.set_default_option("hp_ipc_kbd");
|
||||
keyboard.set_hp_hil_slot(this, "mlc");
|
||||
HP_HIL_SLOT(config, "hil1", "mlc", hp_hil_devices, "hp_ipc_kbd");
|
||||
|
||||
SPEAKER(config, "lspeaker").front_left();
|
||||
SPEAKER(config, "rspeaker").front_right();
|
||||
|
@ -757,15 +757,9 @@ MACHINE_CONFIG_START(hp_ipc_state::hp_ipc_base)
|
||||
hp_hil_mlc_device &mlc(HP_HIL_MLC(config, "mlc", XTAL(15'920'000)/2));
|
||||
mlc.int_callback().set(FUNC(hp_ipc_state::irq_2));
|
||||
mlc.nmi_callback().set(FUNC(hp_ipc_state::irq_7));
|
||||
hp_hil_slot_device &keyboard(HP_HIL_SLOT(config, "hil1", 0));
|
||||
hp_hil_devices(keyboard);
|
||||
keyboard.set_default_option("hp_ipc_kbd");
|
||||
keyboard.set_hp_hil_slot(this, "mlc");
|
||||
|
||||
hp_hil_slot_device &mouse(HP_HIL_SLOT(config, "hil2", 0));
|
||||
hp_hil_devices(mouse);
|
||||
mouse.set_default_option("hp_46060b");
|
||||
mouse.set_hp_hil_slot(this, "mlc");
|
||||
HP_HIL_SLOT(config, "hil1", "mlc", hp_hil_devices, "hp_ipc_kbd");
|
||||
HP_HIL_SLOT(config, "hil2", "mlc", hp_hil_devices, "hp_46060b");
|
||||
|
||||
tms9914_device &hpib(TMS9914(config, "hpib", 4_MHz_XTAL));
|
||||
hpib.int_write_cb().set(FUNC(hp_ipc_state::irq_3));
|
||||
|
Loading…
Reference in New Issue
Block a user