From 4890c043184eb0b4c61982c50dc96e25aa9625f3 Mon Sep 17 00:00:00 2001 From: arbee Date: Thu, 18 May 2023 23:07:09 -0400 Subject: [PATCH] apple/apple2.cpp,apple2e.cpp: More realistic (Control-)Reset behavior. [R. Belmont] * The 6502 is now held in reset until you let go of the keys, like hardware * IIe-class machines now reset the language card and MMU registers, like hardware --- src/mame/apple/apple2.cpp | 32 +++++++++++++++++++++++-- src/mame/apple/apple2e.cpp | 48 +++++++++++++++++++++++++++++++------- 2 files changed, 70 insertions(+), 10 deletions(-) diff --git a/src/mame/apple/apple2.cpp b/src/mame/apple/apple2.cpp index 084ab6ed4ea..26f2deb84a2 100644 --- a/src/mame/apple/apple2.cpp +++ b/src/mame/apple/apple2.cpp @@ -177,6 +177,8 @@ private: int m_inh_bank; + bool m_reset_latch; + double m_x_calibration, m_y_calibration; device_a2bus_card_interface *m_slotdevice[8]; @@ -292,6 +294,7 @@ void apple2_state::machine_start() } m_joystick_x1_time = m_joystick_x2_time = m_joystick_y1_time = m_joystick_y2_time = 0; + m_reset_latch = false; // setup save states save_item(NAME(m_speaker_state)); @@ -307,6 +310,7 @@ void apple2_state::machine_start() save_item(NAME(m_inh_bank)); save_item(NAME(m_cnxx_slot)); save_item(NAME(m_anykeydown)); + save_item(NAME(m_reset_latch)); // setup video pointers m_video->set_ram_pointers(m_ram_ptr, m_ram_ptr); @@ -337,14 +341,38 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2_state::apple2_interrupt) { // CTRL-RESET if ((m_kbspecial->read() & 0x88) == 0x88) { - m_maincpu->reset(); + if (!m_reset_latch) + { + m_reset_latch = true; + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + } + } + else + { + if (m_reset_latch) + { + m_reset_latch = false; + m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + } } } else // plain RESET { if (m_kbspecial->read() & 0x80) { - m_maincpu->reset(); + if (!m_reset_latch) + { + m_reset_latch = true; + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + } + } + else + { + if (m_reset_latch) + { + m_reset_latch = false; + m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + } } } } diff --git a/src/mame/apple/apple2e.cpp b/src/mame/apple/apple2e.cpp index 034b885cd87..fa6f7341277 100644 --- a/src/mame/apple/apple2e.cpp +++ b/src/mame/apple/apple2e.cpp @@ -440,6 +440,7 @@ private: bool m_romswitch; bool m_mockingboard4c; bool m_intc8rom; + bool m_reset_latch; bool m_isiic, m_isiicplus, m_iscec, m_iscecm, m_iscec2000, m_pal; u8 m_migram[0x800]; @@ -1033,6 +1034,7 @@ void apple2e_state::machine_start() } m_joystick_x1_time = m_joystick_x2_time = m_joystick_y1_time = m_joystick_y2_time = 0; + m_reset_latch = false; // setup save states save_item(NAME(m_speaker_state)); @@ -1111,6 +1113,7 @@ void apple2e_state::machine_start() save_item(NAME(m_ace2200_axxx_bank)); save_item(NAME(m_laser_speed)); save_item(NAME(m_laser_fdc_on)); + save_item(NAME(m_reset_latch)); } void apple2e_state::machine_reset() @@ -1304,18 +1307,47 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2e_state::apple2_interrupt) // check for ctrl-reset if ((m_kbspecial->read() & 0x88) == 0x88) { - m_maincpu->reset(); + if (!m_reset_latch) + { + m_reset_latch = true; + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - // reset intcxrom to default - if ((m_isiic) || (m_isace500)) - { - m_intcxrom = true; + // As per Sather: LC resets to read ROM, write RAM, no pre-write, bank 2 + m_lcram = false; + m_lcram2 = true; + m_lcprewrite = false; + m_lcwriteenable = true; + + // More Sather: all MMU switches off (80STORE, RAMRD, RAMWRT, INTCXROM, ALTZP, SLOTC3ROM, PAGE2, HIRES, INTC8ROM) + m_video->a80store_w(false); + m_altzp = false; + m_ramrd = false; + m_ramwrt = false; + m_altzp = false; + m_video->page2_w(false); + m_video->res_w(0); + + // reset intcxrom to default + if ((m_isiic) || (m_isace500)) + { + m_intcxrom = true; + } + else + { + m_intcxrom = false; + m_slotc3rom = false; + } + auxbank_update(); + update_slotrom_banks(); } - else + } + else // user released Control-Reset + { + if (m_reset_latch) { - m_intcxrom = false; + m_reset_latch = false; + m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); } - update_slotrom_banks(); } // check Franklin F-keys