uxn

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

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

Removed PEKDEV macro

Diffstat:
Msrc/devices/audio.c | 9+++------
Msrc/devices/file.c | 14+++++++-------
Msrc/uxn.h | 1-
3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/src/devices/audio.c b/src/devices/audio.c @@ -75,18 +75,15 @@ void audio_start(int instance, Uint8 *d, Uxn *u) { UxnAudio *c = &uxn_audio[instance]; - Uint16 addr, adsr; - Uint8 pitch; - PEKDEV(adsr, 0x8); - PEKDEV(c->len, 0xa); - PEKDEV(addr, 0xc); + Uint8 pitch = d[0xf] & 0x7f; + Uint16 addr = PEEK16(d + 0xc), adsr = PEEK16(d + 0x8); + c->len = PEEK16(d + 0xa); if(c->len > 0x10000 - addr) c->len = 0x10000 - addr; c->addr = &u->ram[addr]; c->volume[0] = d[0xe] >> 4; c->volume[1] = d[0xe] & 0xf; c->repeat = !(d[0xf] & 0x80); - pitch = d[0xf] & 0x7f; if(pitch < 108 && c->len) c->advance = advances[pitch % 12] >> (8 - pitch / 12); else { diff --git a/src/devices/file.c b/src/devices/file.c @@ -237,8 +237,8 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port) Uint16 addr, len, res; switch(port) { case 0x5: - PEKDEV(addr, 0x4); - PEKDEV(len, 0xa); + addr = PEEK16(d + 0x4); + len = PEEK16(d + 0xa); if(len > 0x10000 - addr) len = 0x10000 - addr; res = file_stat(c, &ram[addr], len); @@ -249,21 +249,21 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port) POKDEV(0x2, res); break; case 0x9: - PEKDEV(addr, 0x8); + addr = PEEK16(d + 0x8); res = file_init(c, (char *)&ram[addr], 0x10000 - addr, 0); POKDEV(0x2, res); break; case 0xd: - PEKDEV(addr, 0xc); - PEKDEV(len, 0xa); + addr = PEEK16(d + 0xc); + len = PEEK16(d + 0xa); if(len > 0x10000 - addr) len = 0x10000 - addr; res = file_read(c, &ram[addr], len); POKDEV(0x2, res); break; case 0xf: - PEKDEV(addr, 0xe); - PEKDEV(len, 0xa); + addr = PEEK16(d + 0xe); + len = PEEK16(d + 0xa); if(len > 0x10000 - addr) len = 0x10000 - addr; res = file_write(c, &ram[addr], len, d[0x7]); diff --git a/src/uxn.h b/src/uxn.h @@ -17,7 +17,6 @@ WITH REGARD TO THIS SOFTWARE. #define PEEK16(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]; } /* clang-format on */