From 3ba776d3e0b5ea7d692cdf25910b27034488651c Mon Sep 17 00:00:00 2001 From: fulivi Date: Sun, 31 Jul 2022 08:50:50 +0200 Subject: intel/imds2: correct dump for PIO microcontroller [fulivi] --- src/devices/bus/multibus/isbc202.cpp | 82 +++++++++++++++-------------------- src/devices/bus/multibus/isbc202.h | 2 +- src/devices/bus/multibus/multibus.cpp | 2 + src/devices/bus/multibus/multibus.h | 9 ++++ src/devices/machine/i3001.cpp | 14 +++--- src/devices/machine/i3001.h | 20 ++++----- src/devices/machine/i3002.cpp | 44 ++++++++++--------- src/devices/machine/i3002.h | 28 ++++++------ src/mame/intel/imds2.cpp | 16 +++++++ src/mame/intel/imds2ioc.cpp | 23 +--------- src/mame/intel/imds2ioc.h | 1 - 11 files changed, 121 insertions(+), 120 deletions(-) diff --git a/src/devices/bus/multibus/isbc202.cpp b/src/devices/bus/multibus/isbc202.cpp index f537cfcbe4a..3e281fa230f 100644 --- a/src/devices/bus/multibus/isbc202.cpp +++ b/src/devices/bus/multibus/isbc202.cpp @@ -266,11 +266,10 @@ uint8_t isbc202_device::io_r(address_space &space, offs_t offset) case 3: // Read result byte (no auto XACK) - if (m_cpu == nullptr) { - m_cpu = dynamic_cast(&space.device()); + if (!m_2nd_pass) { set_start(3 , true); } else { - m_cpu = nullptr; + m_2nd_pass = false; res = m_data_low_out; } break; @@ -297,12 +296,12 @@ void isbc202_device::io_w(address_space &space, offs_t offset, uint8_t data) case 4: case 5: case 6: - if (m_cpu != nullptr) { - LOG("CPU != NULL!\n"); + if (!m_2nd_pass) { + m_cpu_data = data; + set_start(offset , false); + } else { + m_2nd_pass = false; } - m_cpu = dynamic_cast(&space.device()); - m_cpu_data = data; - set_start(offset , false); break; case 7: @@ -361,7 +360,7 @@ void isbc202_device::device_start() save_item(NAME(m_op_us)); save_item(NAME(m_px_s1s0)); save_item(NAME(m_cmd)); - save_item(NAME(m_cpu_rd)); + save_item(NAME(m_2nd_pass)); save_item(NAME(m_ready_in)); save_item(NAME(m_ready_ff)); save_item(NAME(m_gate_lower)); @@ -419,7 +418,7 @@ void isbc202_device::device_reset() m_inputs[ IN_SEL_TIMEOUT ] = true; m_inputs[ IN_SEL_F ] = false; - m_cpu = nullptr; + m_2nd_pass = false; m_irq = false; @@ -497,34 +496,34 @@ void isbc202_device::device_add_mconfig(machine_config &config) } // Connect CO/CI signals - m_mcu->fo_w().set(m_cpes[ 0 ] , FUNC(i3002_device::ci_w)); - m_cpes[ 0 ]->co_w().set(m_cpes[ 1 ] , FUNC(i3002_device::ci_w)); - m_cpes[ 1 ]->co_w().set(m_cpes[ 2 ] , FUNC(i3002_device::ci_w)); - m_cpes[ 2 ]->co_w().set(m_cpes[ 3 ] , FUNC(i3002_device::ci_w)); - m_cpes[ 3 ]->co_w().set(FUNC(isbc202_device::co_w)); + m_mcu->set_fo_w_cb(m_cpes[ 0 ] , FUNC(i3002_device::ci_w)); + m_cpes[ 0 ]->set_co_w_cb(m_cpes[ 1 ] , FUNC(i3002_device::ci_w)); + m_cpes[ 1 ]->set_co_w_cb(m_cpes[ 2 ] , FUNC(i3002_device::ci_w)); + m_cpes[ 2 ]->set_co_w_cb(m_cpes[ 3 ] , FUNC(i3002_device::ci_w)); + m_cpes[ 3 ]->set_co_w_cb(FUNC(isbc202_device::co_w)); // Connect RO/LI signals - m_cpes[ 0 ]->ro_w().set(FUNC(isbc202_device::co_w)); - m_cpes[ 1 ]->ro_w().set(m_cpes[ 0 ] , FUNC(i3002_device::li_w)); - m_cpes[ 2 ]->ro_w().set(m_cpes[ 1 ] , FUNC(i3002_device::li_w)); - m_cpes[ 3 ]->ro_w().set(m_cpes[ 2 ] , FUNC(i3002_device::li_w)); + m_cpes[ 0 ]->set_ro_w_cb(FUNC(isbc202_device::co_w)); + m_cpes[ 1 ]->set_ro_w_cb(m_cpes[ 0 ] , FUNC(i3002_device::li_w)); + m_cpes[ 2 ]->set_ro_w_cb(m_cpes[ 1 ] , FUNC(i3002_device::li_w)); + m_cpes[ 3 ]->set_ro_w_cb(m_cpes[ 2 ] , FUNC(i3002_device::li_w)); // Connect M-bus - m_cpes[ 0 ]->mbus_r().set([this]() { return mbus_r(); }); - m_cpes[ 1 ]->mbus_r().set([this]() { return mbus_r() >> 2; }); - m_cpes[ 2 ]->mbus_r().set([this]() { return mbus_r() >> 4; }); - m_cpes[ 3 ]->mbus_r().set([this]() { return mbus_r() >> 6; }); + m_cpes[ 0 ]->set_mbus_r_cb(NAME([this]() { return mbus_r(); })); + m_cpes[ 1 ]->set_mbus_r_cb(NAME([this]() { return mbus_r() >> 2; })); + m_cpes[ 2 ]->set_mbus_r_cb(NAME([this]() { return mbus_r() >> 4; })); + m_cpes[ 3 ]->set_mbus_r_cb(NAME([this]() { return mbus_r() >> 6; })); // Connect I-bus - m_cpes[ 0 ]->ibus_r().set([this]() { return ibus_r(); }); - m_cpes[ 1 ]->ibus_r().set([this]() { return ibus_r() >> 2; }); - m_cpes[ 2 ]->ibus_r().set([this]() { return ibus_r() >> 4; }); - m_cpes[ 3 ]->ibus_r().set([this]() { return ibus_r() >> 6; }); + m_cpes[ 0 ]->set_ibus_r_cb(NAME([this]() { return ibus_r(); })); + m_cpes[ 1 ]->set_ibus_r_cb(NAME([this]() { return ibus_r() >> 2; })); + m_cpes[ 2 ]->set_ibus_r_cb(NAME([this]() { return ibus_r() >> 4; })); + m_cpes[ 3 ]->set_ibus_r_cb(NAME([this]() { return ibus_r() >> 6; })); // Connect SX input - m_mcu->sx_r().set([this]() { return m_microcode_addr & 0xf; }); + m_mcu->set_sx_r_cb(NAME([this]() { return m_microcode_addr & 0xf; })); // Connect PX input - m_mcu->px_r().set(FUNC(isbc202_device::px_r)); + m_mcu->set_px_r_cb(FUNC(isbc202_device::px_r)); // Drives for (auto& finder : m_drives) { @@ -740,18 +739,11 @@ void isbc202_device::set_output() // 1 Reset RDY latches (0) // 0 - if (BIT(m_mask , 5)) { - if (m_cpu != nullptr) { - // Release CPU from wait state - LOG_BUS("CPU out of wait state\n"); - m_cpu->trigger(1); - if (!m_cpu_rd) { - m_cpu = nullptr; - } - // Ensure the MCU executes a few instruction before the CPU - machine().scheduler().boost_interleave(attotime::from_usec(1) , attotime::from_usec(5)); - } else { - LOG("No CPU to wake up?\n"); - } + // Release CPU from wait state + LOG_BUS("CPU out of wait state\n"); + xack_w(0); + // Ensure the MCU executes a few instruction before the CPU + machine().scheduler().boost_interleave(attotime::from_usec(1) , attotime::from_usec(5)); m_inputs[ IN_SEL_START ] = false; } if (BIT(m_mask , 4)) { @@ -1007,14 +999,10 @@ void isbc202_device::set_start(uint8_t off , bool read) m_cmd = off; m_inputs[ IN_SEL_START ] = true; // Put CPU in wait state - m_cpu->spin_until_trigger(1); + xack_w(1); m_cpu_rd = read; + m_2nd_pass = true; LOG_BUS("CPU in wait state (rd=%d)\n" , read); - if (read) { - // If CPU is suspended when reading, rewind PC so that the - // "IN" instruction is repeated when CPU is released - m_cpu->set_pc(m_cpu->pc() - 2); - } } void isbc202_device::set_rd_wr(bool new_rd , bool new_wr) diff --git a/src/devices/bus/multibus/isbc202.h b/src/devices/bus/multibus/isbc202.h index 686065a9c53..6fc94179364 100644 --- a/src/devices/bus/multibus/isbc202.h +++ b/src/devices/bus/multibus/isbc202.h @@ -100,7 +100,7 @@ private: floppy_image_device *m_current_drive; uint8_t m_px_s1s0; // C-A16-11 & C-A16-13 uint8_t m_cmd; // C-A8 - cpu_device *m_cpu; // When != nullptr: CPU is suspended in wait state + bool m_2nd_pass; bool m_cpu_rd; uint8_t m_ready_in; uint8_t m_ready_ff; // I-A44 & I-A43 diff --git a/src/devices/bus/multibus/multibus.cpp b/src/devices/bus/multibus/multibus.cpp index 43b7de9bdc5..f8c64ac0d08 100644 --- a/src/devices/bus/multibus/multibus.cpp +++ b/src/devices/bus/multibus/multibus.cpp @@ -30,6 +30,7 @@ multibus_device::multibus_device(machine_config const &mconfig, char const *tag, , m_mem_config("mem", ENDIANNESS_LITTLE, 16, 24) , m_pio_config("pio", ENDIANNESS_LITTLE, 16, 16) , m_int_cb(*this) + , m_xack_cb(*this) { } @@ -41,6 +42,7 @@ device_memory_interface::space_config_vector multibus_device::memory_space_confi void multibus_device::device_start() { m_int_cb.resolve_all_safe(); + m_xack_cb.resolve_safe(); } multibus_slot_device::multibus_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) diff --git a/src/devices/bus/multibus/multibus.h b/src/devices/bus/multibus/multibus.h index af81837aac4..d753db25778 100644 --- a/src/devices/bus/multibus/multibus.h +++ b/src/devices/bus/multibus/multibus.h @@ -87,6 +87,12 @@ public: template auto int_callback() { return m_int_cb[I].bind(); } template void int_w(int state) { m_int_cb[I](state); } + // XACK/ + auto xack_cb() { return m_xack_cb.bind(); } + + // Set XACK/ signal (this is meant for "device_multibus_interface" devices) + void xack_w(int state) { m_xack_cb(state); } + protected: // device_t overrides virtual void device_start() override; @@ -99,6 +105,7 @@ private: address_space_config const m_pio_config; devcb_write_line::array<8> m_int_cb; + devcb_write_line m_xack_cb; }; class multibus_slot_device @@ -139,6 +146,8 @@ protected: template void int_w(int state) { m_bus->int_w(state); } void int_w(unsigned number, int state); + void xack_w(int state) { m_bus->xack_w(state); } + multibus_device *m_bus; }; diff --git a/src/devices/machine/i3001.cpp b/src/devices/machine/i3001.cpp index decca559d56..b9d0db1fee3 100644 --- a/src/devices/machine/i3001.cpp +++ b/src/devices/machine/i3001.cpp @@ -47,7 +47,9 @@ void i3001_device::fc_w(uint8_t fc) m_fo = true; break; } - m_fo_handler(m_fo); + if (!m_fo_handler.isnull()) { + m_fo_handler(m_fo); + } } WRITE_LINE_MEMBER(i3001_device::clk_w) @@ -57,9 +59,9 @@ WRITE_LINE_MEMBER(i3001_device::clk_w) void i3001_device::device_start() { - m_fo_handler.resolve_safe(); - m_px_handler.resolve_safe(0); - m_sx_handler.resolve_safe(0); + m_fo_handler.resolve(); + m_px_handler.resolve(); + m_sx_handler.resolve(); save_item(NAME(m_addr)); save_item(NAME(m_pr)); @@ -130,8 +132,8 @@ void i3001_device::update() m_addr = pack_row_col((get_row(m_addr) & 0b11000) | 0b00100 | (m_ac & 0b00011) , 0b1100 | (m_pr & 0b0011)); } else { // JPX - uint8_t px = m_px_handler() & 0b1111; - m_pr = m_sx_handler() & 0b1111; + uint8_t px = !m_px_handler.isnull() ? m_px_handler() & 0b1111 : 0; + m_pr = !m_sx_handler.isnull() ? m_sx_handler() & 0b1111 : 0; m_addr = pack_row_col((get_row(m_addr) & 0b11100) | (m_ac & 0b00011) , px); } } diff --git a/src/devices/machine/i3001.h b/src/devices/machine/i3001.h index 11231456f5b..1bb5462c541 100644 --- a/src/devices/machine/i3001.h +++ b/src/devices/machine/i3001.h @@ -41,6 +41,13 @@ class i3001_device : public device_t public: i3001_device(const machine_config &mconfig , const char *tag , device_t *owner , uint32_t clock = 0); + // Output callbacks + template void set_fo_w_cb(T &&... args) { m_fo_handler.set(std::forward(args)...); } + + // Input callbacks + template void set_px_r_cb(T &&... args) { m_px_handler.set(std::forward(args)...); } + template void set_sx_r_cb(T &&... args) { m_sx_handler.set(std::forward(args)...); } + // Mask of valid bits in address static constexpr uint16_t ADDR_MASK = ((1U << 9) - 1); @@ -63,13 +70,6 @@ public: DECLARE_READ_LINE_MEMBER(carry_r) { return m_carry; } DECLARE_READ_LINE_MEMBER(zero_r) { return m_zero; } - // Output callbacks - auto fo_w() { return m_fo_handler.bind(); } - - // Input callbacks - auto px_r() { return m_px_handler.bind(); } - auto sx_r() { return m_sx_handler.bind(); } - // Load address (in real hw address is loaded through PX/SX buses) void addr_w(uint16_t addr) { m_addr = addr & ADDR_MASK; } @@ -80,9 +80,9 @@ protected: virtual void device_start() override; private: - devcb_write_line m_fo_handler; - devcb_read8 m_px_handler; - devcb_read8 m_sx_handler; + device_delegate m_fo_handler; + device_delegate m_px_handler; + device_delegate m_sx_handler; uint16_t m_addr; uint8_t m_pr; diff --git a/src/devices/machine/i3002.cpp b/src/devices/machine/i3002.cpp index 0abfff3eb45..3cdf27b9136 100644 --- a/src/devices/machine/i3002.cpp +++ b/src/devices/machine/i3002.cpp @@ -125,7 +125,7 @@ bool i3002_device::update_ro() decode_fc(m_fc , fg , rg , reg); if (fg == 0 && rg == 2) { - uint8_t ik = m_ibus_handler() & m_kbus; + uint8_t ik = !m_ibus_handler.isnull() ? m_ibus_handler() & m_kbus : 0; uint8_t at = m_reg[ reg ]; set_ro(BIT(at , 0) && !BIT(ik , 0)); return true; @@ -136,10 +136,10 @@ bool i3002_device::update_ro() void i3002_device::device_start() { - m_co_handler.resolve_safe(); - m_ro_handler.resolve_safe(); - m_ibus_handler.resolve_safe(0); - m_mbus_handler.resolve_safe(0); + m_co_handler.resolve(); + m_ro_handler.resolve(); + m_ibus_handler.resolve(); + m_mbus_handler.resolve(); save_item(NAME(m_reg)); save_item(NAME(m_fc)); @@ -173,7 +173,7 @@ void i3002_device::update() case 1: // FC 0 RG II { - uint8_t m = m_mbus_handler() & WORD_MASK; + uint8_t m = !m_mbus_handler.isnull() ? m_mbus_handler() & WORD_MASK : 0; uint8_t tmp = (m_reg[ REG_AC ] & m_kbus) + m + m_ci; m_reg[ reg ] = tmp & WORD_MASK; set_co(BIT(tmp , SLICE_SIZE)); @@ -184,7 +184,7 @@ void i3002_device::update() // FC 0 RG III { // Who designed this mess??? - uint8_t ik = m_ibus_handler() & WORD_MASK & m_kbus; + uint8_t ik = !m_ibus_handler.isnull() ? m_ibus_handler() & WORD_MASK & m_kbus : 0; uint8_t at = m_reg[ reg ]; m_reg[ reg ] = 0; set_ro(BIT(at , 0) && !BIT(ik , 0)); @@ -214,7 +214,7 @@ void i3002_device::update() case 1: // FC 1 RG II { - uint8_t m = m_mbus_handler() & WORD_MASK; + uint8_t m = !m_mbus_handler.isnull() ? m_mbus_handler() & WORD_MASK : 0; m_reg[ REG_MAR ] = m_kbus | m; uint8_t tmp = m + m_kbus + m_ci; m_reg[ reg ] = tmp & WORD_MASK; @@ -249,7 +249,7 @@ void i3002_device::update() case 2: // FC 2 RG III { - uint8_t i = m_ibus_handler() & WORD_MASK; + uint8_t i = !m_ibus_handler.isnull() ? m_ibus_handler() & WORD_MASK : 0; uint8_t tmp = (i & m_kbus) + WORD_MASK + m_ci; m_reg[ reg ] = tmp & WORD_MASK; set_co(BIT(tmp , SLICE_SIZE)); @@ -272,7 +272,7 @@ void i3002_device::update() case 1: // FC 3 RG II (== FC 0 RG II) { - uint8_t m = m_mbus_handler() & WORD_MASK; + uint8_t m = !m_mbus_handler.isnull() ? m_mbus_handler() & WORD_MASK : 0; uint8_t tmp = (m_reg[ REG_AC ] & m_kbus) + m + m_ci; m_reg[ reg ] = tmp & WORD_MASK; set_co(BIT(tmp , SLICE_SIZE)); @@ -282,7 +282,7 @@ void i3002_device::update() case 2: // FC 3 RG III { - uint8_t i = m_ibus_handler() & WORD_MASK; + uint8_t i = !m_ibus_handler.isnull() ? m_ibus_handler() & WORD_MASK : 0; uint8_t tmp = (i & m_kbus) + m_reg[ reg ] + m_ci; m_reg[ reg ] = tmp & WORD_MASK; set_co(BIT(tmp , SLICE_SIZE)); @@ -305,7 +305,7 @@ void i3002_device::update() case 1: // FC 4 RG II { - uint8_t m = m_mbus_handler() & WORD_MASK; + uint8_t m = !m_mbus_handler.isnull() ? m_mbus_handler() & WORD_MASK : 0; uint8_t tmp = m & m_reg[ REG_AC ] & m_kbus; m_reg[ reg ] = tmp; set_co(m_ci || tmp != 0); @@ -315,7 +315,7 @@ void i3002_device::update() case 2: // FC 4 RG III { - uint8_t i = m_ibus_handler() & WORD_MASK; + uint8_t i = !m_ibus_handler.isnull() ? m_ibus_handler() & WORD_MASK : 0; uint8_t tmp = i & m_reg[ reg ] & m_kbus; m_reg[ reg ] = tmp; set_co(m_ci || tmp != 0); @@ -340,7 +340,7 @@ void i3002_device::update() case 1: // FC 5 RG II { - uint8_t m = m_mbus_handler() & WORD_MASK; + uint8_t m = !m_mbus_handler.isnull() ? m_mbus_handler() & WORD_MASK : 0; uint8_t tmp = m & m_kbus; m_reg[ reg ] = tmp; set_co(m_ci || tmp != 0); @@ -363,7 +363,7 @@ void i3002_device::update() case 1: // FC 6 RG II { - uint8_t m = m_mbus_handler() & WORD_MASK; + uint8_t m = !m_mbus_handler.isnull() ? m_mbus_handler() & WORD_MASK : 0; uint8_t tmp = m_reg[ REG_AC ] & m_kbus; m_reg[ reg ] = m | tmp; set_co(m_ci || tmp != 0); @@ -373,7 +373,7 @@ void i3002_device::update() case 2: // FC 6 RG III { - uint8_t ik = m_ibus_handler() & WORD_MASK & m_kbus; + uint8_t ik = !m_ibus_handler.isnull() ? m_ibus_handler() & WORD_MASK & m_kbus : 0; m_reg[ reg ] |= ik; set_co(m_ci || ik != 0); } @@ -395,7 +395,7 @@ void i3002_device::update() case 1: // FC 7 RG II { - uint8_t m = m_mbus_handler() & WORD_MASK; + uint8_t m = !m_mbus_handler.isnull() ? m_mbus_handler() & WORD_MASK : 0; uint8_t tmp = m_reg[ REG_AC ] & m_kbus; set_co(m_ci || (m & tmp) != 0); m_reg[ reg ] = m ^ tmp ^ WORD_MASK; @@ -405,7 +405,7 @@ void i3002_device::update() case 2: // FC 7 RG III { - uint8_t ik = m_ibus_handler() & WORD_MASK & m_kbus; + uint8_t ik = !m_ibus_handler.isnull() ? m_ibus_handler() & WORD_MASK & m_kbus : 0; set_co(m_ci || (m_reg[ reg ] & ik) != 0); m_reg[ reg ] = m_reg[ reg ] ^ ik ^ WORD_MASK; } @@ -418,11 +418,15 @@ void i3002_device::update() void i3002_device::set_co(bool co) { m_co = co; - m_co_handler(m_co); + if (!m_co_handler.isnull()) { + m_co_handler(m_co); + } } void i3002_device::set_ro(bool ro) { m_ro = ro; - m_ro_handler(m_ro); + if (!m_ro_handler.isnull()) { + m_ro_handler(m_ro); + } } diff --git a/src/devices/machine/i3002.h b/src/devices/machine/i3002.h index 70932afe7a2..8fea81bad3c 100644 --- a/src/devices/machine/i3002.h +++ b/src/devices/machine/i3002.h @@ -35,6 +35,14 @@ class i3002_device : public device_t public: i3002_device(const machine_config &mconfig , const char *tag , device_t *owner , uint32_t clock = 0); + // Output callbacks + template void set_co_w_cb(T &&... args) { m_co_handler.set(std::forward(args)...); } + template void set_ro_w_cb(T &&... args) { m_ro_handler.set(std::forward(args)...); } + + // Input bus callbacks + template void set_ibus_r_cb(T &&... args) { m_ibus_handler.set(std::forward(args)...); } + template void set_mbus_r_cb(T &&... args) { m_mbus_handler.set(std::forward(args)...); } + // Width of bit-slice static constexpr unsigned SLICE_SIZE = 2; @@ -68,10 +76,10 @@ public: void fc_kbus_w(uint8_t fc , uint8_t k); // Write Carry Input - DECLARE_WRITE_LINE_MEMBER(ci_w) { m_ci = state != 0; } + DECLARE_WRITE_LINE_MEMBER(ci_w) { m_ci = state; } // Write Left Input - DECLARE_WRITE_LINE_MEMBER(li_w) { m_li = state != 0; } + DECLARE_WRITE_LINE_MEMBER(li_w) { m_li = state; } // Read Carry Output DECLARE_READ_LINE_MEMBER(co_r) const { return m_co; } @@ -79,14 +87,6 @@ public: // Read Right Output DECLARE_READ_LINE_MEMBER(ro_r) const { return m_ro; } - // Output callbacks - auto co_w() { return m_co_handler.bind(); } - auto ro_w() { return m_ro_handler.bind(); } - - // Input bus callbacks - auto ibus_r() { return m_ibus_handler.bind(); } - auto mbus_r() { return m_mbus_handler.bind(); } - // Read output buses uint8_t abus_r() const { return m_reg[ REG_MAR ]; } uint8_t dbus_r() const { return m_reg[ REG_AC ]; } @@ -106,10 +106,10 @@ protected: virtual void device_start() override; private: - devcb_write_line m_co_handler; - devcb_write_line m_ro_handler; - devcb_read8 m_ibus_handler; - devcb_read8 m_mbus_handler; + device_delegate m_co_handler; + device_delegate m_ro_handler; + device_delegate m_ibus_handler; + device_delegate m_mbus_handler; uint8_t m_reg[ REG_COUNT ]; uint8_t m_fc; diff --git a/src/mame/intel/imds2.cpp b/src/mame/intel/imds2.cpp index 50bf08d26b5..112b68403d0 100644 --- a/src/mame/intel/imds2.cpp +++ b/src/mame/intel/imds2.cpp @@ -103,6 +103,8 @@ public: void imds2(machine_config &config); + DECLARE_WRITE_LINE_MEMBER(xack); + private: uint8_t ipc_mem_read(offs_t offset); void ipc_mem_write(offs_t offset, uint8_t data); @@ -304,9 +306,23 @@ void imds2_state::imds2(machine_config &config) m_ioc->parallel_int_cb().set(m_ipclocpic, FUNC(pic8259_device::ir5_w)); MULTIBUS(config, m_bus, 9'830'400); + m_bus->xack_cb().set(FUNC(imds2_state::xack)); MULTIBUS_SLOT(config, m_slot, m_bus, imds2_cards, nullptr, false); // FIXME: isbc202 } +WRITE_LINE_MEMBER(imds2_state::xack) +{ + if (state) { + // Put CPU in wait state + m_ipccpu->spin_until_trigger(1); + // Rewind PC so that the "IN" & "OUT" instructions are repeated when CPU is released + m_ipccpu->set_pc(m_ipccpu->pc() - 2); + } else { + // Release CPU from wait state + m_ipccpu->trigger(1); + } +} + ROM_START(imds2) // ROM definition of IPC cpu (8085A) ROM_REGION(0x1000, "ipcrom", 0) diff --git a/src/mame/intel/imds2ioc.cpp b/src/mame/intel/imds2ioc.cpp index 2340e9aeaa3..010bb624038 100644 --- a/src/mame/intel/imds2ioc.cpp +++ b/src/mame/intel/imds2ioc.cpp @@ -2,13 +2,7 @@ // copyright-holders:F. Ulivi // I/O controller for Intel Intellec MDS series-II // -// NOTE: -// Firmware running on PIO is NOT original because a dump is not available at the moment. -// Emulator runs a version of PIO firmware that was specifically developed by me to implement -// line printer output. -// // TODO: -// - Find a dump of the original PIO firmware // - Adjust speed of processors. Wait states are not accounted for yet. #include "emu.h" @@ -328,23 +322,13 @@ WRITE_LINE_MEMBER(imds2ioc_device::pio_lpt_ack_w) WRITE_LINE_MEMBER(imds2ioc_device::pio_lpt_busy_w) { - // Busy is active high in centronics_device whereas it's active low in MDS - if (!state) { + if (state) { m_device_status_byte |= 0x10; } else { m_device_status_byte &= ~0x10; } } -WRITE_LINE_MEMBER(imds2ioc_device::pio_lpt_select_w) -{ - if (state) { - m_device_status_byte |= 0x40; - } else { - m_device_status_byte &= ~0x40; - } -} - I8275_DRAW_CHARACTER_MEMBER(imds2ioc_device::crtc_display_pixels) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); @@ -641,7 +625,6 @@ void imds2ioc_device::device_add_mconfig(machine_config &config) CENTRONICS(config, m_centronics, centronics_devices, "printer"); m_centronics->ack_handler().set(FUNC(imds2ioc_device::pio_lpt_ack_w)); m_centronics->busy_handler().set(FUNC(imds2ioc_device::pio_lpt_busy_w)); - m_centronics->perror_handler().set(FUNC(imds2ioc_device::pio_lpt_select_w)); } ROM_START(imds2ioc) @@ -665,10 +648,8 @@ ROM_START(imds2ioc) ROMX_LOAD("104593-004.a53", 0x1800, 0x0800, CRC(04407e2a) SHA1(ecd65e4337d2bb7f5f6fdaae95696c9207ba57ee), ROM_BIOS(2)) // ROM definition of PIO controller (8041A) - // For the time being a specially developed PIO firmware is used until a dump of the original PIO is - // available. ROM_REGION(0x400, "iocpio", 0) - ROM_LOAD("pio_a72.bin", 0, 0x400, BAD_DUMP CRC(8c8e740b) SHA1(9b9333a9dc9585aa8f630721d13e551a5c87defc)) + ROM_LOAD("104566-0012.bin", 0, 0x400, CRC(f999e5da) SHA1(77ac1fab5443a16f906b25926ab3ba3ae42db6bb)) // ROM definition of keyboard controller (8741) ROM_REGION(0x400, "kbcpu", 0) diff --git a/src/mame/intel/imds2ioc.h b/src/mame/intel/imds2ioc.h index c5929492382..55dc40f5990 100644 --- a/src/mame/intel/imds2ioc.h +++ b/src/mame/intel/imds2ioc.h @@ -67,7 +67,6 @@ private: void pio_port_p2_w(uint8_t data); DECLARE_WRITE_LINE_MEMBER(pio_lpt_ack_w); DECLARE_WRITE_LINE_MEMBER(pio_lpt_busy_w); - DECLARE_WRITE_LINE_MEMBER(pio_lpt_select_w); I8275_DRAW_CHARACTER_MEMBER(crtc_display_pixels); -- cgit v1.2.3