aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emu.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/emu.c b/emu.c
index b4e1e32..9d1a620 100644
--- a/emu.c
+++ b/emu.c
@@ -131,7 +131,10 @@ void (*extop[nExt])(unsigned short *a) = {
void
ext(unsigned short *b, unsigned short *a)
{
- extop[*b](a);
+ if (extop[*b])
+ extop[*b](a);
+ else
+ warnx("wrong extended opcode 0x%x", *b);
}
void
@@ -521,11 +524,19 @@ step(unsigned short *m, unsigned short *r)
b = o ? fetcharg(reg[Aux], 1) : &reg[Aux];
a = fetcharg((c >> 10) & 0x3f, 0);
+ #if 0
+ fprintf(stderr, "%x %x, %x\n", o, *b, *a);
+ #endif
+
if (skip) {
skip = 0;
reg[SP] = s; /* restore SP on skipped opcode */
- } else
- op[o](b, a);
+ } else {
+ if (op[o])
+ op[o](b, a);
+ else
+ warnx("wrong opcode 0x%x", o);
+ }
usleep(10 * cycle); /* 100kHz */