diff options
author | 2018-10-12 03:28:25 +0200 | |
---|---|---|
committer | 2018-10-11 21:28:24 -0400 | |
commit | 162c81c555297666c2aecb44b2866a7f63cbd46b (patch) | |
tree | e7ffd6a5faa78dead006d319555fc6e6962d65ad | |
parent | d1009b850741d6a55a076a03d67f3d7b682f6628 (diff) |
hp_hil: various fixes/improvements (#4124)
* hp_hil: use logmacro.h (nw)
* add missing save_item()'s (nw)
* hp_hil: remove MCFG (nw)
-rw-r--r-- | src/devices/bus/hp_hil/hlebase.cpp | 4 | ||||
-rw-r--r-- | src/devices/bus/hp_hil/hlebase.h | 4 | ||||
-rw-r--r-- | src/devices/bus/hp_hil/hp_hil.cpp | 39 | ||||
-rw-r--r-- | src/devices/bus/hp_hil/hp_hil.h | 13 | ||||
-rw-r--r-- | src/mame/drivers/hp16500.cpp | 6 | ||||
-rw-r--r-- | src/mame/drivers/hp_ipc.cpp | 17 |
6 files changed, 42 insertions, 41 deletions
diff --git a/src/devices/bus/hp_hil/hlebase.cpp b/src/devices/bus/hp_hil/hlebase.cpp index 5ac421a2497..836ef11cae8 100644 --- a/src/devices/bus/hp_hil/hlebase.cpp +++ b/src/devices/bus/hp_hil/hlebase.cpp @@ -42,6 +42,10 @@ hle_device_base::~hle_device_base() void hle_device_base::device_start() { + + save_item(NAME(m_powerup)); + save_item(NAME(m_passthru)); + set_hp_hil_mlc_device(); m_powerup = true; diff --git a/src/devices/bus/hp_hil/hlebase.h b/src/devices/bus/hp_hil/hlebase.h index 58e320507fe..b5cbfa84bef 100644 --- a/src/devices/bus/hp_hil/hlebase.h +++ b/src/devices/bus/hp_hil/hlebase.h @@ -33,8 +33,10 @@ protected: virtual int hil_poll() = 0; private: - util::fifo<uint8_t, 8> m_fifo; + + bool m_powerup; + bool m_passthru; }; } // namespace bus::hp_hil diff --git a/src/devices/bus/hp_hil/hp_hil.cpp b/src/devices/bus/hp_hil/hp_hil.cpp index d1e20ec163e..02dbf69b61c 100644 --- a/src/devices/bus/hp_hil/hp_hil.cpp +++ b/src/devices/bus/hp_hil/hp_hil.cpp @@ -9,20 +9,8 @@ #include "emu.h" #include "hp_hil.h" - - -#define VERBOSE_DBG 0 - -#define DBG_LOG(N,M,A) \ - do { \ - if(VERBOSE_DBG>=N) \ - { \ - if( M ) \ - logerror("%11.6f at %s: %-10s",machine().time().as_double(),machine().describe_context(),(char*)M ); \ - logerror A; \ - } \ - } while (0) - +//#define VERBOSE 1 +#include "logmacro.h" //************************************************************************** // GLOBAL VARIABLES @@ -88,6 +76,13 @@ void hp_hil_mlc_device::device_start() // resolve callbacks int_cb.resolve_safe(); nmi_cb.resolve_safe(); + + save_item(NAME(m_r2)); + save_item(NAME(m_r3)); + save_item(NAME(m_w1)); + save_item(NAME(m_w2)); + save_item(NAME(m_w3)); + save_item(NAME(m_loop)); } @@ -107,17 +102,17 @@ WRITE8_MEMBER(hp_hil_mlc_device::write) { device_hp_hil_interface *entry = m_device_list.first(); uint16_t tmp = data | (m_w1 << 8); - DBG_LOG(2,"Write", ("%d <- %02x\n", offset, data)); switch (offset) { case 0: - DBG_LOG(1,"Transmit", ("%scommand 0x%02x to device %d\n", !m_loop?"loopback ":"", data, m_w1 & 7)); + LOG("write: %scommand 0x%02x to device %d\n", !m_loop?"loopback ":"", data, m_w1 & 7); m_fifo.clear(); if (m_loop & 2) // no devices on 2nd link loop return; + if (m_loop == 0) { if (!m_fifo.full()) { @@ -138,14 +133,17 @@ WRITE8_MEMBER(hp_hil_mlc_device::write) break; case 1: + LOG("write: W1=%02x\n", 0xf); m_w1 = data & 0xf; break; case 2: + LOG("write: W2=%02x\n", data); m_w2 = data; break; case 3: + LOG("write: W3=%02x\n", data); m_w3 = data; break; @@ -183,15 +181,17 @@ READ8_MEMBER(hp_hil_mlc_device::read) break; } - DBG_LOG(2,"Read", ("%d == %02x\n", offset, data)); + LOG("Read %d == %02x\n", offset, data); return data; } void hp_hil_mlc_device::hil_write(uint16_t data) { - DBG_LOG(1,"Receive", ("%s %04X fifo %s\n", - BIT(data, 11)?"command":"data", data, m_fifo.full()?"full":(m_fifo.empty()?"empty":"ok"))); + LOG("hil_write: %s %04X fifo %s\n", + BIT(data, 11) ? "command" : "data", + data, + m_fifo.full() ? "full" : (m_fifo.empty()?"empty":"ok")); if (!m_fifo.full()) { @@ -248,7 +248,6 @@ device_hp_hil_interface::device_hp_hil_interface(const machine_config &mconfig, { } - //------------------------------------------------- // ~device_hp_hil_interface - destructor //------------------------------------------------- diff --git a/src/devices/bus/hp_hil/hp_hil.h b/src/devices/bus/hp_hil/hp_hil.h index 6ed9d791ff7..4ee8984cdc9 100644 --- a/src/devices/bus/hp_hil/hp_hil.h +++ b/src/devices/bus/hp_hil/hp_hil.h @@ -79,17 +79,6 @@ // INTERFACE CONFIGURATION MACROS //************************************************************************** -#define MCFG_HP_HIL_INT_CALLBACK(_devcb) \ - downcast<hp_hil_mlc_device &>(*device).set_int_callback(DEVCB_##_devcb); - -#define MCFG_HP_HIL_NMI_CALLBACK(_devcb) \ - downcast<hp_hil_mlc_device &>(*device).set_nmi_callback(DEVCB_##_devcb); - -#define MCFG_HP_HIL_SLOT_ADD(_mlc_tag, _tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, HP_HIL_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ - downcast<hp_hil_slot_device &>(*device).set_hp_hil_slot(this, _mlc_tag); - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -193,8 +182,6 @@ protected: int m_device_id; uint16_t m_device_id16; - bool m_powerup; - bool m_passthru; private: device_hp_hil_interface *m_next; diff --git a/src/mame/drivers/hp16500.cpp b/src/mame/drivers/hp16500.cpp index a8a05fb2873..a816ef21a55 100644 --- a/src/mame/drivers/hp16500.cpp +++ b/src/mame/drivers/hp16500.cpp @@ -493,8 +493,10 @@ 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 - MCFG_HP_HIL_SLOT_ADD("mlc", "hil1", hp_hil_devices, "hp_ipc_kbd") - MCFG_HP_HIL_SLOT_ADD("mlc", "hil2", hp_hil_devices, "hp_ipc_kbd") + 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"); SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); diff --git a/src/mame/drivers/hp_ipc.cpp b/src/mame/drivers/hp_ipc.cpp index de97ac955c5..a4cb3238067 100644 --- a/src/mame/drivers/hp_ipc.cpp +++ b/src/mame/drivers/hp_ipc.cpp @@ -754,11 +754,18 @@ MACHINE_CONFIG_START(hp_ipc_state::hp_ipc_base) MCFG_MM58167_IRQ_CALLBACK(WRITELINE(*this, hp_ipc_state, irq_1)) // MCFG_MM58167_STANDBY_IRQ_CALLBACK(WRITELINE(*this, hp_ipc_state, irq_6)) - MCFG_DEVICE_ADD("mlc", HP_HIL_MLC, 15.92_MHz_XTAL / 2) - MCFG_HP_HIL_INT_CALLBACK(WRITELINE(*this, hp_ipc_state, irq_2)) - MCFG_HP_HIL_NMI_CALLBACK(WRITELINE(*this, hp_ipc_state, irq_7)) - MCFG_HP_HIL_SLOT_ADD("mlc", "hil1", hp_hil_devices, "hp_ipc_kbd") - MCFG_HP_HIL_SLOT_ADD("mlc", "hil2", hp_hil_devices, "hp_46060b") + 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"); MCFG_DEVICE_ADD("hpib", TMS9914, 4_MHz_XTAL) MCFG_TMS9914_INT_WRITE_CB(WRITELINE(*this, hp_ipc_state, irq_3)) |