Removed PEKDEV macro

This commit is contained in:
Devine Lu Linvega 2023-03-01 10:49:25 -08:00
parent 53f3c18dcf
commit 486a60b1bd
3 changed files with 10 additions and 14 deletions

View File

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

View File

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

View File

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