mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
a2bus/mouse.cpp: Fix regression caused by MCU port C lines being high after reset
- 6821pia.cpp: Add callback to set port B three-state output
This commit is contained in:
parent
bb7ca8d920
commit
486a4e5ca3
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user