From 5b96cefb3a134498047cf237bef1fcb9da11f7b4 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sun, 12 Jun 2022 09:12:13 -0700 Subject: [PATCH] Added error code for stack busy --- src/devices/system.c | 4 +++- src/uxn.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/devices/system.c b/src/devices/system.c index f1e7d3c..e44dc5f 100644 --- a/src/devices/system.c +++ b/src/devices/system.c @@ -17,7 +17,9 @@ WITH REGARD TO THIS SOFTWARE. static const char *errors[] = { "underflow", "overflow", - "division by zero"}; + "division by zero", + "busy" +}; static void system_print(Stack *s, char *name) diff --git a/src/uxn.c b/src/uxn.c index 6aaa73a..8c1ea8c 100644 --- a/src/uxn.c +++ b/src/uxn.c @@ -88,7 +88,7 @@ uxn_eval(Uxn *u, Uint16 pc) case 0x1f: /* SFT */ POP8(a) POP(b) PUSH(src, b >> (a & 0x0f) << ((a & 0xf0) >> 4)) break; } } - return 1; + return (u->wst->ptr || u->rst->ptr) ? uxn_halt(u, instr, 4, pc - 1) : 1; err: return uxn_halt(u, instr, errcode, pc - 1); }