Removed individual dei/deo

This commit is contained in:
neauoire 2022-04-05 10:43:26 -07:00
parent 038eaf0724
commit 5d80ab088c
3 changed files with 18 additions and 35 deletions

View File

@ -115,11 +115,9 @@ uxn_boot(Uxn *u, Uint8 *ram)
}
Device *
uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *d, Uint8 port), void (*deofn)(Device *d, Uint8 port))
uxn_port(Uxn *u, Uint8 id)
{
Device *d = &u->dev[id];
d->u = u;
d->dei = deifn;
d->deo = deofn;
return d;
}

View File

@ -36,8 +36,6 @@ typedef struct {
typedef struct Device {
struct Uxn *u;
Uint8 dat[16];
Uint8 (*dei)(struct Device *d, Uint8);
void (*deo)(struct Device *d, Uint8);
} Device;
typedef struct Uxn {
@ -51,4 +49,4 @@ typedef struct Uxn {
int uxn_boot(Uxn *u, Uint8 *ram);
int uxn_eval(Uxn *u, Uint16 pc);
int uxn_halt(Uxn *u, Uint8 error, Uint16 addr);
Device *uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *, Uint8), void (*deofn)(Device *, Uint8));
Device *uxn_port(Uxn *u, Uint8 id);

View File

@ -166,19 +166,6 @@ processEvent(Uxn *u)
}
}
static Uint8
nil_dei(Device *d, Uint8 port)
{
return d->dat[port];
}
static void
nil_deo(Device *d, Uint8 port)
{
(void)d;
(void)port;
}
static int
start(Uxn *u, char *rom)
{
@ -190,22 +177,22 @@ start(Uxn *u, char *rom)
u->dei = uxn11_dei;
u->deo = uxn11_deo;
/* system */ uxn_port(u, 0x0, nil_dei, nil_deo);
/* console */ uxn_port(u, 0x1, nil_dei, nil_deo);
/* screen */ uxn_port(u, 0x2, nil_dei, nil_deo);
/* empty */ uxn_port(u, 0x3, nil_dei, nil_deo);
/* empty */ uxn_port(u, 0x4, nil_dei, nil_deo);
/* empty */ uxn_port(u, 0x5, nil_dei, nil_deo);
/* empty */ uxn_port(u, 0x6, nil_dei, nil_deo);
/* empty */ uxn_port(u, 0x7, nil_dei, nil_deo);
/* control */ uxn_port(u, 0x8, nil_dei, nil_deo);
/* mouse */ uxn_port(u, 0x9, nil_dei, nil_deo);
/* file0 */ uxn_port(u, 0xa, nil_dei, nil_deo);
/* file1 */ uxn_port(u, 0xb, nil_dei, nil_deo);
/* datetime */ uxn_port(u, 0xc, nil_dei, nil_deo);
/* empty */ uxn_port(u, 0xd, nil_dei, nil_deo);
/* reserved */ uxn_port(u, 0xe, nil_dei, nil_deo);
/* reserved */ uxn_port(u, 0xf, nil_dei, nil_deo);
/* system */ uxn_port(u, 0x0);
/* console */ uxn_port(u, 0x1);
/* screen */ uxn_port(u, 0x2);
/* empty */ uxn_port(u, 0x3);
/* empty */ uxn_port(u, 0x4);
/* empty */ uxn_port(u, 0x5);
/* empty */ uxn_port(u, 0x6);
/* empty */ uxn_port(u, 0x7);
/* control */ uxn_port(u, 0x8);
/* mouse */ uxn_port(u, 0x9);
/* file0 */ uxn_port(u, 0xa);
/* file1 */ uxn_port(u, 0xb);
/* datetime */ uxn_port(u, 0xc);
/* empty */ uxn_port(u, 0xd);
/* reserved */ uxn_port(u, 0xe);
/* reserved */ uxn_port(u, 0xf);
screen_resize(&uxn_screen, WIDTH, HEIGHT);
if(!uxn_eval(u, PAGE_PROGRAM))