diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp index e8eb52ada42..8f1aec7f7c9 100644 --- a/src/devices/cpu/z80/z80.cpp +++ b/src/devices/cpu/z80/z80.cpp @@ -883,19 +883,15 @@ void nsc800_device::device_reset() memset(m_nsc800_irq_state, 0, sizeof(m_nsc800_irq_state)); } -bool z80_device::check_icount(u8 to_step, int icount_saved, bool redonable) +bool z80_device::check_icount(u8 to_step, int icount_saved, bool redoable) { - if ((m_icount < 0) && redonable && access_to_be_redone()) + if ((m_icount < 0) && redoable && access_to_be_redone()) { m_icount = icount_saved; m_ref = (m_ref & 0xffff00) | (to_step - 1); m_redone = true; return true; } - if (m_wait_state) - { - m_icount = 0; - } if (m_icount <= 0) { m_ref = (m_ref & 0xffff00) | to_step; diff --git a/src/devices/cpu/z80/z80.h b/src/devices/cpu/z80/z80.h index 99ed6a17a40..b71b387dc9b 100644 --- a/src/devices/cpu/z80/z80.h +++ b/src/devices/cpu/z80/z80.h @@ -114,7 +114,7 @@ class z80_device : public cpu_device, public z80_daisy_chain_interface void block_io_interrupted_flags(); virtual void do_op(); - bool check_icount(u8 to_step, int icount_saved, bool redonable); + bool check_icount(u8 to_step, int icount_saved, bool redoable); virtual u8 data_read(u16 addr); virtual void data_write(u16 addr, u8 value); diff --git a/src/emu/devcpu.cpp b/src/emu/devcpu.cpp index efd12d682a9..5f75bf826a2 100644 --- a/src/emu/devcpu.cpp +++ b/src/emu/devcpu.cpp @@ -100,6 +100,7 @@ void cpu_device::access_after_delay(u32 cycles) noexcept void cpu_device::defer_access() noexcept { + if(*m_icountptr > 0) + *m_icountptr = 0; m_access_to_be_redone = true; - *m_icountptr = 0; } diff --git a/src/mame/apple/apple2e.cpp b/src/mame/apple/apple2e.cpp index 209ad1d0f0d..73bddb30d9d 100644 --- a/src/mame/apple/apple2e.cpp +++ b/src/mame/apple/apple2e.cpp @@ -2493,7 +2493,7 @@ u8 apple2e_state::c000_iic_r(offs_t offset) case 0x7e: // read IOUDIS m_vbl = false; lower_irq(IRQ_VBL); - return (m_ioudis ? 0x00 : 0x80) | uFloatingBus7; + return (m_ioudis ? 0x80 : 0x00) | uFloatingBus7; case 0x7f: // read DHIRES return (m_video->get_dhires() ? 0x00 : 0x80) | uFloatingBus7; diff --git a/src/mame/apple/maciifx.cpp b/src/mame/apple/maciifx.cpp index ac1aa7fe4df..c3ad6b9d83f 100644 --- a/src/mame/apple/maciifx.cpp +++ b/src/mame/apple/maciifx.cpp @@ -170,6 +170,8 @@ void maciifx_state::machine_reset() space.unmap_write(0x00000000, memory_end); space.install_rom(0x00000000, memory_end & ~memory_mirror, memory_mirror, m_rom_ptr); m_overlay = true; + + m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15)); } uint32_t maciifx_state::rom_switch_r(offs_t offset) diff --git a/src/mame/novag/savant.cpp b/src/mame/novag/savant.cpp index f3b84f8c4c6..f8b2a604ede 100644 --- a/src/mame/novag/savant.cpp +++ b/src/mame/novag/savant.cpp @@ -22,7 +22,7 @@ The display (both the LCD and the sensors) didn't last long, probably none exist anymore in original working order. TODO: -- get rid of m_wait_in hack when Z80 core accurately emulates WAIT pin +- hard locks MAME, suspect issue with access_to_be_redone in z80.cpp *******************************************************************************/ @@ -68,6 +68,7 @@ class savant_state : public driver_device protected: virtual void machine_start() override; + virtual void machine_reset() override; private: // devices/pointers @@ -82,7 +83,7 @@ class savant_state : public driver_device required_shared_ptr m_nvram; required_ioport_array<3> m_inputs; - bool m_wait_in = false; + bool m_z80_wait = false; u8 m_inp_mux = 0; u8 m_databus = 0; u8 m_control = 0; @@ -115,13 +116,18 @@ class savant_state : public driver_device void savant_state::machine_start() { // register for savestates - save_item(NAME(m_wait_in)); + save_item(NAME(m_z80_wait)); save_item(NAME(m_inp_mux)); save_item(NAME(m_databus)); save_item(NAME(m_control)); save_item(NAME(m_lcd_data)); } +void savant_state::machine_reset() +{ + m_z80_wait = false; +} + /******************************************************************************* @@ -144,22 +150,24 @@ u8 savant_state::nvram_r(offs_t offset) void savant_state::stall_w(offs_t offset, u8 data) { // any access to port C0 puts the Z80 into WAIT, sets BUSRQ, and sets MCU EXT INT - m_databus = offset >> 8; - m_psu->ext_int_w(1); - m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); - m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, ASSERT_LINE); + if (!m_z80_wait) + { + m_databus = offset >> 8; + m_psu->ext_int_w(1); + m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, ASSERT_LINE); + m_maincpu->defer_access(); + } + + m_z80_wait = !m_z80_wait; } u8 savant_state::stall_r(offs_t offset) { if (!machine().side_effects_disabled()) - { - m_wait_in = true; stall_w(offset); - } - // return value is databus (see control_w) - return 0; + return m_databus; } u8 savant_state::mcustatus_r() @@ -206,13 +214,6 @@ void savant_state::control_w(u8 data) { m_psu->ext_int_w(0); m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); - - // hack to set Z80 A after IN A,($C0) - if (m_wait_in) - { - m_maincpu->set_state_int(Z80_A, m_databus); - m_wait_in = false; - } } // d1: clear Z80 BUSRQ