Removed GETVEC macro

This commit is contained in:
Devine Lu Linvega 2023-03-01 10:42:03 -08:00
parent 87de244d37
commit 53f3c18dcf
6 changed files with 12 additions and 13 deletions

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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]; }

View File

@ -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

View File

@ -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();