macadb: Additional cleanup. [R. Belmont]

This commit is contained in:
arbee 2022-09-29 22:29:04 -04:00
parent c418e92160
commit 5c4e076cc7
3 changed files with 3 additions and 89 deletions

View File

@ -202,8 +202,6 @@ macadb_device::macadb_device(const machine_config &mconfig, const char *tag, dev
m_mouse1(*this, "MOUSE1"),
m_mouse2(*this, "MOUSE2"),
m_keys(*this, "KEY%u", 0),
write_via_clock(*this),
write_via_data(*this),
write_adb_data(*this),
write_adb_irq(*this)
{
@ -216,8 +214,6 @@ ioport_constructor macadb_device::device_input_ports() const
void macadb_device::device_start()
{
write_via_clock.resolve_safe();
write_via_data.resolve_safe();
write_adb_data.resolve_safe();
write_adb_irq.resolve_safe();
@ -237,13 +233,9 @@ void macadb_device::device_start()
save_item(NAME(m_adb_datasize));
save_item(NAME(m_adb_buffer));
save_item(NAME(m_adb_command));
save_item(NAME(m_adb_send));
save_item(NAME(m_adb_timer_ticks));
save_item(NAME(m_adb_extclock));
save_item(NAME(m_adb_direction));
save_item(NAME(m_adb_listenreg));
save_item(NAME(m_adb_listenaddr));
save_item(NAME(m_adb_last_talk));
save_item(NAME(m_adb_srq_switch));
save_item(NAME(m_adb_stream_ptr));
save_item(NAME(m_adb_linestate));
@ -263,22 +255,6 @@ void macadb_device::device_start()
save_item(NAME(m_adb_linein));
}
WRITE_LINE_MEMBER(macadb_device::adb_data_w)
{
if (m_adb_timer_ticks > 0)
{
m_adb_command <<= 1;
if (state)
{
m_adb_command |= 1;
}
else
{
m_adb_command &= ~1;
}
}
}
/* *************************************************************************
* High-level ADB primitives used by all lower-level implementations
* *************************************************************************/
@ -511,14 +487,12 @@ void macadb_device::adb_talk()
case ADB_CMD_RESET:
LOGMASKED(LOG_TALK_LISTEN, "ADB RESET: reg %x address %x\n", reg, addr);
m_adb_direction = 0;
m_adb_send = 0;
break;
case ADB_CMD_FLUSH:
LOGMASKED(LOG_TALK_LISTEN, "ADB FLUSH: reg %x address %x\n", reg, addr);
m_adb_direction = 0;
m_adb_send = 0;
break;
default: // reserved/unused
@ -548,9 +522,6 @@ void macadb_device::adb_talk()
case 3: // talk
LOGMASKED(LOG_TALK_LISTEN, "ADB TALK: reg %x address %x (K %x M %x)\n", reg, addr, m_adb_keybaddr, m_adb_mouseaddr);
// keep track of what device the Mac last TALKed to
m_adb_last_talk = addr;
m_adb_direction = 0; // output to Mac
if (addr == m_adb_mouseaddr)
{
@ -839,53 +810,6 @@ TIMER_CALLBACK_MEMBER(macadb_device::mac_adb_tick)
void macadb_device::adb_vblank()
{
#if 0
if (m_adb_state == ADB_STATE_IDLE)
{
if (this->adb_pollmouse())
{
// if the mouse was the last TALK, we can just send the new data
// otherwise we need to pull SRQ
if (m_adb_last_talk == m_adb_mouseaddr)
{
// repeat last TALK to get updated data
m_adb_waiting_cmd = 1;
this->adb_talk();
m_adb_timer_ticks = 8;
this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
}
else
{
write_adb_irq(ASSERT_LINE);
m_adb_command = m_adb_send = 0;
m_adb_timer_ticks = 1; // one tick should be sufficient to make it see the IRQ
this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
m_adb_srq_switch = 1;
}
}
else if (this->adb_pollkbd(0))
{
if (m_adb_last_talk == m_adb_keybaddr)
{
// repeat last TALK to get updated data
m_adb_waiting_cmd = 1;
this->adb_talk();
m_adb_timer_ticks = 8;
this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
}
else
{
write_adb_irq(ASSERT_LINE);
m_adb_command = m_adb_send = 0;
m_adb_timer_ticks = 1; // one tick should be sufficient to make it see the IRQ
this->m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
m_adb_srq_switch = 1;
}
}
}
#endif
}
void macadb_device::device_reset()
@ -894,15 +818,11 @@ void macadb_device::device_reset()
m_adb_srq_switch = 0;
write_adb_irq(CLEAR_LINE); // no interrupt
m_adb_timer_ticks = 0;
m_adb_command = 0;
m_adb_extclock = 0;
m_adb_send = 0;
m_adb_waiting_cmd = 0;
m_adb_srqflag = false;
m_adb_direction = 0;
m_adb_datasize = 0;
m_adb_last_talk = -1;
m_adb_linestate = 0;

View File

@ -19,16 +19,13 @@ public:
// construction/destruction
macadb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
auto via_clock_callback() { return write_via_clock.bind(); }
auto via_data_callback() { return write_via_data.bind(); }
auto adb_data_callback() { return write_adb_data.bind(); }
auto adb_irq_callback() { return write_adb_irq.bind(); }
required_ioport m_mouse0, m_mouse1, m_mouse2;
required_ioport_array<6> m_keys;
devcb_write_line write_via_clock, write_via_data, write_adb_data, write_adb_irq;
devcb_write_line write_adb_data, write_adb_irq;
DECLARE_WRITE_LINE_MEMBER(adb_data_w);
DECLARE_WRITE_LINE_MEMBER(adb_linechange_w);
void adb_vblank();
@ -49,8 +46,8 @@ private:
// ADB HLE state
int32_t m_adb_waiting_cmd, m_adb_datasize, m_adb_buffer[257];
int32_t m_adb_command, m_adb_send, m_adb_timer_ticks, m_adb_extclock, m_adb_direction;
int32_t m_adb_listenreg, m_adb_listenaddr, m_adb_last_talk, m_adb_srq_switch;
int32_t m_adb_command, m_adb_direction;
int32_t m_adb_listenreg, m_adb_listenaddr, m_adb_srq_switch;
int32_t m_adb_stream_ptr;
int32_t m_adb_linestate;
bool m_adb_srqflag;

View File

@ -220,7 +220,6 @@ private:
DECLARE_WRITE_LINE_MEMBER(via_irq_w);
DECLARE_WRITE_LINE_MEMBER(via2_irq_w);
TIMER_CALLBACK_MEMBER(mac_6015_tick);
WRITE_LINE_MEMBER(via_cb2_w) { m_macadb->adb_data_w(state); }
int m_via_interrupt = 0, m_via2_interrupt = 0, m_scc_interrupt = 0, m_asc_interrupt = 0, m_last_taken_interrupt = 0;
int m_ca1_data = 0, m_via2_ca1_hack = 0;
@ -960,7 +959,6 @@ void macpb030_state::macpb140(machine_config &config)
m_via1->writepa_handler().set(FUNC(macpb030_state::mac_via_out_a));
m_via1->writepb_handler().set(FUNC(macpb030_state::mac_via_out_b));
m_via1->irq_handler().set(FUNC(macpb030_state::via_irq_w));
m_via1->cb2_handler().set(FUNC(macpb030_state::via_cb2_w));
R65NC22(config, m_via2, C7M/10);
m_via2->readpa_handler().set(FUNC(macpb030_state::mac_via2_in_a));
@ -1075,7 +1073,6 @@ void macpb030_state::macpb160(machine_config &config)
m_via1->writepa_handler().set(FUNC(macpb030_state::mac_via_out_a));
m_via1->writepb_handler().set(FUNC(macpb030_state::mac_via_out_b));
m_via1->irq_handler().set(FUNC(macpb030_state::via_irq_w));
m_via1->cb2_handler().set(FUNC(macpb030_state::via_cb2_w));
R65NC22(config, m_via2, C7M / 10);
m_via2->readpa_handler().set(FUNC(macpb030_state::mac_via2_in_a));