From 7dfcd2b57962248fcfe9f79e0ebf12d964851a16 Mon Sep 17 00:00:00 2001 From: neauoire Date: Wed, 1 Nov 2023 09:25:39 -0700 Subject: [PATCH] (uxn.c) Wrap RAM on LDA/STA --- src/uxn.c | 6 +++--- src/uxncli.c | 2 +- src/uxnemu.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uxn.c b/src/uxn.c index ad8448b..bd1bc75 100644 --- a/src/uxn.c +++ b/src/uxn.c @@ -37,7 +37,7 @@ WITH REGARD TO THIS SOFTWARE. int uxn_eval(Uxn *u, Uint16 pc) { - int t, n, l, r; + Uint16 t, n, l, r; Uint8 *ram = u->ram, *rr; if(!pc || u->dev[0x0f]) return 0; for(;;) { @@ -91,9 +91,9 @@ uxn_eval(Uxn *u, Uint16 pc) 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 0x14: /* LDA */ t=T2; SET(2,-1) T = ram[t]; break; - case 0x34: /* LDA2 */ t=T2; SET(2, 0) rr = ram + t; T2_(PEEK2(rr)) 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; - case 0x35: /* STA2 */ t=T2;n=N2; SET(4,-4) rr = ram + t; POKE2(rr, n) break; + case 0x35: /* STA2 */ t=T2;n=N2; SET(4,-4) ram[t++] = n >> 8; ram[t] = n; break; case 0x16: /* DEI */ t=T; SET(1, 0) T = emu_dei(u, t); break; case 0x36: /* DEI2 */ t=T; SET(1, 1) N = emu_dei(u, t); T = emu_dei(u, t + 1); break; case 0x17: /* DEO */ t=T;n=N; SET(2,-2) emu_deo(u, t, n); break; diff --git a/src/uxncli.c b/src/uxncli.c index 82d42f3..aaab438 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -70,7 +70,7 @@ main(int argc, char **argv) return system_error("usage", "uxncli [-v] file.rom [args..]"); /* Read flags */ if(argv[i][0] == '-' && argv[i][1] == 'v') - return system_version("Uxncli - Console Varvara Emulator", "31 Oct 2023"); + return system_version("Uxncli - Console Varvara Emulator", "1 Nov 2023"); if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++])) return system_error("Init", "Failed to initialize uxn."); /* Game Loop */ diff --git a/src/uxnemu.c b/src/uxnemu.c index 97a9b03..01df3da 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -549,7 +549,7 @@ main(int argc, char **argv) /* Read flag. Right now, there can be only one. */ if(argv[i][0] == '-') { if(argv[i][1] == 'v') - return system_version("Uxnemu - Graphical Varvara Emulator", "31 Oct 2023"); + return system_version("Uxnemu - Graphical Varvara Emulator", "1 Nov 2023"); if(argv[i][1] == '-') i++; if(strcmp(argv[i], "-2x") == 0 || strcmp(argv[i], "-3x") == 0)