uxn

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

commit 53f3c18dcf6227bc382e77a4b9062dec0ddcd334
parent 87de244d3740908fea7ae151bcec3f71705a4e7a
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Wed,  1 Mar 2023 10:42:03 -0800

Removed GETVEC macro

Diffstat:
Msrc/devices/controller.c | 6+++---
Msrc/devices/mouse.c | 8++++----
Msrc/devices/system.c | 2+-
Msrc/uxn.h | 1-
Msrc/uxncli.c | 2+-
Msrc/uxnemu.c | 6+++---
6 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/devices/controller.c b/src/devices/controller.c @@ -17,7 +17,7 @@ controller_down(Uxn *u, Uint8 *d, Uint8 mask) { if(mask) { d[2] |= mask; - uxn_eval(u, GETVEC(d)); + uxn_eval(u, PEEK16(d)); } } @@ -26,7 +26,7 @@ controller_up(Uxn *u, Uint8 *d, Uint8 mask) { if(mask) { d[2] &= (~mask); - uxn_eval(u, GETVEC(d)); + uxn_eval(u, PEEK16(d)); } } @@ -35,7 +35,7 @@ controller_key(Uxn *u, Uint8 *d, Uint8 key) { if(key) { d[3] = key; - uxn_eval(u, GETVEC(d)); + uxn_eval(u, PEEK16(d)); d[3] = 0x00; } } diff --git a/src/devices/mouse.c b/src/devices/mouse.c @@ -16,14 +16,14 @@ void mouse_down(Uxn *u, Uint8 *d, Uint8 mask) { d[6] |= mask; - uxn_eval(u, GETVEC(d)); + uxn_eval(u, PEEK16(d)); } void mouse_up(Uxn *u, Uint8 *d, Uint8 mask) { d[6] &= (~mask); - uxn_eval(u, GETVEC(d)); + uxn_eval(u, PEEK16(d)); } void @@ -31,7 +31,7 @@ mouse_pos(Uxn *u, Uint8 *d, Uint16 x, Uint16 y) { POKDEV(0x2, x); POKDEV(0x4, y); - uxn_eval(u, GETVEC(d)); + uxn_eval(u, PEEK16(d)); } void @@ -39,7 +39,7 @@ mouse_scroll(Uxn *u, Uint8 *d, Uint16 x, Uint16 y) { POKDEV(0xa, x); POKDEV(0xc, -y); - uxn_eval(u, GETVEC(d)); + uxn_eval(u, PEEK16(d)); POKDEV(0xa, 0); POKDEV(0xc, 0); } diff --git a/src/devices/system.c b/src/devices/system.c @@ -87,7 +87,7 @@ int uxn_halt(Uxn *u, Uint8 instr, Uint8 err, Uint16 addr) { Uint8 *d = &u->dev[0x00]; - Uint16 handler = GETVEC(d); + Uint16 handler = PEEK16(d); if(handler) { u->wst->ptr = 4; u->wst->dat[0] = addr >> 0x8; diff --git a/src/uxn.h b/src/uxn.h @@ -16,7 +16,6 @@ WITH REGARD TO THIS SOFTWARE. #define POKE16(d, v) { (d)[0] = (v) >> 8; (d)[1] = (v); } #define PEEK16(d) ((d)[0] << 8 | (d)[1]) -#define GETVEC(d) ((d)[0] << 8 | (d)[1]) #define POKDEV(x, y) { d[(x)] = (y) >> 8; d[(x) + 1] = (y); } #define PEKDEV(o, x) { (o) = (d[(x)] << 8) + d[(x) + 1]; } diff --git a/src/uxncli.c b/src/uxncli.c @@ -31,7 +31,7 @@ console_input(Uxn *u, char c) { Uint8 *d = &u->dev[0x10]; d[0x02] = c; - return uxn_eval(u, GETVEC(d)); + return uxn_eval(u, PEEK16(d)); } static void diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -67,7 +67,7 @@ console_input(Uxn *u, char c) { Uint8 *d = &u->dev[0x10]; d[0x02] = c; - return uxn_eval(u, GETVEC(d)); + return uxn_eval(u, PEEK16(d)); } static void @@ -388,7 +388,7 @@ handle_events(Uxn *u) } /* Audio */ else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) { - uxn_eval(u, GETVEC(&u->dev[0x30 + 0x10 * (event.type - audio0_event)])); + uxn_eval(u, PEEK16(&u->dev[0x30 + 0x10 * (event.type - audio0_event)])); } /* Mouse */ else if(event.type == SDL_MOUSEMOTION) @@ -445,7 +445,7 @@ run(Uxn *u) exec_deadline = now + deadline_interval; if(!handle_events(u)) return 0; - uxn_eval(u, GETVEC(&u->dev[0x20])); + uxn_eval(u, PEEK16(&u->dev[0x20])); if(uxn_screen.fg.changed || uxn_screen.bg.changed) redraw(); now = SDL_GetPerformanceCounter();