summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2020-08-24 22:48:54 -0400
committer arbee <rb6502@users.noreply.github.com>2020-08-24 22:48:54 -0400
commit1a2e6c29ef019ba48ee11aaae4e034bd792554b4 (patch)
tree4a72e7d18c8ffd015a828c981488124d5cc023bd
parented4a36eeacd94bbbbcbb710c18b3856f2f6a968e (diff)
mac: fix ADB for SE and early II-series machines [R. Belmont]
-rw-r--r--src/mame/machine/mac.cpp19
-rw-r--r--src/mame/machine/macadb.cpp23
2 files changed, 31 insertions, 11 deletions
diff --git a/src/mame/machine/mac.cpp b/src/mame/machine/mac.cpp
index 3519488a36f..6129cbae4d0 100644
--- a/src/mame/machine/mac.cpp
+++ b/src/mame/machine/mac.cpp
@@ -911,7 +911,7 @@ void mac_state::mac_iwm_w(offs_t offset, uint16_t data, uint16_t mem_mask)
WRITE_LINE_MEMBER(mac_state::mac_adb_via_out_cb2)
{
-// printf("VIA OUT CB2 = %x\n", state);
+ //printf("VIA OUT CB2 = %x (ticks %d)\n", state, m_adb_timer_ticks);
if (ADB_IS_EGRET)
{
m_egret->set_via_data(state & 1);
@@ -922,14 +922,17 @@ WRITE_LINE_MEMBER(mac_state::mac_adb_via_out_cb2)
}
else
{
- m_adb_command <<= 1;
- if (state)
+ if (m_adb_timer_ticks > 0)
{
- m_adb_command |= 1;
- }
- else
- {
- m_adb_command &= ~1;
+ m_adb_command <<= 1;
+ if (state)
+ {
+ m_adb_command |= 1;
+ }
+ else
+ {
+ m_adb_command &= ~1;
+ }
}
}
}
diff --git a/src/mame/machine/macadb.cpp b/src/mame/machine/macadb.cpp
index b301dfa6e15..76be06dcc12 100644
--- a/src/mame/machine/macadb.cpp
+++ b/src/mame/machine/macadb.cpp
@@ -650,8 +650,17 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_adb_tick)
}
// do one clock transition on CB1 to advance the VIA shifter
- m_via1->write_cb1(m_adb_extclock ^ 1);
- m_via1->write_cb1(m_adb_extclock);
+ //printf("ADB transition (%d)\n", m_adb_timer_ticks);
+ if (m_adb_direction)
+ {
+ m_via1->write_cb1(m_adb_extclock ^ 1);
+ m_via1->write_cb1(m_adb_extclock);
+ }
+ else
+ {
+ m_via1->write_cb1(m_adb_extclock);
+ m_via1->write_cb1(m_adb_extclock ^ 1);
+ }
m_adb_timer_ticks--;
if (!m_adb_timer_ticks)
@@ -666,6 +675,12 @@ TIMER_CALLBACK_MEMBER(mac_state::mac_adb_tick)
m_adb_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
}
}
+
+ if (!(m_adb_direction) && (ADB_IS_BITBANG_CLASS))
+ {
+ // m_via1->write_cb1(m_adb_extclock);
+ m_via1->write_cb1(m_adb_extclock ^ 1);
+ }
}
else
{
@@ -697,6 +712,7 @@ void mac_state::mac_adb_newaction(int state)
case ADB_STATE_XFER_EVEN:
case ADB_STATE_XFER_ODD:
+ //printf("EVEN/ODD: adb datasize %d\n", m_adb_datasize);
if (m_adb_datasize > 0)
{
int i;
@@ -706,6 +722,7 @@ void mac_state::mac_adb_newaction(int state)
{
// set up the byte
m_adb_send = m_adb_buffer[0];
+ //printf("ADB sending %02x\n", m_adb_send);
m_adb_datasize--;
// move down the rest of the buffer, if any
@@ -1144,7 +1161,7 @@ void mac_state::adb_vblank()
{
m_adb_irq_pending = 1;
m_adb_command = m_adb_send = 0;
- m_adb_timer_ticks = 1; // one tick should be sufficient to make it see the IRQ
+ 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;
}