From 5c79d2813ad79c7f44862a196d0515ef8244bfc0 Mon Sep 17 00:00:00 2001 From: neauoire Date: Wed, 1 Nov 2023 09:54:57 -0700 Subject: [PATCH] (uxn.c) Wrap zero-page --- src/uxn.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uxn.c b/src/uxn.c index 12c8b38..1207994 100644 --- a/src/uxn.c +++ b/src/uxn.c @@ -83,13 +83,13 @@ uxn_eval(Uxn *u, Uint16 pc) case 0x0f: /* STH */ t=T; SET(1,-1) FLIP SHIFT(1) T = t; break; case 0x2f: /* STH2 */ t=T2; SET(2,-2) FLIP SHIFT(2) T2_(t) break; case 0x10: /* LDZ */ t=T; SET(1, 0) T = ram[t]; break; - case 0x30: /* LDZ2 */ t=T; SET(1, 1) N = ram[t++]; T = ram[t]; break; + case 0x30: /* LDZ2 */ t=T; SET(1, 1) N = ram[t++]; T = ram[(Uint8)t]; break; case 0x11: /* STZ */ t=T;n=N; SET(2,-2) ram[t] = n; break; - case 0x31: /* STZ2 */ t=T;n=H2; SET(3,-3) ram[t++] = n >> 8; ram[t] = n; break; - case 0x12: /* LDR */ t=T; SET(1, 0) T = ram[pc + (Sint8)t]; break; - case 0x32: /* LDR2 */ t=T; SET(1, 1) rr = ram + pc + (Sint8)t; T2_(PEEK2(rr)) break; - case 0x13: /* STR */ t=T;n=N; SET(2,-2) ram[pc + (Sint8)t] = n; break; - case 0x33: /* STR2 */ t=T;n=H2; SET(3,-3) rr = ram + pc + (Sint8)t; POKE2(rr, n) break; + case 0x31: /* STZ2 */ t=T;n=H2; SET(3,-3) ram[t++] = n >> 8; ram[(Uint8)t] = n; break; + case 0x12: /* LDR */ t=T; SET(1, 0) r = pc + (Sint8)t; T = ram[r]; break; + case 0x32: /* LDR2 */ t=T; SET(1, 1) r = pc + (Sint8)t; N = ram[r++]; T = ram[r]; break; + case 0x13: /* STR */ t=T;n=N; SET(2,-2) r = pc + (Sint8)t; ram[r] = n; break; + case 0x33: /* STR2 */ t=T;n=H2; SET(3,-3) r = pc + (Sint8)t; ram[r++] = n >> 8; ram[r] = n; break; case 0x14: /* LDA */ t=T2; SET(2,-1) T = ram[t]; break; case 0x34: /* LDA2 */ t=T2; SET(2, 0) N = ram[t++]; T = ram[t]; break; case 0x15: /* STA */ t=T2;n=L; SET(3,-3) ram[t] = n; break;