(uxn.c) Wrap RAM on LDA/STA
This commit is contained in:
parent
8e976310d3
commit
7dfcd2b579
|
@ -37,7 +37,7 @@ WITH REGARD TO THIS SOFTWARE.
|
||||||
int
|
int
|
||||||
uxn_eval(Uxn *u, Uint16 pc)
|
uxn_eval(Uxn *u, Uint16 pc)
|
||||||
{
|
{
|
||||||
int t, n, l, r;
|
Uint16 t, n, l, r;
|
||||||
Uint8 *ram = u->ram, *rr;
|
Uint8 *ram = u->ram, *rr;
|
||||||
if(!pc || u->dev[0x0f]) return 0;
|
if(!pc || u->dev[0x0f]) return 0;
|
||||||
for(;;) {
|
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 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 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 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 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 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 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;
|
case 0x17: /* DEO */ t=T;n=N; SET(2,-2) emu_deo(u, t, n); break;
|
||||||
|
|
|
@ -70,7 +70,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 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++]))
|
if(!system_init(&u, (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 */
|
||||||
|
|
|
@ -549,7 +549,7 @@ main(int argc, char **argv)
|
||||||
/* Read flag. Right now, there can be only one. */
|
/* Read flag. Right now, there can be only one. */
|
||||||
if(argv[i][0] == '-') {
|
if(argv[i][0] == '-') {
|
||||||
if(argv[i][1] == 'v')
|
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] == '-')
|
if(argv[i][1] == '-')
|
||||||
i++;
|
i++;
|
||||||
if(strcmp(argv[i], "-2x") == 0 || strcmp(argv[i], "-3x") == 0)
|
if(strcmp(argv[i], "-2x") == 0 || strcmp(argv[i], "-3x") == 0)
|
||||||
|
|
Loading…
Reference in New Issue