(uxn.c) Use small registers for SWP/DUP

This commit is contained in:
Devine Lu Linvega 2024-07-01 13:21:31 -08:00
parent 3b880b83cf
commit 3276f03ffe
3 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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++];

View File

@ -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 */