diff --git a/src/uxn-fast.c b/src/uxn-fast.c index c8e4a7c..81ba839 100644 --- 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 index 017b7c5..1dd378e 100644 --- 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 index 20154c2..89a2127 100644 --- 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 index ace80a3..3a00a88 100644 --- 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 index bffb8bf..1aa87b9 100644 --- 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); + /* 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 to dev/screen */ + /* Write screen size */ poke16(devscreen->dat, 2, ppu.width); poke16(devscreen->dat, 4, ppu.height);