Browse code

Device memory is not a member of ram

Devine Lu Linvega authored on 01/01/2023 20:21:30
Showing 4 changed files
... ...
@@ -125,6 +125,9 @@ uxn_boot(Uxn *u, Uint8 *ram, Dei *dei, Deo *deo)
125 125
 	for(i = 0; i < sizeof(*u); i++)
126 126
 		cptr[i] = 0x00;
127 127
 	u->ram = ram;
128
+	u->dev = (Uint8 *)(ram + 0x10200);
129
+	u->dei = dei;
130
+	u->deo = deo;
128 131
 	return 1;
129 132
 }
130 133
 
... ...
@@ -46,7 +46,7 @@ typedef struct Device {
46 46
 } Device;
47 47
 
48 48
 typedef struct Uxn {
49
-	Uint8 *ram;
49
+	Uint8 *ram, *dev;
50 50
 	Stack wst, rst;
51 51
 	Device devold[16];
52 52
 	Uint8 (*dei)(struct Uxn *u, Uint8 addr);
... ...
@@ -94,7 +94,7 @@ uxn_interrupt(void)
94 94
 static int
95 95
 start(Uxn *u)
96 96
 {
97
-	if(!uxn_boot(u, (Uint8 *)calloc(0x10000, sizeof(Uint8)), emu_dei, emu_deo))
97
+	if(!uxn_boot(u, (Uint8 *)calloc(0x10300, sizeof(Uint8)), emu_dei, emu_deo))
98 98
 		return error("Boot", "Failed");
99 99
 	/* system   */ uxn_port(u, 0x0, system_dei, system_deo);
100 100
 	/* console  */ uxn_port(u, 0x1, nil_dei, console_deo);
... ...
@@ -264,7 +264,7 @@ static int
264 264
 start(Uxn *u, char *rom)
265 265
 {
266 266
 	free(u->ram);
267
-	if(!uxn_boot(u, calloc(0x10000, 1), emu_dei, emu_deo))
267
+	if(!uxn_boot(u, calloc(0x10300, 1), emu_dei, emu_deo))
268 268
 		return error("Boot", "Failed to start uxn.");
269 269
 	if(!load(u, rom))
270 270
 		return error("Boot", "Failed to load rom.");