From c307d95ce0ade9b8e9c3530d350e108a979b0195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Banaan=20Ananas?= Date: Mon, 11 Aug 2014 22:11:10 +0000 Subject: [PATCH] fix http://mametesters.org/view.php?id=5350 to quote OG: "CPU cores *must* call standard_irq_callback() when taking an interrupt. No ifs, no buts, Not only HOLD_LINE relies on it, but more importantly run until interrupt relies on it." --- src/emu/cpu/m6809/base6x09.ops | 13 ++++++++++++ src/emu/cpu/m6809/hd6309.h | 4 ++-- src/emu/cpu/m6809/hd6309.ops | 2 +- src/emu/cpu/m6809/konami.h | 4 ++-- src/emu/cpu/m6809/konami.ops | 2 +- src/emu/cpu/m6809/m6809.h | 1 - src/emu/cpu/m6809/m6809.ops | 2 +- src/emu/cpu/m6809/m6809inl.h | 39 ++++------------------------------ 8 files changed, 24 insertions(+), 43 deletions(-) diff --git a/src/emu/cpu/m6809/base6x09.ops b/src/emu/cpu/m6809/base6x09.ops index 38ec4413e2a..334521eb385 100644 --- a/src/emu/cpu/m6809/base6x09.ops +++ b/src/emu/cpu/m6809/base6x09.ops @@ -7,6 +7,7 @@ NMI: m_cc |= CC_I | CC_F; set_ea(VECTOR_NMI); eat(1); + standard_irq_callback(INPUT_LINE_NMI); goto INTERRUPT_VECTOR; FIRQ: @@ -25,6 +26,7 @@ FIRQ: m_cc |= CC_I | CC_F; set_ea(VECTOR_FIRQ); eat(1); + standard_irq_callback(M6809_FIRQ_LINE); goto INTERRUPT_VECTOR; IRQ: @@ -35,6 +37,7 @@ IRQ: m_cc |= CC_I; set_ea(VECTOR_IRQ); eat(1); + standard_irq_callback(M6809_IRQ_LINE); goto INTERRUPT_VECTOR; INTERRUPT_VECTOR: @@ -447,6 +450,16 @@ CWAI: set_ea(m_ea.w); // need to do this to set the addressing mode m_cc |= CC_I | (m_ea.w != VECTOR_IRQ ? CC_F : 0); + + // invoke standard interrupt callback for MAME core + switch (m_ea.w) + { + case VECTOR_NMI: standard_irq_callback(INPUT_LINE_NMI); break; + case VECTOR_FIRQ: standard_irq_callback(M6809_FIRQ_LINE); break; + case VECTOR_IRQ: standard_irq_callback(M6809_IRQ_LINE); break; + default: break; + } + goto INTERRUPT_VECTOR; LEA_xy: diff --git a/src/emu/cpu/m6809/hd6309.h b/src/emu/cpu/m6809/hd6309.h index fd63ee3b00e..10a591204b4 100644 --- a/src/emu/cpu/m6809/hd6309.h +++ b/src/emu/cpu/m6809/hd6309.h @@ -140,7 +140,7 @@ enum HD6309_ZERO_WORD }; -#define HD6309_IRQ_LINE 0 /* IRQ line number */ -#define HD6309_FIRQ_LINE 1 /* FIRQ line number */ +#define HD6309_IRQ_LINE M6809_IRQ_LINE /* 0 - IRQ line number */ +#define HD6309_FIRQ_LINE M6809_FIRQ_LINE /* 1 - FIRQ line number */ #endif // __HD6309_H__ diff --git a/src/emu/cpu/m6809/hd6309.ops b/src/emu/cpu/m6809/hd6309.ops index a1250bf351d..cddde7318d4 100644 --- a/src/emu/cpu/m6809/hd6309.ops +++ b/src/emu/cpu/m6809/hd6309.ops @@ -1,6 +1,6 @@ MAIN: // check interrupt lines - switch(check_pending_interrupt()) + switch(get_pending_interrupt()) { case VECTOR_NMI: goto NMI; case VECTOR_FIRQ: goto FIRQ; diff --git a/src/emu/cpu/m6809/konami.h b/src/emu/cpu/m6809/konami.h index c3bd891e5ba..47600969d7c 100644 --- a/src/emu/cpu/m6809/konami.h +++ b/src/emu/cpu/m6809/konami.h @@ -73,7 +73,7 @@ private: void execute_one(); }; -#define KONAMI_IRQ_LINE 0 /* IRQ line number */ -#define KONAMI_FIRQ_LINE 1 /* FIRQ line number */ +#define KONAMI_IRQ_LINE M6809_IRQ_LINE /* 0 - IRQ line number */ +#define KONAMI_FIRQ_LINE M6809_FIRQ_LINE /* 1 - FIRQ line number */ #endif /* __KONAMI_CPU_H__ */ diff --git a/src/emu/cpu/m6809/konami.ops b/src/emu/cpu/m6809/konami.ops index 0183e317d36..e2246f85b71 100644 --- a/src/emu/cpu/m6809/konami.ops +++ b/src/emu/cpu/m6809/konami.ops @@ -1,6 +1,6 @@ MAIN: // check interrupt lines - switch(check_pending_interrupt()) + switch(get_pending_interrupt()) { case VECTOR_NMI: goto NMI; case VECTOR_FIRQ: goto FIRQ; diff --git a/src/emu/cpu/m6809/m6809.h b/src/emu/cpu/m6809/m6809.h index 8b8dd2b5f5c..175d388329b 100644 --- a/src/emu/cpu/m6809/m6809.h +++ b/src/emu/cpu/m6809/m6809.h @@ -238,7 +238,6 @@ protected: bool is_register_addressing_mode(); bool is_ea_addressing_mode() { return m_addressing_mode == ADDRESSING_MODE_EA; } UINT16 get_pending_interrupt(); - UINT16 check_pending_interrupt(); void log_illegal(); private: diff --git a/src/emu/cpu/m6809/m6809.ops b/src/emu/cpu/m6809/m6809.ops index e736bcdd9f2..49fe45644b9 100644 --- a/src/emu/cpu/m6809/m6809.ops +++ b/src/emu/cpu/m6809/m6809.ops @@ -1,6 +1,6 @@ MAIN: // check interrupt lines - switch(check_pending_interrupt()) + switch(get_pending_interrupt()) { case VECTOR_NMI: goto NMI; case VECTOR_FIRQ: goto FIRQ; diff --git a/src/emu/cpu/m6809/m6809inl.h b/src/emu/cpu/m6809/m6809inl.h index 09567f73c00..a041cb9d403 100644 --- a/src/emu/cpu/m6809/m6809inl.h +++ b/src/emu/cpu/m6809/m6809inl.h @@ -302,43 +302,12 @@ inline bool m6809_base_device::is_register_addressing_mode() inline UINT16 m6809_base_device::get_pending_interrupt() { - UINT16 result; if (m_nmi_asserted) - result = VECTOR_NMI; + return VECTOR_NMI; else if (!(m_cc & CC_F) && m_firq_line) - result = VECTOR_FIRQ; + return VECTOR_FIRQ; else if (!(m_cc & CC_I) && m_irq_line) - result = VECTOR_IRQ; + return VECTOR_IRQ; else - result = 0; - return result; -} - - - -//------------------------------------------------- -// check_pending_interrupt -//------------------------------------------------- - -inline UINT16 m6809_base_device::check_pending_interrupt() -{ - UINT16 result = get_pending_interrupt(); - - // check_pending_interrupt() will also invoke the IRQ - // callback for FIRQ and IRQ interrupts - // - // I'm not sure why this is necessary; neither the 6809, 6309 - // nor (presumably) Konami had any interrupt acknowledge lines so - // it isn't clear what this is reflecting - switch(result) - { - case VECTOR_FIRQ: - standard_irq_callback(M6809_FIRQ_LINE); - break; - case VECTOR_IRQ: - standard_irq_callback(M6809_IRQ_LINE); - break; - } - - return result; + return 0; }