From ecd1a49b2e80f8e46d9581dc7467b1542381d427 Mon Sep 17 00:00:00 2001 From: hap Date: Wed, 14 Feb 2024 11:55:19 +0100 Subject: h8_intc: base h8 does not have ISR --- src/devices/cpu/h8/gt913.cpp | 2 +- src/devices/cpu/h8/h8325.cpp | 2 +- src/devices/cpu/h8/h8_intc.cpp | 28 +++++++++++++++------------- src/devices/cpu/h8/h8_intc.h | 18 +++++++++--------- src/mame/saitek/gk2000.cpp | 12 +++--------- 5 files changed, 29 insertions(+), 33 deletions(-) diff --git a/src/devices/cpu/h8/gt913.cpp b/src/devices/cpu/h8/gt913.cpp index a96fb3f121f..8b0f19ba1a2 100644 --- a/src/devices/cpu/h8/gt913.cpp +++ b/src/devices/cpu/h8/gt913.cpp @@ -149,7 +149,7 @@ uint8_t gt913_device::uart_control_r(offs_t offset) void gt913_device::syscr_w(uint8_t data) { // NMI active edge - m_intc->set_nmi_type(BIT(data, 2) ? h8_intc_device::EDGE_RISE : h8_intc_device::EDGE_FALL); + m_intc->set_nmi_edge(BIT(data, 2)); m_syscr = data; } diff --git a/src/devices/cpu/h8/h8325.cpp b/src/devices/cpu/h8/h8325.cpp index b7cb0ef7d06..a229788f3ee 100644 --- a/src/devices/cpu/h8/h8325.cpp +++ b/src/devices/cpu/h8/h8325.cpp @@ -221,7 +221,7 @@ void h8325_device::syscr_w(uint8_t data) m_ram_view.disable(); // NMIEG - m_intc->set_nmi_type((data & 4) ? h8325_intc_device::EDGE_RISE : h8325_intc_device::EDGE_FALL); + m_intc->set_nmi_edge(BIT(data, 2)); // SSBY m_standby_pending = bool(data & 0x80); diff --git a/src/devices/cpu/h8/h8_intc.cpp b/src/devices/cpu/h8/h8_intc.cpp index 2570325f6bd..c3b4934cdc1 100644 --- a/src/devices/cpu/h8/h8_intc.cpp +++ b/src/devices/cpu/h8/h8_intc.cpp @@ -6,9 +6,6 @@ H8 interrupt controllers family - TODO: - - why is ISR in the base class? original H8 does not have this register - ***************************************************************************/ #include "emu.h" @@ -32,7 +29,7 @@ h8_intc_device::h8_intc_device(const machine_config &mconfig, const char *tag, d } h8_intc_device::h8_intc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, type, tag, owner, clock), m_irq_vector_base(0), m_irq_vector_count(0), m_irq_vector_nmi(0), + device_t(mconfig, type, tag, owner, clock), m_irq_vector_base(0), m_irq_vector_count(0), m_irq_vector_nmi(0), m_has_isr(false), m_cpu(*this, finder_base::DUMMY_TAG), m_nmi_type(EDGE_FALL), m_nmi_input(false), m_irq_input(0), m_ier(0), m_isr(0), m_iscr(0), m_icr_filter(0), m_ipr_filter(0) { } @@ -121,6 +118,10 @@ void h8_intc_device::set_input(int inputnum, int state) m_isr |= 1 << inputnum; update_irq_state(); } + if(!m_has_isr) { + m_isr = 0; + check_level_irqs(!set); + } } } @@ -143,18 +144,17 @@ void h8_intc_device::ier_w(uint8_t data) update_irq_state(); } -void h8_intc_device::check_level_irqs(bool force_update) +void h8_intc_device::check_level_irqs(bool update) { - logerror("irq_input=%02x\n", m_irq_input); - bool update = force_update; + bool set = false; for(int i=0; iASSERT - EDGE_RISE, // ASSERT->CLEAR - EDGE_DUAL - }; - h8_intc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); template h8_intc_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&cpu) : h8_intc_device(mconfig, tag, owner) @@ -35,7 +28,7 @@ public: void internal_interrupt(int vector); void set_input(int inputnum, int state); void set_filter(int icr_filter, int ipr_filter); - void set_nmi_type(int type) { m_nmi_type = type; } + void set_nmi_edge(int state) { m_nmi_type = state ? EDGE_RISE : EDGE_FALL; } uint8_t ier_r(); void ier_w(uint8_t data); @@ -43,11 +36,18 @@ public: void iscr_w(uint8_t data); protected: + enum { + LEVEL_LOW, // ASSERT + EDGE_FALL, // CLEAR->ASSERT + EDGE_RISE, // ASSERT->CLEAR + EDGE_DUAL + }; enum { MAX_VECTORS = 256 }; int m_irq_vector_base; int m_irq_vector_count; int m_irq_vector_nmi; + bool m_has_isr; required_device m_cpu; @@ -69,7 +69,7 @@ protected: virtual void get_priority(int vect, int &icr_pri, int &ipr_pri) const; void update_irq_state(); virtual void update_irq_types(); - void check_level_irqs(bool force_update = false); + void check_level_irqs(bool update); }; class h8325_intc_device : public h8_intc_device { diff --git a/src/mame/saitek/gk2000.cpp b/src/mame/saitek/gk2000.cpp index bf902d06f88..293b019b988 100644 --- a/src/mame/saitek/gk2000.cpp +++ b/src/mame/saitek/gk2000.cpp @@ -73,7 +73,6 @@ private: void p4_w(u8 data); u8 p5_r(); void p5_w(u8 data); - u8 p6_r(); void p6_w(u8 data); u8 p7_r(); void p7_w(u8 data); @@ -190,12 +189,6 @@ void gk2000_state::p5_w(u8 data) m_inp_mux = (m_inp_mux & 0xff) | (~data << 5 & 0x700); } -u8 gk2000_state::p6_r() -{ - //printf("r6 "); - return 0xff; -} - void gk2000_state::p6_w(u8 data) { //printf("w6_%X ",data); @@ -261,7 +254,8 @@ static INPUT_PORTS_START( gk2000 ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_K) PORT_START("POWER") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Z) PORT_CHANGED_MEMBER(DEVICE_SELF, gk2000_state, go_button, 0) PORT_NAME("Go / Stop") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Z) PORT_CHANGED_MEMBER(DEVICE_SELF, gk2000_state, go_button, 0) PORT_NAME("Go / Stop") + PORT_BIT(0xef, IP_ACTIVE_HIGH, IPT_UNUSED) INPUT_PORTS_END @@ -287,7 +281,7 @@ void gk2000_state::gk2000(machine_config &config) m_maincpu->write_port4().set(FUNC(gk2000_state::p4_w)); m_maincpu->read_port5().set(FUNC(gk2000_state::p5_r)); m_maincpu->write_port5().set(FUNC(gk2000_state::p5_w)); - m_maincpu->read_port6().set(FUNC(gk2000_state::p6_r)); + m_maincpu->read_port6().set_ioport("POWER").invert(); m_maincpu->write_port6().set(FUNC(gk2000_state::p6_w)); m_maincpu->read_port7().set(FUNC(gk2000_state::p7_r)); m_maincpu->write_port7().set(FUNC(gk2000_state::p7_w)); -- cgit v1.2.3