summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/devices/bus/a2bus/mouse.cpp11
-rw-r--r--src/devices/machine/6821pia.cpp18
-rw-r--r--src/devices/machine/6821pia.h3
3 files changed, 19 insertions, 13 deletions
diff --git a/src/devices/bus/a2bus/mouse.cpp b/src/devices/bus/a2bus/mouse.cpp
index e5c2e7fcf84..414338bf8ad 100644
--- a/src/devices/bus/a2bus/mouse.cpp
+++ b/src/devices/bus/a2bus/mouse.cpp
@@ -40,8 +40,8 @@
Hookup notes:
- PIA port A connects to 68705 port A in its entirety (bi-directional)
- PIA PB4-PB7 connects to 68705 PC0-3 (bi-directional)
+ PIA port A connects to 68705 port A in its entirety (bi-directional with internal pullups)
+ PIA PB4-PB7 connects to 68705 PC0-3 (bi-directional but should not be pulled up)
PIA PB0 is 'sync latch'
PIA PB1 is A8 on the EPROM
PIA PB2 is A9 on the EPROM
@@ -139,6 +139,7 @@ void a2bus_mouse_device::device_add_mconfig(machine_config &config)
PIA6821(config, m_pia, 1021800);
m_pia->writepa_handler().set(FUNC(a2bus_mouse_device::pia_out_a));
m_pia->writepb_handler().set(FUNC(a2bus_mouse_device::pia_out_b));
+ m_pia->tspb_handler().set_constant(0x00);
m_pia->irqa_handler().set(FUNC(a2bus_mouse_device::pia_irqa_w));
m_pia->irqb_handler().set(FUNC(a2bus_mouse_device::pia_irqb_w));
}
@@ -186,15 +187,11 @@ void a2bus_mouse_device::device_start()
save_item(NAME(m_port_b_in));
save_item(NAME(m_last));
save_item(NAME(m_count));
-
- m_port_b_in = 0x00;
}
void a2bus_mouse_device::device_reset()
{
- m_rom_bank = 0;
m_last[0] = m_last[1] = m_count[0] = m_count[1] = 0;
- m_port_a_in = 0x00;
}
/*-------------------------------------------------
@@ -231,7 +228,7 @@ void a2bus_mouse_device::pia_out_a(uint8_t data)
void a2bus_mouse_device::pia_out_b(uint8_t data)
{
- m_mcu->pc_w(0xf0 | ((data >> 4) & 0x0f));
+ m_mcu->pc_w(data >> 4);
m_rom_bank = (data & 0xe) << 7;
}
diff --git a/src/devices/machine/6821pia.cpp b/src/devices/machine/6821pia.cpp
index 2ce825a08eb..24d64e21683 100644
--- a/src/devices/machine/6821pia.cpp
+++ b/src/devices/machine/6821pia.cpp
@@ -49,6 +49,7 @@ pia6821_device::pia6821_device(const machine_config &mconfig, const char *tag, d
m_in_ca2_handler(*this),
m_out_a_handler(*this),
m_out_b_handler(*this),
+ m_ts_b_handler(*this),
m_ca2_handler(*this),
m_cb2_handler(*this),
m_irqa_handler(*this),
@@ -83,6 +84,7 @@ void pia6821_device::device_resolve_objects()
m_in_ca2_handler.resolve();
m_out_a_handler.resolve();
m_out_b_handler.resolve();
+ m_ts_b_handler.resolve();
m_ca2_handler.resolve();
m_cb2_handler.resolve();
m_irqa_handler.resolve_safe();
@@ -191,7 +193,9 @@ void pia6821_device::device_reset()
if (!m_ca2_handler.isnull())
m_ca2_handler(1);
- // TODO: reset port B to three-state outputs
+ // reset port B to three-state outputs
+ if (!m_out_b_handler.isnull() && !m_ts_b_handler.isnull())
+ m_out_b_handler(offs_t(0), m_ts_b_handler(), 0);
}
@@ -345,8 +349,13 @@ uint8_t pia6821_device::get_out_a_value()
uint8_t pia6821_device::get_out_b_value()
{
- // input pins are high-impedance - we just send them as zeros for backwards compatibility
- return m_out_b & m_ddr_b;
+ uint8_t ret = m_out_b & m_ddr_b;
+
+ // input pins are high-impedance - send them as zeros for backwards compatibility
+ if (m_ddr_b != 0xff && !m_ts_b_handler.isnull())
+ ret |= m_ts_b_handler() & ~m_ddr_b;
+
+ return ret;
}
@@ -650,14 +659,13 @@ void pia6821_device::send_to_out_a_func(const char* message)
void pia6821_device::send_to_out_b_func(const char* message)
{
- // input pins are high-impedance - we just send them as zeros for backwards compatibility
const uint8_t data = get_out_b_value();
LOG("PIA %s = %02X DDRB=%02x\n", message, data, m_ddr_b);
if (!m_out_b_handler.isnull())
{
- m_out_b_handler(offs_t(0), data);
+ m_out_b_handler(offs_t(0), data, m_ddr_b);
}
else
{
diff --git a/src/devices/machine/6821pia.h b/src/devices/machine/6821pia.h
index a3253baaea9..397b584fa3b 100644
--- a/src/devices/machine/6821pia.h
+++ b/src/devices/machine/6821pia.h
@@ -43,9 +43,9 @@ public:
auto readca2_handler() { return m_in_ca2_handler.bind(); }
auto readcb1_handler() { return m_in_cb1_handler.bind(); }
- // TODO: CONVERT THESE TO WRITE LINE
auto writepa_handler() { return m_out_a_handler.bind(); }
auto writepb_handler() { return m_out_b_handler.bind(); }
+ auto tspb_handler() { return m_ts_b_handler.bind(); }
auto ca2_handler() { return m_ca2_handler.bind(); }
auto cb2_handler() { return m_cb2_handler.bind(); }
@@ -163,6 +163,7 @@ private:
devcb_read_line m_in_ca2_handler;
devcb_write8 m_out_a_handler;
devcb_write8 m_out_b_handler;
+ devcb_read8 m_ts_b_handler;
devcb_write_line m_ca2_handler;
devcb_write_line m_cb2_handler;
devcb_write_line m_irqa_handler;