Removed POKDEV

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

View File

@ -242,16 +242,16 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port)
if(len > 0x10000 - addr) if(len > 0x10000 - addr)
len = 0x10000 - addr; len = 0x10000 - addr;
res = file_stat(c, &ram[addr], len); res = file_stat(c, &ram[addr], len);
POKDEV(0x2, res); POKE16(d + 0x2, res);
break; break;
case 0x6: case 0x6:
res = file_delete(c); res = file_delete(c);
POKDEV(0x2, res); POKE16(d + 0x2, res);
break; break;
case 0x9: case 0x9:
addr = PEEK16(d + 0x8); addr = PEEK16(d + 0x8);
res = file_init(c, (char *)&ram[addr], 0x10000 - addr, 0); res = file_init(c, (char *)&ram[addr], 0x10000 - addr, 0);
POKDEV(0x2, res); POKE16(d + 0x2, res);
break; break;
case 0xd: case 0xd:
addr = PEEK16(d + 0xc); addr = PEEK16(d + 0xc);
@ -259,7 +259,7 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port)
if(len > 0x10000 - addr) if(len > 0x10000 - addr)
len = 0x10000 - addr; len = 0x10000 - addr;
res = file_read(c, &ram[addr], len); res = file_read(c, &ram[addr], len);
POKDEV(0x2, res); POKE16(d + 0x2, res);
break; break;
case 0xf: case 0xf:
addr = PEEK16(d + 0xe); addr = PEEK16(d + 0xe);
@ -267,7 +267,7 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port)
if(len > 0x10000 - addr) if(len > 0x10000 - addr)
len = 0x10000 - addr; len = 0x10000 - addr;
res = file_write(c, &ram[addr], len, d[0x7]); res = file_write(c, &ram[addr], len, d[0x7]);
POKDEV(0x2, res); POKE16(d + 0x2, res);
break; break;
} }
} }
@ -281,7 +281,7 @@ file_dei(Uint8 id, Uint8 *d, Uint8 port)
case 0xc: case 0xc:
case 0xd: case 0xd:
res = file_read(c, &d[port], 1); res = file_read(c, &d[port], 1);
POKDEV(0x2, res); POKE16(d + 0x2, res);
break; break;
} }
return d[port]; return d[port];

View File

@ -29,17 +29,17 @@ mouse_up(Uxn *u, Uint8 *d, Uint8 mask)
void void
mouse_pos(Uxn *u, Uint8 *d, Uint16 x, Uint16 y) mouse_pos(Uxn *u, Uint8 *d, Uint16 x, Uint16 y)
{ {
POKDEV(0x2, x); POKE16(d + 0x2, x);
POKDEV(0x4, y); POKE16(d + 0x4, y);
uxn_eval(u, PEEK16(d)); uxn_eval(u, PEEK16(d));
} }
void void
mouse_scroll(Uxn *u, Uint8 *d, Uint16 x, Uint16 y) mouse_scroll(Uxn *u, Uint8 *d, Uint16 x, Uint16 y)
{ {
POKDEV(0xa, x); POKE16(d + 0xa, x);
POKDEV(0xc, -y); POKE16(d + 0xc, -y);
uxn_eval(u, PEEK16(d)); uxn_eval(u, PEEK16(d));
POKDEV(0xa, 0); POKE16(d + 0xa, 0);
POKDEV(0xc, 0); POKE16(d + 0xc, 0);
} }

View File

@ -16,8 +16,6 @@ WITH REGARD TO THIS SOFTWARE.
#define POKE16(d, v) { (d)[0] = (v) >> 8; (d)[1] = (v); } #define POKE16(d, v) { (d)[0] = (v) >> 8; (d)[1] = (v); }
#define PEEK16(d) ((d)[0] << 8 | (d)[1]) #define PEEK16(d) ((d)[0] << 8 | (d)[1])
#define POKDEV(x, y) { d[(x)] = (y) >> 8; d[(x) + 1] = (y); }
/* clang-format on */ /* clang-format on */
typedef unsigned char Uint8; typedef unsigned char Uint8;