diff options
author | Vas Crabb <vas@vastheman.com> | 2021-04-04 03:25:53 +1000 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2021-04-04 03:25:53 +1000 |
commit | 49006281c1750d25433613ad81c3d5e58e420e8a (patch) | |
tree | e0aa49bf8a2d7b6b15ee2c08590dafb28055e44f | |
parent | c6c0f2f3ec7d25d47ef88bc0325e88e60195881e (diff) |
bus/a2bus: Also synchronise data and asserting strobe for Apple II Parallel Interface Card.
-rw-r--r-- | src/devices/bus/a2bus/a2pic.cpp | 79 | ||||
-rw-r--r-- | src/devices/bus/a2bus/a2pic.h | 2 |
2 files changed, 44 insertions, 37 deletions
diff --git a/src/devices/bus/a2bus/a2pic.cpp b/src/devices/bus/a2bus/a2pic.cpp index aaf0503be82..6833e1f6d63 100644 --- a/src/devices/bus/a2bus/a2pic.cpp +++ b/src/devices/bus/a2bus/a2pic.cpp @@ -177,29 +177,25 @@ void a2bus_pic_device::write_c0nx(u8 offset, u8 data) switch (offset & 0x07U) { case 0U: + if (BIT(m_input_x->read(), 1)) { - ioport_value const x(m_input_x->read()); - - // latch output data - remember MSB can be forced low by jumper - if (BIT(x, 1)) - { - LOG("Latch data %02X\n", data); - m_data_latch = data; - m_printer_out->write(data & (BIT(x, 2) ? 0xffU : 0x7fU)); - } - else - { - LOG("Output disabled, not latching data\n"); - } - - // start strobe if autostrobe is enabled + // latch output data and start strobe if autostrobe is enabled + LOG("Latch data %02X\n", data); + machine().scheduler().synchronize( + timer_expired_delegate(FUNC(a2bus_pic_device::data_write), this), + unsigned(data) | (1 << 8) | ((m_autostrobe_disable ? 0 : 1) << 9)); + } + else + { + // just start strobe if autostrobe is enabled + LOG("Output disabled, not latching data\n"); if (!m_autostrobe_disable) - start_strobe(); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_pic_device::data_write), this), 1 << 9); } break; case 2U: - start_strobe(); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_pic_device::data_write), this), 1 << 9); break; case 5U: @@ -408,6 +404,36 @@ void a2bus_pic_device::set_fault_in(void *ptr, s32 param) } +void a2bus_pic_device::data_write(void *ptr, s32 param) +{ + // latch output data - remember MSB can be forced low by jumper + if (BIT(param, 8)) + { + m_data_latch = u8(u32(param)); + m_printer_out->write(m_data_latch & (BIT(m_input_x->read(), 2) ? 0xffU : 0x7fU)); + } + + // start/extend strobe output + if (BIT(param, 9)) + { + ioport_value const sw1(m_input_sw1->read()); + unsigned const cycles(15U - ((sw1 & 0x07U) << 1)); + int const state(BIT(sw1, 3)); + if (!m_strobe_timer->enabled()) + { + LOG("Output /STROBE=%d for %u cycles\n", state, cycles); + clear_ack_latch(); + m_printer_conn->write_strobe(state); + } + else + { + LOG("Adjust /STROBE=%d remaining to %u cycles\n", state, cycles); + } + m_strobe_timer->adjust(attotime::from_ticks(cycles * 7, clock())); + } +} + + //---------------------------------------------- // helpers @@ -425,25 +451,6 @@ void a2bus_pic_device::reset_mode() } -void a2bus_pic_device::start_strobe() -{ - ioport_value const sw1(m_input_sw1->read()); - unsigned const cycles(15U - ((sw1 & 0x07U) << 1)); - int const state(BIT(sw1, 3)); - if (!m_strobe_timer->enabled()) - { - LOG("Output /STROBE=%d for %u cycles\n", state, cycles); - clear_ack_latch(); - m_printer_conn->write_strobe(state); - } - else - { - LOG("Adjust /STROBE=%d remaining to %u cycles\n", state, cycles); - } - m_strobe_timer->adjust(attotime::from_ticks(cycles, clock())); -} - - void a2bus_pic_device::set_ack_latch() { if (m_strobe_timer->enabled()) diff --git a/src/devices/bus/a2bus/a2pic.h b/src/devices/bus/a2bus/a2pic.h index 048260c1b60..80a0a247027 100644 --- a/src/devices/bus/a2bus/a2pic.h +++ b/src/devices/bus/a2bus/a2pic.h @@ -96,10 +96,10 @@ private: void set_perror_in(void *ptr, s32 param); void set_select_in(void *ptr, s32 param); void set_fault_in(void *ptr, s32 param); + void data_write(void *ptr, s32 param); // helpers void reset_mode(); - void start_strobe(); void set_ack_latch(); void clear_ack_latch(); void enable_irq(); |