From 18fda43ee7495e73af0c8e7eff2822eb0dc3eccf Mon Sep 17 00:00:00 2001 From: smf- Date: Tue, 11 Mar 2014 08:16:57 +0000 Subject: [PATCH] Fixed c64 restore key and c128 crashing if exp_irq_w called at device_start() time. --- src/mess/drivers/c128.c | 10 +++++----- src/mess/drivers/c64.c | 13 +++++++++---- src/mess/includes/c128.h | 6 +++--- src/mess/includes/c64.h | 5 +++-- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/mess/drivers/c128.c b/src/mess/drivers/c128.c index 964556a0487..cd5dab7e58c 100644 --- a/src/mess/drivers/c128.c +++ b/src/mess/drivers/c128.c @@ -50,10 +50,8 @@ QUICKLOAD_LOAD_MEMBER( c128_state, cbm_c64 ) inline void c128_state::check_interrupts() { - int restore = !BIT(m_restore->read(), 0); - int irq = m_cia1_irq || m_vic_irq || m_exp_irq; - int nmi = m_cia2_irq || restore || m_exp_nmi; + int nmi = m_cia2_irq || !m_restore || m_exp_nmi; //int aec = m_exp_dma && m_z80_busack; //int rdy = m_vic_aec && m_z80en && m_vic_ba; //int busreq = !m_z80en || !(m_z80_busack && !aec) @@ -493,8 +491,10 @@ ADDRESS_MAP_END // INPUT_PORTS( c128 ) //------------------------------------------------- -INPUT_CHANGED_MEMBER( c128_state::restore ) +WRITE_LINE_MEMBER( c128_state::write_restore ) { + m_restore = state; + check_interrupts(); } @@ -615,7 +615,7 @@ static INPUT_PORTS_START( c128 ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_START( "RESTORE" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, c128_state, write_restore) PORT_START( "LOCK" ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) diff --git a/src/mess/drivers/c64.c b/src/mess/drivers/c64.c index 82690bcedcc..93c64fc455c 100644 --- a/src/mess/drivers/c64.c +++ b/src/mess/drivers/c64.c @@ -48,10 +48,8 @@ QUICKLOAD_LOAD_MEMBER( c64_state, cbm_c64 ) void c64_state::check_interrupts() { - int restore = 0; // TODO: push restore m_restore ? !BIT(m_restore->read(), 0) : CLEAR_LINE; - int irq = m_cia1_irq || m_vic_irq || m_exp_irq; - int nmi = m_cia2_irq || restore || m_exp_nmi; + int nmi = m_cia2_irq || !m_restore || m_exp_nmi; //int rdy = m_exp_dma && m_vic_ba; m_maincpu->set_input_line(M6510_IRQ_LINE, irq); @@ -366,6 +364,13 @@ ADDRESS_MAP_END // INPUT_PORTS( c64 ) //------------------------------------------------- +WRITE_LINE_MEMBER( c64_state::write_restore ) +{ + m_restore = state; + + check_interrupts(); +} + static INPUT_PORTS_START( c64 ) PORT_START( "ROW0" ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) @@ -448,7 +453,7 @@ static INPUT_PORTS_START( c64 ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_START( "RESTORE" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, c64_state, write_restore) PORT_START( "LOCK" ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) diff --git a/src/mess/includes/c128.h b/src/mess/includes/c128.h index 9f5e5e1badd..20f8b49964b 100644 --- a/src/mess/includes/c128.h +++ b/src/mess/includes/c128.h @@ -73,7 +73,6 @@ public: m_k0(*this, "K0"), m_k1(*this, "K1"), m_k2(*this, "K2"), - m_restore(*this, "RESTORE"), m_lock(*this, "LOCK"), m_caps(*this, "CAPS"), m_40_80(*this, "40_80"), @@ -89,6 +88,7 @@ public: m_cnt1(1), m_sp1(1), m_iec_data_out(1), + m_restore(1), m_cia1_irq(CLEAR_LINE), m_cia2_irq(CLEAR_LINE), m_vic_irq(CLEAR_LINE), @@ -131,7 +131,6 @@ public: required_ioport m_k0; required_ioport m_k1; required_ioport m_k2; - required_ioport m_restore; required_ioport m_lock; required_ioport m_caps; required_ioport m_40_80; @@ -192,7 +191,7 @@ public: DECLARE_WRITE_LINE_MEMBER( exp_dma_w ); DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); - DECLARE_INPUT_CHANGED_MEMBER( restore ); + DECLARE_WRITE_LINE_MEMBER( write_restore ); DECLARE_INPUT_CHANGED_MEMBER( caps_lock ); DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c64 ); @@ -230,6 +229,7 @@ public: int m_iec_data_out; // interrupt state + int m_restore; int m_cia1_irq; int m_cia2_irq; int m_vic_irq; diff --git a/src/mess/includes/c64.h b/src/mess/includes/c64.h index 25f3e9c2877..5afed913b59 100644 --- a/src/mess/includes/c64.h +++ b/src/mess/includes/c64.h @@ -61,13 +61,13 @@ public: m_row5(*this, "ROW5"), m_row6(*this, "ROW6"), m_row7(*this, "ROW7"), - m_restore(*this, "RESTORE"), m_lock(*this, "LOCK"), m_loram(1), m_hiram(1), m_charen(1), m_va14(1), m_va15(1), + m_restore(1), m_cia1_irq(CLEAR_LINE), m_cia2_irq(CLEAR_LINE), m_vic_irq(CLEAR_LINE), @@ -100,7 +100,6 @@ public: optional_ioport m_row5; optional_ioport m_row6; optional_ioport m_row7; - optional_ioport m_restore; optional_ioport m_lock; virtual void machine_start(); @@ -133,6 +132,7 @@ public: DECLARE_READ8_MEMBER( cpu_r ); DECLARE_WRITE8_MEMBER( cpu_w ); + DECLARE_WRITE_LINE_MEMBER( write_restore ); DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); DECLARE_WRITE_LINE_MEMBER( exp_nmi_w ); DECLARE_WRITE_LINE_MEMBER( exp_dma_w ); @@ -163,6 +163,7 @@ public: int m_va15; // interrupt state + int m_restore; int m_cia1_irq; int m_cia2_irq; int m_vic_irq;