~rabbits/uxn

486a60b1bd4a1fb8941542ef7f06e313d612fadb — Devine Lu Linvega 12 days ago 53f3c18
Removed PEKDEV macro
3 files changed, 10 insertions(+), 14 deletions(-)

M src/devices/audio.c
M src/devices/file.c
M src/uxn.h
M src/devices/audio.c => src/devices/audio.c +3 -6
@@ 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 {

M src/devices/file.c => src/devices/file.c +7 -7
@@ 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]);

M src/uxn.h => src/uxn.h +0 -1
@@ 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 */