Browse code

Rename memory banks

neauoire authored on 11/01/2022 22:16:27
Showing 4 changed files
... ...
@@ -150,7 +150,7 @@ file_deo(Device *d, Uint8 port)
150 150
 	case 0x5:
151 151
 		DEVPEEK16(a, 0x4);
152 152
 		DEVPEEK16(b, 0xa);
153
-		res = file_stat(&memory[a], b);
153
+		res = file_stat(&bank1[a], b);
154 154
 		DEVPOKE16(0x2, res);
155 155
 		break;
156 156
 	case 0x6:
... ...
@@ -159,19 +159,19 @@ file_deo(Device *d, Uint8 port)
159 159
 		break;
160 160
 	case 0x9:
161 161
 		DEVPEEK16(a, 0x8);
162
-		res = file_init(&memory[a]);
162
+		res = file_init(&bank1[a]);
163 163
 		DEVPOKE16(0x2, res);
164 164
 		break;
165 165
 	case 0xd:
166 166
 		DEVPEEK16(a, 0xc);
167 167
 		DEVPEEK16(b, 0xa);
168
-		res = file_read(&memory[a], b);
168
+		res = file_read(&bank1[a], b);
169 169
 		DEVPOKE16(0x2, res);
170 170
 		break;
171 171
 	case 0xf:
172 172
 		DEVPEEK16(a, 0xe);
173 173
 		DEVPEEK16(b, 0xa);
174
-		res = file_write(&memory[a], b, d->dat[0x7]);
174
+		res = file_write(&bank1[a], b, d->dat[0x7]);
175 175
 		DEVPOKE16(0x2, res);
176 176
 		break;
177 177
 	}
... ...
@@ -12,4 +12,4 @@ WITH REGARD TO THIS SOFTWARE.
12 12
 
13 13
 void file_deo(Device *d, Uint8 port);
14 14
 
15
-extern Uint8 *memory;
16 15
\ No newline at end of file
16
+extern Uint8 *bank1;
17 17
\ No newline at end of file
... ...
@@ -4,7 +4,7 @@
4 4
 
5 5
 #include "uxn.h"
6 6
 
7
-Uint8 *supervisor_memory, *memory;
7
+Uint8 *bank0, *bank1;
8 8
 
9 9
 #include "devices/system.h"
10 10
 #include "devices/file.h"
... ...
@@ -119,9 +119,9 @@ main(int argc, char **argv)
119 119
 	Uxn u;
120 120
 	int i, loaded = 0;
121 121
 
122
-	supervisor_memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
123
-	memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
124
-	if(!uxn_boot(&u, memory, supervisor_memory + PAGE_DEV, (Stack *)(supervisor_memory + PAGE_WST), (Stack *)(supervisor_memory + PAGE_RST)))
122
+	bank0 = (Uint8 *)calloc(0x10000, sizeof(Uint8));
123
+	bank1 = (Uint8 *)calloc(0x10000, sizeof(Uint8));
124
+	if(!uxn_boot(&u, bank1, bank0 + PAGE_DEV, (Stack *)(bank0 + PAGE_WST), (Stack *)(bank0 + PAGE_RST)))
125 125
 		return error("Boot", "Failed");
126 126
 
127 127
 	/* system   */ devsystem = uxn_port(&u, 0x0, system_dei, system_deo);
... ...
@@ -4,7 +4,7 @@
4 4
 
5 5
 #include "uxn.h"
6 6
 
7
-Uint8 *supervisor_memory, *memory;
7
+Uint8 *bank0, *bank1;
8 8
 
9 9
 #pragma GCC diagnostic push
10 10
 #pragma clang diagnostic push
... ...
@@ -252,10 +252,10 @@ load(Uxn *u, char *rom)
252 252
 static int
253 253
 start(Uxn *u, char *rom)
254 254
 {
255
-	memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
256
-	supervisor_memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
255
+	bank1 = (Uint8 *)calloc(0x10000, sizeof(Uint8));
256
+	bank0 = (Uint8 *)calloc(0x10000, sizeof(Uint8));
257 257
 
258
-	if(!uxn_boot(u, memory, supervisor_memory + PAGE_DEV, (Stack *)(supervisor_memory + PAGE_WST), (Stack *)(supervisor_memory + PAGE_RST)))
258
+	if(!uxn_boot(u, bank1, bank0 + PAGE_DEV, (Stack *)(bank0 + PAGE_WST), (Stack *)(bank0 + PAGE_RST)))
259 259
 		return error("Boot", "Failed to start uxn.");
260 260
 	if(!load(u, rom))
261 261
 		return error("Boot", "Failed to load rom.");
... ...
@@ -277,7 +277,7 @@ start(Uxn *u, char *rom)
277 277
 	/* unused   */ uxn_port(u, 0xf, nil_dei, nil_deo);
278 278
 
279 279
 	/* Supervisor */
280
-	if(!uxn_boot(&supervisor, supervisor_memory, supervisor_memory + VISOR_DEV, (Stack *)(supervisor_memory + VISOR_WST), (Stack *)(supervisor_memory + VISOR_RST)))
280
+	if(!uxn_boot(&supervisor, bank0, bank0 + VISOR_DEV, (Stack *)(bank0 + VISOR_WST), (Stack *)(bank0 + VISOR_RST)))
281 281
 		return error("Boot", "Failed to start uxn.");
282 282
 	if(!load(&supervisor, "supervisor.rom"))
283 283
 		error("Supervisor", "No debugger found.");