From 3276f03ffe6db7b4a55efe03fdef3a6357e4c004 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 1 Jul 2024 13:21:31 -0800 Subject: [PATCH] (uxn.c) Use small registers for SWP/DUP --- src/uxn.c | 6 +++--- src/uxn11.c | 2 +- src/uxncli.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uxn.c b/src/uxn.c index 86446ad..2421b9c 100644 --- a/src/uxn.c +++ b/src/uxn.c @@ -36,7 +36,7 @@ WITH REGARD TO THIS SOFTWARE. int uxn_eval(Uint16 pc) { - Uint16 t, n, l, r; + Uint16 t, n, l, x, r; Uint8 *rr; if(!pc || uxn.dev[0x0f]) return 0; for(;;) { @@ -51,11 +51,11 @@ uxn_eval(Uint16 pc) case 0x03: /* NIP */ t=T; SET(2,-1) T = t; break; case 0x23: /* NIP2 */ t=T,n=N; SET(4,-2) T = t, N = n; break; case 0x04: /* SWP */ t=T;n=N; SET(2, 0) T = n, N = t; break; - case 0x24: /* SWP2 */ t=T2,n=N2; SET(4, 0) T2_(n) N2_(t) break; + case 0x24: /* SWP2 */ t=T,n=N,l=L,x=X;SET(4, 0) T = l, N = x, L = t, X = n; break; case 0x05: /* ROT */ t=T,n=N,l=L; SET(3, 0) T = l, N = t, L = n; break; case 0x25: /* ROT2 */ t=T2,n=N2,l=L2; SET(6, 0) T2_(l) N2_(t) L2_(n) break; case 0x06: /* DUP */ t=T; SET(1, 1) T = t, N = t; break; - case 0x26: /* DUP2 */ t=T2; SET(2, 2) T2_(t) N2_(t) break; + case 0x26: /* DUP2 */ t=T,n=N; SET(2, 2) T = t, N = n, L = t, X = n; break; case 0x07: /* OVR */ t=T,n=N; SET(2, 1) T = n, N = t, L = n; break; case 0x27: /* OVR2 */ t=T2,n=N2; SET(4, 2) T2_(n) N2_(t) L2_(n) break; case 0x08: /* EQU */ t=T,n=N; SET(2,-1) T = n == t; break; diff --git a/src/uxn11.c b/src/uxn11.c index bb1d95b..594b3ea 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -271,7 +271,7 @@ main(int argc, char **argv) int i = 1; char *rom; if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') { - fprintf(stdout, "Uxn11 - Varvara Emulator, 30 Jun 2024.\n"); + fprintf(stdout, "Uxn11 - Varvara Emulator, 1 Jul 2024.\n"); i++; } rom = i == argc ? "boot.rom" : argv[i++]; diff --git a/src/uxncli.c b/src/uxncli.c index 1cdf2de..fd451ac 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -51,7 +51,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 !printf("Uxncli - Console Varvara Emulator, 30 Jun 2024\n"); + return !printf("Uxncli - Console Varvara Emulator, 1 Jul 2024\n"); if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++])) return system_error("Init", "Failed to initialize uxn."); /* Game Loop */