From b7d80643e85efa944f900f4b5fce2a1d6f138e19 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sat, 13 Apr 2024 19:31:09 -0700 Subject: [PATCH] Fix non-ASCII bytes being detected as whitespace --- src/uxnasm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/uxnasm.c b/src/uxnasm.c index c036c97..762b9a9 100644 --- a/src/uxnasm.c +++ b/src/uxnasm.c @@ -122,7 +122,8 @@ walkcomment(FILE *f, Context *ctx) static int walkmacro(Item *m, Context *ctx) { - char c, *dataptr = m->data, *cptr = token; + unsigned char c; + char *dataptr = m->data, *cptr = token; while((c = *dataptr++)) { if(c < 0x21) { *cptr++ = 0x00; @@ -137,7 +138,8 @@ walkmacro(Item *m, Context *ctx) static int walkfile(FILE *f, Context *ctx) { - char c, *cptr = token; + unsigned char c; + char *cptr = token; while(f && fread(&c, 1, 1, f)) { if(c < 0x21) { *cptr++ = 0x00; @@ -407,7 +409,7 @@ main(int argc, char *argv[]) { ptr = PAGE; copy("on-reset", scope, 0); - if(argc == 2 && scmp(argv[1], "-v", 2)) return !printf("Uxnasm - Uxntal Assembler, 3 Apr 2024.\n"); + if(argc == 2 && scmp(argv[1], "-v", 2)) return !printf("Uxnasm - Uxntal Assembler, 13 Apr 2024.\n"); if(argc != 3) return error_top("usage", "uxnasm [-v] input.tal output.rom"); if(!assemble(argv[1])) return 1; if(!resolve(argv[2])) return 1;