uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit fad574816dcaa93086414d84021b51c8bd4f0319
parent bc26d9d60d3180cb43f24b4573d654a612577885
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Thu, 12 Jan 2023 20:35:42 -0800

Removed errcode from stacks

Diffstat:
Msrc/devices/system.c | 16+++++++++-------
Msrc/uxn.h | 2+-
2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/devices/system.c b/src/devices/system.c @@ -42,13 +42,15 @@ int uxn_halt(Uxn *u, Uint8 instr, Uint8 err, Uint16 addr) { Uint8 *d = &u->dev[0x00]; - if(instr & 0x40) - u->rst->err = err; - else - u->wst->err = err; - if(GETVEC(d)) - uxn_eval(u, GETVEC(d)); - else { + Uint16 handler = GETVEC(d); + if(handler) { + u->wst->ptr = 4; + u->wst->dat[0] = addr >> 0x8; + u->wst->dat[1] = addr & 0xff; + u->wst->dat[2] = instr; + u->wst->dat[3] = err; + return uxn_eval(u, handler); + } else { system_inspect(u); fprintf(stderr, "%s %s, by %02x at 0x%04x.\n", (instr & 0x40) ? "Return-stack" : "Working-stack", errors[err - 1], instr, addr); } diff --git a/src/uxn.h b/src/uxn.h @@ -26,7 +26,7 @@ typedef unsigned int Uint32; /* clang-format on */ typedef struct { - Uint8 dat[254], err, ptr; + Uint8 dat[255], ptr; } Stack; typedef struct Uxn {