From 1acef2aaede8c6cfe4a7ddcee7f20208e8b6e5a6 Mon Sep 17 00:00:00 2001 From: neauoire Date: Sun, 10 Apr 2022 10:31:18 -0700 Subject: [PATCH] Added instruction code to error report --- src/devices/system.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/devices/system.c b/src/devices/system.c index bcd980a..f1e7d3c 100644 --- a/src/devices/system.c +++ b/src/devices/system.c @@ -41,14 +41,16 @@ system_inspect(Uxn *u) int uxn_halt(Uxn *u, Uint8 instr, Uint8 err, Uint16 addr) { - Stack *origin = (instr & 0x40) ? u->wst : u->rst; Uint8 *d = &u->dev[0x00]; - origin->err = err; + if(instr & 0x40) + u->rst->err = err; + else + u->wst->err = err; if(GETVEC(d)) uxn_eval(u, GETVEC(d)); else { system_inspect(u); - fprintf(stderr, "%s %s, at 0x%04x.\n", (instr & 0x40) ? "Return-stack" : "Working-stack", errors[err - 1], addr); + fprintf(stderr, "%s %s, by %02x at 0x%04x.\n", (instr & 0x40) ? "Return-stack" : "Working-stack", errors[err - 1], instr, addr); } return 0; }