| ... | ... |
@@ -108,7 +108,7 @@ err: |
| 108 | 108 |
/* clang-format on */ |
| 109 | 109 |
|
| 110 | 110 |
int |
| 111 |
-uxn_boot(Uxn *u, Stack *wst, Stack *rst, Uint8 *memory) |
|
| 111 |
+uxn_boot(Uxn *u, Uint8 *ram, Uint8 *dev, Stack *wst, Stack *rst) |
|
| 112 | 112 |
{
|
| 113 | 113 |
Uint32 i; |
| 114 | 114 |
char *cptr = (char *)u; |
| ... | ... |
@@ -116,7 +116,7 @@ uxn_boot(Uxn *u, Stack *wst, Stack *rst, Uint8 *memory) |
| 116 | 116 |
cptr[i] = 0x00; |
| 117 | 117 |
u->wst = wst; |
| 118 | 118 |
u->rst = rst; |
| 119 |
- u->ram = memory; |
|
| 119 |
+ u->ram = ram; |
|
| 120 | 120 |
return 1; |
| 121 | 121 |
} |
| 122 | 122 |
|
| ... | ... |
@@ -16,6 +16,7 @@ typedef signed short Sint16; |
| 16 | 16 |
typedef unsigned int Uint32; |
| 17 | 17 |
|
| 18 | 18 |
#define PAGE_PROGRAM 0x0100 |
| 19 |
+#define PAGE_DEV 0xfd00 |
|
| 19 | 20 |
#define PAGE_WST 0xfe00 |
| 20 | 21 |
#define PAGE_RST 0xff00 |
| 21 | 22 |
|
| ... | ... |
@@ -45,7 +46,7 @@ typedef struct Uxn {
|
| 45 | 46 |
Device dev[16]; |
| 46 | 47 |
} Uxn; |
| 47 | 48 |
|
| 48 |
-int uxn_boot(Uxn *u, Stack *wst, Stack *rst, Uint8 *memory); |
|
| 49 |
+int uxn_boot(Uxn *u, Uint8 *ram, Uint8 *dev, Stack *wst, Stack *rst); |
|
| 49 | 50 |
int uxn_eval(Uxn *u, Uint16 pc); |
| 50 | 51 |
int uxn_halt(Uxn *u, Uint8 error, Uint16 addr); |
| 51 | 52 |
Device *uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *, Uint8), void (*deofn)(Device *, Uint8)); |
| ... | ... |
@@ -143,7 +143,7 @@ main(int argc, char **argv) |
| 143 | 143 |
|
| 144 | 144 |
shadow = (Uint8 *)calloc(0xffff, sizeof(Uint8)); |
| 145 | 145 |
memory = (Uint8 *)calloc(0xffff, sizeof(Uint8)); |
| 146 |
- if(!uxn_boot(&u, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST), memory)) |
|
| 146 |
+ if(!uxn_boot(&u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST))) |
|
| 147 | 147 |
return error("Boot", "Failed");
|
| 148 | 148 |
|
| 149 | 149 |
/* system */ devsystem = uxn_port(&u, 0x0, system_dei, system_deo); |
| ... | ... |
@@ -278,9 +278,9 @@ start(Uxn *u, char *rom) |
| 278 | 278 |
memory = (Uint8 *)calloc(0xffff, sizeof(Uint8)); |
| 279 | 279 |
shadow = (Uint8 *)calloc(0xffff, sizeof(Uint8)); |
| 280 | 280 |
|
| 281 |
- if(!uxn_boot(&hypervisor, (Stack *)(shadow + 0xfc00), (Stack *)(shadow + 0xfd00), shadow)) |
|
| 281 |
+ if(!uxn_boot(&hypervisor, shadow, shadow + PAGE_DEV, (Stack *)(shadow + 0xfb00), (Stack *)(shadow + 0xfc00))) |
|
| 282 | 282 |
return error("Boot", "Failed to start uxn.");
|
| 283 |
- if(!uxn_boot(u, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST), memory)) |
|
| 283 |
+ if(!uxn_boot(u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST))) |
|
| 284 | 284 |
return error("Boot", "Failed to start uxn.");
|
| 285 | 285 |
if(!load(&hypervisor, "hypervisor.rom")) |
| 286 | 286 |
error("Hypervisor", "No debugger found.");
|