Connecting new device ports to uxn core
This commit is contained in:
parent
d1ca328b98
commit
0fd68e96f0
|
@ -116,7 +116,7 @@ timeout:
|
|||
/* clang-format on */
|
||||
|
||||
int
|
||||
uxn_boot(Uxn *u, Uint8 *ram)
|
||||
uxn_boot(Uxn *u, Uint8 *ram, Dei *dei, Deo *deo)
|
||||
{
|
||||
Uint32 i;
|
||||
char *cptr = (char *)u;
|
||||
|
|
|
@ -49,9 +49,14 @@ typedef struct Uxn {
|
|||
Uint8 *ram;
|
||||
Stack wst, rst;
|
||||
Device dev[16];
|
||||
Uint8 (*dei)(struct Uxn *u, Uint8 addr);
|
||||
void (*deo)(struct Uxn *u, Uint8 addr, Uint8 value);
|
||||
} Uxn;
|
||||
|
||||
int uxn_boot(Uxn *u, Uint8 *ram);
|
||||
typedef Uint8 Dei(Uxn *u, Uint8 addr);
|
||||
typedef void Deo(Uxn *u, Uint8 addr, Uint8 value);
|
||||
|
||||
int uxn_boot(Uxn *u, Uint8 *ram, Dei *dei, Deo *deo);
|
||||
int uxn_eval(Uxn *u, Uint16 pc);
|
||||
int uxn_interrupt(void);
|
||||
int uxn_halt(Uxn *u, Uint8 error, Uint16 addr);
|
||||
|
|
13
src/uxncli.c
13
src/uxncli.c
|
@ -24,6 +24,17 @@ error(char *msg, const char *err)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static Uint8
|
||||
emu_dei(Uxn *u, Uint8 addr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
emu_deo(Uxn *u, Uint8 addr, Uint8 v)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
system_deo_special(Device *d, Uint8 port)
|
||||
{
|
||||
|
@ -83,7 +94,7 @@ uxn_interrupt(void)
|
|||
static int
|
||||
start(Uxn *u)
|
||||
{
|
||||
if(!uxn_boot(u, (Uint8 *)calloc(0x10000, sizeof(Uint8))))
|
||||
if(!uxn_boot(u, (Uint8 *)calloc(0x10000, sizeof(Uint8)), emu_dei, emu_deo))
|
||||
return error("Boot", "Failed");
|
||||
/* system */ uxn_port(u, 0x0, system_dei, system_deo);
|
||||
/* console */ uxn_port(u, 0x1, nil_dei, console_deo);
|
||||
|
|
13
src/uxnemu.c
13
src/uxnemu.c
|
@ -176,6 +176,17 @@ init(void)
|
|||
|
||||
#pragma mark - Devices
|
||||
|
||||
static Uint8
|
||||
emu_dei(Uxn *u, Uint8 addr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
emu_deo(Uxn *u, Uint8 addr, Uint8 v)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
system_deo_special(Device *d, Uint8 port)
|
||||
{
|
||||
|
@ -253,7 +264,7 @@ static int
|
|||
start(Uxn *u, char *rom)
|
||||
{
|
||||
free(u->ram);
|
||||
if(!uxn_boot(u, calloc(0x10000, 1)))
|
||||
if(!uxn_boot(u, calloc(0x10000, 1), emu_dei, emu_deo))
|
||||
return error("Boot", "Failed to start uxn.");
|
||||
if(!load(u, rom))
|
||||
return error("Boot", "Failed to load rom.");
|
||||
|
|
Loading…
Reference in New Issue