uxn_boot() now expects dei/deo fn pointers
This commit is contained in:
parent
d118cc3813
commit
507a4b838c
|
@ -96,7 +96,7 @@ err:
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|
||||||
int
|
int
|
||||||
uxn_boot(Uxn *u, Uint8 *ram)
|
uxn_boot(Uxn *u, Uint8 *ram, Uint8 (*dei)(struct Uxn *, Uint8), void (*deo)(struct Uxn *, Uint8, Uint8))
|
||||||
{
|
{
|
||||||
Uint32 i;
|
Uint32 i;
|
||||||
char *cptr = (char *)u;
|
char *cptr = (char *)u;
|
||||||
|
@ -106,5 +106,7 @@ uxn_boot(Uxn *u, Uint8 *ram)
|
||||||
u->wst = (Stack *)(ram + 0x10000);
|
u->wst = (Stack *)(ram + 0x10000);
|
||||||
u->rst = (Stack *)(ram + 0x10100);
|
u->rst = (Stack *)(ram + 0x10100);
|
||||||
u->dev = (Uint8 *)(ram + 0x10200);
|
u->dev = (Uint8 *)(ram + 0x10200);
|
||||||
|
u->dei = dei;
|
||||||
|
u->deo = deo;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,6 @@ typedef struct Uxn {
|
||||||
void (*deo)(struct Uxn *u, Uint8 addr, Uint8 value);
|
void (*deo)(struct Uxn *u, Uint8 addr, Uint8 value);
|
||||||
} Uxn;
|
} Uxn;
|
||||||
|
|
||||||
int uxn_boot(Uxn *u, Uint8 *ram);
|
int uxn_boot(Uxn *u, Uint8 *ram, Uint8 (*dei)(struct Uxn *, Uint8), void (*deo)(struct Uxn *, Uint8, Uint8));
|
||||||
int uxn_eval(Uxn *u, Uint16 pc);
|
int uxn_eval(Uxn *u, Uint16 pc);
|
||||||
int uxn_halt(Uxn *u, Uint8 instr, Uint8 err, Uint16 addr);
|
int uxn_halt(Uxn *u, Uint8 instr, Uint8 err, Uint16 addr);
|
||||||
|
|
|
@ -227,10 +227,8 @@ main(int argc, char **argv)
|
||||||
if(argc < 2)
|
if(argc < 2)
|
||||||
return emu_error("Usage", "uxn11 game.rom args");
|
return emu_error("Usage", "uxn11 game.rom args");
|
||||||
rom_path = argv[1];
|
rom_path = argv[1];
|
||||||
if(!uxn_boot(&u, (Uint8 *)calloc(0x10300, sizeof(Uint8))))
|
if(!uxn_boot(&u, (Uint8 *)calloc(0x10300, sizeof(Uint8)), emu_dei, emu_deo))
|
||||||
return emu_error("Boot", "Failed");
|
return emu_error("Boot", "Failed");
|
||||||
u.dei = emu_dei;
|
|
||||||
u.deo = emu_deo;
|
|
||||||
/* start sequence */
|
/* start sequence */
|
||||||
if(!emu_start(&u, rom_path))
|
if(!emu_start(&u, rom_path))
|
||||||
return emu_error("Start", rom_path);
|
return emu_error("Start", rom_path);
|
||||||
|
|
|
@ -75,10 +75,8 @@ main(int argc, char **argv)
|
||||||
int i;
|
int i;
|
||||||
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, (Uint8 *)calloc(0x10300, sizeof(Uint8))))
|
if(!uxn_boot(&u, (Uint8 *)calloc(0x10300, sizeof(Uint8)), emu_dei, emu_deo))
|
||||||
return emu_error("Boot", "Failed");
|
return emu_error("Boot", "Failed");
|
||||||
u.dei = emu_dei;
|
|
||||||
u.deo = emu_deo;
|
|
||||||
if(!load_rom(&u, argv[1]))
|
if(!load_rom(&u, argv[1]))
|
||||||
return emu_error("Load", "Failed");
|
return emu_error("Load", "Failed");
|
||||||
fprintf(stderr, "Loaded %s\n", argv[1]);
|
fprintf(stderr, "Loaded %s\n", argv[1]);
|
||||||
|
|
Loading…
Reference in New Issue