(uxnasm) Added support for partial label jsi

This commit is contained in:
Devine Lu Linvega 2024-02-25 16:06:54 -08:00
parent de4a534bf4
commit 202ca78800
2 changed files with 4 additions and 4 deletions

View File

@ -32,9 +32,9 @@
BRK BRK
&on-second ( -> ) &on-second ( -> )
[ LIT2 00 _&frame ] STR [ LIT2 00 _&frame ] STR
[ LIT2 ff &time $1 ] ADD DUP ?{ Timer/end } [ LIT2 ff &time $1 ] ADD DUP ?{ /end }
,&time STR ,&time STR
Timer/<draw> BRK /<draw> BRK
&start ( -- ) &start ( -- )
[ LIT2 0f _&time ] STR [ LIT2 0f _&time ] STR
[ LIT2 00 _&paused ] STR [ LIT2 00 _&paused ] STR

View File

@ -195,7 +195,7 @@ makereference(char *scope, char *label, char rune, Uint16 addr)
if(label[0] == '{') { if(label[0] == '{') {
p.lambda_stack[p.lambda_ptr++] = p.lambda_count; p.lambda_stack[p.lambda_ptr++] = p.lambda_count;
scpy(makelambda(p.lambda_count++), r->name, 0x40); scpy(makelambda(p.lambda_count++), r->name, 0x40);
} else if(label[0] == '&') { } else if(label[0] == '&' || label[0] == '/') {
if(!sublabel(subw, scope, label + 1)) if(!sublabel(subw, scope, label + 1))
return error("Invalid sublabel", label); return error("Invalid sublabel", label);
scpy(subw, r->name, 0x40); scpy(subw, r->name, 0x40);
@ -502,7 +502,7 @@ main(int argc, char *argv[])
if(argc == 1) if(argc == 1)
return error("usage", "uxnasm [-v] input.tal output.rom"); return error("usage", "uxnasm [-v] input.tal output.rom");
if(argv[1][0] == '-' && argv[1][1] == 'v') 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"))) if(!(src = fopen(argv[1], "r")))
return !error("Invalid input", argv[1]); return !error("Invalid input", argv[1]);
if(!assemble(src)) if(!assemble(src))