From 10d74db99111042f02bc4412d11e4558dc731fa9 Mon Sep 17 00:00:00 2001 From: Phil Bennett Date: Thu, 29 Jul 2010 07:08:29 +0000 Subject: [PATCH] Fixed HD63701 SLP opcode [Sandro Ronco] ---------- Forwarded message ---------- From: Sandro Ronco Date: Mon, Jul 26, 2010 at 6:07 PM Subject: [HD63701]Fix slp opcode To: submit@mamedev.org Fixed SLP opcode basing on HD63701 and HD6303 datasheet. This is need for psion driver in MESS, but I did some testing in MAME and I have not seen regressions. Probably nobody noticed this before because this opcode is almost unused in arcade machine. If you want have a confirmation of this you can see the diagram at page 14 of the HD63701 datasheet or at page 24 of the HD6303 datasheet, where it is clear that the "sleep cancel signal" is not conditional at the IRQ mask. Regards Sandro Ronco --- src/emu/cpu/m6800/m6800.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c index 4da2e7a7d74..247a376223f 100644 --- a/src/emu/cpu/m6800/m6800.c +++ b/src/emu/cpu/m6800/m6800.c @@ -596,19 +596,29 @@ INLINE void CHECK_IRQ_LINES(m6800_state *cpustate) { if (cpustate->nmi_pending) { + if(cpustate->wai_state & M6800_SLP) + cpustate->wai_state &= ~M6800_SLP; + cpustate->nmi_pending = FALSE; enter_interrupt(cpustate, "M6800 '%s' take NMI\n",0xfffc); } - else if( !(CC & 0x10) ) + else { if( cpustate->irq_state[M6800_IRQ_LINE] != CLEAR_LINE ) { /* standard IRQ */ - enter_interrupt(cpustate, "M6800 '%s' take IRQ1\n",0xfff8); - if( cpustate->irq_callback ) - (void)(*cpustate->irq_callback)(cpustate->device, M6800_IRQ_LINE); + if(cpustate->wai_state & M6800_SLP) + cpustate->wai_state &= ~M6800_SLP; + + if( !(CC & 0x10) ) + { + enter_interrupt(cpustate, "M6800 '%s' take IRQ1\n",0xfff8); + if( cpustate->irq_callback ) + (void)(*cpustate->irq_callback)(cpustate->device, M6800_IRQ_LINE); + } } else - m6800_check_irq2(cpustate); + if( !(CC & 0x10) ) + m6800_check_irq2(cpustate); } } @@ -622,6 +632,8 @@ static void check_timer_event(m6800_state *cpustate) cpustate->tcsr |= TCSR_OCF; cpustate->pending_tcsr |= TCSR_OCF; MODIFIED_tcsr; + if((cpustate->tcsr & TCSR_EOCI) && cpustate->wai_state & M6800_SLP) + cpustate->wai_state &= ~M6800_SLP; if ( !(CC & 0x10) && (cpustate->tcsr & TCSR_EOCI)) TAKE_OCI; } @@ -635,6 +647,8 @@ static void check_timer_event(m6800_state *cpustate) cpustate->tcsr |= TCSR_TOF; cpustate->pending_tcsr |= TCSR_TOF; MODIFIED_tcsr; + if((cpustate->tcsr & TCSR_ETOI) && cpustate->wai_state & M6800_SLP) + cpustate->wai_state &= ~M6800_SLP; if ( !(CC & 0x10) && (cpustate->tcsr & TCSR_ETOI)) TAKE_TOI; }