From 978713474a57506fcbaba760e5739d562086f3e1 Mon Sep 17 00:00:00 2001 From: Andrew Alderwick Date: Tue, 7 Jun 2022 20:03:12 +0100 Subject: [PATCH] (uxnasm) Prevent tail call optimisation when required, fixes asma Literals do not get squashed across absolute or relative pads and labels, now the tail call optimisations do not occur under the same conditions. etc/asma-test.tal was identifying serious errors with asma.rom, which uses "JSR2 &skip JMP2r" in @asma-macro-body. --- src/uxnasm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uxnasm.c b/src/uxnasm.c index e2f188d..03cc333 100644 --- a/src/uxnasm.c +++ b/src/uxnasm.c @@ -299,24 +299,24 @@ parse(char *w, FILE *f) if(!sihx(w + 1)) return error("Invalid padding", w); p.ptr = shex(w + 1); - litlast = 0; + litlast = jsrlast = 0; break; case '$': /* pad-relative */ if(!sihx(w + 1)) return error("Invalid padding", w); p.ptr += shex(w + 1); - litlast = 0; + litlast = jsrlast = 0; break; case '@': /* label */ if(!makelabel(w + 1)) return error("Invalid label", w); scpy(w + 1, p.scope, 0x40); - litlast = 0; + litlast = jsrlast = 0; break; case '&': /* sublabel */ if(!makelabel(sublabel(subw, p.scope, w + 1))) return error("Invalid sublabel", w); - litlast = 0; + litlast = jsrlast = 0; break; case '#': /* literals hex */ if(!sihx(w + 1) || (slen(w) != 3 && slen(w) != 5))