Simplified system_cmd
This commit is contained in:
parent
e20b572c20
commit
0dcc3b4c2e
|
@ -41,15 +41,8 @@ system_inspect(Uxn *u)
|
||||||
|
|
||||||
/* RAM */
|
/* RAM */
|
||||||
|
|
||||||
Uint8 *
|
|
||||||
system_init(Mmu *m, Uint16 pages)
|
|
||||||
{
|
|
||||||
m->pages = (Uint8 *)calloc(0x10000 * pages, sizeof(Uint8));
|
|
||||||
return m->pages;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mmu_eval(Uint8 *ram, Uint16 addr)
|
system_cmd(Uint8 *ram, Uint16 addr)
|
||||||
{
|
{
|
||||||
Uint16 a = addr, i = 0;
|
Uint16 a = addr, i = 0;
|
||||||
Uint8 o = ram[a++];
|
Uint8 o = ram[a++];
|
||||||
|
@ -85,7 +78,7 @@ system_deo(Uxn *u, Uint8 *d, Uint8 port)
|
||||||
switch(port) {
|
switch(port) {
|
||||||
case 0x3:
|
case 0x3:
|
||||||
PEKDEV(a, 0x2);
|
PEKDEV(a, 0x2);
|
||||||
mmu_eval(u->ram, a);
|
system_cmd(u->ram, a);
|
||||||
break;
|
break;
|
||||||
case 0xe:
|
case 0xe:
|
||||||
if(u->wst->ptr || u->rst->ptr) system_inspect(u);
|
if(u->wst->ptr || u->rst->ptr) system_inspect(u);
|
||||||
|
@ -113,4 +106,3 @@ uxn_halt(Uxn *u, Uint8 instr, Uint8 err, Uint16 addr)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,6 @@ WITH REGARD TO THIS SOFTWARE.
|
||||||
|
|
||||||
#define RAM_PAGES 0x10
|
#define RAM_PAGES 0x10
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
Uint8 *pages;
|
|
||||||
} Mmu;
|
|
||||||
|
|
||||||
Uint8 *system_init(Mmu *m, Uint16 pages);
|
|
||||||
int system_load(Uxn *u, char *filename);
|
int system_load(Uxn *u, char *filename);
|
||||||
void system_inspect(Uxn *u);
|
|
||||||
void system_deo(Uxn *u, Uint8 *d, Uint8 port);
|
void system_deo(Uxn *u, Uint8 *d, Uint8 port);
|
||||||
|
void system_inspect(Uxn *u);
|
||||||
|
|
|
@ -78,10 +78,9 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
Uxn u;
|
Uxn u;
|
||||||
int i;
|
int i;
|
||||||
Mmu mmu;
|
|
||||||
if(argc < 2)
|
if(argc < 2)
|
||||||
return emu_error("Usage", "uxncli game.rom args");
|
return emu_error("Usage", "uxncli game.rom args");
|
||||||
if(!uxn_boot(&u, system_init(&mmu, RAM_PAGES), emu_dei, emu_deo))
|
if(!uxn_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), emu_dei, emu_deo))
|
||||||
return emu_error("Boot", "Failed");
|
return emu_error("Boot", "Failed");
|
||||||
if(!system_load(&u, argv[1]))
|
if(!system_load(&u, argv[1]))
|
||||||
return emu_error("Load", "Failed");
|
return emu_error("Load", "Failed");
|
||||||
|
|
|
@ -53,7 +53,6 @@ static Uint32 stdin_event, audio0_event;
|
||||||
static Uint64 exec_deadline, deadline_interval, ms_interval;
|
static Uint64 exec_deadline, deadline_interval, ms_interval;
|
||||||
|
|
||||||
char *rom_path;
|
char *rom_path;
|
||||||
Mmu mmu;
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
error(char *msg, const char *err)
|
error(char *msg, const char *err)
|
||||||
|
@ -263,8 +262,8 @@ init(void)
|
||||||
static int
|
static int
|
||||||
start(Uxn *u, char *rom)
|
start(Uxn *u, char *rom)
|
||||||
{
|
{
|
||||||
free(mmu.pages);
|
free(u->ram);
|
||||||
if(!uxn_boot(u, system_init(&mmu, RAM_PAGES), emu_dei, emu_deo))
|
if(!uxn_boot(u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), emu_dei, emu_deo))
|
||||||
return error("Boot", "Failed to start uxn.");
|
return error("Boot", "Failed to start uxn.");
|
||||||
if(!system_load(u, rom))
|
if(!system_load(u, rom))
|
||||||
return error("Boot", "Failed to load rom.");
|
return error("Boot", "Failed to load rom.");
|
||||||
|
|
Loading…
Reference in New Issue