uxn

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

commit 0dffbf6c0e42882e2dbeb77e24fdd46ea88d8468
parent 4765924b374cacd2e1d4ddbaa7b8edaad0889056
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Sat, 24 Feb 2024 08:49:32 -0800

(uxnasm)Passing uxntal scope requirements

Diffstat:
Msrc/uxnasm.c | 13+++++++------
Msrc/uxnemu.c | 2+-
2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/uxnasm.c b/src/uxnasm.c @@ -320,7 +320,10 @@ parse(char *w, FILE *f) case '@': /* label */ if(!makelabel(w + 1)) return error("Invalid label", w); - scpy(w + 1, p.scope, 0x40); + i = 0; + while(w[i + 1] != '/' && i < 0x3e && (p.scope[i] = w[i + 1])) + i++; + p.scope[i] = '\0'; break; case '&': /* sublabel */ if(!sublabel(subw, p.scope, w + 1) || !makelabel(subw)) @@ -346,7 +349,6 @@ parse(char *w, FILE *f) case '.': /* literal byte zero-page */ makereference(p.scope, w + 1, w[0], p.ptr + 1); return writelitbyte(0xff); - case ':': case '=': /* raw short absolute */ makereference(p.scope, w + 1, w[0], p.ptr); return writeshort(0xffff, 0); @@ -420,7 +422,6 @@ resolve(void) p.data[r->addr] = l->addr & 0xff; l->refs++; break; - case ':': case '=': case ';': if(!(l = findlabel(r->name))) @@ -498,10 +499,10 @@ int main(int argc, char *argv[]) { FILE *src, *dst; - if(argc == 2 && argv[1][0] == '-' && argv[1][1] == 'v') - return !fprintf(stdout, "Uxnasm - Uxntal Assembler, 27 Oct 2023.\n"); - if(argc != 3) + if(argc == 1) return error("usage", "uxnasm [-v] input.tal output.rom"); + if(argv[1][0] == '-' && argv[1][1] == 'v') + return !fprintf(stdout, "Uxnasm - Uxntal Assembler, 24 Feb 2024.\n"); if(!(src = fopen(argv[1], "r"))) return !error("Invalid input", argv[1]); if(!assemble(src)) diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -131,7 +131,7 @@ stdin_handler(void *p) SDL_Event event; USED(p); event.type = stdin_event; - while(read(0, &event.cbutton.button, 1) > 0){ + while(read(0, &event.cbutton.button, 1) > 0) { while(SDL_PushEvent(&event) < 0) SDL_Delay(25); /* slow down - the queue is most likely full */ }