(uxnasm)Passing uxntal scope requirements

This commit is contained in:
Devine Lu Linvega 2024-02-24 08:49:32 -08:00
parent 4765924b37
commit 0dffbf6c0e
2 changed files with 8 additions and 7 deletions

View File

@ -320,7 +320,10 @@ parse(char *w, FILE *f)
case '@': /* label */ case '@': /* label */
if(!makelabel(w + 1)) if(!makelabel(w + 1))
return error("Invalid label", w); 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; break;
case '&': /* sublabel */ case '&': /* sublabel */
if(!sublabel(subw, p.scope, w + 1) || !makelabel(subw)) if(!sublabel(subw, p.scope, w + 1) || !makelabel(subw))
@ -346,7 +349,6 @@ parse(char *w, FILE *f)
case '.': /* literal byte zero-page */ case '.': /* literal byte zero-page */
makereference(p.scope, w + 1, w[0], p.ptr + 1); makereference(p.scope, w + 1, w[0], p.ptr + 1);
return writelitbyte(0xff); return writelitbyte(0xff);
case ':':
case '=': /* raw short absolute */ case '=': /* raw short absolute */
makereference(p.scope, w + 1, w[0], p.ptr); makereference(p.scope, w + 1, w[0], p.ptr);
return writeshort(0xffff, 0); return writeshort(0xffff, 0);
@ -420,7 +422,6 @@ resolve(void)
p.data[r->addr] = l->addr & 0xff; p.data[r->addr] = l->addr & 0xff;
l->refs++; l->refs++;
break; break;
case ':':
case '=': case '=':
case ';': case ';':
if(!(l = findlabel(r->name))) if(!(l = findlabel(r->name)))
@ -498,10 +499,10 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
FILE *src, *dst; FILE *src, *dst;
if(argc == 2 && argv[1][0] == '-' && argv[1][1] == 'v') if(argc == 1)
return !fprintf(stdout, "Uxnasm - Uxntal Assembler, 27 Oct 2023.\n");
if(argc != 3)
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')
return !fprintf(stdout, "Uxnasm - Uxntal Assembler, 24 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))

0
src/uxnemu.c Executable file → Normal file
View File