uxn

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

commit abd7ab403e6453b64a4bb799c1b6de081e9f19db
parent 486a60b1bd4a1fb8941542ef7f06e313d612fadb
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Wed,  1 Mar 2023 10:53:44 -0800

Removed POKDEV

Diffstat:
Msrc/devices/file.c | 12++++++------
Msrc/devices/mouse.c | 12++++++------
Msrc/uxn.h | 2--
3 files changed, 12 insertions(+), 14 deletions(-)

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