From 550aceee231ed3b9f55af90ca1142b507747dd4c Mon Sep 17 00:00:00 2001 From: Andrew Alderwick Date: Sat, 19 Feb 2022 00:28:03 +0000 Subject: [PATCH] (uxnasm) Allow writing the 0xffff byte of RAM. --- src/uxnasm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/uxnasm.c b/src/uxnasm.c index 63d0c18..2a54455 100644 --- a/src/uxnasm.c +++ b/src/uxnasm.c @@ -35,7 +35,8 @@ typedef struct { typedef struct { Uint8 data[LENGTH]; - Uint16 ptr, length, llen, mlen, rlen; + unsigned int ptr, length; + Uint16 llen, mlen, rlen; Label labels[512]; Macro macros[256]; Reference refs[2048]; @@ -193,6 +194,10 @@ writebyte(Uint8 b) fprintf(stderr, "-- Writing in zero-page: %02x\n", b); return 0; } + else if(p.ptr > 0xffff) { + fprintf(stderr, "-- Writing after the end of RAM: %02x\n", b); + return 0; + } else if(p.ptr < p.length) { fprintf(stderr, "-- Memory overwrite: %04x -> %04x\n", p.length, p.ptr); return 0;