summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/hmcs40
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2015-03-18 15:35:40 +0100
committer hap <happppp@users.noreply.github.com>2015-03-18 15:35:40 +0100
commit0e63709997962a62f85195964910be56070261cb (patch)
tree6203c2ffd9e06e7cabf9270d8c65ce7600534cad /src/emu/cpu/hmcs40
parentbb94e7d86ddda3d6ddcb442deeccb63a8ab23470 (diff)
another small interrupt bugfix
Diffstat (limited to 'src/emu/cpu/hmcs40')
-rw-r--r--src/emu/cpu/hmcs40/hmcs40.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/emu/cpu/hmcs40/hmcs40.c b/src/emu/cpu/hmcs40/hmcs40.c
index f3b7f9a17dc..2daa1a911b4 100644
--- a/src/emu/cpu/hmcs40/hmcs40.c
+++ b/src/emu/cpu/hmcs40/hmcs40.c
@@ -459,6 +459,7 @@ void hmcs40_cpu_device::do_interrupt()
{
m_icount--;
push_stack();
+ m_ie = 0;
// line 0/1 for external interrupt, let's use 2 for t/c interrupt
int line = (m_iri) ? m_eint_line : 2;
@@ -466,8 +467,10 @@ void hmcs40_cpu_device::do_interrupt()
// vector $3f, on page 0(timer/counter), or page 1(external)
// external interrupt has priority over t/c interrupt
m_pc = 0x3f | (m_iri ? 0x40 : 0);
- m_iri = m_irt = 0;
- m_ie = 0;
+ if (m_iri)
+ m_iri = 0;
+ else
+ m_irt = 0;
standard_irq_callback(line);
}
@@ -554,7 +557,12 @@ void hmcs40_cpu_device::execute_run()
// LPU is handled 1 cycle later
if ((m_prev_op & 0x3e0) == 0x340)
+ {
+ if ((m_op & 0x1c0) != 0x1c0)
+ logerror("%s LPU without BR/CAL at $%04X\n", tag(), m_prev_pc);
+
m_pc = ((m_page << 6) | (m_pc & 0x3f)) & m_pcmask;
+ }
// check/handle interrupt, but not in the middle of a long jump
if (m_ie && (m_iri || m_irt) && (m_op & 0x3e0) != 0x340)
@@ -567,7 +575,7 @@ void hmcs40_cpu_device::execute_run()
// fetch next opcode
debugger_instruction_hook(this, m_pc);
m_op = m_program->read_word(m_pc << 1) & 0x3ff;
- m_i = BITSWAP8(m_op,7,6,5,4,0,1,2,3) & 0xf; // reversed bit-order for immediate param
+ m_i = BITSWAP8(m_op,7,6,5,4,0,1,2,3) & 0xf; // reversed bit-order for immediate param (except for XAMR?)
increment_pc();
// handle opcode
@@ -633,7 +641,8 @@ op_lay(); - 118
break;
case 0x034:
//op_illegal();
- op_amc(); // mirror?
+ //op_amc(); // mirror?
+ op_am();
break;
case 0x230:
@@ -641,7 +650,8 @@ op_lay(); - 118
break;
case 0x234:
//op_illegal();
- op_smc(); // mirror?
+ //op_smc(); // mirror?
+ op_nega();
break;