uxn

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

commit a2e40d9d10c11ef48f4f93d0dc86f5085b4263ce
parent f875d096059a83f745656b5b754296bfbd2b0064
Author: neauoire <aliceffekt@gmail.com>
Date:   Sun, 29 Aug 2021 19:52:12 -0700

Removed unused device string

Diffstat:
Msrc/uxn-fast.c | 3+--
Msrc/uxn.c | 7+++----
Msrc/uxn.h | 2+-
Msrc/uxncli.c | 32++++++++++++++++----------------
Msrc/uxnemu.c | 36++++++++++++++++++------------------
5 files changed, 39 insertions(+), 41 deletions(-)

diff --git a/src/uxn-fast.c b/src/uxn-fast.c @@ -4030,13 +4030,12 @@ uxn_boot(Uxn *u) } Device * -uxn_port(Uxn *u, Uint8 id, char *name, void (*talkfn)(Device *d, Uint8 b0, Uint8 w)) +uxn_port(Uxn *u, Uint8 id, void (*talkfn)(Device *d, Uint8 b0, Uint8 w)) { Device *d = &u->dev[id]; d->addr = id * 0x10; d->u = u; d->mem = u->ram.dat; d->talk = talkfn; - (void)name; return d; } diff --git a/src/uxn.c b/src/uxn.c @@ -41,10 +41,10 @@ static Uint16 devr8(Device *d, Uint8 a) { d->talk(d, a & 0x0f, 0); return d->dat static void warp8(Uxn *u, Uint16 a){ u->ram.ptr += (Sint8)a; } static void pull8(Uxn *u){ push8(u->src, peek8(u->ram.dat, u->ram.ptr++)); } /* short mode */ -void poke16(Uint8 *m, Uint16 a, Uint16 b) { poke8(m, a, b >> 8); poke8(m, a + 1, b); } -Uint16 peek16(Uint8 *m, Uint16 a) { return (peek8(m, a) << 8) + peek8(m, a + 1); } static void push16(Stack *s, Uint16 a) { push8(s, a >> 8); push8(s, a); } static Uint16 pop16(Stack *s) { Uint8 a = pop8(s), b = pop8(s); return a + (b << 8); } + void poke16(Uint8 *m, Uint16 a, Uint16 b) { poke8(m, a, b >> 8); poke8(m, a + 1, b); } + Uint16 peek16(Uint8 *m, Uint16 a) { return (peek8(m, a) << 8) + peek8(m, a + 1); } static void devw16(Device *d, Uint8 a, Uint16 b) { devw8(d, a, b >> 8); devw8(d, a + 1, b); } static Uint16 devr16(Device *d, Uint8 a) { return (devr8(d, a) << 8) + devr8(d, a + 1); } static void warp16(Uxn *u, Uint16 a){ u->ram.ptr = a; } @@ -148,13 +148,12 @@ uxn_boot(Uxn *u) } Device * -uxn_port(Uxn *u, Uint8 id, char *name, void (*talkfn)(Device *d, Uint8 b0, Uint8 w)) +uxn_port(Uxn *u, Uint8 id, void (*talkfn)(Device *d, Uint8 b0, Uint8 w)) { Device *d = &u->dev[id]; d->addr = id * 0x10; d->u = u; d->mem = u->ram.dat; d->talk = talkfn; - (void)name; return d; } diff --git a/src/uxn.h b/src/uxn.h @@ -46,4 +46,4 @@ Uint16 peek16(Uint8 *m, Uint16 a); int uxn_boot(Uxn *c); int uxn_eval(Uxn *u, Uint16 vec); int uxn_halt(Uxn *u, Uint8 error, char *name, int id); -Device *uxn_port(Uxn *u, Uint8 id, char *name, void (*talkfn)(Device *, Uint8, Uint8)); +Device *uxn_port(Uxn *u, Uint8 id, void (*talkfn)(Device *, Uint8, Uint8)); diff --git a/src/uxncli.c b/src/uxncli.c @@ -167,22 +167,22 @@ main(int argc, char **argv) if(!load(&u, argv[1])) return error("Load", "Failed"); - devsystem = uxn_port(&u, 0x0, "system", system_talk); - devconsole = uxn_port(&u, 0x1, "console", console_talk); - uxn_port(&u, 0x2, "empty", nil_talk); - uxn_port(&u, 0x3, "empty", nil_talk); - uxn_port(&u, 0x4, "empty", nil_talk); - uxn_port(&u, 0x5, "empty", nil_talk); - uxn_port(&u, 0x6, "empty", nil_talk); - uxn_port(&u, 0x7, "empty", nil_talk); - uxn_port(&u, 0x8, "empty", nil_talk); - uxn_port(&u, 0x9, "empty", nil_talk); - uxn_port(&u, 0xa, "file", file_talk); - uxn_port(&u, 0xb, "datetime", datetime_talk); - uxn_port(&u, 0xc, "empty", nil_talk); - uxn_port(&u, 0xd, "empty", nil_talk); - uxn_port(&u, 0xe, "empty", nil_talk); - uxn_port(&u, 0xf, "empty", nil_talk); + /* system */ devsystem = uxn_port(&u, 0x0, system_talk); + /* console */ devconsole = uxn_port(&u, 0x1, console_talk); + /* empty */ uxn_port(&u, 0x2, nil_talk); + /* empty */ uxn_port(&u, 0x3, nil_talk); + /* empty */ uxn_port(&u, 0x4, nil_talk); + /* empty */ uxn_port(&u, 0x5, nil_talk); + /* empty */ uxn_port(&u, 0x6, nil_talk); + /* empty */ uxn_port(&u, 0x7, nil_talk); + /* empty */ uxn_port(&u, 0x8, nil_talk); + /* empty */ uxn_port(&u, 0x9, nil_talk); + /* file */ uxn_port(&u, 0xa, file_talk); + /* datetime */ uxn_port(&u, 0xb, datetime_talk); + /* empty */ uxn_port(&u, 0xc, nil_talk); + /* empty */ uxn_port(&u, 0xd, nil_talk); + /* empty */ uxn_port(&u, 0xe, nil_talk); + /* empty */ uxn_port(&u, 0xf, nil_talk); run(&u); diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -525,24 +525,24 @@ main(int argc, char **argv) if(!init()) return error("Init", "Failed to initialize emulator."); - devsystem = uxn_port(&u, 0x0, "system", system_talk); - devconsole = uxn_port(&u, 0x1, "console", console_talk); - devscreen = uxn_port(&u, 0x2, "screen", screen_talk); - devaudio0 = uxn_port(&u, 0x3, "audio0", audio_talk); - uxn_port(&u, 0x4, "audio1", audio_talk); - uxn_port(&u, 0x5, "audio2", audio_talk); - uxn_port(&u, 0x6, "audio3", audio_talk); - uxn_port(&u, 0x7, "---", nil_talk); - devctrl = uxn_port(&u, 0x8, "controller", nil_talk); - devmouse = uxn_port(&u, 0x9, "mouse", nil_talk); - uxn_port(&u, 0xa, "file", file_talk); - uxn_port(&u, 0xb, "datetime", datetime_talk); - uxn_port(&u, 0xc, "---", nil_talk); - uxn_port(&u, 0xd, "---", nil_talk); - uxn_port(&u, 0xe, "---", nil_talk); - uxn_port(&u, 0xf, "---", nil_talk); - - /* Write screen size to dev/screen */ + /* system */ devsystem = uxn_port(&u, 0x0, system_talk); + /* console */ devconsole = uxn_port(&u, 0x1, console_talk); + /* screen */ devscreen = uxn_port(&u, 0x2, screen_talk); + /* audio0 */ devaudio0 = uxn_port(&u, 0x3, audio_talk); + /* audio1 */ uxn_port(&u, 0x4, audio_talk); + /* audio2 */ uxn_port(&u, 0x5, audio_talk); + /* audio3 */ uxn_port(&u, 0x6, audio_talk); + /* unused */ uxn_port(&u, 0x7, nil_talk); + /* control */ devctrl = uxn_port(&u, 0x8, nil_talk); + /* mouse */ devmouse = uxn_port(&u, 0x9, nil_talk); + /* file */ uxn_port(&u, 0xa, file_talk); + /* datetime */ uxn_port(&u, 0xb, datetime_talk); + /* unused */ uxn_port(&u, 0xc, nil_talk); + /* unused */ uxn_port(&u, 0xd, nil_talk); + /* unused */ uxn_port(&u, 0xe, nil_talk); + /* unused */ uxn_port(&u, 0xf, nil_talk); + + /* Write screen size */ poke16(devscreen->dat, 2, ppu.width); poke16(devscreen->dat, 4, ppu.height);