uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit cd30b48665e491d1cb61a9b64bda016e7cf011d1
parent ede186b22684fa6908bfd8c3a33027753ea89d81
Author: neauoire <aliceffekt@gmail.com>
Date:   Tue, 11 Jan 2022 14:16:27 -0800

Rename memory banks

Diffstat:
Msrc/devices/file.c | 8++++----
Msrc/devices/file.h | 4++--
Msrc/uxncli.c | 8++++----
Msrc/uxnemu.c | 10+++++-----
4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/devices/file.c b/src/devices/file.c @@ -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; } diff --git a/src/devices/file.h b/src/devices/file.h @@ -12,4 +12,4 @@ WITH REGARD TO THIS SOFTWARE. void file_deo(Device *d, Uint8 port); -extern Uint8 *memory; -\ No newline at end of file +extern Uint8 *bank1; +\ No newline at end of file diff --git a/src/uxncli.c b/src/uxncli.c @@ -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); diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -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.");