From a55b07e1db342096942f6248217d70707f658a0c Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sun, 25 Feb 2024 16:06:14 -0800 Subject: [PATCH] (uxnasm) Added support for partial label jsi --- etc/coverage.tal | 12 +++++++----- src/uxnasm.c | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/etc/coverage.tal b/etc/coverage.tal index a75fdf1..122c2a3 100644 --- a/etc/coverage.tal +++ b/etc/coverage.tal @@ -22,21 +22,23 @@ BRK -( +( @| test label inheritance ) -@object - -&x $1 &y $1 +@Object &x $1 &y $1 &get-x ( -- x ) ,&x LDR JMP2r -@object/get-y ( -- y ) +@Object/get-y ( -- y ) ,&y LDR JMP2r +@Object/get-both ( -- x y ) + /get-x /get-y + JMP2r + ( raw lambda length ) _{ 01 02 03 } diff --git a/src/uxnasm.c b/src/uxnasm.c index 2f7b8f7..e2a1a00 100644 --- a/src/uxnasm.c +++ b/src/uxnasm.c @@ -195,7 +195,7 @@ makereference(char *scope, char *label, char rune, Uint16 addr) if(label[0] == '{') { p.lambda_stack[p.lambda_ptr++] = p.lambda_count; scpy(makelambda(p.lambda_count++), r->name, 0x40); - } else if(label[0] == '&') { + } else if(label[0] == '&' || label[0] == '/') { if(!sublabel(subw, scope, label + 1)) return error("Invalid sublabel", label); scpy(subw, r->name, 0x40); @@ -321,7 +321,7 @@ parse(char *w, FILE *f) if(!makelabel(w + 1)) return error("Invalid label", w); i = 0; - while(w[i + 1] != '/' && i < 0x3e && (p.scope[i] = w[i + 1])) + while(w[i + 1] != '/' && i < 0x3e && (p.scope[i] = w[i + 1])) i++; p.scope[i] = '\0'; break; @@ -502,7 +502,7 @@ main(int argc, char *argv[]) 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"); + return !fprintf(stdout, "Uxnasm - Uxntal Assembler, 25 Feb 2024.\n"); if(!(src = fopen(argv[1], "r"))) return !error("Invalid input", argv[1]); if(!assemble(src))