diff --git a/src/devices/file.c b/src/devices/file.c index f1e7ce4..6edbf59 100644 --- a/src/devices/file.c +++ b/src/devices/file.c @@ -242,16 +242,16 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port) if(len > 0x10000 - addr) len = 0x10000 - addr; res = file_stat(c, &ram[addr], len); - POKDEV(0x2, res); + POKE16(d + 0x2, res); break; case 0x6: res = file_delete(c); - POKDEV(0x2, res); + POKE16(d + 0x2, res); break; case 0x9: addr = PEEK16(d + 0x8); res = file_init(c, (char *)&ram[addr], 0x10000 - addr, 0); - POKDEV(0x2, res); + POKE16(d + 0x2, res); break; case 0xd: addr = PEEK16(d + 0xc); @@ -259,7 +259,7 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port) if(len > 0x10000 - addr) len = 0x10000 - addr; res = file_read(c, &ram[addr], len); - POKDEV(0x2, res); + POKE16(d + 0x2, res); break; case 0xf: addr = PEEK16(d + 0xe); @@ -267,7 +267,7 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port) if(len > 0x10000 - addr) len = 0x10000 - addr; res = file_write(c, &ram[addr], len, d[0x7]); - POKDEV(0x2, res); + POKE16(d + 0x2, res); break; } } @@ -281,7 +281,7 @@ file_dei(Uint8 id, Uint8 *d, Uint8 port) case 0xc: case 0xd: res = file_read(c, &d[port], 1); - POKDEV(0x2, res); + POKE16(d + 0x2, res); break; } return d[port]; diff --git a/src/devices/mouse.c b/src/devices/mouse.c index 61a3368..593e054 100644 --- a/src/devices/mouse.c +++ b/src/devices/mouse.c @@ -29,17 +29,17 @@ mouse_up(Uxn *u, Uint8 *d, Uint8 mask) void mouse_pos(Uxn *u, Uint8 *d, Uint16 x, Uint16 y) { - POKDEV(0x2, x); - POKDEV(0x4, y); + POKE16(d + 0x2, x); + POKE16(d + 0x4, y); uxn_eval(u, PEEK16(d)); } void mouse_scroll(Uxn *u, Uint8 *d, Uint16 x, Uint16 y) { - POKDEV(0xa, x); - POKDEV(0xc, -y); + POKE16(d + 0xa, x); + POKE16(d + 0xc, -y); uxn_eval(u, PEEK16(d)); - POKDEV(0xa, 0); - POKDEV(0xc, 0); + POKE16(d + 0xa, 0); + POKE16(d + 0xc, 0); } diff --git a/src/uxn.h b/src/uxn.h index 7bdc8ea..bcfc489 100644 --- a/src/uxn.h +++ b/src/uxn.h @@ -16,8 +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 POKDEV(x, y) { d[(x)] = (y) >> 8; d[(x) + 1] = (y); } - /* clang-format on */ typedef unsigned char Uint8;