Browse code

(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.

Andrew Alderwick authored on 07/06/2022 19:03:12
Showing 1 changed files
... ...
@@ -299,24 +299,24 @@ parse(char *w, FILE *f)
299 299
 		if(!sihx(w + 1))
300 300
 			return error("Invalid padding", w);
301 301
 		p.ptr = shex(w + 1);
302
-		litlast = 0;
302
+		litlast = jsrlast = 0;
303 303
 		break;
304 304
 	case '$': /* pad-relative */
305 305
 		if(!sihx(w + 1))
306 306
 			return error("Invalid padding", w);
307 307
 		p.ptr += shex(w + 1);
308
-		litlast = 0;
308
+		litlast = jsrlast = 0;
309 309
 		break;
310 310
 	case '@': /* label */
311 311
 		if(!makelabel(w + 1))
312 312
 			return error("Invalid label", w);
313 313
 		scpy(w + 1, p.scope, 0x40);
314
-		litlast = 0;
314
+		litlast = jsrlast = 0;
315 315
 		break;
316 316
 	case '&': /* sublabel */
317 317
 		if(!makelabel(sublabel(subw, p.scope, w + 1)))
318 318
 			return error("Invalid sublabel", w);
319
-		litlast = 0;
319
+		litlast = jsrlast = 0;
320 320
 		break;
321 321
 	case '#': /* literals hex */
322 322
 		if(!sihx(w + 1) || (slen(w) != 3 && slen(w) != 5))