Rename memory banks

This commit is contained in:
neauoire 2022-01-11 14:16:27 -08:00
parent ede186b226
commit cd30b48665
4 changed files with 14 additions and 14 deletions

View File

@ -150,7 +150,7 @@ file_deo(Device *d, Uint8 port)
case 0x5:
DEVPEEK16(a, 0x4);
DEVPEEK16(b, 0xa);
res = file_stat(&memory[a], b);
res = file_stat(&bank1[a], b);
DEVPOKE16(0x2, res);
break;
case 0x6:
@ -159,19 +159,19 @@ file_deo(Device *d, Uint8 port)
break;
case 0x9:
DEVPEEK16(a, 0x8);
res = file_init(&memory[a]);
res = file_init(&bank1[a]);
DEVPOKE16(0x2, res);
break;
case 0xd:
DEVPEEK16(a, 0xc);
DEVPEEK16(b, 0xa);
res = file_read(&memory[a], b);
res = file_read(&bank1[a], b);
DEVPOKE16(0x2, res);
break;
case 0xf:
DEVPEEK16(a, 0xe);
DEVPEEK16(b, 0xa);
res = file_write(&memory[a], b, d->dat[0x7]);
res = file_write(&bank1[a], b, d->dat[0x7]);
DEVPOKE16(0x2, res);
break;
}

View File

@ -12,4 +12,4 @@ WITH REGARD TO THIS SOFTWARE.
void file_deo(Device *d, Uint8 port);
extern Uint8 *memory;
extern Uint8 *bank1;

View File

@ -4,7 +4,7 @@
#include "uxn.h"
Uint8 *supervisor_memory, *memory;
Uint8 *bank0, *bank1;
#include "devices/system.h"
#include "devices/file.h"
@ -119,9 +119,9 @@ main(int argc, char **argv)
Uxn u;
int i, loaded = 0;
supervisor_memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
if(!uxn_boot(&u, memory, supervisor_memory + PAGE_DEV, (Stack *)(supervisor_memory + PAGE_WST), (Stack *)(supervisor_memory + PAGE_RST)))
bank0 = (Uint8 *)calloc(0x10000, sizeof(Uint8));
bank1 = (Uint8 *)calloc(0x10000, sizeof(Uint8));
if(!uxn_boot(&u, bank1, bank0 + PAGE_DEV, (Stack *)(bank0 + PAGE_WST), (Stack *)(bank0 + PAGE_RST)))
return error("Boot", "Failed");
/* system */ devsystem = uxn_port(&u, 0x0, system_dei, system_deo);

View File

@ -4,7 +4,7 @@
#include "uxn.h"
Uint8 *supervisor_memory, *memory;
Uint8 *bank0, *bank1;
#pragma GCC diagnostic push
#pragma clang diagnostic push
@ -252,10 +252,10 @@ load(Uxn *u, char *rom)
static int
start(Uxn *u, char *rom)
{
memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
supervisor_memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
bank1 = (Uint8 *)calloc(0x10000, sizeof(Uint8));
bank0 = (Uint8 *)calloc(0x10000, sizeof(Uint8));
if(!uxn_boot(u, memory, supervisor_memory + PAGE_DEV, (Stack *)(supervisor_memory + PAGE_WST), (Stack *)(supervisor_memory + PAGE_RST)))
if(!uxn_boot(u, bank1, bank0 + PAGE_DEV, (Stack *)(bank0 + PAGE_WST), (Stack *)(bank0 + PAGE_RST)))
return error("Boot", "Failed to start uxn.");
if(!load(u, rom))
return error("Boot", "Failed to load rom.");
@ -277,7 +277,7 @@ start(Uxn *u, char *rom)
/* unused */ uxn_port(u, 0xf, nil_dei, nil_deo);
/* Supervisor */
if(!uxn_boot(&supervisor, supervisor_memory, supervisor_memory + VISOR_DEV, (Stack *)(supervisor_memory + VISOR_WST), (Stack *)(supervisor_memory + VISOR_RST)))
if(!uxn_boot(&supervisor, bank0, bank0 + VISOR_DEV, (Stack *)(bank0 + VISOR_WST), (Stack *)(bank0 + VISOR_RST)))
return error("Boot", "Failed to start uxn.");
if(!load(&supervisor, "supervisor.rom"))
error("Supervisor", "No debugger found.");