From 695e59170899ce4f1a6a295fcb827e809c53f895 Mon Sep 17 00:00:00 2001 From: Dennis Munsie Date: Sun, 20 Oct 2024 17:57:03 -0400 Subject: apple/apple2e.cpp: Fix behavior of $c02x softswitches to match behavior of hardware (#12894) --- src/mame/apple/apple2e.cpp | 51 +++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/mame/apple/apple2e.cpp b/src/mame/apple/apple2e.cpp index fbef9e2920c..b5c64bf1118 100644 --- a/src/mame/apple/apple2e.cpp +++ b/src/mame/apple/apple2e.cpp @@ -1778,33 +1778,38 @@ void apple2e_state::do_io(int offset, bool is_iic) return; } - switch (offset) - { - case 0x20: - if (m_cassette) - { - m_cassette_state ^= 1; - m_cassette->output(m_cassette_state ? 1.0f : -1.0f); - } - break; + if ((offset & 0xf0) == 0x20) // tape out / ROM bank on IIc/IIc+ + { + if (m_cassette) + { + // Officially Apple only documents this softswitch at $c020 but + // all models with a tape interface will respond to any of the $c02x + // addresses + m_cassette_state ^= 1; + m_cassette->output(m_cassette_state ? 1.0f : -1.0f); + } + + if (is_iic) + { + // Apple IIc Tech Reference 1st edition lists this softswitch at $c028 while + // the 2nd edition lists it at $c02x. Both the IIc and IIc Plus will respond to + // $c02x. + m_romswitch = !m_romswitch; + update_slotrom_banks(); + lcrom_update(); - case 0x28: - if (is_iic) + // MIG is reset when ROMSWITCH turns off + if ((m_isiicplus) && !(m_romswitch)) { - m_romswitch = !m_romswitch; - update_slotrom_banks(); - lcrom_update(); - - // MIG is reset when ROMSWITCH turns off - if ((m_isiicplus) && !(m_romswitch)) - { - m_migpage = 0; - m_intdrive = false; - m_35sel = false; - } + m_migpage = 0; + m_intdrive = false; + m_35sel = false; } - break; + } + } + switch (offset) + { case 0x40: // utility strobe (not available on IIc) if (!is_iic) { -- cgit v1.2.3