(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 */
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))

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

@ -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 */
}