From 83de614e532e2bb7d9d418e15832265c1d81b08b Mon Sep 17 00:00:00 2001 From: neauoire Date: Sat, 28 Aug 2021 10:30:50 -0700 Subject: [PATCH] Do no display unused macros anymore --- etc/tal.sublime-syntax | 12 ++++++++---- src/uxnasm.c | 8 ++------ src/uxnemu.c | 9 +-------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/etc/tal.sublime-syntax b/etc/tal.sublime-syntax index d5ef00f..8a7cd97 100644 --- a/etc/tal.sublime-syntax +++ b/etc/tal.sublime-syntax @@ -31,10 +31,10 @@ contexts: scope: entity.name.type.typedef pop: true - match: '\;(\S+)\sLDA2' - scope: constant.numeric + scope: entity.name.type.typedef pop: true - match: '\;(\S+)\sLDA' - scope: constant.numeric + scope: entity.name.type.typedef pop: true # set - match: '\.(\S+)\sDEO2' @@ -56,10 +56,10 @@ contexts: scope: constant.numeric pop: true - match: '\;(\S+)\sSTA2' - scope: entity.name.type.typedef + scope: constant.numeric pop: true - match: '\;(\S+)\sSTA' - scope: entity.name.type.typedef + scope: constant.numeric pop: true # label @@ -70,6 +70,10 @@ contexts: - match: '\&(\S+)\s?' scope: string.control pop: true + # include + - match: 'include' + scope: string.control + pop: true # jump - match: '\|(\S+)\s?' diff --git a/src/uxnasm.c b/src/uxnasm.c index 8a10e80..a64953e 100644 --- a/src/uxnasm.c +++ b/src/uxnasm.c @@ -20,7 +20,6 @@ typedef unsigned short Uint16; typedef struct { char name[64], items[256][64]; Uint8 len; - Uint16 refs; } Macro; typedef struct { @@ -154,7 +153,7 @@ makemacro(char *name, FILE *f) return error("Macro duplicate", name); if(sihx(name) && slen(name) % 2 == 0) return error("Macro name is hex number", name); - if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name)) + if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name) || scmp(name,"include",8)) return error("Macro name is invalid", name); m = &p.macros[p.mlen++]; scpy(name, m->name, 64); @@ -280,7 +279,7 @@ parsetoken(char *w) for(i = 0; i < m->len; ++i) if(!parsetoken(m->items[i])) return error("Invalid macro", m->name); - return ++m->refs; + return 1; } return error("Invalid token", w); } @@ -380,9 +379,6 @@ cleanup(char *filename) continue; /* Ignore capitalized labels(devices) */ else if(!p.labels[i].refs) fprintf(stderr, "--- Unused label: %s\n", p.labels[i].name); - for(i = 0; i < p.mlen; ++i) - if(!p.macros[i].refs) - fprintf(stderr, "--- Unused macro: %s\n", p.macros[i].name); printf("Assembled %s(%d bytes), %d labels, %d macros.\n", filename, (p.length - TRIM), p.llen, p.mlen); } diff --git a/src/uxnemu.c b/src/uxnemu.c index 4c8f892..4d501ba 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -112,14 +112,7 @@ redraw(Uxn *u) { if(devsystem->dat[0xe]) inspect(&ppu, u->wst.dat, u->wst.ptr, u->rst.ptr, u->ram.dat); - if(rgbaSurface == NULL) - SDL_BlitScaled(idxSurface, NULL, winSurface, &gRect); - else if(zoom == 1) - SDL_BlitSurface(idxSurface, NULL, winSurface, &gRect); - else { - SDL_BlitSurface(idxSurface, NULL, rgbaSurface, NULL); - SDL_BlitScaled(rgbaSurface, NULL, winSurface, &gRect); - } + SDL_BlitSurface(idxSurface, NULL, winSurface, &gRect); SDL_UpdateWindowSurface(gWindow); reqdraw = 0; }