From 5d80ab088c75e9eb9ee82ad15537b2e63fad8161 Mon Sep 17 00:00:00 2001 From: neauoire Date: Tue, 5 Apr 2022 10:43:26 -0700 Subject: [PATCH] Removed individual dei/deo --- src/uxn.c | 4 +--- src/uxn.h | 4 +--- src/uxn11.c | 45 ++++++++++++++++----------------------------- 3 files changed, 18 insertions(+), 35 deletions(-) diff --git a/src/uxn.c b/src/uxn.c index 561b165..f3934ca 100644 --- a/src/uxn.c +++ b/src/uxn.c @@ -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; } diff --git a/src/uxn.h b/src/uxn.h index 0622fac..f0d1de8 100644 --- a/src/uxn.h +++ b/src/uxn.h @@ -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); diff --git a/src/uxn11.c b/src/uxn11.c index 4d6a644..7a2249f 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -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))