Fix bug when processing interrupts
authorAnthony Liu <antliu@gmail.com>
Thu, 5 Dec 2013 15:48:36 +0000 (23:48 +0800)
committerHugo Villeneuve <hugo@hugovil.com>
Fri, 6 Dec 2013 04:41:24 +0000 (23:41 -0500)
Push current PC onto stack and take vector address from parameter.

src/cpu8051.c

index 6480853..956ae7d 100644 (file)
@@ -226,8 +226,8 @@ cpu8051_ReadB(uint8_t bit_address)
 static void
 cpu8051_process_interrupt(int pc, int pri)
 {
-       stack_push16(pc);
-       cpu8051.pc = 0x0B;
+       stack_push16(cpu8051.pc);
+       cpu8051.pc = pc;
        cpu8051.active_priority = pri;
 }