diff --git a/src/uxn.c b/src/uxn.c index 5357f8e..378314a 100644 --- a/src/uxn.c +++ b/src/uxn.c @@ -47,12 +47,19 @@ uxn_eval(Uint16 pc) /* IMM */ case 0x00: case 0x20: switch(ins) { - case 0x00: /* BRK */ return 1; - case 0x20: /* JCI */ t=T; SHIFT(-1) if(!t) { pc += 2; break; } /* fall-through */ - 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 0x80: /* LIT */ case 0xc0: SHIFT( 1) T = uxn.ram[pc++]; break; - case 0xa0: /* LIT2 */ case 0xe0: SHIFT( 2) N = uxn.ram[pc++]; T = uxn.ram[pc++]; break; + case 0x00: /* BRK */ return 1; + 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 0x60: /* JSI */ uxn.rst.ptr += 2; + rr = uxn.ram + pc; + 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; /* ALU */ case 0x01: /* INC */ t=T; SET(1, 0) T = t + 1; break; diff --git a/src/uxn11.c b/src/uxn11.c index d4417b3..aecf100 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -272,7 +272,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, 29 Jun 2024.\n"); + fprintf(stdout, "Uxn11 - Varvara Emulator, 30 Jun 2024.\n"); i++; } rom = i == argc ? "boot.rom" : argv[i++]; diff --git a/src/uxncli.c b/src/uxncli.c index 9fb8377..85cc05c 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -72,7 +72,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, 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++])) return system_error("Init", "Failed to initialize uxn."); /* Game Loop */