Ported to last uxn core

This commit is contained in:
Devine Lu Linvega 2023-02-02 09:34:14 -08:00
parent 4882bfc986
commit db4e07f5b1
3 changed files with 7 additions and 7 deletions

View File

@ -62,9 +62,9 @@ system_load(Uxn *u, char *filename)
FILE *f = fopen(filename, "rb"); FILE *f = fopen(filename, "rb");
if(!f) if(!f)
return 0; return 0;
l = fread(&u->ram[PAGE_PROGRAM], 1, 0x10000 - PAGE_PROGRAM, f); l = fread(&u->ram[PAGE_PROGRAM], 0x10000 - PAGE_PROGRAM, 1, f);
while(l && ++i < RAM_PAGES) while(l && ++i < RAM_PAGES)
l = fread(u->ram + 0x10000 * i, 1, 0x10000, f); l = fread(u->ram + 0x10000 * i, 0x10000, 1, f);
fclose(f); fclose(f);
return 1; return 1;
} }

View File

@ -75,7 +75,7 @@ uxn_eval(Uxn *u, Uint16 pc)
case 0x0f: /* STH */ POP(a) PUSH(dst, a) break; case 0x0f: /* STH */ POP(a) PUSH(dst, a) break;
case 0x10: /* LDZ */ POP8(a) PEEK(b, a) PUSH(src, b) break; case 0x10: /* LDZ */ POP8(a) PEEK(b, a) PUSH(src, b) break;
case 0x11: /* STZ */ POP8(a) POP(b) POKE(a, b) break; case 0x11: /* STZ */ POP8(a) POP(b) POKE(a, b) break;
case 0x12: /* LDR */ POP8(a) PEEK(b, pc + (Sint8)a) PUSH(src, b) break; case 0x12: /* LDR */ POP8(a) b = pc + (Sint8)a; PEEK(c, b) PUSH(src, c) break;
case 0x13: /* STR */ POP8(a) POP(b) c = pc + (Sint8)a; POKE(c, b) break; case 0x13: /* STR */ POP8(a) POP(b) c = pc + (Sint8)a; POKE(c, b) break;
case 0x14: /* LDA */ POP16(a) PEEK(b, a) PUSH(src, b) break; case 0x14: /* LDA */ POP16(a) PEEK(b, a) PUSH(src, b) break;
case 0x15: /* STA */ POP16(a) POP(b) POKE(a, b) break; case 0x15: /* STA */ POP16(a) POP(b) POKE(a, b) break;
@ -100,9 +100,9 @@ uxn_boot(Uxn *u, Uint8 *ram, Dei *dei, Deo *deo)
char *cptr = (char *)u; char *cptr = (char *)u;
for(i = 0; i < sizeof(*u); i++) for(i = 0; i < sizeof(*u); i++)
cptr[i] = 0x00; cptr[i] = 0x00;
u->wst = (Stack *)(ram + 0x10000); u->wst = (Stack *)(ram + 0xf0000);
u->rst = (Stack *)(ram + 0x10100); u->rst = (Stack *)(ram + 0xf0100);
u->dev = (Uint8 *)(ram + 0x10200); u->dev = (Uint8 *)(ram + 0xf0200);
u->ram = ram; u->ram = ram;
u->dei = dei; u->dei = dei;
u->deo = deo; u->deo = deo;

View File

@ -26,7 +26,7 @@ typedef unsigned int Uint32;
/* clang-format on */ /* clang-format on */
typedef struct { typedef struct {
Uint8 dat[254], err, ptr; Uint8 dat[255], ptr;
} Stack; } Stack;
typedef struct Uxn { typedef struct Uxn {