Faster imm opcodes
This commit is contained in:
parent
9d0803e99f
commit
e379cfa2ad
19
src/uxn.c
19
src/uxn.c
|
@ -47,12 +47,19 @@ uxn_eval(Uint16 pc)
|
||||||
/* IMM */
|
/* IMM */
|
||||||
case 0x00: case 0x20:
|
case 0x00: case 0x20:
|
||||||
switch(ins) {
|
switch(ins) {
|
||||||
case 0x00: /* BRK */ return 1;
|
case 0x00: /* BRK */ return 1;
|
||||||
case 0x20: /* JCI */ t=T; SHIFT(-1) if(!t) { pc += 2; break; } /* fall-through */
|
case 0x20: /* JCI */ if(!uxn.wst.dat[uxn.wst.ptr--]) { pc += 2; break; } /* fall-through */
|
||||||
case 0x40: /* JMI */ rr = uxn.ram + pc; pc += 2 + PEEK2(rr); break;
|
case 0x40: /* JMI */ rr = uxn.ram + pc; pc += 2 + PEEK2(rr); break;
|
||||||
case 0x60: /* JSI */ SHIFT( 2) rr = uxn.ram + pc; pc += 2; T2_(pc); pc += PEEK2(rr); break;
|
case 0x60: /* JSI */ uxn.rst.ptr += 2;
|
||||||
case 0x80: /* LIT */ case 0xc0: SHIFT( 1) T = uxn.ram[pc++]; break;
|
rr = uxn.ram + pc;
|
||||||
case 0xa0: /* LIT2 */ case 0xe0: SHIFT( 2) N = uxn.ram[pc++]; T = uxn.ram[pc++]; break;
|
pc += 2; r = pc;
|
||||||
|
uxn.rst.dat[uxn.rst.ptr] = pc;
|
||||||
|
uxn.rst.dat[(Uint8)(uxn.rst.ptr - 1)] = pc >> 8;
|
||||||
|
pc += PEEK2(rr); break;
|
||||||
|
case 0xa0: /* LIT2 */ uxn.wst.dat[++uxn.wst.ptr] = uxn.ram[pc++]; /* fall-through */
|
||||||
|
case 0x80: /* LIT */ uxn.wst.dat[++uxn.wst.ptr] = uxn.ram[pc++]; break;
|
||||||
|
case 0xe0: /* LIT2r */ uxn.rst.dat[++uxn.rst.ptr] = uxn.ram[pc++]; /* fall-through */
|
||||||
|
case 0xc0: /* LITr */ uxn.rst.dat[++uxn.rst.ptr] = uxn.ram[pc++]; break;
|
||||||
} break;
|
} break;
|
||||||
/* ALU */
|
/* ALU */
|
||||||
case 0x01: /* INC */ t=T; SET(1, 0) T = t + 1; break;
|
case 0x01: /* INC */ t=T; SET(1, 0) T = t + 1; break;
|
||||||
|
|
|
@ -272,7 +272,7 @@ main(int argc, char **argv)
|
||||||
int i = 1;
|
int i = 1;
|
||||||
char *rom;
|
char *rom;
|
||||||
if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
|
if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
|
||||||
fprintf(stdout, "Uxn11 - Varvara Emulator, 29 Jun 2024.\n");
|
fprintf(stdout, "Uxn11 - Varvara Emulator, 30 Jun 2024.\n");
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
rom = i == argc ? "boot.rom" : argv[i++];
|
rom = i == argc ? "boot.rom" : argv[i++];
|
||||||
|
|
|
@ -72,7 +72,7 @@ main(int argc, char **argv)
|
||||||
return system_error("usage", "uxncli [-v] file.rom [args..]");
|
return system_error("usage", "uxncli [-v] file.rom [args..]");
|
||||||
/* Read flags */
|
/* Read flags */
|
||||||
if(argv[i][0] == '-' && argv[i][1] == 'v')
|
if(argv[i][0] == '-' && argv[i][1] == 'v')
|
||||||
return !printf("Uxncli - Console Varvara Emulator, 29 Jun 2024\n");
|
return !printf("Uxncli - Console Varvara Emulator, 30 Jun 2024\n");
|
||||||
if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
|
if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
|
||||||
return system_error("Init", "Failed to initialize uxn.");
|
return system_error("Init", "Failed to initialize uxn.");
|
||||||
/* Game Loop */
|
/* Game Loop */
|
||||||
|
|
Loading…
Reference in New Issue