diff --git a/src/uxn.c b/src/uxn.c index 7778aef..c3a7f1a 100644 --- a/src/uxn.c +++ b/src/uxn.c @@ -108,7 +108,7 @@ err: /* clang-format on */ int -uxn_boot(Uxn *u, Stack *wst, Stack *rst, Uint8 *memory) +uxn_boot(Uxn *u, Uint8 *ram, Uint8 *dev, Stack *wst, Stack *rst) { Uint32 i; char *cptr = (char *)u; @@ -116,7 +116,7 @@ uxn_boot(Uxn *u, Stack *wst, Stack *rst, Uint8 *memory) cptr[i] = 0x00; u->wst = wst; u->rst = rst; - u->ram = memory; + u->ram = ram; return 1; } diff --git a/src/uxn.h b/src/uxn.h index 2359c47..3be5990 100644 --- a/src/uxn.h +++ b/src/uxn.h @@ -16,6 +16,7 @@ typedef signed short Sint16; typedef unsigned int Uint32; #define PAGE_PROGRAM 0x0100 +#define PAGE_DEV 0xfd00 #define PAGE_WST 0xfe00 #define PAGE_RST 0xff00 @@ -45,7 +46,7 @@ typedef struct Uxn { Device dev[16]; } Uxn; -int uxn_boot(Uxn *u, Stack *wst, Stack *rst, Uint8 *memory); +int uxn_boot(Uxn *u, Uint8 *ram, Uint8 *dev, Stack *wst, Stack *rst); int uxn_eval(Uxn *u, Uint16 pc); int uxn_halt(Uxn *u, Uint8 error, Uint16 addr); Device *uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *, Uint8), void (*deofn)(Device *, Uint8)); diff --git a/src/uxncli.c b/src/uxncli.c index 8966ea4..ff82b69 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -143,7 +143,7 @@ main(int argc, char **argv) shadow = (Uint8 *)calloc(0xffff, sizeof(Uint8)); memory = (Uint8 *)calloc(0xffff, sizeof(Uint8)); - if(!uxn_boot(&u, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST), memory)) + if(!uxn_boot(&u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST))) return error("Boot", "Failed"); /* system */ devsystem = uxn_port(&u, 0x0, system_dei, system_deo); diff --git a/src/uxnemu.c b/src/uxnemu.c index 40881d2..f50dce3 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -278,9 +278,9 @@ start(Uxn *u, char *rom) memory = (Uint8 *)calloc(0xffff, sizeof(Uint8)); shadow = (Uint8 *)calloc(0xffff, sizeof(Uint8)); - if(!uxn_boot(&hypervisor, (Stack *)(shadow + 0xfc00), (Stack *)(shadow + 0xfd00), shadow)) + if(!uxn_boot(&hypervisor, shadow, shadow + PAGE_DEV, (Stack *)(shadow + 0xfb00), (Stack *)(shadow + 0xfc00))) return error("Boot", "Failed to start uxn."); - if(!uxn_boot(u, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST), memory)) + if(!uxn_boot(u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST))) return error("Boot", "Failed to start uxn."); if(!load(&hypervisor, "hypervisor.rom")) error("Hypervisor", "No debugger found.");