uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 180984f8fb881763573bd84a1dc906217d85055e
parent b328a4e87da8275d14ab3b29530b727a2acc975d
Author: neauoire <aliceffekt@gmail.com>
Date:   Fri,  7 Jan 2022 11:48:09 -0800

Removed device port masks

Diffstat:
Msrc/uxn.c | 3+--
Msrc/uxn.h | 4++--
Msrc/uxncli.c | 32++++++++++++++++----------------
Msrc/uxnemu.c | 40++++++++++++++++++++--------------------
4 files changed, 39 insertions(+), 40 deletions(-)

diff --git a/src/uxn.c b/src/uxn.c @@ -122,11 +122,10 @@ uxn_boot(Uxn *u, Uint8 *ram, Uint8 *devpage, Stack *wst, Stack *rst) } Device * -uxn_port(Uxn *u, Uint8 id, Uint16 mask, Uint8 (*deifn)(Device *d, Uint8 port), void (*deofn)(Device *d, Uint8 port)) +uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *d, Uint8 port), void (*deofn)(Device *d, Uint8 port)) { Device *d = &u->dev[id]; d->u = u; - d->mask = mask; d->mem = u->ram; d->dei = deifn; d->deo = deofn; diff --git a/src/uxn.h b/src/uxn.h @@ -37,7 +37,7 @@ typedef struct { typedef struct Device { struct Uxn *u; Uint8 *dat, *mem; - Uint16 vector, mask; + Uint16 vector; Uint8 (*dei)(struct Device *d, Uint8); void (*deo)(struct Device *d, Uint8); } Device; @@ -51,4 +51,4 @@ typedef struct Uxn { int uxn_boot(Uxn *u, Uint8 *ram, Uint8 *devpage, Stack *wst, Stack *rst); int uxn_eval(Uxn *u, Uint16 pc); int uxn_halt(Uxn *u, Uint8 error, Uint16 addr); -Device *uxn_port(Uxn *u, Uint8 id, Uint16 mask, Uint8 (*deifn)(Device *, Uint8), void (*deofn)(Device *, Uint8)); +Device *uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *, Uint8), void (*deofn)(Device *, Uint8)); diff --git a/src/uxncli.c b/src/uxncli.c @@ -124,22 +124,22 @@ main(int argc, char **argv) if(!uxn_boot(&u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST))) return error("Boot", "Failed"); - /* system */ devsystem = uxn_port(&u, 0x0, 0xffff, system_dei, system_deo); - /* console */ devconsole = uxn_port(&u, 0x1, 0xffff, nil_dei, console_deo); - /* empty */ uxn_port(&u, 0x2, 0xffff, nil_dei, nil_deo); - /* empty */ uxn_port(&u, 0x3, 0xffff, nil_dei, nil_deo); - /* empty */ uxn_port(&u, 0x4, 0xffff, nil_dei, nil_deo); - /* empty */ uxn_port(&u, 0x5, 0xffff, nil_dei, nil_deo); - /* empty */ uxn_port(&u, 0x6, 0xffff, nil_dei, nil_deo); - /* empty */ uxn_port(&u, 0x7, 0xffff, nil_dei, nil_deo); - /* empty */ uxn_port(&u, 0x8, 0xffff, nil_dei, nil_deo); - /* empty */ uxn_port(&u, 0x9, 0xffff, nil_dei, nil_deo); - /* file */ uxn_port(&u, 0xa, 0xffff, nil_dei, file_deo); - /* datetime */ uxn_port(&u, 0xb, 0xffff, datetime_dei, nil_deo); - /* empty */ uxn_port(&u, 0xc, 0xffff, nil_dei, nil_deo); - /* empty */ uxn_port(&u, 0xd, 0xffff, nil_dei, nil_deo); - /* empty */ uxn_port(&u, 0xe, 0xffff, nil_dei, nil_deo); - /* empty */ uxn_port(&u, 0xf, 0xffff, nil_dei, nil_deo); + /* system */ devsystem = uxn_port(&u, 0x0, system_dei, system_deo); + /* console */ devconsole = uxn_port(&u, 0x1, nil_dei, console_deo); + /* empty */ 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); + /* empty */ uxn_port(&u, 0x8, nil_dei, nil_deo); + /* empty */ uxn_port(&u, 0x9, nil_dei, nil_deo); + /* file */ uxn_port(&u, 0xa, nil_dei, file_deo); + /* datetime */ uxn_port(&u, 0xb, datetime_dei, nil_deo); + /* empty */ uxn_port(&u, 0xc, nil_dei, nil_deo); + /* empty */ uxn_port(&u, 0xd, nil_dei, nil_deo); + /* empty */ uxn_port(&u, 0xe, nil_dei, nil_deo); + /* empty */ uxn_port(&u, 0xf, nil_dei, nil_deo); for(i = 1; i < argc; i++) { if(!loaded++) { diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -264,28 +264,28 @@ start(Uxn *u, char *rom) if(!load(u, rom)) return error("Boot", "Failed to load rom."); - /* system */ devsystem = uxn_port(u, 0x0, 0xffff, system_dei, system_deo); - /* console */ devconsole = uxn_port(u, 0x1, 0xffff, nil_dei, console_deo); - /* screen */ devscreen = uxn_port(u, 0x2, 0xffff, screen_dei, screen_deo); - /* audio0 */ devaudio0 = uxn_port(u, 0x3, 0xffff, audio_dei, audio_deo); - /* audio1 */ uxn_port(u, 0x4, 0xffff, audio_dei, audio_deo); - /* audio2 */ uxn_port(u, 0x5, 0xffff, audio_dei, audio_deo); - /* audio3 */ uxn_port(u, 0x6, 0xffff, audio_dei, audio_deo); - /* unused */ uxn_port(u, 0x7, 0xffff, nil_dei, nil_deo); - /* control */ devctrl = uxn_port(u, 0x8, 0x0000, nil_dei, nil_deo); - /* mouse */ devmouse = uxn_port(u, 0x9, 0x0000, nil_dei, nil_deo); - /* file */ uxn_port(u, 0xa, 0xffff, nil_dei, file_deo); - /* datetime */ uxn_port(u, 0xb, 0xffff, datetime_dei, nil_deo); - /* unused */ uxn_port(u, 0xc, 0xffff, nil_dei, nil_deo); - /* unused */ uxn_port(u, 0xd, 0xffff, nil_dei, nil_deo); - /* unused */ uxn_port(u, 0xe, 0xffff, nil_dei, nil_deo); - /* unused */ uxn_port(u, 0xf, 0xffff, nil_dei, nil_deo); + /* system */ devsystem = uxn_port(u, 0x0, system_dei, system_deo); + /* console */ devconsole = uxn_port(u, 0x1, nil_dei, console_deo); + /* screen */ devscreen = uxn_port(u, 0x2, screen_dei, screen_deo); + /* audio0 */ devaudio0 = uxn_port(u, 0x3, audio_dei, audio_deo); + /* audio1 */ uxn_port(u, 0x4, audio_dei, audio_deo); + /* audio2 */ uxn_port(u, 0x5, audio_dei, audio_deo); + /* audio3 */ uxn_port(u, 0x6, audio_dei, audio_deo); + /* unused */ uxn_port(u, 0x7, nil_dei, nil_deo); + /* control */ devctrl = uxn_port(u, 0x8, nil_dei, nil_deo); + /* mouse */ devmouse = uxn_port(u, 0x9, nil_dei, nil_deo); + /* file */ uxn_port(u, 0xa, nil_dei, file_deo); + /* datetime */ uxn_port(u, 0xb, datetime_dei, nil_deo); + /* unused */ uxn_port(u, 0xc, nil_dei, nil_deo); + /* unused */ uxn_port(u, 0xd, nil_dei, nil_deo); + /* unused */ uxn_port(u, 0xe, nil_dei, nil_deo); + /* unused */ uxn_port(u, 0xf, nil_dei, nil_deo); /* Supervisor */ - uxn_port(&supervisor, 0x0, 0xffff, system_dei, system_deo); - uxn_port(&supervisor, 0x1, 0xffff, nil_dei, console_deo); - uxn_port(&supervisor, 0x2, 0xffff, screen_dei, screen_deo); - uxn_port(&supervisor, 0x8, 0x0000, nil_dei, nil_deo); + uxn_port(&supervisor, 0x0, system_dei, system_deo); + uxn_port(&supervisor, 0x1, nil_dei, console_deo); + uxn_port(&supervisor, 0x2, screen_dei, screen_deo); + uxn_port(&supervisor, 0x8, nil_dei, nil_deo); uxn_eval(&supervisor, PAGE_PROGRAM);