diff --git a/src/uxnasm.c b/src/uxnasm.c index b555787..ff51414 100644 --- a/src/uxnasm.c +++ b/src/uxnasm.c @@ -44,8 +44,6 @@ typedef struct { } Program; Program p; -static int litlast = 0; -static int jsrlast = 0; /* clang-format off */ @@ -207,8 +205,6 @@ writebyte(Uint8 b) return error("Memory overwrite", ""); p.data[p.ptr++] = b; p.length = p.ptr; - litlast = 0; - jsrlast = 0; return 1; } @@ -217,8 +213,6 @@ writeopcode(char *w) { Uint8 res; res = writebyte(findopcode(w)); - if(scmp(w, "JSR2", 4)) - jsrlast = 1; return res; } @@ -233,15 +227,8 @@ writeshort(Uint16 s, int lit) static int writelitbyte(Uint8 b) { - if(litlast) { /* literals optimization */ - Uint8 hb = p.data[p.ptr - 1]; - p.ptr -= 2; - p.length = p.ptr; - return writeshort((hb << 8) + b, 1); - } if(!writebyte(findopcode("LIT"))) return 0; if(!writebyte(b)) return 0; - litlast = 1; return 1; } @@ -292,24 +279,20 @@ parse(char *w, FILE *f) if(!sihx(w + 1)) return error("Invalid padding", w); p.ptr = shex(w + 1); - litlast = jsrlast = 0; break; case '$': /* pad-relative */ if(!sihx(w + 1)) return error("Invalid padding", w); p.ptr += shex(w + 1); - litlast = jsrlast = 0; break; case '@': /* label */ if(!makelabel(w + 1)) return error("Invalid label", w); scpy(w + 1, p.scope, 0x40); - litlast = jsrlast = 0; break; case '&': /* sublabel */ if(!makelabel(sublabel(subw, p.scope, w + 1))) return error("Invalid sublabel", w); - litlast = jsrlast = 0; break; case '#': /* literals hex */ if(!sihx(w + 1) || (slen(w) != 3 && slen(w) != 5)) @@ -321,11 +304,11 @@ parse(char *w, FILE *f) } break; case '.': /* literal byte zero-page */ - makereference(p.scope, w, p.ptr - litlast); + makereference(p.scope, w, p.ptr); if(!writelitbyte(0xff)) return 0; break; case ',': /* literal byte relative */ - makereference(p.scope, w, p.ptr - litlast); + makereference(p.scope, w, p.ptr); if(!writelitbyte(0xff)) return 0; break; case ';': /* literal short absolute */