commit 6a6a2ec3835034d4bcc45668acccb866bc4ff486
parent 459855d825456ce153c74cad4c959b42dec7644c
Author: neauoire <aliceffekt@gmail.com>
Date: Wed, 12 Jan 2022 18:56:59 -0800
Removed external memory bank
Diffstat:
4 files changed, 6 insertions(+), 17 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(&bank0[a], b);
+ res = file_stat(&d->u->ram[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(&bank0[a]);
+ res = file_init(&d->u->ram[a]);
DEVPOKE16(0x2, res);
break;
case 0xd:
DEVPEEK16(a, 0xc);
DEVPEEK16(b, 0xa);
- res = file_read(&bank0[a], b);
+ res = file_read(&d->u->ram[a], b);
DEVPOKE16(0x2, res);
break;
case 0xf:
DEVPEEK16(a, 0xe);
DEVPEEK16(b, 0xa);
- res = file_write(&bank0[a], b, d->dat[0x7]);
+ res = file_write(&d->u->ram[a], b, d->dat[0x7]);
DEVPOKE16(0x2, res);
break;
}
diff --git a/src/devices/file.h b/src/devices/file.h
@@ -11,5 +11,3 @@ WITH REGARD TO THIS SOFTWARE.
*/
void file_deo(Device *d, Uint8 port);
-
-extern Uint8 *bank0;
-\ No newline at end of file
diff --git a/src/uxncli.c b/src/uxncli.c
@@ -2,9 +2,6 @@
#include <stdlib.h>
#include "uxn.h"
-
-Uint8 *bank0;
-
#include "devices/system.h"
#include "devices/file.h"
#include "devices/datetime.h"
@@ -118,8 +115,7 @@ load(Uxn *u, char *filepath)
static int
start(Uxn *u)
{
- bank0 = (Uint8 *)calloc(0x10000, sizeof(Uint8));
- if(!uxn_boot(u, bank0))
+ if(!uxn_boot(u, (Uint8 *)calloc(0x10000, sizeof(Uint8))))
return error("Boot", "Failed");
/* system */ uxn_port(u, 0x0, system_dei, system_deo);
/* console */ uxn_port(u, 0x1, nil_dei, console_deo);
diff --git a/src/uxnemu.c b/src/uxnemu.c
@@ -3,8 +3,6 @@
#include "uxn.h"
-Uint8 *bank0;
-
#pragma GCC diagnostic push
#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
@@ -262,9 +260,7 @@ load(Uxn *u, char *rom)
static int
start(Uxn *u, char *rom)
{
- bank0 = (Uint8 *)calloc(0x10000, sizeof(Uint8));
-
- if(!uxn_boot(u, bank0))
+ if(!uxn_boot(u, (Uint8 *)calloc(0x10000, sizeof(Uint8))))
return error("Boot", "Failed to start uxn.");
if(!load(u, rom))
return error("Boot", "Failed to load rom.");