From 683eb6b8590baa19a78c93fdc8f8cf1fced8e2f6 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 26 Mar 2024 11:02:11 -0700 Subject: [PATCH] (uxnasm)Catch overflow proper --- src/uxnasm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/uxnasm.c b/src/uxnasm.c index 3ca6400..08526aa 100644 --- a/src/uxnasm.c +++ b/src/uxnasm.c @@ -1,7 +1,7 @@ #include /* -Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick +Copyright (c) 2021-2024 Devine Lu Linvega, Andrew Alderwick Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -34,9 +34,10 @@ typedef struct { } Reference; typedef struct { + int ptr; Uint8 data[LENGTH]; Uint8 lambda_stack[0x100], lambda_ptr, lambda_len; - Uint16 ptr, line, length, label_len, macro_len, refs_len; + Uint16 line, length, label_len, macro_len, refs_len; char scope[0x40], lambda_name[0x05], *location; Label labels[0x400]; Macro macros[0x100]; @@ -258,7 +259,7 @@ writebyte(Uint8 b) { if(p.ptr < TRIM) return error_asm("Writing in zero-page"); - else if(p.ptr == 0xffff) + else if(p.ptr >= 0x10000) return error_asm("Writing outside memory"); else if(p.ptr < p.length) return error_asm("Writing rewind");