| ... | ... |
@@ -3,7 +3,7 @@ local replacements = {
|
| 3 | 3 |
op_and16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d & b); push8(u->src, c & a); }',
|
| 4 | 4 |
op_ora16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d | b); push8(u->src, c | a); }',
|
| 5 | 5 |
op_eor16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d ^ b); push8(u->src, c ^ a); }',
|
| 6 |
- op_lit16 = '{ push8(u->src, mempeek8(u->ram.dat, u->ram.ptr++)); push8(u->src, mempeek8(u->ram.dat, u->ram.ptr++)); }',
|
|
| 6 |
+ op_lit16 = '{ push8(u->src, peek8(u->ram.dat, u->ram.ptr++)); push8(u->src, peek8(u->ram.dat, u->ram.ptr++)); }',
|
|
| 7 | 7 |
op_swp16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, b); push8(u->src, a); push8(u->src, d); push8(u->src, c); }',
|
| 8 | 8 |
op_ovr16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d); push8(u->src, c); push8(u->src, b); push8(u->src, a); push8(u->src, d); push8(u->src, c); }',
|
| 9 | 9 |
op_dup16 = '{ Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b); push8(u->src, a); push8(u->src, b); push8(u->src, a); }',
|
| ... | ... |
@@ -295,7 +295,7 @@ See etc/mkuxn-fast.moon for instructions. |
| 295 | 295 |
local _continue_0 = false |
| 296 | 296 |
repeat |
| 297 | 297 |
local l = f:read('*l')
|
| 298 |
- if l:match(' push') or l:match('[ *]pop') or l:match('devpeek16') then
|
|
| 298 |
+ if l:match(' push') or l:match('[ *]pop') or l:match('devr16') then
|
|
| 299 | 299 |
_continue_0 = true |
| 300 | 300 |
break |
| 301 | 301 |
end |
| ... | ... |
@@ -23,7 +23,7 @@ replacements = |
| 23 | 23 |
op_and16: '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d & b); push8(u->src, c & a); }'
|
| 24 | 24 |
op_ora16: '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d | b); push8(u->src, c | a); }'
|
| 25 | 25 |
op_eor16: '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d ^ b); push8(u->src, c ^ a); }'
|
| 26 |
- op_lit16: '{ push8(u->src, mempeek8(u->ram.dat, u->ram.ptr++)); push8(u->src, mempeek8(u->ram.dat, u->ram.ptr++)); }'
|
|
| 26 |
+ op_lit16: '{ push8(u->src, peek8(u->ram.dat, u->ram.ptr++)); push8(u->src, peek8(u->ram.dat, u->ram.ptr++)); }'
|
|
| 27 | 27 |
op_swp16: '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, b); push8(u->src, a); push8(u->src, d); push8(u->src, c); }'
|
| 28 | 28 |
op_ovr16: '{ Uint8 a = pop8(u->src), b = pop8(u->src), c = pop8(u->src), d = pop8(u->src); push8(u->src, d); push8(u->src, c); push8(u->src, b); push8(u->src, a); push8(u->src, d); push8(u->src, c); }'
|
| 29 | 29 |
op_dup16: '{ Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b); push8(u->src, a); push8(u->src, b); push8(u->src, a); }'
|
| ... | ... |
@@ -214,7 +214,7 @@ See etc/mkuxn-fast.moon for instructions. |
| 214 | 214 |
wanted = true |
| 215 | 215 |
while true |
| 216 | 216 |
l = f\read '*l' |
| 217 |
- if l\match' push' or l\match'[ *]pop' or l\match'devpeek16' |
|
| 217 |
+ if l\match' push' or l\match'[ *]pop' or l\match'devr16' |
|
| 218 | 218 |
continue |
| 219 | 219 |
if l == '/* Stack */' |
| 220 | 220 |
wanted = false |
| ... | ... |
@@ -29,13 +29,13 @@ See etc/mkuxn-fast.moon for instructions. |
| 29 | 29 |
#pragma mark - Operations |
| 30 | 30 |
|
| 31 | 31 |
/* clang-format off */ |
| 32 |
-static void mempoke8(Uint8 *m, Uint16 a, Uint8 b) { m[a] = b; }
|
|
| 33 |
-static Uint8 mempeek8(Uint8 *m, Uint16 a) { return m[a]; }
|
|
| 34 |
-static void devpoke8(Device *d, Uint8 a, Uint8 b) { d->dat[a & 0xf] = b; d->talk(d, a & 0x0f, 1); }
|
|
| 35 |
-static Uint8 devpeek8(Device *d, Uint8 a) { d->talk(d, a & 0x0f, 0); return d->dat[a & 0xf]; }
|
|
| 36 |
-void mempoke16(Uint8 *m, Uint16 a, Uint16 b) { mempoke8(m, a, b >> 8); mempoke8(m, a + 1, b); }
|
|
| 37 |
-Uint16 mempeek16(Uint8 *m, Uint16 a) { return (mempeek8(m, a) << 8) + mempeek8(m, a + 1); }
|
|
| 38 |
-static void devpoke16(Device *d, Uint8 a, Uint16 b) { devpoke8(d, a, b >> 8); devpoke8(d, a + 1, b); }
|
|
| 32 |
+static void poke8(Uint8 *m, Uint16 a, Uint8 b) { m[a] = b; }
|
|
| 33 |
+static Uint8 peek8(Uint8 *m, Uint16 a) { return m[a]; }
|
|
| 34 |
+static void devw8(Device *d, Uint8 a, Uint8 b) { d->dat[a & 0xf] = b; d->talk(d, a & 0x0f, 1); }
|
|
| 35 |
+static Uint8 devr8(Device *d, Uint8 a) { d->talk(d, a & 0x0f, 0); return d->dat[a & 0xf]; }
|
|
| 36 |
+void poke16(Uint8 *m, Uint16 a, Uint16 b) { poke8(m, a, b >> 8); poke8(m, a + 1, b); }
|
|
| 37 |
+Uint16 peek16(Uint8 *m, Uint16 a) { return (peek8(m, a) << 8) + peek8(m, a + 1); }
|
|
| 38 |
+static void devw16(Device *d, Uint8 a, Uint16 b) { devw8(d, a, b >> 8); devw8(d, a + 1, b); }
|
|
| 39 | 39 |
|
| 40 | 40 |
/* clang-format on */ |
| 41 | 41 |
|
| ... | ... |
@@ -57,7 +57,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 57 | 57 |
case 0x00: /* LIT */ |
| 58 | 58 |
case 0x80: /* LITk */ |
| 59 | 59 |
{
|
| 60 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++); |
|
| 60 |
+ u->wst.dat[u->wst.ptr] = peek8(u->ram.dat, u->ram.ptr++); |
|
| 61 | 61 |
#ifndef NO_STACK_CHECKS |
| 62 | 62 |
if(__builtin_expect(u->wst.ptr > 254, 0)) {
|
| 63 | 63 |
u->wst.error = 2; |
| ... | ... |
@@ -289,7 +289,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 289 | 289 |
case 0x10: /* LDZ */ |
| 290 | 290 |
{
|
| 291 | 291 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 292 |
- u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a); |
|
| 292 |
+ u->wst.dat[u->wst.ptr - 1] = peek8(u->ram.dat, a); |
|
| 293 | 293 |
#ifndef NO_STACK_CHECKS |
| 294 | 294 |
if(__builtin_expect(u->wst.ptr < 1, 0)) {
|
| 295 | 295 |
u->wst.error = 1; |
| ... | ... |
@@ -302,7 +302,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 302 | 302 |
{
|
| 303 | 303 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 304 | 304 |
Uint8 b = u->wst.dat[u->wst.ptr - 2]; |
| 305 |
- mempoke8(u->ram.dat, a, b); |
|
| 305 |
+ poke8(u->ram.dat, a, b); |
|
| 306 | 306 |
#ifndef NO_STACK_CHECKS |
| 307 | 307 |
if(__builtin_expect(u->wst.ptr < 2, 0)) {
|
| 308 | 308 |
u->wst.error = 1; |
| ... | ... |
@@ -315,7 +315,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 315 | 315 |
case 0x12: /* LDR */ |
| 316 | 316 |
{
|
| 317 | 317 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 318 |
- u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 318 |
+ u->wst.dat[u->wst.ptr - 1] = peek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 319 | 319 |
#ifndef NO_STACK_CHECKS |
| 320 | 320 |
if(__builtin_expect(u->wst.ptr < 1, 0)) {
|
| 321 | 321 |
u->wst.error = 1; |
| ... | ... |
@@ -328,7 +328,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 328 | 328 |
{
|
| 329 | 329 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 330 | 330 |
Uint8 b = u->wst.dat[u->wst.ptr - 2]; |
| 331 |
- mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 331 |
+ poke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 332 | 332 |
#ifndef NO_STACK_CHECKS |
| 333 | 333 |
if(__builtin_expect(u->wst.ptr < 2, 0)) {
|
| 334 | 334 |
u->wst.error = 1; |
| ... | ... |
@@ -341,7 +341,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 341 | 341 |
case 0x14: /* LDA */ |
| 342 | 342 |
{
|
| 343 | 343 |
Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
| 344 |
- u->wst.dat[u->wst.ptr - 2] = mempeek8(u->ram.dat, a); |
|
| 344 |
+ u->wst.dat[u->wst.ptr - 2] = peek8(u->ram.dat, a); |
|
| 345 | 345 |
#ifndef NO_STACK_CHECKS |
| 346 | 346 |
if(__builtin_expect(u->wst.ptr < 2, 0)) {
|
| 347 | 347 |
u->wst.error = 1; |
| ... | ... |
@@ -355,7 +355,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 355 | 355 |
{
|
| 356 | 356 |
Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
| 357 | 357 |
Uint8 b = u->wst.dat[u->wst.ptr - 3]; |
| 358 |
- mempoke8(u->ram.dat, a, b); |
|
| 358 |
+ poke8(u->ram.dat, a, b); |
|
| 359 | 359 |
#ifndef NO_STACK_CHECKS |
| 360 | 360 |
if(__builtin_expect(u->wst.ptr < 3, 0)) {
|
| 361 | 361 |
u->wst.error = 1; |
| ... | ... |
@@ -368,7 +368,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 368 | 368 |
case 0x16: /* DEI */ |
| 369 | 369 |
{
|
| 370 | 370 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 371 |
- u->wst.dat[u->wst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); |
|
| 371 |
+ u->wst.dat[u->wst.ptr - 1] = devr8(&u->dev[a >> 4], a); |
|
| 372 | 372 |
#ifndef NO_STACK_CHECKS |
| 373 | 373 |
if(__builtin_expect(u->wst.ptr < 1, 0)) {
|
| 374 | 374 |
u->wst.error = 1; |
| ... | ... |
@@ -380,7 +380,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 380 | 380 |
case 0x17: /* DEO */ |
| 381 | 381 |
{
|
| 382 | 382 |
Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
| 383 |
- devpoke8(&u->dev[a >> 4], a, b); |
|
| 383 |
+ devw8(&u->dev[a >> 4], a, b); |
|
| 384 | 384 |
#ifndef NO_STACK_CHECKS |
| 385 | 385 |
if(__builtin_expect(u->wst.ptr < 2, 0)) {
|
| 386 | 386 |
u->wst.error = 1; |
| ... | ... |
@@ -504,7 +504,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 504 | 504 |
case 0x20: /* LITr */ |
| 505 | 505 |
case 0xa0: /* LITkr */ |
| 506 | 506 |
{
|
| 507 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++); |
|
| 507 |
+ u->rst.dat[u->rst.ptr] = peek8(u->ram.dat, u->ram.ptr++); |
|
| 508 | 508 |
#ifndef NO_STACK_CHECKS |
| 509 | 509 |
if(__builtin_expect(u->rst.ptr > 254, 0)) {
|
| 510 | 510 |
u->rst.error = 2; |
| ... | ... |
@@ -736,7 +736,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 736 | 736 |
case 0x30: /* LDZr */ |
| 737 | 737 |
{
|
| 738 | 738 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 739 |
- u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a); |
|
| 739 |
+ u->rst.dat[u->rst.ptr - 1] = peek8(u->ram.dat, a); |
|
| 740 | 740 |
#ifndef NO_STACK_CHECKS |
| 741 | 741 |
if(__builtin_expect(u->rst.ptr < 1, 0)) {
|
| 742 | 742 |
u->rst.error = 1; |
| ... | ... |
@@ -749,7 +749,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 749 | 749 |
{
|
| 750 | 750 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 751 | 751 |
Uint8 b = u->rst.dat[u->rst.ptr - 2]; |
| 752 |
- mempoke8(u->ram.dat, a, b); |
|
| 752 |
+ poke8(u->ram.dat, a, b); |
|
| 753 | 753 |
#ifndef NO_STACK_CHECKS |
| 754 | 754 |
if(__builtin_expect(u->rst.ptr < 2, 0)) {
|
| 755 | 755 |
u->rst.error = 1; |
| ... | ... |
@@ -762,7 +762,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 762 | 762 |
case 0x32: /* LDRr */ |
| 763 | 763 |
{
|
| 764 | 764 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 765 |
- u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 765 |
+ u->rst.dat[u->rst.ptr - 1] = peek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 766 | 766 |
#ifndef NO_STACK_CHECKS |
| 767 | 767 |
if(__builtin_expect(u->rst.ptr < 1, 0)) {
|
| 768 | 768 |
u->rst.error = 1; |
| ... | ... |
@@ -775,7 +775,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 775 | 775 |
{
|
| 776 | 776 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 777 | 777 |
Uint8 b = u->rst.dat[u->rst.ptr - 2]; |
| 778 |
- mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 778 |
+ poke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 779 | 779 |
#ifndef NO_STACK_CHECKS |
| 780 | 780 |
if(__builtin_expect(u->rst.ptr < 2, 0)) {
|
| 781 | 781 |
u->rst.error = 1; |
| ... | ... |
@@ -788,7 +788,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 788 | 788 |
case 0x34: /* LDAr */ |
| 789 | 789 |
{
|
| 790 | 790 |
Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
| 791 |
- u->rst.dat[u->rst.ptr - 2] = mempeek8(u->ram.dat, a); |
|
| 791 |
+ u->rst.dat[u->rst.ptr - 2] = peek8(u->ram.dat, a); |
|
| 792 | 792 |
#ifndef NO_STACK_CHECKS |
| 793 | 793 |
if(__builtin_expect(u->rst.ptr < 2, 0)) {
|
| 794 | 794 |
u->rst.error = 1; |
| ... | ... |
@@ -802,7 +802,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 802 | 802 |
{
|
| 803 | 803 |
Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
| 804 | 804 |
Uint8 b = u->rst.dat[u->rst.ptr - 3]; |
| 805 |
- mempoke8(u->ram.dat, a, b); |
|
| 805 |
+ poke8(u->ram.dat, a, b); |
|
| 806 | 806 |
#ifndef NO_STACK_CHECKS |
| 807 | 807 |
if(__builtin_expect(u->rst.ptr < 3, 0)) {
|
| 808 | 808 |
u->rst.error = 1; |
| ... | ... |
@@ -815,7 +815,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 815 | 815 |
case 0x36: /* DEIr */ |
| 816 | 816 |
{
|
| 817 | 817 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 818 |
- u->rst.dat[u->rst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); |
|
| 818 |
+ u->rst.dat[u->rst.ptr - 1] = devr8(&u->dev[a >> 4], a); |
|
| 819 | 819 |
#ifndef NO_STACK_CHECKS |
| 820 | 820 |
if(__builtin_expect(u->rst.ptr < 1, 0)) {
|
| 821 | 821 |
u->rst.error = 1; |
| ... | ... |
@@ -827,7 +827,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 827 | 827 |
case 0x37: /* DEOr */ |
| 828 | 828 |
{
|
| 829 | 829 |
Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
| 830 |
- devpoke8(&u->dev[a >> 4], a, b); |
|
| 830 |
+ devw8(&u->dev[a >> 4], a, b); |
|
| 831 | 831 |
#ifndef NO_STACK_CHECKS |
| 832 | 832 |
if(__builtin_expect(u->rst.ptr < 2, 0)) {
|
| 833 | 833 |
u->rst.error = 1; |
| ... | ... |
@@ -951,8 +951,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 951 | 951 |
case 0x40: /* LIT2 */ |
| 952 | 952 |
case 0xc0: /* LIT2k */ |
| 953 | 953 |
{
|
| 954 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++); |
|
| 955 |
- u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr++); |
|
| 954 |
+ u->wst.dat[u->wst.ptr] = peek8(u->ram.dat, u->ram.ptr++); |
|
| 955 |
+ u->wst.dat[u->wst.ptr + 1] = peek8(u->ram.dat, u->ram.ptr++); |
|
| 956 | 956 |
#ifndef NO_STACK_CHECKS |
| 957 | 957 |
if(__builtin_expect(u->wst.ptr > 253, 0)) {
|
| 958 | 958 |
u->wst.error = 2; |
| ... | ... |
@@ -1192,8 +1192,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1192 | 1192 |
case 0x50: /* LDZ2 */ |
| 1193 | 1193 |
{
|
| 1194 | 1194 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 1195 |
- u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a); |
|
| 1196 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a + 1); |
|
| 1195 |
+ u->wst.dat[u->wst.ptr - 1] = peek8(u->ram.dat, a); |
|
| 1196 |
+ u->wst.dat[u->wst.ptr] = peek8(u->ram.dat, a + 1); |
|
| 1197 | 1197 |
#ifndef NO_STACK_CHECKS |
| 1198 | 1198 |
if(__builtin_expect(u->wst.ptr < 1, 0)) {
|
| 1199 | 1199 |
u->wst.error = 1; |
| ... | ... |
@@ -1211,7 +1211,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1211 | 1211 |
{
|
| 1212 | 1212 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 1213 | 1213 |
Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
| 1214 |
- mempoke16(u->ram.dat, a, b); |
|
| 1214 |
+ poke16(u->ram.dat, a, b); |
|
| 1215 | 1215 |
#ifndef NO_STACK_CHECKS |
| 1216 | 1216 |
if(__builtin_expect(u->wst.ptr < 3, 0)) {
|
| 1217 | 1217 |
u->wst.error = 1; |
| ... | ... |
@@ -1224,8 +1224,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1224 | 1224 |
case 0x52: /* LDR2 */ |
| 1225 | 1225 |
{
|
| 1226 | 1226 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 1227 |
- u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 1228 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); |
|
| 1227 |
+ u->wst.dat[u->wst.ptr - 1] = peek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 1228 |
+ u->wst.dat[u->wst.ptr] = peek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); |
|
| 1229 | 1229 |
#ifndef NO_STACK_CHECKS |
| 1230 | 1230 |
if(__builtin_expect(u->wst.ptr < 1, 0)) {
|
| 1231 | 1231 |
u->wst.error = 1; |
| ... | ... |
@@ -1243,7 +1243,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1243 | 1243 |
{
|
| 1244 | 1244 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 1245 | 1245 |
Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
| 1246 |
- mempoke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 1246 |
+ poke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 1247 | 1247 |
#ifndef NO_STACK_CHECKS |
| 1248 | 1248 |
if(__builtin_expect(u->wst.ptr < 3, 0)) {
|
| 1249 | 1249 |
u->wst.error = 1; |
| ... | ... |
@@ -1256,8 +1256,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1256 | 1256 |
case 0x54: /* LDA2 */ |
| 1257 | 1257 |
{
|
| 1258 | 1258 |
Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
| 1259 |
- u->wst.dat[u->wst.ptr - 2] = mempeek8(u->ram.dat, a); |
|
| 1260 |
- u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a + 1); |
|
| 1259 |
+ u->wst.dat[u->wst.ptr - 2] = peek8(u->ram.dat, a); |
|
| 1260 |
+ u->wst.dat[u->wst.ptr - 1] = peek8(u->ram.dat, a + 1); |
|
| 1261 | 1261 |
#ifndef NO_STACK_CHECKS |
| 1262 | 1262 |
if(__builtin_expect(u->wst.ptr < 2, 0)) {
|
| 1263 | 1263 |
u->wst.error = 1; |
| ... | ... |
@@ -1270,7 +1270,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1270 | 1270 |
{
|
| 1271 | 1271 |
Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
| 1272 | 1272 |
Uint16 b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
| 1273 |
- mempoke16(u->ram.dat, a, b); |
|
| 1273 |
+ poke16(u->ram.dat, a, b); |
|
| 1274 | 1274 |
#ifndef NO_STACK_CHECKS |
| 1275 | 1275 |
if(__builtin_expect(u->wst.ptr < 4, 0)) {
|
| 1276 | 1276 |
u->wst.error = 1; |
| ... | ... |
@@ -1283,8 +1283,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1283 | 1283 |
case 0x56: /* DEI2 */ |
| 1284 | 1284 |
{
|
| 1285 | 1285 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 1286 |
- u->wst.dat[u->wst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); |
|
| 1287 |
- u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a + 1); |
|
| 1286 |
+ u->wst.dat[u->wst.ptr - 1] = devr8(&u->dev[a >> 4], a); |
|
| 1287 |
+ u->wst.dat[u->wst.ptr] = devr8(&u->dev[a >> 4], a + 1); |
|
| 1288 | 1288 |
#ifndef NO_STACK_CHECKS |
| 1289 | 1289 |
if(__builtin_expect(u->wst.ptr < 1, 0)) {
|
| 1290 | 1290 |
u->wst.error = 1; |
| ... | ... |
@@ -1302,7 +1302,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1302 | 1302 |
{
|
| 1303 | 1303 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 1304 | 1304 |
Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
| 1305 |
- devpoke16(&u->dev[a >> 4], a, b); |
|
| 1305 |
+ devw16(&u->dev[a >> 4], a, b); |
|
| 1306 | 1306 |
#ifndef NO_STACK_CHECKS |
| 1307 | 1307 |
if(__builtin_expect(u->wst.ptr < 3, 0)) {
|
| 1308 | 1308 |
u->wst.error = 1; |
| ... | ... |
@@ -1435,8 +1435,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1435 | 1435 |
case 0x60: /* LIT2r */ |
| 1436 | 1436 |
case 0xe0: /* LIT2kr */ |
| 1437 | 1437 |
{
|
| 1438 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++); |
|
| 1439 |
- u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr++); |
|
| 1438 |
+ u->rst.dat[u->rst.ptr] = peek8(u->ram.dat, u->ram.ptr++); |
|
| 1439 |
+ u->rst.dat[u->rst.ptr + 1] = peek8(u->ram.dat, u->ram.ptr++); |
|
| 1440 | 1440 |
#ifndef NO_STACK_CHECKS |
| 1441 | 1441 |
if(__builtin_expect(u->rst.ptr > 253, 0)) {
|
| 1442 | 1442 |
u->rst.error = 2; |
| ... | ... |
@@ -1676,8 +1676,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1676 | 1676 |
case 0x70: /* LDZ2r */ |
| 1677 | 1677 |
{
|
| 1678 | 1678 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 1679 |
- u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a); |
|
| 1680 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a + 1); |
|
| 1679 |
+ u->rst.dat[u->rst.ptr - 1] = peek8(u->ram.dat, a); |
|
| 1680 |
+ u->rst.dat[u->rst.ptr] = peek8(u->ram.dat, a + 1); |
|
| 1681 | 1681 |
#ifndef NO_STACK_CHECKS |
| 1682 | 1682 |
if(__builtin_expect(u->rst.ptr < 1, 0)) {
|
| 1683 | 1683 |
u->rst.error = 1; |
| ... | ... |
@@ -1695,7 +1695,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1695 | 1695 |
{
|
| 1696 | 1696 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 1697 | 1697 |
Uint16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); |
| 1698 |
- mempoke16(u->ram.dat, a, b); |
|
| 1698 |
+ poke16(u->ram.dat, a, b); |
|
| 1699 | 1699 |
#ifndef NO_STACK_CHECKS |
| 1700 | 1700 |
if(__builtin_expect(u->rst.ptr < 3, 0)) {
|
| 1701 | 1701 |
u->rst.error = 1; |
| ... | ... |
@@ -1708,8 +1708,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1708 | 1708 |
case 0x72: /* LDR2r */ |
| 1709 | 1709 |
{
|
| 1710 | 1710 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 1711 |
- u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 1712 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); |
|
| 1711 |
+ u->rst.dat[u->rst.ptr - 1] = peek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 1712 |
+ u->rst.dat[u->rst.ptr] = peek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); |
|
| 1713 | 1713 |
#ifndef NO_STACK_CHECKS |
| 1714 | 1714 |
if(__builtin_expect(u->rst.ptr < 1, 0)) {
|
| 1715 | 1715 |
u->rst.error = 1; |
| ... | ... |
@@ -1727,7 +1727,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1727 | 1727 |
{
|
| 1728 | 1728 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 1729 | 1729 |
Uint16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); |
| 1730 |
- mempoke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 1730 |
+ poke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 1731 | 1731 |
#ifndef NO_STACK_CHECKS |
| 1732 | 1732 |
if(__builtin_expect(u->rst.ptr < 3, 0)) {
|
| 1733 | 1733 |
u->rst.error = 1; |
| ... | ... |
@@ -1740,8 +1740,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1740 | 1740 |
case 0x74: /* LDA2r */ |
| 1741 | 1741 |
{
|
| 1742 | 1742 |
Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
| 1743 |
- u->rst.dat[u->rst.ptr - 2] = mempeek8(u->ram.dat, a); |
|
| 1744 |
- u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a + 1); |
|
| 1743 |
+ u->rst.dat[u->rst.ptr - 2] = peek8(u->ram.dat, a); |
|
| 1744 |
+ u->rst.dat[u->rst.ptr - 1] = peek8(u->ram.dat, a + 1); |
|
| 1745 | 1745 |
#ifndef NO_STACK_CHECKS |
| 1746 | 1746 |
if(__builtin_expect(u->rst.ptr < 2, 0)) {
|
| 1747 | 1747 |
u->rst.error = 1; |
| ... | ... |
@@ -1754,7 +1754,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1754 | 1754 |
{
|
| 1755 | 1755 |
Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
| 1756 | 1756 |
Uint16 b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); |
| 1757 |
- mempoke16(u->ram.dat, a, b); |
|
| 1757 |
+ poke16(u->ram.dat, a, b); |
|
| 1758 | 1758 |
#ifndef NO_STACK_CHECKS |
| 1759 | 1759 |
if(__builtin_expect(u->rst.ptr < 4, 0)) {
|
| 1760 | 1760 |
u->rst.error = 1; |
| ... | ... |
@@ -1767,8 +1767,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1767 | 1767 |
case 0x76: /* DEI2r */ |
| 1768 | 1768 |
{
|
| 1769 | 1769 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 1770 |
- u->rst.dat[u->rst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); |
|
| 1771 |
- u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a + 1); |
|
| 1770 |
+ u->rst.dat[u->rst.ptr - 1] = devr8(&u->dev[a >> 4], a); |
|
| 1771 |
+ u->rst.dat[u->rst.ptr] = devr8(&u->dev[a >> 4], a + 1); |
|
| 1772 | 1772 |
#ifndef NO_STACK_CHECKS |
| 1773 | 1773 |
if(__builtin_expect(u->rst.ptr < 1, 0)) {
|
| 1774 | 1774 |
u->rst.error = 1; |
| ... | ... |
@@ -1786,7 +1786,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 1786 | 1786 |
{
|
| 1787 | 1787 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 1788 | 1788 |
Uint16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); |
| 1789 |
- devpoke16(&u->dev[a >> 4], a, b); |
|
| 1789 |
+ devw16(&u->dev[a >> 4], a, b); |
|
| 1790 | 1790 |
#ifndef NO_STACK_CHECKS |
| 1791 | 1791 |
if(__builtin_expect(u->rst.ptr < 3, 0)) {
|
| 1792 | 1792 |
u->rst.error = 1; |
| ... | ... |
@@ -2167,7 +2167,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2167 | 2167 |
case 0x90: /* LDZk */ |
| 2168 | 2168 |
{
|
| 2169 | 2169 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 2170 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); |
|
| 2170 |
+ u->wst.dat[u->wst.ptr] = peek8(u->ram.dat, a); |
|
| 2171 | 2171 |
#ifndef NO_STACK_CHECKS |
| 2172 | 2172 |
if(__builtin_expect(u->wst.ptr < 1, 0)) {
|
| 2173 | 2173 |
u->wst.error = 1; |
| ... | ... |
@@ -2185,7 +2185,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2185 | 2185 |
{
|
| 2186 | 2186 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 2187 | 2187 |
Uint8 b = u->wst.dat[u->wst.ptr - 2]; |
| 2188 |
- mempoke8(u->ram.dat, a, b); |
|
| 2188 |
+ poke8(u->ram.dat, a, b); |
|
| 2189 | 2189 |
#ifndef NO_STACK_CHECKS |
| 2190 | 2190 |
if(__builtin_expect(u->wst.ptr < 2, 0)) {
|
| 2191 | 2191 |
u->wst.error = 1; |
| ... | ... |
@@ -2197,7 +2197,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2197 | 2197 |
case 0x92: /* LDRk */ |
| 2198 | 2198 |
{
|
| 2199 | 2199 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 2200 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 2200 |
+ u->wst.dat[u->wst.ptr] = peek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 2201 | 2201 |
#ifndef NO_STACK_CHECKS |
| 2202 | 2202 |
if(__builtin_expect(u->wst.ptr < 1, 0)) {
|
| 2203 | 2203 |
u->wst.error = 1; |
| ... | ... |
@@ -2215,7 +2215,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2215 | 2215 |
{
|
| 2216 | 2216 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 2217 | 2217 |
Uint8 b = u->wst.dat[u->wst.ptr - 2]; |
| 2218 |
- mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 2218 |
+ poke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 2219 | 2219 |
#ifndef NO_STACK_CHECKS |
| 2220 | 2220 |
if(__builtin_expect(u->wst.ptr < 2, 0)) {
|
| 2221 | 2221 |
u->wst.error = 1; |
| ... | ... |
@@ -2227,7 +2227,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2227 | 2227 |
case 0x94: /* LDAk */ |
| 2228 | 2228 |
{
|
| 2229 | 2229 |
Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
| 2230 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); |
|
| 2230 |
+ u->wst.dat[u->wst.ptr] = peek8(u->ram.dat, a); |
|
| 2231 | 2231 |
#ifndef NO_STACK_CHECKS |
| 2232 | 2232 |
if(__builtin_expect(u->wst.ptr < 2, 0)) {
|
| 2233 | 2233 |
u->wst.error = 1; |
| ... | ... |
@@ -2245,7 +2245,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2245 | 2245 |
{
|
| 2246 | 2246 |
Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
| 2247 | 2247 |
Uint8 b = u->wst.dat[u->wst.ptr - 3]; |
| 2248 |
- mempoke8(u->ram.dat, a, b); |
|
| 2248 |
+ poke8(u->ram.dat, a, b); |
|
| 2249 | 2249 |
#ifndef NO_STACK_CHECKS |
| 2250 | 2250 |
if(__builtin_expect(u->wst.ptr < 3, 0)) {
|
| 2251 | 2251 |
u->wst.error = 1; |
| ... | ... |
@@ -2257,7 +2257,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2257 | 2257 |
case 0x96: /* DEIk */ |
| 2258 | 2258 |
{
|
| 2259 | 2259 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 2260 |
- u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a); |
|
| 2260 |
+ u->wst.dat[u->wst.ptr] = devr8(&u->dev[a >> 4], a); |
|
| 2261 | 2261 |
#ifndef NO_STACK_CHECKS |
| 2262 | 2262 |
if(__builtin_expect(u->wst.ptr < 1, 0)) {
|
| 2263 | 2263 |
u->wst.error = 1; |
| ... | ... |
@@ -2274,7 +2274,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2274 | 2274 |
case 0x97: /* DEOk */ |
| 2275 | 2275 |
{
|
| 2276 | 2276 |
Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
| 2277 |
- devpoke8(&u->dev[a >> 4], a, b); |
|
| 2277 |
+ devw8(&u->dev[a >> 4], a, b); |
|
| 2278 | 2278 |
#ifndef NO_STACK_CHECKS |
| 2279 | 2279 |
if(__builtin_expect(u->wst.ptr < 2, 0)) {
|
| 2280 | 2280 |
u->wst.error = 1; |
| ... | ... |
@@ -2677,7 +2677,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2677 | 2677 |
case 0xb0: /* LDZkr */ |
| 2678 | 2678 |
{
|
| 2679 | 2679 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 2680 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); |
|
| 2680 |
+ u->rst.dat[u->rst.ptr] = peek8(u->ram.dat, a); |
|
| 2681 | 2681 |
#ifndef NO_STACK_CHECKS |
| 2682 | 2682 |
if(__builtin_expect(u->rst.ptr < 1, 0)) {
|
| 2683 | 2683 |
u->rst.error = 1; |
| ... | ... |
@@ -2695,7 +2695,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2695 | 2695 |
{
|
| 2696 | 2696 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 2697 | 2697 |
Uint8 b = u->rst.dat[u->rst.ptr - 2]; |
| 2698 |
- mempoke8(u->ram.dat, a, b); |
|
| 2698 |
+ poke8(u->ram.dat, a, b); |
|
| 2699 | 2699 |
#ifndef NO_STACK_CHECKS |
| 2700 | 2700 |
if(__builtin_expect(u->rst.ptr < 2, 0)) {
|
| 2701 | 2701 |
u->rst.error = 1; |
| ... | ... |
@@ -2707,7 +2707,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2707 | 2707 |
case 0xb2: /* LDRkr */ |
| 2708 | 2708 |
{
|
| 2709 | 2709 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 2710 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 2710 |
+ u->rst.dat[u->rst.ptr] = peek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 2711 | 2711 |
#ifndef NO_STACK_CHECKS |
| 2712 | 2712 |
if(__builtin_expect(u->rst.ptr < 1, 0)) {
|
| 2713 | 2713 |
u->rst.error = 1; |
| ... | ... |
@@ -2725,7 +2725,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2725 | 2725 |
{
|
| 2726 | 2726 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 2727 | 2727 |
Uint8 b = u->rst.dat[u->rst.ptr - 2]; |
| 2728 |
- mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 2728 |
+ poke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 2729 | 2729 |
#ifndef NO_STACK_CHECKS |
| 2730 | 2730 |
if(__builtin_expect(u->rst.ptr < 2, 0)) {
|
| 2731 | 2731 |
u->rst.error = 1; |
| ... | ... |
@@ -2737,7 +2737,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2737 | 2737 |
case 0xb4: /* LDAkr */ |
| 2738 | 2738 |
{
|
| 2739 | 2739 |
Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
| 2740 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); |
|
| 2740 |
+ u->rst.dat[u->rst.ptr] = peek8(u->ram.dat, a); |
|
| 2741 | 2741 |
#ifndef NO_STACK_CHECKS |
| 2742 | 2742 |
if(__builtin_expect(u->rst.ptr < 2, 0)) {
|
| 2743 | 2743 |
u->rst.error = 1; |
| ... | ... |
@@ -2755,7 +2755,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2755 | 2755 |
{
|
| 2756 | 2756 |
Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
| 2757 | 2757 |
Uint8 b = u->rst.dat[u->rst.ptr - 3]; |
| 2758 |
- mempoke8(u->ram.dat, a, b); |
|
| 2758 |
+ poke8(u->ram.dat, a, b); |
|
| 2759 | 2759 |
#ifndef NO_STACK_CHECKS |
| 2760 | 2760 |
if(__builtin_expect(u->rst.ptr < 3, 0)) {
|
| 2761 | 2761 |
u->rst.error = 1; |
| ... | ... |
@@ -2767,7 +2767,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2767 | 2767 |
case 0xb6: /* DEIkr */ |
| 2768 | 2768 |
{
|
| 2769 | 2769 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 2770 |
- u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a); |
|
| 2770 |
+ u->rst.dat[u->rst.ptr] = devr8(&u->dev[a >> 4], a); |
|
| 2771 | 2771 |
#ifndef NO_STACK_CHECKS |
| 2772 | 2772 |
if(__builtin_expect(u->rst.ptr < 1, 0)) {
|
| 2773 | 2773 |
u->rst.error = 1; |
| ... | ... |
@@ -2784,7 +2784,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 2784 | 2784 |
case 0xb7: /* DEOkr */ |
| 2785 | 2785 |
{
|
| 2786 | 2786 |
Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
| 2787 |
- devpoke8(&u->dev[a >> 4], a, b); |
|
| 2787 |
+ devw8(&u->dev[a >> 4], a, b); |
|
| 2788 | 2788 |
#ifndef NO_STACK_CHECKS |
| 2789 | 2789 |
if(__builtin_expect(u->rst.ptr < 2, 0)) {
|
| 2790 | 2790 |
u->rst.error = 1; |
| ... | ... |
@@ -3198,8 +3198,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3198 | 3198 |
case 0xd0: /* LDZ2k */ |
| 3199 | 3199 |
{
|
| 3200 | 3200 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 3201 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); |
|
| 3202 |
- u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, a + 1); |
|
| 3201 |
+ u->wst.dat[u->wst.ptr] = peek8(u->ram.dat, a); |
|
| 3202 |
+ u->wst.dat[u->wst.ptr + 1] = peek8(u->ram.dat, a + 1); |
|
| 3203 | 3203 |
#ifndef NO_STACK_CHECKS |
| 3204 | 3204 |
if(__builtin_expect(u->wst.ptr < 1, 0)) {
|
| 3205 | 3205 |
u->wst.error = 1; |
| ... | ... |
@@ -3217,7 +3217,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3217 | 3217 |
{
|
| 3218 | 3218 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 3219 | 3219 |
Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
| 3220 |
- mempoke16(u->ram.dat, a, b); |
|
| 3220 |
+ poke16(u->ram.dat, a, b); |
|
| 3221 | 3221 |
#ifndef NO_STACK_CHECKS |
| 3222 | 3222 |
if(__builtin_expect(u->wst.ptr < 3, 0)) {
|
| 3223 | 3223 |
u->wst.error = 1; |
| ... | ... |
@@ -3229,8 +3229,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3229 | 3229 |
case 0xd2: /* LDR2k */ |
| 3230 | 3230 |
{
|
| 3231 | 3231 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 3232 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 3233 |
- u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); |
|
| 3232 |
+ u->wst.dat[u->wst.ptr] = peek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 3233 |
+ u->wst.dat[u->wst.ptr + 1] = peek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); |
|
| 3234 | 3234 |
#ifndef NO_STACK_CHECKS |
| 3235 | 3235 |
if(__builtin_expect(u->wst.ptr < 1, 0)) {
|
| 3236 | 3236 |
u->wst.error = 1; |
| ... | ... |
@@ -3248,7 +3248,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3248 | 3248 |
{
|
| 3249 | 3249 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 3250 | 3250 |
Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
| 3251 |
- mempoke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 3251 |
+ poke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 3252 | 3252 |
#ifndef NO_STACK_CHECKS |
| 3253 | 3253 |
if(__builtin_expect(u->wst.ptr < 3, 0)) {
|
| 3254 | 3254 |
u->wst.error = 1; |
| ... | ... |
@@ -3260,8 +3260,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3260 | 3260 |
case 0xd4: /* LDA2k */ |
| 3261 | 3261 |
{
|
| 3262 | 3262 |
Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
| 3263 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); |
|
| 3264 |
- u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, a + 1); |
|
| 3263 |
+ u->wst.dat[u->wst.ptr] = peek8(u->ram.dat, a); |
|
| 3264 |
+ u->wst.dat[u->wst.ptr + 1] = peek8(u->ram.dat, a + 1); |
|
| 3265 | 3265 |
#ifndef NO_STACK_CHECKS |
| 3266 | 3266 |
if(__builtin_expect(u->wst.ptr < 2, 0)) {
|
| 3267 | 3267 |
u->wst.error = 1; |
| ... | ... |
@@ -3279,7 +3279,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3279 | 3279 |
{
|
| 3280 | 3280 |
Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
| 3281 | 3281 |
Uint16 b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
| 3282 |
- mempoke16(u->ram.dat, a, b); |
|
| 3282 |
+ poke16(u->ram.dat, a, b); |
|
| 3283 | 3283 |
#ifndef NO_STACK_CHECKS |
| 3284 | 3284 |
if(__builtin_expect(u->wst.ptr < 4, 0)) {
|
| 3285 | 3285 |
u->wst.error = 1; |
| ... | ... |
@@ -3291,8 +3291,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3291 | 3291 |
case 0xd6: /* DEI2k */ |
| 3292 | 3292 |
{
|
| 3293 | 3293 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 3294 |
- u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a); |
|
| 3295 |
- u->wst.dat[u->wst.ptr + 1] = devpeek8(&u->dev[a >> 4], a + 1); |
|
| 3294 |
+ u->wst.dat[u->wst.ptr] = devr8(&u->dev[a >> 4], a); |
|
| 3295 |
+ u->wst.dat[u->wst.ptr + 1] = devr8(&u->dev[a >> 4], a + 1); |
|
| 3296 | 3296 |
#ifndef NO_STACK_CHECKS |
| 3297 | 3297 |
if(__builtin_expect(u->wst.ptr < 1, 0)) {
|
| 3298 | 3298 |
u->wst.error = 1; |
| ... | ... |
@@ -3310,7 +3310,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3310 | 3310 |
{
|
| 3311 | 3311 |
Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
| 3312 | 3312 |
Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
| 3313 |
- devpoke16(&u->dev[a >> 4], a, b); |
|
| 3313 |
+ devw16(&u->dev[a >> 4], a, b); |
|
| 3314 | 3314 |
#ifndef NO_STACK_CHECKS |
| 3315 | 3315 |
if(__builtin_expect(u->wst.ptr < 3, 0)) {
|
| 3316 | 3316 |
u->wst.error = 1; |
| ... | ... |
@@ -3733,8 +3733,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3733 | 3733 |
case 0xf0: /* LDZ2kr */ |
| 3734 | 3734 |
{
|
| 3735 | 3735 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 3736 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); |
|
| 3737 |
- u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, a + 1); |
|
| 3736 |
+ u->rst.dat[u->rst.ptr] = peek8(u->ram.dat, a); |
|
| 3737 |
+ u->rst.dat[u->rst.ptr + 1] = peek8(u->ram.dat, a + 1); |
|
| 3738 | 3738 |
#ifndef NO_STACK_CHECKS |
| 3739 | 3739 |
if(__builtin_expect(u->rst.ptr < 1, 0)) {
|
| 3740 | 3740 |
u->rst.error = 1; |
| ... | ... |
@@ -3752,7 +3752,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3752 | 3752 |
{
|
| 3753 | 3753 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 3754 | 3754 |
Uint16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); |
| 3755 |
- mempoke16(u->ram.dat, a, b); |
|
| 3755 |
+ poke16(u->ram.dat, a, b); |
|
| 3756 | 3756 |
#ifndef NO_STACK_CHECKS |
| 3757 | 3757 |
if(__builtin_expect(u->rst.ptr < 3, 0)) {
|
| 3758 | 3758 |
u->rst.error = 1; |
| ... | ... |
@@ -3764,8 +3764,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3764 | 3764 |
case 0xf2: /* LDR2kr */ |
| 3765 | 3765 |
{
|
| 3766 | 3766 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 3767 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 3768 |
- u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); |
|
| 3767 |
+ u->rst.dat[u->rst.ptr] = peek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
| 3768 |
+ u->rst.dat[u->rst.ptr + 1] = peek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); |
|
| 3769 | 3769 |
#ifndef NO_STACK_CHECKS |
| 3770 | 3770 |
if(__builtin_expect(u->rst.ptr < 1, 0)) {
|
| 3771 | 3771 |
u->rst.error = 1; |
| ... | ... |
@@ -3783,7 +3783,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3783 | 3783 |
{
|
| 3784 | 3784 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 3785 | 3785 |
Uint16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); |
| 3786 |
- mempoke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 3786 |
+ poke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
| 3787 | 3787 |
#ifndef NO_STACK_CHECKS |
| 3788 | 3788 |
if(__builtin_expect(u->rst.ptr < 3, 0)) {
|
| 3789 | 3789 |
u->rst.error = 1; |
| ... | ... |
@@ -3795,8 +3795,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3795 | 3795 |
case 0xf4: /* LDA2kr */ |
| 3796 | 3796 |
{
|
| 3797 | 3797 |
Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
| 3798 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); |
|
| 3799 |
- u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, a + 1); |
|
| 3798 |
+ u->rst.dat[u->rst.ptr] = peek8(u->ram.dat, a); |
|
| 3799 |
+ u->rst.dat[u->rst.ptr + 1] = peek8(u->ram.dat, a + 1); |
|
| 3800 | 3800 |
#ifndef NO_STACK_CHECKS |
| 3801 | 3801 |
if(__builtin_expect(u->rst.ptr < 2, 0)) {
|
| 3802 | 3802 |
u->rst.error = 1; |
| ... | ... |
@@ -3814,7 +3814,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3814 | 3814 |
{
|
| 3815 | 3815 |
Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
| 3816 | 3816 |
Uint16 b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); |
| 3817 |
- mempoke16(u->ram.dat, a, b); |
|
| 3817 |
+ poke16(u->ram.dat, a, b); |
|
| 3818 | 3818 |
#ifndef NO_STACK_CHECKS |
| 3819 | 3819 |
if(__builtin_expect(u->rst.ptr < 4, 0)) {
|
| 3820 | 3820 |
u->rst.error = 1; |
| ... | ... |
@@ -3826,8 +3826,8 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3826 | 3826 |
case 0xf6: /* DEI2kr */ |
| 3827 | 3827 |
{
|
| 3828 | 3828 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 3829 |
- u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a); |
|
| 3830 |
- u->rst.dat[u->rst.ptr + 1] = devpeek8(&u->dev[a >> 4], a + 1); |
|
| 3829 |
+ u->rst.dat[u->rst.ptr] = devr8(&u->dev[a >> 4], a); |
|
| 3830 |
+ u->rst.dat[u->rst.ptr + 1] = devr8(&u->dev[a >> 4], a + 1); |
|
| 3831 | 3831 |
#ifndef NO_STACK_CHECKS |
| 3832 | 3832 |
if(__builtin_expect(u->rst.ptr < 1, 0)) {
|
| 3833 | 3833 |
u->rst.error = 1; |
| ... | ... |
@@ -3845,7 +3845,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
| 3845 | 3845 |
{
|
| 3846 | 3846 |
Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
| 3847 | 3847 |
Uint16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); |
| 3848 |
- devpoke16(&u->dev[a >> 4], a, b); |
|
| 3848 |
+ devw16(&u->dev[a >> 4], a, b); |
|
| 3849 | 3849 |
#ifndef NO_STACK_CHECKS |
| 3850 | 3850 |
if(__builtin_expect(u->rst.ptr < 3, 0)) {
|
| 3851 | 3851 |
u->rst.error = 1; |
| ... | ... |
@@ -23,18 +23,18 @@ static void push8(Stack *s, Uint8 a) { if(s->ptr == 0xff) { s->error = 2; retu
|
| 23 | 23 |
static Uint8 pop8_keep(Stack *s) { if(s->kptr == 0) { s->error = 1; return 0; } return s->dat[--s->kptr]; }
|
| 24 | 24 |
static Uint8 pop8_nokeep(Stack *s) { if(s->ptr == 0) { s->error = 1; return 0; } return s->dat[--s->ptr]; }
|
| 25 | 25 |
static Uint8 (*pop8)(Stack *s); |
| 26 |
-static void mempoke8(Uint8 *m, Uint16 a, Uint8 b) { m[a] = b; }
|
|
| 27 |
-static Uint8 mempeek8(Uint8 *m, Uint16 a) { return m[a]; }
|
|
| 28 |
-static void devpoke8(Device *d, Uint8 a, Uint8 b) { d->dat[a & 0xf] = b; d->talk(d, a & 0x0f, 1); }
|
|
| 29 |
-static Uint8 devpeek8(Device *d, Uint8 a) { d->talk(d, a & 0x0f, 0); return d->dat[a & 0xf]; }
|
|
| 26 |
+static void poke8(Uint8 *m, Uint16 a, Uint8 b) { m[a] = b; }
|
|
| 27 |
+static Uint8 peek8(Uint8 *m, Uint16 a) { return m[a]; }
|
|
| 28 |
+static void devw8(Device *d, Uint8 a, Uint8 b) { d->dat[a & 0xf] = b; d->talk(d, a & 0x0f, 1); }
|
|
| 29 |
+static Uint8 devr8(Device *d, Uint8 a) { d->talk(d, a & 0x0f, 0); return d->dat[a & 0xf]; }
|
|
| 30 | 30 |
static void push16(Stack *s, Uint16 a) { push8(s, a >> 8); push8(s, a); }
|
| 31 | 31 |
static Uint16 pop16(Stack *s) { Uint8 a = pop8(s), b = pop8(s); return a + (b << 8); }
|
| 32 |
-void mempoke16(Uint8 *m, Uint16 a, Uint16 b) { mempoke8(m, a, b >> 8); mempoke8(m, a + 1, b); }
|
|
| 33 |
-Uint16 mempeek16(Uint8 *m, Uint16 a) { return (mempeek8(m, a) << 8) + mempeek8(m, a + 1); }
|
|
| 34 |
-static void devpoke16(Device *d, Uint8 a, Uint16 b) { devpoke8(d, a, b >> 8); devpoke8(d, a + 1, b); }
|
|
| 35 |
-static Uint16 devpeek16(Device *d, Uint16 a) { return (devpeek8(d, a) << 8) + devpeek8(d, a + 1); }
|
|
| 32 |
+void poke16(Uint8 *m, Uint16 a, Uint16 b) { poke8(m, a, b >> 8); poke8(m, a + 1, b); }
|
|
| 33 |
+Uint16 peek16(Uint8 *m, Uint16 a) { return (peek8(m, a) << 8) + peek8(m, a + 1); }
|
|
| 34 |
+static void devw16(Device *d, Uint8 a, Uint16 b) { devw8(d, a, b >> 8); devw8(d, a + 1, b); }
|
|
| 35 |
+static Uint16 devr16(Device *d, Uint16 a) { return (devr8(d, a) << 8) + devr8(d, a + 1); }
|
|
| 36 | 36 |
/* Stack */ |
| 37 |
-static void op_lit(Uxn *u) { push8(u->src, mempeek8(u->ram.dat, u->ram.ptr++)); }
|
|
| 37 |
+static void op_lit(Uxn *u) { push8(u->src, peek8(u->ram.dat, u->ram.ptr++)); }
|
|
| 38 | 38 |
static void op_inc(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, a + 1); }
|
| 39 | 39 |
static void op_pop(Uxn *u) { pop8(u->src); }
|
| 40 | 40 |
static void op_dup(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, a); push8(u->src, a); }
|
| ... | ... |
@@ -52,14 +52,14 @@ static void op_jnz(Uxn *u) { Uint8 a = pop8(u->src); if(pop8(u->src)) u->ram.ptr
|
| 52 | 52 |
static void op_jsr(Uxn *u) { Uint8 a = pop8(u->src); push16(u->dst, u->ram.ptr); u->ram.ptr += (Sint8)a; }
|
| 53 | 53 |
static void op_sth(Uxn *u) { Uint8 a = pop8(u->src); push8(u->dst, a); }
|
| 54 | 54 |
/* Memory */ |
| 55 |
-static void op_ldz(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, mempeek8(u->ram.dat, a)); }
|
|
| 56 |
-static void op_stz(Uxn *u) { Uint8 a = pop8(u->src); Uint8 b = pop8(u->src); mempoke8(u->ram.dat, a, b); }
|
|
| 57 |
-static void op_ldr(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a)); }
|
|
| 58 |
-static void op_str(Uxn *u) { Uint8 a = pop8(u->src); Uint8 b = pop8(u->src); mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); }
|
|
| 59 |
-static void op_lda(Uxn *u) { Uint16 a = pop16(u->src); push8(u->src, mempeek8(u->ram.dat, a)); }
|
|
| 60 |
-static void op_sta(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); mempoke8(u->ram.dat, a, b); }
|
|
| 61 |
-static void op_dei(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, devpeek8(&u->dev[a >> 4], a)); }
|
|
| 62 |
-static void op_deo(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); devpoke8(&u->dev[a >> 4], a, b); }
|
|
| 55 |
+static void op_ldz(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, peek8(u->ram.dat, a)); }
|
|
| 56 |
+static void op_stz(Uxn *u) { Uint8 a = pop8(u->src); Uint8 b = pop8(u->src); poke8(u->ram.dat, a, b); }
|
|
| 57 |
+static void op_ldr(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, peek8(u->ram.dat, u->ram.ptr + (Sint8)a)); }
|
|
| 58 |
+static void op_str(Uxn *u) { Uint8 a = pop8(u->src); Uint8 b = pop8(u->src); poke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); }
|
|
| 59 |
+static void op_lda(Uxn *u) { Uint16 a = pop16(u->src); push8(u->src, peek8(u->ram.dat, a)); }
|
|
| 60 |
+static void op_sta(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); poke8(u->ram.dat, a, b); }
|
|
| 61 |
+static void op_dei(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, devr8(&u->dev[a >> 4], a)); }
|
|
| 62 |
+static void op_deo(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); devw8(&u->dev[a >> 4], a, b); }
|
|
| 63 | 63 |
/* Arithmetic */ |
| 64 | 64 |
static void op_add(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b + a); }
|
| 65 | 65 |
static void op_sub(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b - a); }
|
| ... | ... |
@@ -70,7 +70,7 @@ static void op_ora(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->
|
| 70 | 70 |
static void op_eor(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b ^ a); }
|
| 71 | 71 |
static void op_sft(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b >> (a & 0x07) << ((a & 0x70) >> 4)); }
|
| 72 | 72 |
/* Stack(16-bits) */ |
| 73 |
-static void op_lit16(Uxn *u) { push16(u->src, mempeek16(u->ram.dat, u->ram.ptr++)); u->ram.ptr++; }
|
|
| 73 |
+static void op_lit16(Uxn *u) { push16(u->src, peek16(u->ram.dat, u->ram.ptr++)); u->ram.ptr++; }
|
|
| 74 | 74 |
static void op_inc16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->src, a + 1); }
|
| 75 | 75 |
static void op_pop16(Uxn *u) { pop16(u->src); }
|
| 76 | 76 |
static void op_dup16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->src, a); push16(u->src, a); }
|
| ... | ... |
@@ -88,14 +88,14 @@ static void op_jnz16(Uxn *u) { Uint16 a = pop16(u->src); if(pop8(u->src)) u->ram
|
| 88 | 88 |
static void op_jsr16(Uxn *u) { push16(u->dst, u->ram.ptr); u->ram.ptr = pop16(u->src); }
|
| 89 | 89 |
static void op_sth16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->dst, a); }
|
| 90 | 90 |
/* Memory(16-bits) */ |
| 91 |
-static void op_ldz16(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, mempeek16(u->ram.dat, a)); }
|
|
| 92 |
-static void op_stz16(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); mempoke16(u->ram.dat, a, b); }
|
|
| 93 |
-static void op_ldr16(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, mempeek16(u->ram.dat, u->ram.ptr + (Sint8)a)); }
|
|
| 94 |
-static void op_str16(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); mempoke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); }
|
|
| 95 |
-static void op_lda16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->src, mempeek16(u->ram.dat, a)); }
|
|
| 96 |
-static void op_sta16(Uxn *u) { Uint16 a = pop16(u->src); Uint16 b = pop16(u->src); mempoke16(u->ram.dat, a, b); }
|
|
| 97 |
-static void op_dei16(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, devpeek16(&u->dev[a >> 4], a)); }
|
|
| 98 |
-static void op_deo16(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); devpoke16(&u->dev[a >> 4], a, b); }
|
|
| 91 |
+static void op_ldz16(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, peek16(u->ram.dat, a)); }
|
|
| 92 |
+static void op_stz16(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); poke16(u->ram.dat, a, b); }
|
|
| 93 |
+static void op_ldr16(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, peek16(u->ram.dat, u->ram.ptr + (Sint8)a)); }
|
|
| 94 |
+static void op_str16(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); poke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); }
|
|
| 95 |
+static void op_lda16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->src, peek16(u->ram.dat, a)); }
|
|
| 96 |
+static void op_sta16(Uxn *u) { Uint16 a = pop16(u->src); Uint16 b = pop16(u->src); poke16(u->ram.dat, a, b); }
|
|
| 97 |
+static void op_dei16(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, devr16(&u->dev[a >> 4], a)); }
|
|
| 98 |
+static void op_deo16(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); devw16(&u->dev[a >> 4], a, b); }
|
|
| 99 | 99 |
/* Arithmetic(16-bits) */ |
| 100 | 100 |
static void op_add16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b + a); }
|
| 101 | 101 |
static void op_sub16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b - a); }
|
| ... | ... |
@@ -40,8 +40,8 @@ typedef struct Uxn {
|
| 40 | 40 |
|
| 41 | 41 |
struct Uxn; |
| 42 | 42 |
|
| 43 |
-void mempoke16(Uint8 *m, Uint16 a, Uint16 b); |
|
| 44 |
-Uint16 mempeek16(Uint8 *m, Uint16 a); |
|
| 43 |
+void poke16(Uint8 *m, Uint16 a, Uint16 b); |
|
| 44 |
+Uint16 peek16(Uint8 *m, Uint16 a); |
|
| 45 | 45 |
|
| 46 | 46 |
int uxn_boot(Uxn *c); |
| 47 | 47 |
int uxn_eval(Uxn *u, Uint16 vec); |
| ... | ... |
@@ -77,10 +77,10 @@ file_talk(Device *d, Uint8 b0, Uint8 w) |
| 77 | 77 |
{
|
| 78 | 78 |
Uint8 read = b0 == 0xd; |
| 79 | 79 |
if(w && (read || b0 == 0xf)) {
|
| 80 |
- char *name = (char *)&d->mem[mempeek16(d->dat, 0x8)]; |
|
| 81 |
- Uint16 result = 0, length = mempeek16(d->dat, 0xa); |
|
| 82 |
- long offset = (mempeek16(d->dat, 0x4) << 16) + mempeek16(d->dat, 0x6); |
|
| 83 |
- Uint16 addr = mempeek16(d->dat, b0 - 1); |
|
| 80 |
+ char *name = (char *)&d->mem[peek16(d->dat, 0x8)]; |
|
| 81 |
+ Uint16 result = 0, length = peek16(d->dat, 0xa); |
|
| 82 |
+ long offset = (peek16(d->dat, 0x4) << 16) + peek16(d->dat, 0x6); |
|
| 83 |
+ Uint16 addr = peek16(d->dat, b0 - 1); |
|
| 84 | 84 |
FILE *f = fopen(name, read ? "r" : (offset ? "a" : "w")); |
| 85 | 85 |
if(f) {
|
| 86 | 86 |
fprintf(stderr, "%s %s %s #%04x, ", read ? "Loading" : "Saving", name, read ? "to" : "from", addr); |
| ... | ... |
@@ -89,7 +89,7 @@ file_talk(Device *d, Uint8 b0, Uint8 w) |
| 89 | 89 |
fprintf(stderr, "%04x bytes\n", result); |
| 90 | 90 |
fclose(f); |
| 91 | 91 |
} |
| 92 |
- mempoke16(d->dat, 0x2, result); |
|
| 92 |
+ poke16(d->dat, 0x2, result); |
|
| 93 | 93 |
} |
| 94 | 94 |
} |
| 95 | 95 |
|
| ... | ... |
@@ -99,14 +99,14 @@ datetime_talk(Device *d, Uint8 b0, Uint8 w) |
| 99 | 99 |
time_t seconds = time(NULL); |
| 100 | 100 |
struct tm *t = localtime(&seconds); |
| 101 | 101 |
t->tm_year += 1900; |
| 102 |
- mempoke16(d->dat, 0x0, t->tm_year); |
|
| 102 |
+ poke16(d->dat, 0x0, t->tm_year); |
|
| 103 | 103 |
d->dat[0x2] = t->tm_mon; |
| 104 | 104 |
d->dat[0x3] = t->tm_mday; |
| 105 | 105 |
d->dat[0x4] = t->tm_hour; |
| 106 | 106 |
d->dat[0x5] = t->tm_min; |
| 107 | 107 |
d->dat[0x6] = t->tm_sec; |
| 108 | 108 |
d->dat[0x7] = t->tm_wday; |
| 109 |
- mempoke16(d->dat, 0x08, t->tm_yday); |
|
| 109 |
+ poke16(d->dat, 0x08, t->tm_yday); |
|
| 110 | 110 |
d->dat[0xa] = t->tm_isdst; |
| 111 | 111 |
(void)b0; |
| 112 | 112 |
(void)w; |
| ... | ... |
@@ -138,7 +138,7 @@ run(Uxn *u) |
| 138 | 138 |
Uint16 vec = PAGE_PROGRAM; |
| 139 | 139 |
uxn_eval(u, vec); |
| 140 | 140 |
while((!u->dev[0].dat[0xf]) && (read(0, &devconsole->dat[0x2], 1) > 0)) {
|
| 141 |
- vec = mempeek16(devconsole->dat, 0); |
|
| 141 |
+ vec = peek16(devconsole->dat, 0); |
|
| 142 | 142 |
if(!vec) vec = u->ram.ptr; /* continue after last BRK */ |
| 143 | 143 |
uxn_eval(u, vec); |
| 144 | 144 |
} |
| ... | ... |
@@ -221,8 +221,8 @@ domouse(SDL_Event *event) |
| 221 | 221 |
Uint8 flag = 0x00; |
| 222 | 222 |
Uint16 x = clamp(event->motion.x / zoom - PAD, 0, ppu.width - 1); |
| 223 | 223 |
Uint16 y = clamp(event->motion.y / zoom - PAD, 0, ppu.height - 1); |
| 224 |
- mempoke16(devmouse->dat, 0x2, x); |
|
| 225 |
- mempoke16(devmouse->dat, 0x4, y); |
|
| 224 |
+ poke16(devmouse->dat, 0x2, x); |
|
| 225 |
+ poke16(devmouse->dat, 0x4, y); |
|
| 226 | 226 |
switch(event->button.button) {
|
| 227 | 227 |
case SDL_BUTTON_LEFT: flag = 0x01; break; |
| 228 | 228 |
case SDL_BUTTON_RIGHT: flag = 0x10; break; |
| ... | ... |
@@ -320,16 +320,16 @@ static void |
| 320 | 320 |
screen_talk(Device *d, Uint8 b0, Uint8 w) |
| 321 | 321 |
{
|
| 322 | 322 |
if(w && b0 == 0xe) {
|
| 323 |
- Uint16 x = mempeek16(d->dat, 0x8); |
|
| 324 |
- Uint16 y = mempeek16(d->dat, 0xa); |
|
| 323 |
+ Uint16 x = peek16(d->dat, 0x8); |
|
| 324 |
+ Uint16 y = peek16(d->dat, 0xa); |
|
| 325 | 325 |
Uint8 layer = d->dat[0xe] >> 4 & 0x1; |
| 326 | 326 |
ppu_pixel(&ppu, layer, x, y, d->dat[0xe] & 0x3); |
| 327 | 327 |
reqdraw = 1; |
| 328 | 328 |
} else if(w && b0 == 0xf) {
|
| 329 |
- Uint16 x = mempeek16(d->dat, 0x8); |
|
| 330 |
- Uint16 y = mempeek16(d->dat, 0xa); |
|
| 329 |
+ Uint16 x = peek16(d->dat, 0x8); |
|
| 330 |
+ Uint16 y = peek16(d->dat, 0xa); |
|
| 331 | 331 |
Uint8 layer = d->dat[0xf] >> 0x6 & 0x1; |
| 332 |
- Uint8 *addr = &d->mem[mempeek16(d->dat, 0xc)]; |
|
| 332 |
+ Uint8 *addr = &d->mem[peek16(d->dat, 0xc)]; |
|
| 333 | 333 |
if(d->dat[0xf] >> 0x7 & 0x1) |
| 334 | 334 |
ppu_2bpp(&ppu, layer, x, y, addr, d->dat[0xf] & 0xf, d->dat[0xf] >> 0x4 & 0x1, d->dat[0xf] >> 0x5 & 0x1); |
| 335 | 335 |
else |
| ... | ... |
@@ -343,10 +343,10 @@ file_talk(Device *d, Uint8 b0, Uint8 w) |
| 343 | 343 |
{
|
| 344 | 344 |
Uint8 read = b0 == 0xd; |
| 345 | 345 |
if(w && (read || b0 == 0xf)) {
|
| 346 |
- char *name = (char *)&d->mem[mempeek16(d->dat, 0x8)]; |
|
| 347 |
- Uint16 result = 0, length = mempeek16(d->dat, 0xa); |
|
| 348 |
- long offset = (mempeek16(d->dat, 0x4) << 16) + mempeek16(d->dat, 0x6); |
|
| 349 |
- Uint16 addr = mempeek16(d->dat, b0 - 1); |
|
| 346 |
+ char *name = (char *)&d->mem[peek16(d->dat, 0x8)]; |
|
| 347 |
+ Uint16 result = 0, length = peek16(d->dat, 0xa); |
|
| 348 |
+ long offset = (peek16(d->dat, 0x4) << 16) + peek16(d->dat, 0x6); |
|
| 349 |
+ Uint16 addr = peek16(d->dat, b0 - 1); |
|
| 350 | 350 |
FILE *f = fopen(name, read ? "r" : (offset ? "a" : "w")); |
| 351 | 351 |
if(f) {
|
| 352 | 352 |
fprintf(stderr, "%s %s %s #%04x, ", read ? "Loading" : "Saving", name, read ? "to" : "from", addr); |
| ... | ... |
@@ -355,7 +355,7 @@ file_talk(Device *d, Uint8 b0, Uint8 w) |
| 355 | 355 |
fprintf(stderr, "%04x bytes\n", result); |
| 356 | 356 |
fclose(f); |
| 357 | 357 |
} |
| 358 |
- mempoke16(d->dat, 0x2, result); |
|
| 358 |
+ poke16(d->dat, 0x2, result); |
|
| 359 | 359 |
} |
| 360 | 360 |
} |
| 361 | 361 |
|
| ... | ... |
@@ -366,17 +366,17 @@ audio_talk(Device *d, Uint8 b0, Uint8 w) |
| 366 | 366 |
if(!audio_id) return; |
| 367 | 367 |
if(!w) {
|
| 368 | 368 |
if(b0 == 0x2) |
| 369 |
- mempoke16(d->dat, 0x2, c->i); |
|
| 369 |
+ poke16(d->dat, 0x2, c->i); |
|
| 370 | 370 |
else if(b0 == 0x4) |
| 371 | 371 |
d->dat[0x4] = apu_get_vu(c); |
| 372 | 372 |
} else if(b0 == 0xf) {
|
| 373 | 373 |
SDL_LockAudioDevice(audio_id); |
| 374 |
- c->len = mempeek16(d->dat, 0xa); |
|
| 375 |
- c->addr = &d->mem[mempeek16(d->dat, 0xc)]; |
|
| 374 |
+ c->len = peek16(d->dat, 0xa); |
|
| 375 |
+ c->addr = &d->mem[peek16(d->dat, 0xc)]; |
|
| 376 | 376 |
c->volume[0] = d->dat[0xe] >> 4; |
| 377 | 377 |
c->volume[1] = d->dat[0xe] & 0xf; |
| 378 | 378 |
c->repeat = !(d->dat[0xf] & 0x80); |
| 379 |
- apu_start(c, mempeek16(d->dat, 0x8), d->dat[0xf] & 0x7f); |
|
| 379 |
+ apu_start(c, peek16(d->dat, 0x8), d->dat[0xf] & 0x7f); |
|
| 380 | 380 |
SDL_UnlockAudioDevice(audio_id); |
| 381 | 381 |
SDL_PauseAudioDevice(audio_id, 0); |
| 382 | 382 |
} |
| ... | ... |
@@ -388,14 +388,14 @@ datetime_talk(Device *d, Uint8 b0, Uint8 w) |
| 388 | 388 |
time_t seconds = time(NULL); |
| 389 | 389 |
struct tm *t = localtime(&seconds); |
| 390 | 390 |
t->tm_year += 1900; |
| 391 |
- mempoke16(d->dat, 0x0, t->tm_year); |
|
| 391 |
+ poke16(d->dat, 0x0, t->tm_year); |
|
| 392 | 392 |
d->dat[0x2] = t->tm_mon; |
| 393 | 393 |
d->dat[0x3] = t->tm_mday; |
| 394 | 394 |
d->dat[0x4] = t->tm_hour; |
| 395 | 395 |
d->dat[0x5] = t->tm_min; |
| 396 | 396 |
d->dat[0x6] = t->tm_sec; |
| 397 | 397 |
d->dat[0x7] = t->tm_wday; |
| 398 |
- mempoke16(d->dat, 0x08, t->tm_yday); |
|
| 398 |
+ poke16(d->dat, 0x08, t->tm_yday); |
|
| 399 | 399 |
d->dat[0xa] = t->tm_isdst; |
| 400 | 400 |
(void)b0; |
| 401 | 401 |
(void)w; |
| ... | ... |
@@ -459,19 +459,19 @@ run(Uxn *u) |
| 459 | 459 |
case SDL_KEYDOWN: |
| 460 | 460 |
case SDL_KEYUP: |
| 461 | 461 |
doctrl(u, &event, event.type == SDL_KEYDOWN); |
| 462 |
- uxn_eval(u, mempeek16(devctrl->dat, 0)); |
|
| 462 |
+ uxn_eval(u, peek16(devctrl->dat, 0)); |
|
| 463 | 463 |
devctrl->dat[3] = 0; |
| 464 | 464 |
break; |
| 465 | 465 |
case SDL_MOUSEWHEEL: |
| 466 | 466 |
devmouse->dat[7] = event.wheel.y; |
| 467 |
- uxn_eval(u, mempeek16(devmouse->dat, 0)); |
|
| 467 |
+ uxn_eval(u, peek16(devmouse->dat, 0)); |
|
| 468 | 468 |
devmouse->dat[7] = 0; |
| 469 | 469 |
break; |
| 470 | 470 |
case SDL_MOUSEBUTTONUP: |
| 471 | 471 |
case SDL_MOUSEBUTTONDOWN: |
| 472 | 472 |
case SDL_MOUSEMOTION: |
| 473 | 473 |
domouse(&event); |
| 474 |
- uxn_eval(u, mempeek16(devmouse->dat, 0)); |
|
| 474 |
+ uxn_eval(u, peek16(devmouse->dat, 0)); |
|
| 475 | 475 |
break; |
| 476 | 476 |
case SDL_WINDOWEVENT: |
| 477 | 477 |
if(event.window.event == SDL_WINDOWEVENT_EXPOSED) |
| ... | ... |
@@ -482,12 +482,12 @@ run(Uxn *u) |
| 482 | 482 |
default: |
| 483 | 483 |
if(event.type == stdin_event) {
|
| 484 | 484 |
devconsole->dat[0x2] = event.cbutton.button; |
| 485 |
- uxn_eval(u, mempeek16(devconsole->dat, 0)); |
|
| 485 |
+ uxn_eval(u, peek16(devconsole->dat, 0)); |
|
| 486 | 486 |
} else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) |
| 487 |
- uxn_eval(u, mempeek16((devaudio0 + (event.type - audio0_event))->dat, 0)); |
|
| 487 |
+ uxn_eval(u, peek16((devaudio0 + (event.type - audio0_event))->dat, 0)); |
|
| 488 | 488 |
} |
| 489 | 489 |
} |
| 490 |
- uxn_eval(u, mempeek16(devscreen->dat, 0)); |
|
| 490 |
+ uxn_eval(u, peek16(devscreen->dat, 0)); |
|
| 491 | 491 |
if(reqdraw || devsystem->dat[0xe]) |
| 492 | 492 |
redraw(u); |
| 493 | 493 |
if(!BENCH) {
|
| ... | ... |
@@ -544,8 +544,8 @@ main(int argc, char **argv) |
| 544 | 544 |
uxn_port(&u, 0xf, "---", nil_talk); |
| 545 | 545 |
|
| 546 | 546 |
/* Write screen size to dev/screen */ |
| 547 |
- mempoke16(devscreen->dat, 2, ppu.width); |
|
| 548 |
- mempoke16(devscreen->dat, 4, ppu.height); |
|
| 547 |
+ poke16(devscreen->dat, 2, ppu.width); |
|
| 548 |
+ poke16(devscreen->dat, 4, ppu.height); |
|
| 549 | 549 |
|
| 550 | 550 |
run(&u); |
| 551 | 551 |
quit(); |