Removed external memory bank

This commit is contained in:
neauoire 2022-01-12 18:56:59 -08:00
parent 459855d825
commit 6a6a2ec383
4 changed files with 6 additions and 16 deletions

View File

@ -150,7 +150,7 @@ file_deo(Device *d, Uint8 port)
case 0x5: case 0x5:
DEVPEEK16(a, 0x4); DEVPEEK16(a, 0x4);
DEVPEEK16(b, 0xa); DEVPEEK16(b, 0xa);
res = file_stat(&bank0[a], b); res = file_stat(&d->u->ram[a], b);
DEVPOKE16(0x2, res); DEVPOKE16(0x2, res);
break; break;
case 0x6: case 0x6:
@ -159,19 +159,19 @@ file_deo(Device *d, Uint8 port)
break; break;
case 0x9: case 0x9:
DEVPEEK16(a, 0x8); DEVPEEK16(a, 0x8);
res = file_init(&bank0[a]); res = file_init(&d->u->ram[a]);
DEVPOKE16(0x2, res); DEVPOKE16(0x2, res);
break; break;
case 0xd: case 0xd:
DEVPEEK16(a, 0xc); DEVPEEK16(a, 0xc);
DEVPEEK16(b, 0xa); DEVPEEK16(b, 0xa);
res = file_read(&bank0[a], b); res = file_read(&d->u->ram[a], b);
DEVPOKE16(0x2, res); DEVPOKE16(0x2, res);
break; break;
case 0xf: case 0xf:
DEVPEEK16(a, 0xe); DEVPEEK16(a, 0xe);
DEVPEEK16(b, 0xa); 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); DEVPOKE16(0x2, res);
break; break;
} }

View File

@ -11,5 +11,3 @@ WITH REGARD TO THIS SOFTWARE.
*/ */
void file_deo(Device *d, Uint8 port); void file_deo(Device *d, Uint8 port);
extern Uint8 *bank0;

View File

@ -2,9 +2,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "uxn.h" #include "uxn.h"
Uint8 *bank0;
#include "devices/system.h" #include "devices/system.h"
#include "devices/file.h" #include "devices/file.h"
#include "devices/datetime.h" #include "devices/datetime.h"
@ -118,8 +115,7 @@ load(Uxn *u, char *filepath)
static int static int
start(Uxn *u) start(Uxn *u)
{ {
bank0 = (Uint8 *)calloc(0x10000, sizeof(Uint8)); if(!uxn_boot(u, (Uint8 *)calloc(0x10000, sizeof(Uint8))))
if(!uxn_boot(u, bank0))
return error("Boot", "Failed"); return error("Boot", "Failed");
/* system */ uxn_port(u, 0x0, system_dei, system_deo); /* system */ uxn_port(u, 0x0, system_dei, system_deo);
/* console */ uxn_port(u, 0x1, nil_dei, console_deo); /* console */ uxn_port(u, 0x1, nil_dei, console_deo);

View File

@ -3,8 +3,6 @@
#include "uxn.h" #include "uxn.h"
Uint8 *bank0;
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" #pragma GCC diagnostic ignored "-Wpedantic"
@ -262,9 +260,7 @@ load(Uxn *u, char *rom)
static int static int
start(Uxn *u, char *rom) start(Uxn *u, char *rom)
{ {
bank0 = (Uint8 *)calloc(0x10000, sizeof(Uint8)); if(!uxn_boot(u, (Uint8 *)calloc(0x10000, sizeof(Uint8))))
if(!uxn_boot(u, bank0))
return error("Boot", "Failed to start uxn."); return error("Boot", "Failed to start uxn.");
if(!load(u, rom)) if(!load(u, rom))
return error("Boot", "Failed to load rom."); return error("Boot", "Failed to load rom.");