@@ 75,11 75,9 @@ system_cmd(Uint8 *ram, Uint16 addr)
static void
system_deo(Uint8 *d, Uint8 port)
{
- Uint16 a;
switch(port) {
case 0x3:
- PEKDEV(a, 0x2);
- system_cmd(u.ram, a);
+ system_cmd(u.ram, PEEK16(d+0x2));
break;
}
}
@@ 108,10 106,8 @@ screen_deo(Uint8 *d, Uint8 port)
{
switch(port) {
case 0xe: {
- Uint16 x, y;
+ Uint16 x = PEEK16(d + 0x8), y = PEEK16(d + 0xa);
Uint8 fg = !!(d[0xe] & 0x40);
- PEKDEV(x, 0x8);
- PEKDEV(y, 0xa);
ppu_pixel(&ppu, fg, x, y, d[0xe] & 0x3);
if(d[0x6] & 0x01) POKDEV(0x8, x + 1); /* auto x+1 */
if(d[0x6] & 0x02) POKDEV(0xa, y + 1); /* auto y+1 */
@@ 119,13 115,9 @@ screen_deo(Uint8 *d, Uint8 port)
break;
}
case 0xf: {
- Uint16 x, y, dx, dy, addr;
- Uint8 i, n, twobpp = !!(d[0xf] & 0x80);
+ Uint16 x = PEEK16(d + 0x8), y = PEEK16(d + 0xa), dx, dy, addr = PEEK16(d + 0xc);
+ Uint8 i, n = d[0x6] >> 4, twobpp = !!(d[0xf] & 0x80);
Uint8 fg = !!(d[0xf] & 0x40);
- PEKDEV(x, 0x8);
- PEKDEV(y, 0xa);
- PEKDEV(addr, 0xc);
- n = d[0x6] >> 4;
dx = (d[0x6] & 0x01) << 3;
dy = (d[0x6] & 0x02) << 2;
if(addr >= 0xff00)
@@ 21,7 21,6 @@ typedef unsigned int Uint32;
#define GETVEC(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 */