... | ... |
@@ -204,9 +204,9 @@ for l in assert(io.lines('src/uxn.c')) do |
204 | 204 |
}, |
205 | 205 |
body = dump(ops[op], 'u->wst', 'u->rst') |
206 | 206 |
} |
207 |
- allops[i + 0x40 + 1] = { |
|
207 |
+ allops[i + 0x20 + 1] = { |
|
208 | 208 |
n = { |
209 |
- i + 0x40 |
|
209 |
+ i + 0x20 |
|
210 | 210 |
}, |
211 | 211 |
body = dump(ops[op], 'u->rst', 'u->wst') |
212 | 212 |
} |
... | ... |
@@ -216,13 +216,16 @@ for l in assert(io.lines('src/uxn.c')) do |
216 | 216 |
}, |
217 | 217 |
body = dump(ops['keep_' .. op], 'u->wst', 'u->rst') |
218 | 218 |
} |
219 |
- allops[i + 0xc0 + 1] = { |
|
219 |
+ allops[i + 0xa0 + 1] = { |
|
220 | 220 |
n = { |
221 |
- i + 0xc0 |
|
221 |
+ i + 0xa0 |
|
222 | 222 |
}, |
223 | 223 |
body = dump(ops['keep_' .. op], 'u->rst', 'u->wst') |
224 | 224 |
} |
225 | 225 |
i = i + 1 |
226 |
+ if i == 0x20 then |
|
227 |
+ i = i + 0x20 |
|
228 |
+ end |
|
226 | 229 |
end |
227 | 230 |
end |
228 | 231 |
end |
... | ... |
@@ -237,12 +240,12 @@ for l in assert(io.lines('src/uxnasm.c')) do |
237 | 240 |
for op in l:gmatch('"(...)"') do |
238 | 241 |
i = i + 1 |
239 | 242 |
allops[i + 0x00].name = op |
240 |
- allops[i + 0x20].name = op .. '2' |
|
241 |
- allops[i + 0x40].name = op .. 'r' |
|
243 |
+ allops[i + 0x20].name = op .. 'r' |
|
244 |
+ allops[i + 0x40].name = op .. '2' |
|
242 | 245 |
allops[i + 0x60].name = op .. '2r' |
243 | 246 |
allops[i + 0x80].name = op .. 'k' |
244 |
- allops[i + 0xa0].name = op .. '2k' |
|
245 |
- allops[i + 0xc0].name = op .. 'kr' |
|
247 |
+ allops[i + 0xa0].name = op .. 'kr' |
|
248 |
+ allops[i + 0xc0].name = op .. '2k' |
|
246 | 249 |
allops[i + 0xe0].name = op .. '2kr' |
247 | 250 |
end |
248 | 251 |
end |
... | ... |
@@ -158,10 +158,12 @@ for l in assert io.lines 'src/uxn.c' |
158 | 158 |
if not ops[op] |
159 | 159 |
error 'missing ' .. op |
160 | 160 |
allops[i + 0x00 + 1] = { n: { i + 0x00 }, body: dump ops[op], 'u->wst', 'u->rst' } |
161 |
- allops[i + 0x40 + 1] = { n: { i + 0x40 }, body: dump ops[op], 'u->rst', 'u->wst' } |
|
161 |
+ allops[i + 0x20 + 1] = { n: { i + 0x20 }, body: dump ops[op], 'u->rst', 'u->wst' } |
|
162 | 162 |
allops[i + 0x80 + 1] = { n: { i + 0x80 }, body: dump ops['keep_' .. op], 'u->wst', 'u->rst' } |
163 |
- allops[i + 0xc0 + 1] = { n: { i + 0xc0 }, body: dump ops['keep_' .. op], 'u->rst', 'u->wst' } |
|
163 |
+ allops[i + 0xa0 + 1] = { n: { i + 0xa0 }, body: dump ops['keep_' .. op], 'u->rst', 'u->wst' } |
|
164 | 164 |
i += 1 |
165 |
+ if i == 0x20 |
|
166 |
+ i += 0x20 |
|
165 | 167 |
|
166 | 168 |
i = 0 |
167 | 169 |
wanted = false |
... | ... |
@@ -174,12 +176,12 @@ for l in assert io.lines 'src/uxnasm.c' |
174 | 176 |
for op in l\gmatch '"(...)"' |
175 | 177 |
i += 1 |
176 | 178 |
allops[i + 0x00].name = op |
177 |
- allops[i + 0x20].name = op .. '2' |
|
178 |
- allops[i + 0x40].name = op .. 'r' |
|
179 |
+ allops[i + 0x20].name = op .. 'r' |
|
180 |
+ allops[i + 0x40].name = op .. '2' |
|
179 | 181 |
allops[i + 0x60].name = op .. '2r' |
180 | 182 |
allops[i + 0x80].name = op .. 'k' |
181 |
- allops[i + 0xa0].name = op .. '2k' |
|
182 |
- allops[i + 0xc0].name = op .. 'kr' |
|
183 |
+ allops[i + 0xa0].name = op .. 'kr' |
|
184 |
+ allops[i + 0xc0].name = op .. '2k' |
|
183 | 185 |
allops[i + 0xe0].name = op .. '2kr' |
184 | 186 |
|
185 | 187 |
for i = 1, 256 |
... | ... |
@@ -22,7 +22,8 @@ See etc/mkuxn-fast.moon for instructions. |
22 | 22 |
|
23 | 23 |
*/ |
24 | 24 |
|
25 |
-#define MODE_RETURN 0x40 |
|
25 |
+#define MODE_RETURN 0x20 |
|
26 |
+#define MODE_SHORT 0x40 |
|
26 | 27 |
#define MODE_KEEP 0x80 |
27 | 28 |
|
28 | 29 |
#pragma mark - Operations |
... | ... |
@@ -500,935 +501,935 @@ uxn_eval(Uxn *u, Uint16 vec) |
500 | 501 |
u->wst.ptr -= 1; |
501 | 502 |
} |
502 | 503 |
break; |
503 |
- case 0x20: /* LIT2 */ |
|
504 |
- case 0xa0: /* LIT2k */ |
|
504 |
+ case 0x20: /* LITr */ |
|
505 |
+ case 0xa0: /* LITkr */ |
|
505 | 506 |
{ |
506 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++); |
|
507 |
- u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr++); |
|
507 |
+ u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++); |
|
508 | 508 |
#ifndef NO_STACK_CHECKS |
509 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
510 |
- u->wst.error = 2; |
|
509 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
510 |
+ u->rst.error = 2; |
|
511 | 511 |
goto error; |
512 | 512 |
} |
513 | 513 |
#endif |
514 |
- u->wst.ptr += 2; |
|
514 |
+ u->rst.ptr += 1; |
|
515 | 515 |
} |
516 | 516 |
break; |
517 |
- case 0x21: /* INC2 */ |
|
517 |
+ case 0x21: /* INCr */ |
|
518 | 518 |
{ |
519 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
520 |
- u->wst.dat[u->wst.ptr - 2] = (a + 1) >> 8; |
|
521 |
- u->wst.dat[u->wst.ptr - 1] = (a + 1) & 0xff; |
|
519 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
520 |
+ u->rst.dat[u->rst.ptr - 1] = a + 1; |
|
522 | 521 |
#ifndef NO_STACK_CHECKS |
523 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
524 |
- u->wst.error = 1; |
|
522 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
523 |
+ u->rst.error = 1; |
|
525 | 524 |
goto error; |
526 | 525 |
} |
527 | 526 |
#endif |
528 | 527 |
} |
529 | 528 |
break; |
530 |
- case 0x22: /* POP2 */ |
|
529 |
+ case 0x22: /* POPr */ |
|
531 | 530 |
{ |
532 |
- (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
531 |
+ u->rst.dat[u->rst.ptr - 1]; |
|
533 | 532 |
#ifndef NO_STACK_CHECKS |
534 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
535 |
- u->wst.error = 1; |
|
533 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
534 |
+ u->rst.error = 1; |
|
536 | 535 |
goto error; |
537 | 536 |
} |
538 | 537 |
#endif |
539 |
- u->wst.ptr -= 2; |
|
538 |
+ u->rst.ptr -= 1; |
|
540 | 539 |
} |
541 | 540 |
break; |
542 |
- case 0x23: /* DUP2 */ |
|
541 |
+ case 0x23: /* DUPr */ |
|
543 | 542 |
{ |
544 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
|
545 |
- u->wst.dat[u->wst.ptr] = b; |
|
546 |
- u->wst.dat[u->wst.ptr + 1] = a; |
|
543 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
544 |
+ u->rst.dat[u->rst.ptr] = a; |
|
547 | 545 |
#ifndef NO_STACK_CHECKS |
548 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
549 |
- u->wst.error = 1; |
|
546 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
547 |
+ u->rst.error = 1; |
|
550 | 548 |
goto error; |
551 | 549 |
} |
552 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
553 |
- u->wst.error = 2; |
|
550 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
551 |
+ u->rst.error = 2; |
|
554 | 552 |
goto error; |
555 | 553 |
} |
556 | 554 |
#endif |
557 |
- u->wst.ptr += 2; |
|
555 |
+ u->rst.ptr += 1; |
|
558 | 556 |
} |
559 | 557 |
break; |
560 |
- case 0x24: /* NIP2 */ |
|
558 |
+ case 0x24: /* NIPr */ |
|
561 | 559 |
{ |
562 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
563 |
- (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
564 |
- u->wst.dat[u->wst.ptr - 4] = a >> 8; |
|
565 |
- u->wst.dat[u->wst.ptr - 3] = a & 0xff; |
|
560 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
561 |
+ u->rst.dat[u->rst.ptr - 2]; |
|
562 |
+ u->rst.dat[u->rst.ptr - 2] = a; |
|
566 | 563 |
#ifndef NO_STACK_CHECKS |
567 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
568 |
- u->wst.error = 1; |
|
564 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
565 |
+ u->rst.error = 1; |
|
569 | 566 |
goto error; |
570 | 567 |
} |
571 | 568 |
#endif |
572 |
- u->wst.ptr -= 2; |
|
569 |
+ u->rst.ptr -= 1; |
|
573 | 570 |
} |
574 | 571 |
break; |
575 |
- case 0x25: /* SWP2 */ |
|
572 |
+ case 0x25: /* SWPr */ |
|
576 | 573 |
{ |
577 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
578 |
- u->wst.dat[u->wst.ptr - 4] = b; |
|
579 |
- u->wst.dat[u->wst.ptr - 3] = a; |
|
580 |
- u->wst.dat[u->wst.ptr - 2] = d; |
|
581 |
- u->wst.dat[u->wst.ptr - 1] = c; |
|
574 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
575 |
+ u->rst.dat[u->rst.ptr - 2] = a; |
|
576 |
+ u->rst.dat[u->rst.ptr - 1] = b; |
|
582 | 577 |
#ifndef NO_STACK_CHECKS |
583 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
584 |
- u->wst.error = 1; |
|
578 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
579 |
+ u->rst.error = 1; |
|
585 | 580 |
goto error; |
586 | 581 |
} |
587 | 582 |
#endif |
588 | 583 |
} |
589 | 584 |
break; |
590 |
- case 0x26: /* OVR2 */ |
|
585 |
+ case 0x26: /* OVRr */ |
|
591 | 586 |
{ |
592 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
593 |
- u->wst.dat[u->wst.ptr] = d; |
|
594 |
- u->wst.dat[u->wst.ptr + 1] = c; |
|
587 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
588 |
+ u->rst.dat[u->rst.ptr] = b; |
|
595 | 589 |
#ifndef NO_STACK_CHECKS |
596 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
597 |
- u->wst.error = 1; |
|
590 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
591 |
+ u->rst.error = 1; |
|
598 | 592 |
goto error; |
599 | 593 |
} |
600 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
601 |
- u->wst.error = 2; |
|
594 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
595 |
+ u->rst.error = 2; |
|
602 | 596 |
goto error; |
603 | 597 |
} |
604 | 598 |
#endif |
605 |
- u->wst.ptr += 2; |
|
599 |
+ u->rst.ptr += 1; |
|
606 | 600 |
} |
607 | 601 |
break; |
608 |
- case 0x27: /* ROT2 */ |
|
602 |
+ case 0x27: /* ROTr */ |
|
609 | 603 |
{ |
610 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4], e = u->wst.dat[u->wst.ptr - 5], f = u->wst.dat[u->wst.ptr - 6]; |
|
611 |
- u->wst.dat[u->wst.ptr - 6] = d; |
|
612 |
- u->wst.dat[u->wst.ptr - 5] = c; |
|
613 |
- u->wst.dat[u->wst.ptr - 4] = b; |
|
614 |
- u->wst.dat[u->wst.ptr - 3] = a; |
|
615 |
- u->wst.dat[u->wst.ptr - 2] = f; |
|
616 |
- u->wst.dat[u->wst.ptr - 1] = e; |
|
604 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3]; |
|
605 |
+ u->rst.dat[u->rst.ptr - 3] = b; |
|
606 |
+ u->rst.dat[u->rst.ptr - 2] = a; |
|
607 |
+ u->rst.dat[u->rst.ptr - 1] = c; |
|
617 | 608 |
#ifndef NO_STACK_CHECKS |
618 |
- if(__builtin_expect(u->wst.ptr < 6, 0)) { |
|
619 |
- u->wst.error = 1; |
|
609 |
+ if(__builtin_expect(u->rst.ptr < 3, 0)) { |
|
610 |
+ u->rst.error = 1; |
|
620 | 611 |
goto error; |
621 | 612 |
} |
622 | 613 |
#endif |
623 | 614 |
} |
624 | 615 |
break; |
625 |
- case 0x28: /* EQU2 */ |
|
616 |
+ case 0x28: /* EQUr */ |
|
626 | 617 |
{ |
627 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
628 |
- u->wst.dat[u->wst.ptr - 4] = b == a; |
|
618 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
619 |
+ u->rst.dat[u->rst.ptr - 2] = b == a; |
|
629 | 620 |
#ifndef NO_STACK_CHECKS |
630 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
631 |
- u->wst.error = 1; |
|
621 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
622 |
+ u->rst.error = 1; |
|
632 | 623 |
goto error; |
633 | 624 |
} |
634 | 625 |
#endif |
635 |
- u->wst.ptr -= 3; |
|
626 |
+ u->rst.ptr -= 1; |
|
636 | 627 |
} |
637 | 628 |
break; |
638 |
- case 0x29: /* NEQ2 */ |
|
629 |
+ case 0x29: /* NEQr */ |
|
639 | 630 |
{ |
640 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
641 |
- u->wst.dat[u->wst.ptr - 4] = b != a; |
|
631 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
632 |
+ u->rst.dat[u->rst.ptr - 2] = b != a; |
|
642 | 633 |
#ifndef NO_STACK_CHECKS |
643 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
644 |
- u->wst.error = 1; |
|
634 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
635 |
+ u->rst.error = 1; |
|
645 | 636 |
goto error; |
646 | 637 |
} |
647 | 638 |
#endif |
648 |
- u->wst.ptr -= 3; |
|
639 |
+ u->rst.ptr -= 1; |
|
649 | 640 |
} |
650 | 641 |
break; |
651 |
- case 0x2a: /* GTH2 */ |
|
642 |
+ case 0x2a: /* GTHr */ |
|
652 | 643 |
{ |
653 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
654 |
- u->wst.dat[u->wst.ptr - 4] = b > a; |
|
644 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
645 |
+ u->rst.dat[u->rst.ptr - 2] = b > a; |
|
655 | 646 |
#ifndef NO_STACK_CHECKS |
656 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
657 |
- u->wst.error = 1; |
|
647 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
648 |
+ u->rst.error = 1; |
|
658 | 649 |
goto error; |
659 | 650 |
} |
660 | 651 |
#endif |
661 |
- u->wst.ptr -= 3; |
|
652 |
+ u->rst.ptr -= 1; |
|
662 | 653 |
} |
663 | 654 |
break; |
664 |
- case 0x2b: /* LTH2 */ |
|
655 |
+ case 0x2b: /* LTHr */ |
|
665 | 656 |
{ |
666 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
667 |
- u->wst.dat[u->wst.ptr - 4] = b < a; |
|
657 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
658 |
+ u->rst.dat[u->rst.ptr - 2] = b < a; |
|
668 | 659 |
#ifndef NO_STACK_CHECKS |
669 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
670 |
- u->wst.error = 1; |
|
660 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
661 |
+ u->rst.error = 1; |
|
671 | 662 |
goto error; |
672 | 663 |
} |
673 | 664 |
#endif |
674 |
- u->wst.ptr -= 3; |
|
665 |
+ u->rst.ptr -= 1; |
|
675 | 666 |
} |
676 | 667 |
break; |
677 |
- case 0x2c: /* JMP2 */ |
|
668 |
+ case 0x2c: /* JMPr */ |
|
678 | 669 |
{ |
679 |
- u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
670 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
671 |
+ u->ram.ptr += (Sint8)a; |
|
680 | 672 |
#ifndef NO_STACK_CHECKS |
681 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
682 |
- u->wst.error = 1; |
|
673 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
674 |
+ u->rst.error = 1; |
|
683 | 675 |
goto error; |
684 | 676 |
} |
685 | 677 |
#endif |
686 |
- u->wst.ptr -= 2; |
|
678 |
+ u->rst.ptr -= 1; |
|
687 | 679 |
} |
688 | 680 |
break; |
689 |
- case 0x2d: /* JCN2 */ |
|
681 |
+ case 0x2d: /* JCNr */ |
|
690 | 682 |
{ |
691 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
692 |
- if(u->wst.dat[u->wst.ptr - 3]) u->ram.ptr = a; |
|
683 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
684 |
+ if(u->rst.dat[u->rst.ptr - 2]) u->ram.ptr += (Sint8)a; |
|
693 | 685 |
#ifndef NO_STACK_CHECKS |
694 |
- if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
695 |
- u->wst.error = 1; |
|
686 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
687 |
+ u->rst.error = 1; |
|
696 | 688 |
goto error; |
697 | 689 |
} |
698 | 690 |
#endif |
699 |
- u->wst.ptr -= 3; |
|
691 |
+ u->rst.ptr -= 2; |
|
700 | 692 |
} |
701 | 693 |
break; |
702 |
- case 0x2e: /* JSR2 */ |
|
694 |
+ case 0x2e: /* JSRr */ |
|
703 | 695 |
{ |
704 |
- u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8; |
|
705 |
- u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff; |
|
706 |
- u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
696 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
697 |
+ u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8; |
|
698 |
+ u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff; |
|
699 |
+ u->ram.ptr += (Sint8)a; |
|
707 | 700 |
#ifndef NO_STACK_CHECKS |
708 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
709 |
- u->wst.error = 1; |
|
701 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
702 |
+ u->rst.error = 1; |
|
710 | 703 |
goto error; |
711 | 704 |
} |
712 | 705 |
#endif |
713 |
- u->wst.ptr -= 2; |
|
706 |
+ u->rst.ptr -= 1; |
|
714 | 707 |
#ifndef NO_STACK_CHECKS |
715 |
- if(__builtin_expect(u->rst.ptr > 253, 0)) { |
|
716 |
- u->rst.error = 2; |
|
708 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
709 |
+ u->wst.error = 2; |
|
717 | 710 |
goto error; |
718 | 711 |
} |
719 | 712 |
#endif |
720 |
- u->rst.ptr += 2; |
|
713 |
+ u->wst.ptr += 2; |
|
721 | 714 |
} |
722 | 715 |
break; |
723 |
- case 0x2f: /* STH2 */ |
|
716 |
+ case 0x2f: /* STHr */ |
|
724 | 717 |
{ |
725 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
|
726 |
- u->rst.dat[u->rst.ptr] = b; |
|
727 |
- u->rst.dat[u->rst.ptr + 1] = a; |
|
718 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
719 |
+ u->wst.dat[u->wst.ptr] = a; |
|
728 | 720 |
#ifndef NO_STACK_CHECKS |
729 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
730 |
- u->wst.error = 1; |
|
721 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
722 |
+ u->rst.error = 1; |
|
731 | 723 |
goto error; |
732 | 724 |
} |
733 | 725 |
#endif |
734 |
- u->wst.ptr -= 2; |
|
726 |
+ u->rst.ptr -= 1; |
|
735 | 727 |
#ifndef NO_STACK_CHECKS |
736 |
- if(__builtin_expect(u->rst.ptr > 253, 0)) { |
|
737 |
- u->rst.error = 2; |
|
728 |
+ if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
729 |
+ u->wst.error = 2; |
|
738 | 730 |
goto error; |
739 | 731 |
} |
740 | 732 |
#endif |
741 |
- u->rst.ptr += 2; |
|
733 |
+ u->wst.ptr += 1; |
|
742 | 734 |
} |
743 | 735 |
break; |
744 |
- case 0x30: /* LDZ2 */ |
|
736 |
+ case 0x30: /* LDZr */ |
|
745 | 737 |
{ |
746 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
747 |
- u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a); |
|
748 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a + 1); |
|
738 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
739 |
+ u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a); |
|
749 | 740 |
#ifndef NO_STACK_CHECKS |
750 |
- if(__builtin_expect(u->wst.ptr < 1, 0)) { |
|
751 |
- u->wst.error = 1; |
|
752 |
- goto error; |
|
753 |
- } |
|
754 |
- if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
755 |
- u->wst.error = 2; |
|
741 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
742 |
+ u->rst.error = 1; |
|
756 | 743 |
goto error; |
757 | 744 |
} |
758 | 745 |
#endif |
759 |
- u->wst.ptr += 1; |
|
760 | 746 |
} |
761 | 747 |
break; |
762 |
- case 0x31: /* STZ2 */ |
|
748 |
+ case 0x31: /* STZr */ |
|
763 | 749 |
{ |
764 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
765 |
- Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
|
766 |
- mempoke16(u->ram.dat, a, b); |
|
750 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
751 |
+ Uint8 b = u->rst.dat[u->rst.ptr - 2]; |
|
752 |
+ mempoke8(u->ram.dat, a, b); |
|
767 | 753 |
#ifndef NO_STACK_CHECKS |
768 |
- if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
769 |
- u->wst.error = 1; |
|
754 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
755 |
+ u->rst.error = 1; |
|
770 | 756 |
goto error; |
771 | 757 |
} |
772 | 758 |
#endif |
773 |
- u->wst.ptr -= 3; |
|
759 |
+ u->rst.ptr -= 2; |
|
774 | 760 |
} |
775 | 761 |
break; |
776 |
- case 0x32: /* LDR2 */ |
|
762 |
+ case 0x32: /* LDRr */ |
|
777 | 763 |
{ |
778 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
779 |
- u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
780 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); |
|
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); |
|
781 | 766 |
#ifndef NO_STACK_CHECKS |
782 |
- if(__builtin_expect(u->wst.ptr < 1, 0)) { |
|
783 |
- u->wst.error = 1; |
|
784 |
- goto error; |
|
785 |
- } |
|
786 |
- if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
787 |
- u->wst.error = 2; |
|
767 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
768 |
+ u->rst.error = 1; |
|
788 | 769 |
goto error; |
789 | 770 |
} |
790 | 771 |
#endif |
791 |
- u->wst.ptr += 1; |
|
792 | 772 |
} |
793 | 773 |
break; |
794 |
- case 0x33: /* STR2 */ |
|
774 |
+ case 0x33: /* STRr */ |
|
795 | 775 |
{ |
796 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
797 |
- Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
|
798 |
- mempoke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
776 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
777 |
+ Uint8 b = u->rst.dat[u->rst.ptr - 2]; |
|
778 |
+ mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
799 | 779 |
#ifndef NO_STACK_CHECKS |
800 |
- if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
801 |
- u->wst.error = 1; |
|
780 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
781 |
+ u->rst.error = 1; |
|
802 | 782 |
goto error; |
803 | 783 |
} |
804 | 784 |
#endif |
805 |
- u->wst.ptr -= 3; |
|
785 |
+ u->rst.ptr -= 2; |
|
806 | 786 |
} |
807 | 787 |
break; |
808 |
- case 0x34: /* LDA2 */ |
|
788 |
+ case 0x34: /* LDAr */ |
|
809 | 789 |
{ |
810 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
811 |
- u->wst.dat[u->wst.ptr - 2] = mempeek8(u->ram.dat, a); |
|
812 |
- u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a + 1); |
|
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); |
|
813 | 792 |
#ifndef NO_STACK_CHECKS |
814 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
815 |
- u->wst.error = 1; |
|
793 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
794 |
+ u->rst.error = 1; |
|
816 | 795 |
goto error; |
817 | 796 |
} |
818 | 797 |
#endif |
798 |
+ u->rst.ptr -= 1; |
|
819 | 799 |
} |
820 | 800 |
break; |
821 |
- case 0x35: /* STA2 */ |
|
801 |
+ case 0x35: /* STAr */ |
|
822 | 802 |
{ |
823 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
824 |
- Uint16 b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
825 |
- mempoke16(u->ram.dat, a, b); |
|
803 |
+ Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
|
804 |
+ Uint8 b = u->rst.dat[u->rst.ptr - 3]; |
|
805 |
+ mempoke8(u->ram.dat, a, b); |
|
826 | 806 |
#ifndef NO_STACK_CHECKS |
827 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
828 |
- u->wst.error = 1; |
|
807 |
+ if(__builtin_expect(u->rst.ptr < 3, 0)) { |
|
808 |
+ u->rst.error = 1; |
|
829 | 809 |
goto error; |
830 | 810 |
} |
831 | 811 |
#endif |
832 |
- u->wst.ptr -= 4; |
|
812 |
+ u->rst.ptr -= 3; |
|
833 | 813 |
} |
834 | 814 |
break; |
835 |
- case 0x36: /* DEI2 */ |
|
815 |
+ case 0x36: /* DEIr */ |
|
836 | 816 |
{ |
837 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
838 |
- u->wst.dat[u->wst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); |
|
839 |
- u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a + 1); |
|
817 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
818 |
+ u->rst.dat[u->rst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); |
|
840 | 819 |
#ifndef NO_STACK_CHECKS |
841 |
- if(__builtin_expect(u->wst.ptr < 1, 0)) { |
|
842 |
- u->wst.error = 1; |
|
843 |
- goto error; |
|
844 |
- } |
|
845 |
- if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
846 |
- u->wst.error = 2; |
|
820 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
821 |
+ u->rst.error = 1; |
|
847 | 822 |
goto error; |
848 | 823 |
} |
849 | 824 |
#endif |
850 |
- u->wst.ptr += 1; |
|
851 | 825 |
} |
852 | 826 |
break; |
853 |
- case 0x37: /* DEO2 */ |
|
827 |
+ case 0x37: /* DEOr */ |
|
854 | 828 |
{ |
855 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
856 |
- Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
|
857 |
- devpoke16(&u->dev[a >> 4], a, b); |
|
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); |
|
858 | 831 |
#ifndef NO_STACK_CHECKS |
859 |
- if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
860 |
- u->wst.error = 1; |
|
832 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
833 |
+ u->rst.error = 1; |
|
861 | 834 |
goto error; |
862 | 835 |
} |
863 | 836 |
#endif |
864 |
- u->wst.ptr -= 3; |
|
837 |
+ u->rst.ptr -= 2; |
|
865 | 838 |
} |
866 | 839 |
break; |
867 |
- case 0x38: /* ADD2 */ |
|
840 |
+ case 0x38: /* ADDr */ |
|
868 | 841 |
{ |
869 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
870 |
- u->wst.dat[u->wst.ptr - 4] = (b + a) >> 8; |
|
871 |
- u->wst.dat[u->wst.ptr - 3] = (b + a) & 0xff; |
|
842 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
843 |
+ u->rst.dat[u->rst.ptr - 2] = b + a; |
|
872 | 844 |
#ifndef NO_STACK_CHECKS |
873 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
874 |
- u->wst.error = 1; |
|
845 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
846 |
+ u->rst.error = 1; |
|
875 | 847 |
goto error; |
876 | 848 |
} |
877 | 849 |
#endif |
878 |
- u->wst.ptr -= 2; |
|
850 |
+ u->rst.ptr -= 1; |
|
879 | 851 |
} |
880 | 852 |
break; |
881 |
- case 0x39: /* SUB2 */ |
|
853 |
+ case 0x39: /* SUBr */ |
|
882 | 854 |
{ |
883 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
884 |
- u->wst.dat[u->wst.ptr - 4] = (b - a) >> 8; |
|
885 |
- u->wst.dat[u->wst.ptr - 3] = (b - a) & 0xff; |
|
855 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
856 |
+ u->rst.dat[u->rst.ptr - 2] = b - a; |
|
886 | 857 |
#ifndef NO_STACK_CHECKS |
887 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
888 |
- u->wst.error = 1; |
|
858 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
859 |
+ u->rst.error = 1; |
|
889 | 860 |
goto error; |
890 | 861 |
} |
891 | 862 |
#endif |
892 |
- u->wst.ptr -= 2; |
|
863 |
+ u->rst.ptr -= 1; |
|
893 | 864 |
} |
894 | 865 |
break; |
895 |
- case 0x3a: /* MUL2 */ |
|
866 |
+ case 0x3a: /* MULr */ |
|
896 | 867 |
{ |
897 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
898 |
- u->wst.dat[u->wst.ptr - 4] = (b * a) >> 8; |
|
899 |
- u->wst.dat[u->wst.ptr - 3] = (b * a) & 0xff; |
|
868 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
869 |
+ u->rst.dat[u->rst.ptr - 2] = b * a; |
|
900 | 870 |
#ifndef NO_STACK_CHECKS |
901 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
902 |
- u->wst.error = 1; |
|
871 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
872 |
+ u->rst.error = 1; |
|
903 | 873 |
goto error; |
904 | 874 |
} |
905 | 875 |
#endif |
906 |
- u->wst.ptr -= 2; |
|
876 |
+ u->rst.ptr -= 1; |
|
907 | 877 |
} |
908 | 878 |
break; |
909 |
- case 0x3b: /* DIV2 */ |
|
879 |
+ case 0x3b: /* DIVr */ |
|
910 | 880 |
{ |
911 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
881 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
912 | 882 |
if(a == 0) { |
913 |
- u->wst.error = 3; |
|
883 |
+ u->rst.error = 3; |
|
914 | 884 |
#ifndef NO_STACK_CHECKS |
915 | 885 |
goto error; |
916 | 886 |
#endif |
917 | 887 |
a = 1; |
918 | 888 |
} |
919 |
- u->wst.dat[u->wst.ptr - 4] = (b / a) >> 8; |
|
920 |
- u->wst.dat[u->wst.ptr - 3] = (b / a) & 0xff; |
|
889 |
+ u->rst.dat[u->rst.ptr - 2] = b / a; |
|
921 | 890 |
#ifndef NO_STACK_CHECKS |
922 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
923 |
- u->wst.error = 1; |
|
891 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
892 |
+ u->rst.error = 1; |
|
924 | 893 |
goto error; |
925 | 894 |
} |
926 | 895 |
#endif |
927 |
- u->wst.ptr -= 2; |
|
896 |
+ u->rst.ptr -= 1; |
|
928 | 897 |
} |
929 | 898 |
break; |
930 |
- case 0x3c: /* AND2 */ |
|
899 |
+ case 0x3c: /* ANDr */ |
|
931 | 900 |
{ |
932 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
933 |
- u->wst.dat[u->wst.ptr - 4] = d & b; |
|
934 |
- u->wst.dat[u->wst.ptr - 3] = c & a; |
|
901 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
902 |
+ u->rst.dat[u->rst.ptr - 2] = b & a; |
|
935 | 903 |
#ifndef NO_STACK_CHECKS |
936 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
937 |
- u->wst.error = 1; |
|
904 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
905 |
+ u->rst.error = 1; |
|
938 | 906 |
goto error; |
939 | 907 |
} |
940 | 908 |
#endif |
941 |
- u->wst.ptr -= 2; |
|
909 |
+ u->rst.ptr -= 1; |
|
942 | 910 |
} |
943 | 911 |
break; |
944 |
- case 0x3d: /* ORA2 */ |
|
912 |
+ case 0x3d: /* ORAr */ |
|
945 | 913 |
{ |
946 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
947 |
- u->wst.dat[u->wst.ptr - 4] = d | b; |
|
948 |
- u->wst.dat[u->wst.ptr - 3] = c | a; |
|
914 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
915 |
+ u->rst.dat[u->rst.ptr - 2] = b | a; |
|
949 | 916 |
#ifndef NO_STACK_CHECKS |
950 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
951 |
- u->wst.error = 1; |
|
917 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
918 |
+ u->rst.error = 1; |
|
952 | 919 |
goto error; |
953 | 920 |
} |
954 | 921 |
#endif |
955 |
- u->wst.ptr -= 2; |
|
922 |
+ u->rst.ptr -= 1; |
|
956 | 923 |
} |
957 | 924 |
break; |
958 |
- case 0x3e: /* EOR2 */ |
|
925 |
+ case 0x3e: /* EORr */ |
|
959 | 926 |
{ |
960 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
961 |
- u->wst.dat[u->wst.ptr - 4] = d ^ b; |
|
962 |
- u->wst.dat[u->wst.ptr - 3] = c ^ a; |
|
927 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
928 |
+ u->rst.dat[u->rst.ptr - 2] = b ^ a; |
|
963 | 929 |
#ifndef NO_STACK_CHECKS |
964 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
965 |
- u->wst.error = 1; |
|
930 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
931 |
+ u->rst.error = 1; |
|
966 | 932 |
goto error; |
967 | 933 |
} |
968 | 934 |
#endif |
969 |
- u->wst.ptr -= 2; |
|
935 |
+ u->rst.ptr -= 1; |
|
970 | 936 |
} |
971 | 937 |
break; |
972 |
- case 0x3f: /* SFT2 */ |
|
938 |
+ case 0x3f: /* SFTr */ |
|
973 | 939 |
{ |
974 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
975 |
- Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
|
976 |
- u->wst.dat[u->wst.ptr - 3] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) >> 8; |
|
977 |
- u->wst.dat[u->wst.ptr - 2] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) & 0xff; |
|
940 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
941 |
+ u->rst.dat[u->rst.ptr - 2] = b >> (a & 0x07) << ((a & 0x70) >> 4); |
|
978 | 942 |
#ifndef NO_STACK_CHECKS |
979 |
- if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
980 |
- u->wst.error = 1; |
|
943 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
944 |
+ u->rst.error = 1; |
|
981 | 945 |
goto error; |
982 | 946 |
} |
983 | 947 |
#endif |
984 |
- u->wst.ptr -= 1; |
|
948 |
+ u->rst.ptr -= 1; |
|
985 | 949 |
} |
986 | 950 |
break; |
987 |
- case 0x40: /* LITr */ |
|
988 |
- case 0xc0: /* LITkr */ |
|
951 |
+ case 0x40: /* LIT2 */ |
|
952 |
+ case 0xc0: /* LIT2k */ |
|
989 | 953 |
{ |
990 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++); |
|
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++); |
|
991 | 956 |
#ifndef NO_STACK_CHECKS |
992 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
993 |
- u->rst.error = 2; |
|
957 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
958 |
+ u->wst.error = 2; |
|
994 | 959 |
goto error; |
995 | 960 |
} |
996 | 961 |
#endif |
997 |
- u->rst.ptr += 1; |
|
962 |
+ u->wst.ptr += 2; |
|
998 | 963 |
} |
999 | 964 |
break; |
1000 |
- case 0x41: /* INCr */ |
|
965 |
+ case 0x41: /* INC2 */ |
|
1001 | 966 |
{ |
1002 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
1003 |
- u->rst.dat[u->rst.ptr - 1] = a + 1; |
|
967 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
968 |
+ u->wst.dat[u->wst.ptr - 2] = (a + 1) >> 8; |
|
969 |
+ u->wst.dat[u->wst.ptr - 1] = (a + 1) & 0xff; |
|
1004 | 970 |
#ifndef NO_STACK_CHECKS |
1005 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
1006 |
- u->rst.error = 1; |
|
971 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
972 |
+ u->wst.error = 1; |
|
1007 | 973 |
goto error; |
1008 | 974 |
} |
1009 | 975 |
#endif |
1010 | 976 |
} |
1011 | 977 |
break; |
1012 |
- case 0x42: /* POPr */ |
|
978 |
+ case 0x42: /* POP2 */ |
|
1013 | 979 |
{ |
1014 |
- u->rst.dat[u->rst.ptr - 1]; |
|
980 |
+ (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
1015 | 981 |
#ifndef NO_STACK_CHECKS |
1016 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
1017 |
- u->rst.error = 1; |
|
982 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
983 |
+ u->wst.error = 1; |
|
1018 | 984 |
goto error; |
1019 | 985 |
} |
1020 | 986 |
#endif |
1021 |
- u->rst.ptr -= 1; |
|
987 |
+ u->wst.ptr -= 2; |
|
1022 | 988 |
} |
1023 | 989 |
break; |
1024 |
- case 0x43: /* DUPr */ |
|
990 |
+ case 0x43: /* DUP2 */ |
|
1025 | 991 |
{ |
1026 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
1027 |
- u->rst.dat[u->rst.ptr] = a; |
|
992 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
|
993 |
+ u->wst.dat[u->wst.ptr] = b; |
|
994 |
+ u->wst.dat[u->wst.ptr + 1] = a; |
|
1028 | 995 |
#ifndef NO_STACK_CHECKS |
1029 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
1030 |
- u->rst.error = 1; |
|
996 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
997 |
+ u->wst.error = 1; |
|
1031 | 998 |
goto error; |
1032 | 999 |
} |
1033 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
1034 |
- u->rst.error = 2; |
|
1000 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
1001 |
+ u->wst.error = 2; |
|
1035 | 1002 |
goto error; |
1036 | 1003 |
} |
1037 | 1004 |
#endif |
1038 |
- u->rst.ptr += 1; |
|
1005 |
+ u->wst.ptr += 2; |
|
1039 | 1006 |
} |
1040 | 1007 |
break; |
1041 |
- case 0x44: /* NIPr */ |
|
1008 |
+ case 0x44: /* NIP2 */ |
|
1042 | 1009 |
{ |
1043 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
1044 |
- u->rst.dat[u->rst.ptr - 2]; |
|
1045 |
- u->rst.dat[u->rst.ptr - 2] = a; |
|
1010 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
1011 |
+ (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
1012 |
+ u->wst.dat[u->wst.ptr - 4] = a >> 8; |
|
1013 |
+ u->wst.dat[u->wst.ptr - 3] = a & 0xff; |
|
1046 | 1014 |
#ifndef NO_STACK_CHECKS |
1047 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1048 |
- u->rst.error = 1; |
|
1015 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1016 |
+ u->wst.error = 1; |
|
1049 | 1017 |
goto error; |
1050 | 1018 |
} |
1051 | 1019 |
#endif |
1052 |
- u->rst.ptr -= 1; |
|
1020 |
+ u->wst.ptr -= 2; |
|
1053 | 1021 |
} |
1054 | 1022 |
break; |
1055 |
- case 0x45: /* SWPr */ |
|
1023 |
+ case 0x45: /* SWP2 */ |
|
1056 | 1024 |
{ |
1057 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1058 |
- u->rst.dat[u->rst.ptr - 2] = a; |
|
1059 |
- u->rst.dat[u->rst.ptr - 1] = b; |
|
1025 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
1026 |
+ u->wst.dat[u->wst.ptr - 4] = b; |
|
1027 |
+ u->wst.dat[u->wst.ptr - 3] = a; |
|
1028 |
+ u->wst.dat[u->wst.ptr - 2] = d; |
|
1029 |
+ u->wst.dat[u->wst.ptr - 1] = c; |
|
1060 | 1030 |
#ifndef NO_STACK_CHECKS |
1061 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1062 |
- u->rst.error = 1; |
|
1031 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1032 |
+ u->wst.error = 1; |
|
1063 | 1033 |
goto error; |
1064 | 1034 |
} |
1065 | 1035 |
#endif |
1066 | 1036 |
} |
1067 | 1037 |
break; |
1068 |
- case 0x46: /* OVRr */ |
|
1038 |
+ case 0x46: /* OVR2 */ |
|
1069 | 1039 |
{ |
1070 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1071 |
- u->rst.dat[u->rst.ptr] = b; |
|
1040 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
1041 |
+ u->wst.dat[u->wst.ptr] = d; |
|
1042 |
+ u->wst.dat[u->wst.ptr + 1] = c; |
|
1072 | 1043 |
#ifndef NO_STACK_CHECKS |
1073 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1074 |
- u->rst.error = 1; |
|
1044 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1045 |
+ u->wst.error = 1; |
|
1075 | 1046 |
goto error; |
1076 | 1047 |
} |
1077 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
1078 |
- u->rst.error = 2; |
|
1048 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
1049 |
+ u->wst.error = 2; |
|
1079 | 1050 |
goto error; |
1080 | 1051 |
} |
1081 | 1052 |
#endif |
1082 |
- u->rst.ptr += 1; |
|
1053 |
+ u->wst.ptr += 2; |
|
1083 | 1054 |
} |
1084 | 1055 |
break; |
1085 |
- case 0x47: /* ROTr */ |
|
1056 |
+ case 0x47: /* ROT2 */ |
|
1086 | 1057 |
{ |
1087 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3]; |
|
1088 |
- u->rst.dat[u->rst.ptr - 3] = b; |
|
1089 |
- u->rst.dat[u->rst.ptr - 2] = a; |
|
1090 |
- u->rst.dat[u->rst.ptr - 1] = c; |
|
1058 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4], e = u->wst.dat[u->wst.ptr - 5], f = u->wst.dat[u->wst.ptr - 6]; |
|
1059 |
+ u->wst.dat[u->wst.ptr - 6] = d; |
|
1060 |
+ u->wst.dat[u->wst.ptr - 5] = c; |
|
1061 |
+ u->wst.dat[u->wst.ptr - 4] = b; |
|
1062 |
+ u->wst.dat[u->wst.ptr - 3] = a; |
|
1063 |
+ u->wst.dat[u->wst.ptr - 2] = f; |
|
1064 |
+ u->wst.dat[u->wst.ptr - 1] = e; |
|
1091 | 1065 |
#ifndef NO_STACK_CHECKS |
1092 |
- if(__builtin_expect(u->rst.ptr < 3, 0)) { |
|
1093 |
- u->rst.error = 1; |
|
1066 |
+ if(__builtin_expect(u->wst.ptr < 6, 0)) { |
|
1067 |
+ u->wst.error = 1; |
|
1094 | 1068 |
goto error; |
1095 | 1069 |
} |
1096 | 1070 |
#endif |
1097 | 1071 |
} |
1098 | 1072 |
break; |
1099 |
- case 0x48: /* EQUr */ |
|
1073 |
+ case 0x48: /* EQU2 */ |
|
1100 | 1074 |
{ |
1101 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1102 |
- u->rst.dat[u->rst.ptr - 2] = b == a; |
|
1075 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
1076 |
+ u->wst.dat[u->wst.ptr - 4] = b == a; |
|
1103 | 1077 |
#ifndef NO_STACK_CHECKS |
1104 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1105 |
- u->rst.error = 1; |
|
1078 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1079 |
+ u->wst.error = 1; |
|
1106 | 1080 |
goto error; |
1107 | 1081 |
} |
1108 | 1082 |
#endif |
1109 |
- u->rst.ptr -= 1; |
|
1083 |
+ u->wst.ptr -= 3; |
|
1110 | 1084 |
} |
1111 | 1085 |
break; |
1112 |
- case 0x49: /* NEQr */ |
|
1086 |
+ case 0x49: /* NEQ2 */ |
|
1113 | 1087 |
{ |
1114 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1115 |
- u->rst.dat[u->rst.ptr - 2] = b != a; |
|
1088 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
1089 |
+ u->wst.dat[u->wst.ptr - 4] = b != a; |
|
1116 | 1090 |
#ifndef NO_STACK_CHECKS |
1117 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1118 |
- u->rst.error = 1; |
|
1091 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1092 |
+ u->wst.error = 1; |
|
1119 | 1093 |
goto error; |
1120 | 1094 |
} |
1121 | 1095 |
#endif |
1122 |
- u->rst.ptr -= 1; |
|
1096 |
+ u->wst.ptr -= 3; |
|
1123 | 1097 |
} |
1124 | 1098 |
break; |
1125 |
- case 0x4a: /* GTHr */ |
|
1099 |
+ case 0x4a: /* GTH2 */ |
|
1126 | 1100 |
{ |
1127 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1128 |
- u->rst.dat[u->rst.ptr - 2] = b > a; |
|
1101 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
1102 |
+ u->wst.dat[u->wst.ptr - 4] = b > a; |
|
1129 | 1103 |
#ifndef NO_STACK_CHECKS |
1130 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1131 |
- u->rst.error = 1; |
|
1104 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1105 |
+ u->wst.error = 1; |
|
1132 | 1106 |
goto error; |
1133 | 1107 |
} |
1134 | 1108 |
#endif |
1135 |
- u->rst.ptr -= 1; |
|
1109 |
+ u->wst.ptr -= 3; |
|
1136 | 1110 |
} |
1137 | 1111 |
break; |
1138 |
- case 0x4b: /* LTHr */ |
|
1112 |
+ case 0x4b: /* LTH2 */ |
|
1139 | 1113 |
{ |
1140 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1141 |
- u->rst.dat[u->rst.ptr - 2] = b < a; |
|
1114 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
1115 |
+ u->wst.dat[u->wst.ptr - 4] = b < a; |
|
1142 | 1116 |
#ifndef NO_STACK_CHECKS |
1143 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1144 |
- u->rst.error = 1; |
|
1117 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1118 |
+ u->wst.error = 1; |
|
1145 | 1119 |
goto error; |
1146 | 1120 |
} |
1147 | 1121 |
#endif |
1148 |
- u->rst.ptr -= 1; |
|
1122 |
+ u->wst.ptr -= 3; |
|
1149 | 1123 |
} |
1150 | 1124 |
break; |
1151 |
- case 0x4c: /* JMPr */ |
|
1125 |
+ case 0x4c: /* JMP2 */ |
|
1152 | 1126 |
{ |
1153 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
1154 |
- u->ram.ptr += (Sint8)a; |
|
1127 |
+ u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
1155 | 1128 |
#ifndef NO_STACK_CHECKS |
1156 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
1157 |
- u->rst.error = 1; |
|
1129 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
1130 |
+ u->wst.error = 1; |
|
1158 | 1131 |
goto error; |
1159 | 1132 |
} |
1160 | 1133 |
#endif |
1161 |
- u->rst.ptr -= 1; |
|
1134 |
+ u->wst.ptr -= 2; |
|
1162 | 1135 |
} |
1163 | 1136 |
break; |
1164 |
- case 0x4d: /* JCNr */ |
|
1137 |
+ case 0x4d: /* JCN2 */ |
|
1165 | 1138 |
{ |
1166 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
1167 |
- if(u->rst.dat[u->rst.ptr - 2]) u->ram.ptr += (Sint8)a; |
|
1139 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
1140 |
+ if(u->wst.dat[u->wst.ptr - 3]) u->ram.ptr = a; |
|
1168 | 1141 |
#ifndef NO_STACK_CHECKS |
1169 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1170 |
- u->rst.error = 1; |
|
1142 |
+ if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
1143 |
+ u->wst.error = 1; |
|
1171 | 1144 |
goto error; |
1172 | 1145 |
} |
1173 | 1146 |
#endif |
1174 |
- u->rst.ptr -= 2; |
|
1147 |
+ u->wst.ptr -= 3; |
|
1175 | 1148 |
} |
1176 | 1149 |
break; |
1177 |
- case 0x4e: /* JSRr */ |
|
1150 |
+ case 0x4e: /* JSR2 */ |
|
1178 | 1151 |
{ |
1179 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
1180 |
- u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8; |
|
1181 |
- u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff; |
|
1182 |
- u->ram.ptr += (Sint8)a; |
|
1152 |
+ u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8; |
|
1153 |
+ u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff; |
|
1154 |
+ u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
1183 | 1155 |
#ifndef NO_STACK_CHECKS |
1184 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
1185 |
- u->rst.error = 1; |
|
1156 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
1157 |
+ u->wst.error = 1; |
|
1186 | 1158 |
goto error; |
1187 | 1159 |
} |
1188 | 1160 |
#endif |
1189 |
- u->rst.ptr -= 1; |
|
1161 |
+ u->wst.ptr -= 2; |
|
1190 | 1162 |
#ifndef NO_STACK_CHECKS |
1191 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
1192 |
- u->wst.error = 2; |
|
1163 |
+ if(__builtin_expect(u->rst.ptr > 253, 0)) { |
|
1164 |
+ u->rst.error = 2; |
|
1193 | 1165 |
goto error; |
1194 | 1166 |
} |
1195 | 1167 |
#endif |
1196 |
- u->wst.ptr += 2; |
|
1168 |
+ u->rst.ptr += 2; |
|
1197 | 1169 |
} |
1198 | 1170 |
break; |
1199 |
- case 0x4f: /* STHr */ |
|
1171 |
+ case 0x4f: /* STH2 */ |
|
1200 | 1172 |
{ |
1201 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
1202 |
- u->wst.dat[u->wst.ptr] = a; |
|
1173 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
|
1174 |
+ u->rst.dat[u->rst.ptr] = b; |
|
1175 |
+ u->rst.dat[u->rst.ptr + 1] = a; |
|
1203 | 1176 |
#ifndef NO_STACK_CHECKS |
1204 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
1205 |
- u->rst.error = 1; |
|
1177 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
1178 |
+ u->wst.error = 1; |
|
1206 | 1179 |
goto error; |
1207 | 1180 |
} |
1208 | 1181 |
#endif |
1209 |
- u->rst.ptr -= 1; |
|
1182 |
+ u->wst.ptr -= 2; |
|
1210 | 1183 |
#ifndef NO_STACK_CHECKS |
1211 |
- if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
1212 |
- u->wst.error = 2; |
|
1184 |
+ if(__builtin_expect(u->rst.ptr > 253, 0)) { |
|
1185 |
+ u->rst.error = 2; |
|
1213 | 1186 |
goto error; |
1214 | 1187 |
} |
1215 | 1188 |
#endif |
1216 |
- u->wst.ptr += 1; |
|
1189 |
+ u->rst.ptr += 2; |
|
1217 | 1190 |
} |
1218 | 1191 |
break; |
1219 |
- case 0x50: /* LDZr */ |
|
1192 |
+ case 0x50: /* LDZ2 */ |
|
1220 | 1193 |
{ |
1221 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
1222 |
- u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a); |
|
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); |
|
1223 | 1197 |
#ifndef NO_STACK_CHECKS |
1224 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
1225 |
- u->rst.error = 1; |
|
1198 |
+ if(__builtin_expect(u->wst.ptr < 1, 0)) { |
|
1199 |
+ u->wst.error = 1; |
|
1200 |
+ goto error; |
|
1201 |
+ } |
|
1202 |
+ if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
1203 |
+ u->wst.error = 2; |
|
1226 | 1204 |
goto error; |
1227 | 1205 |
} |
1228 | 1206 |
#endif |
1207 |
+ u->wst.ptr += 1; |
|
1229 | 1208 |
} |
1230 | 1209 |
break; |
1231 |
- case 0x51: /* STZr */ |
|
1210 |
+ case 0x51: /* STZ2 */ |
|
1232 | 1211 |
{ |
1233 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
1234 |
- Uint8 b = u->rst.dat[u->rst.ptr - 2]; |
|
1235 |
- mempoke8(u->ram.dat, a, b); |
|
1212 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
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); |
|
1236 | 1215 |
#ifndef NO_STACK_CHECKS |
1237 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1238 |
- u->rst.error = 1; |
|
1216 |
+ if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
1217 |
+ u->wst.error = 1; |
|
1239 | 1218 |
goto error; |
1240 | 1219 |
} |
1241 | 1220 |
#endif |
1242 |
- u->rst.ptr -= 2; |
|
1221 |
+ u->wst.ptr -= 3; |
|
1243 | 1222 |
} |
1244 | 1223 |
break; |
1245 |
- case 0x52: /* LDRr */ |
|
1224 |
+ case 0x52: /* LDR2 */ |
|
1246 | 1225 |
{ |
1247 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
1248 |
- u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
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); |
|
1249 | 1229 |
#ifndef NO_STACK_CHECKS |
1250 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
1251 |
- u->rst.error = 1; |
|
1230 |
+ if(__builtin_expect(u->wst.ptr < 1, 0)) { |
|
1231 |
+ u->wst.error = 1; |
|
1232 |
+ goto error; |
|
1233 |
+ } |
|
1234 |
+ if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
1235 |
+ u->wst.error = 2; |
|
1252 | 1236 |
goto error; |
1253 | 1237 |
} |
1254 | 1238 |
#endif |
1239 |
+ u->wst.ptr += 1; |
|
1255 | 1240 |
} |
1256 | 1241 |
break; |
1257 |
- case 0x53: /* STRr */ |
|
1242 |
+ case 0x53: /* STR2 */ |
|
1258 | 1243 |
{ |
1259 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
1260 |
- Uint8 b = u->rst.dat[u->rst.ptr - 2]; |
|
1261 |
- mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
1244 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
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); |
|
1262 | 1247 |
#ifndef NO_STACK_CHECKS |
1263 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1264 |
- u->rst.error = 1; |
|
1248 |
+ if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
1249 |
+ u->wst.error = 1; |
|
1265 | 1250 |
goto error; |
1266 | 1251 |
} |
1267 | 1252 |
#endif |
1268 |
- u->rst.ptr -= 2; |
|
1253 |
+ u->wst.ptr -= 3; |
|
1269 | 1254 |
} |
1270 | 1255 |
break; |
1271 |
- case 0x54: /* LDAr */ |
|
1256 |
+ case 0x54: /* LDA2 */ |
|
1272 | 1257 |
{ |
1273 |
- Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
|
1274 |
- u->rst.dat[u->rst.ptr - 2] = mempeek8(u->ram.dat, a); |
|
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); |
|
1275 | 1261 |
#ifndef NO_STACK_CHECKS |
1276 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1277 |
- u->rst.error = 1; |
|
1262 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
1263 |
+ u->wst.error = 1; |
|
1278 | 1264 |
goto error; |
1279 | 1265 |
} |
1280 | 1266 |
#endif |
1281 |
- u->rst.ptr -= 1; |
|
1282 | 1267 |
} |
1283 | 1268 |
break; |
1284 |
- case 0x55: /* STAr */ |
|
1269 |
+ case 0x55: /* STA2 */ |
|
1285 | 1270 |
{ |
1286 |
- Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
|
1287 |
- Uint8 b = u->rst.dat[u->rst.ptr - 3]; |
|
1288 |
- mempoke8(u->ram.dat, a, b); |
|
1271 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
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); |
|
1289 | 1274 |
#ifndef NO_STACK_CHECKS |
1290 |
- if(__builtin_expect(u->rst.ptr < 3, 0)) { |
|
1291 |
- u->rst.error = 1; |
|
1275 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1276 |
+ u->wst.error = 1; |
|
1292 | 1277 |
goto error; |
1293 | 1278 |
} |
1294 | 1279 |
#endif |
1295 |
- u->rst.ptr -= 3; |
|
1280 |
+ u->wst.ptr -= 4; |
|
1296 | 1281 |
} |
1297 | 1282 |
break; |
1298 |
- case 0x56: /* DEIr */ |
|
1283 |
+ case 0x56: /* DEI2 */ |
|
1299 | 1284 |
{ |
1300 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
1301 |
- u->rst.dat[u->rst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); |
|
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); |
|
1302 | 1288 |
#ifndef NO_STACK_CHECKS |
1303 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
1304 |
- u->rst.error = 1; |
|
1289 |
+ if(__builtin_expect(u->wst.ptr < 1, 0)) { |
|
1290 |
+ u->wst.error = 1; |
|
1291 |
+ goto error; |
|
1292 |
+ } |
|
1293 |
+ if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
1294 |
+ u->wst.error = 2; |
|
1305 | 1295 |
goto error; |
1306 | 1296 |
} |
1307 | 1297 |
#endif |
1298 |
+ u->wst.ptr += 1; |
|
1308 | 1299 |
} |
1309 | 1300 |
break; |
1310 |
- case 0x57: /* DEOr */ |
|
1301 |
+ case 0x57: /* DEO2 */ |
|
1311 | 1302 |
{ |
1312 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1313 |
- devpoke8(&u->dev[a >> 4], a, b); |
|
1303 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
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); |
|
1314 | 1306 |
#ifndef NO_STACK_CHECKS |
1315 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1316 |
- u->rst.error = 1; |
|
1307 |
+ if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
1308 |
+ u->wst.error = 1; |
|
1317 | 1309 |
goto error; |
1318 | 1310 |
} |
1319 | 1311 |
#endif |
1320 |
- u->rst.ptr -= 2; |
|
1312 |
+ u->wst.ptr -= 3; |
|
1321 | 1313 |
} |
1322 | 1314 |
break; |
1323 |
- case 0x58: /* ADDr */ |
|
1315 |
+ case 0x58: /* ADD2 */ |
|
1324 | 1316 |
{ |
1325 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1326 |
- u->rst.dat[u->rst.ptr - 2] = b + a; |
|
1317 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
1318 |
+ u->wst.dat[u->wst.ptr - 4] = (b + a) >> 8; |
|
1319 |
+ u->wst.dat[u->wst.ptr - 3] = (b + a) & 0xff; |
|
1327 | 1320 |
#ifndef NO_STACK_CHECKS |
1328 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1329 |
- u->rst.error = 1; |
|
1321 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1322 |
+ u->wst.error = 1; |
|
1330 | 1323 |
goto error; |
1331 | 1324 |
} |
1332 | 1325 |
#endif |
1333 |
- u->rst.ptr -= 1; |
|
1326 |
+ u->wst.ptr -= 2; |
|
1334 | 1327 |
} |
1335 | 1328 |
break; |
1336 |
- case 0x59: /* SUBr */ |
|
1329 |
+ case 0x59: /* SUB2 */ |
|
1337 | 1330 |
{ |
1338 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1339 |
- u->rst.dat[u->rst.ptr - 2] = b - a; |
|
1331 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
1332 |
+ u->wst.dat[u->wst.ptr - 4] = (b - a) >> 8; |
|
1333 |
+ u->wst.dat[u->wst.ptr - 3] = (b - a) & 0xff; |
|
1340 | 1334 |
#ifndef NO_STACK_CHECKS |
1341 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1342 |
- u->rst.error = 1; |
|
1335 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1336 |
+ u->wst.error = 1; |
|
1343 | 1337 |
goto error; |
1344 | 1338 |
} |
1345 | 1339 |
#endif |
1346 |
- u->rst.ptr -= 1; |
|
1340 |
+ u->wst.ptr -= 2; |
|
1347 | 1341 |
} |
1348 | 1342 |
break; |
1349 |
- case 0x5a: /* MULr */ |
|
1343 |
+ case 0x5a: /* MUL2 */ |
|
1350 | 1344 |
{ |
1351 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1352 |
- u->rst.dat[u->rst.ptr - 2] = b * a; |
|
1345 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
1346 |
+ u->wst.dat[u->wst.ptr - 4] = (b * a) >> 8; |
|
1347 |
+ u->wst.dat[u->wst.ptr - 3] = (b * a) & 0xff; |
|
1353 | 1348 |
#ifndef NO_STACK_CHECKS |
1354 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1355 |
- u->rst.error = 1; |
|
1349 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1350 |
+ u->wst.error = 1; |
|
1356 | 1351 |
goto error; |
1357 | 1352 |
} |
1358 | 1353 |
#endif |
1359 |
- u->rst.ptr -= 1; |
|
1354 |
+ u->wst.ptr -= 2; |
|
1360 | 1355 |
} |
1361 | 1356 |
break; |
1362 |
- case 0x5b: /* DIVr */ |
|
1357 |
+ case 0x5b: /* DIV2 */ |
|
1363 | 1358 |
{ |
1364 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1359 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
1365 | 1360 |
if(a == 0) { |
1366 |
- u->rst.error = 3; |
|
1361 |
+ u->wst.error = 3; |
|
1367 | 1362 |
#ifndef NO_STACK_CHECKS |
1368 | 1363 |
goto error; |
1369 | 1364 |
#endif |
1370 | 1365 |
a = 1; |
1371 | 1366 |
} |
1372 |
- u->rst.dat[u->rst.ptr - 2] = b / a; |
|
1367 |
+ u->wst.dat[u->wst.ptr - 4] = (b / a) >> 8; |
|
1368 |
+ u->wst.dat[u->wst.ptr - 3] = (b / a) & 0xff; |
|
1373 | 1369 |
#ifndef NO_STACK_CHECKS |
1374 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1375 |
- u->rst.error = 1; |
|
1370 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1371 |
+ u->wst.error = 1; |
|
1376 | 1372 |
goto error; |
1377 | 1373 |
} |
1378 | 1374 |
#endif |
1379 |
- u->rst.ptr -= 1; |
|
1375 |
+ u->wst.ptr -= 2; |
|
1380 | 1376 |
} |
1381 | 1377 |
break; |
1382 |
- case 0x5c: /* ANDr */ |
|
1378 |
+ case 0x5c: /* AND2 */ |
|
1383 | 1379 |
{ |
1384 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1385 |
- u->rst.dat[u->rst.ptr - 2] = b & a; |
|
1380 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
1381 |
+ u->wst.dat[u->wst.ptr - 4] = d & b; |
|
1382 |
+ u->wst.dat[u->wst.ptr - 3] = c & a; |
|
1386 | 1383 |
#ifndef NO_STACK_CHECKS |
1387 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1388 |
- u->rst.error = 1; |
|
1384 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1385 |
+ u->wst.error = 1; |
|
1389 | 1386 |
goto error; |
1390 | 1387 |
} |
1391 | 1388 |
#endif |
1392 |
- u->rst.ptr -= 1; |
|
1389 |
+ u->wst.ptr -= 2; |
|
1393 | 1390 |
} |
1394 | 1391 |
break; |
1395 |
- case 0x5d: /* ORAr */ |
|
1392 |
+ case 0x5d: /* ORA2 */ |
|
1396 | 1393 |
{ |
1397 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1398 |
- u->rst.dat[u->rst.ptr - 2] = b | a; |
|
1394 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
1395 |
+ u->wst.dat[u->wst.ptr - 4] = d | b; |
|
1396 |
+ u->wst.dat[u->wst.ptr - 3] = c | a; |
|
1399 | 1397 |
#ifndef NO_STACK_CHECKS |
1400 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1401 |
- u->rst.error = 1; |
|
1398 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1399 |
+ u->wst.error = 1; |
|
1402 | 1400 |
goto error; |
1403 | 1401 |
} |
1404 | 1402 |
#endif |
1405 |
- u->rst.ptr -= 1; |
|
1403 |
+ u->wst.ptr -= 2; |
|
1406 | 1404 |
} |
1407 | 1405 |
break; |
1408 |
- case 0x5e: /* EORr */ |
|
1406 |
+ case 0x5e: /* EOR2 */ |
|
1409 | 1407 |
{ |
1410 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1411 |
- u->rst.dat[u->rst.ptr - 2] = b ^ a; |
|
1408 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
1409 |
+ u->wst.dat[u->wst.ptr - 4] = d ^ b; |
|
1410 |
+ u->wst.dat[u->wst.ptr - 3] = c ^ a; |
|
1412 | 1411 |
#ifndef NO_STACK_CHECKS |
1413 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1414 |
- u->rst.error = 1; |
|
1412 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
1413 |
+ u->wst.error = 1; |
|
1415 | 1414 |
goto error; |
1416 | 1415 |
} |
1417 | 1416 |
#endif |
1418 |
- u->rst.ptr -= 1; |
|
1417 |
+ u->wst.ptr -= 2; |
|
1419 | 1418 |
} |
1420 | 1419 |
break; |
1421 |
- case 0x5f: /* SFTr */ |
|
1420 |
+ case 0x5f: /* SFT2 */ |
|
1422 | 1421 |
{ |
1423 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
1424 |
- u->rst.dat[u->rst.ptr - 2] = b >> (a & 0x07) << ((a & 0x70) >> 4); |
|
1422 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
1423 |
+ Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
|
1424 |
+ u->wst.dat[u->wst.ptr - 3] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) >> 8; |
|
1425 |
+ u->wst.dat[u->wst.ptr - 2] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) & 0xff; |
|
1425 | 1426 |
#ifndef NO_STACK_CHECKS |
1426 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
1427 |
- u->rst.error = 1; |
|
1427 |
+ if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
1428 |
+ u->wst.error = 1; |
|
1428 | 1429 |
goto error; |
1429 | 1430 |
} |
1430 | 1431 |
#endif |
1431 |
- u->rst.ptr -= 1; |
|
1432 |
+ u->wst.ptr -= 1; |
|
1432 | 1433 |
} |
1433 | 1434 |
break; |
1434 | 1435 |
case 0x60: /* LIT2r */ |
... | ... |
@@ -2425,1049 +2426,1049 @@ uxn_eval(Uxn *u, Uint16 vec) |
2425 | 2426 |
u->wst.ptr += 1; |
2426 | 2427 |
} |
2427 | 2428 |
break; |
2428 |
- case 0xa1: /* INC2k */ |
|
2429 |
+ case 0xa1: /* INCkr */ |
|
2429 | 2430 |
{ |
2430 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
2431 |
- u->wst.dat[u->wst.ptr] = (a + 1) >> 8; |
|
2432 |
- u->wst.dat[u->wst.ptr + 1] = (a + 1) & 0xff; |
|
2431 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
2432 |
+ u->rst.dat[u->rst.ptr] = a + 1; |
|
2433 | 2433 |
#ifndef NO_STACK_CHECKS |
2434 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
2435 |
- u->wst.error = 1; |
|
2434 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
2435 |
+ u->rst.error = 1; |
|
2436 | 2436 |
goto error; |
2437 | 2437 |
} |
2438 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2439 |
- u->wst.error = 2; |
|
2438 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2439 |
+ u->rst.error = 2; |
|
2440 | 2440 |
goto error; |
2441 | 2441 |
} |
2442 | 2442 |
#endif |
2443 |
- u->wst.ptr += 2; |
|
2443 |
+ u->rst.ptr += 1; |
|
2444 | 2444 |
} |
2445 | 2445 |
break; |
2446 |
- case 0xa2: /* POP2k */ |
|
2446 |
+ case 0xa2: /* POPkr */ |
|
2447 | 2447 |
{ |
2448 |
- (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
2448 |
+ u->rst.dat[u->rst.ptr - 1]; |
|
2449 | 2449 |
#ifndef NO_STACK_CHECKS |
2450 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
2451 |
- u->wst.error = 1; |
|
2450 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
2451 |
+ u->rst.error = 1; |
|
2452 | 2452 |
goto error; |
2453 | 2453 |
} |
2454 | 2454 |
#endif |
2455 | 2455 |
} |
2456 | 2456 |
break; |
2457 |
- case 0xa3: /* DUP2k */ |
|
2457 |
+ case 0xa3: /* DUPkr */ |
|
2458 | 2458 |
{ |
2459 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
|
2460 |
- u->wst.dat[u->wst.ptr] = b; |
|
2461 |
- u->wst.dat[u->wst.ptr + 1] = a; |
|
2462 |
- u->wst.dat[u->wst.ptr + 2] = b; |
|
2463 |
- u->wst.dat[u->wst.ptr + 3] = a; |
|
2459 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
2460 |
+ u->rst.dat[u->rst.ptr] = a; |
|
2461 |
+ u->rst.dat[u->rst.ptr + 1] = a; |
|
2464 | 2462 |
#ifndef NO_STACK_CHECKS |
2465 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
2466 |
- u->wst.error = 1; |
|
2463 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
2464 |
+ u->rst.error = 1; |
|
2467 | 2465 |
goto error; |
2468 | 2466 |
} |
2469 |
- if(__builtin_expect(u->wst.ptr > 251, 0)) { |
|
2470 |
- u->wst.error = 2; |
|
2467 |
+ if(__builtin_expect(u->rst.ptr > 253, 0)) { |
|
2468 |
+ u->rst.error = 2; |
|
2471 | 2469 |
goto error; |
2472 | 2470 |
} |
2473 | 2471 |
#endif |
2474 |
- u->wst.ptr += 4; |
|
2472 |
+ u->rst.ptr += 2; |
|
2475 | 2473 |
} |
2476 | 2474 |
break; |
2477 |
- case 0xa4: /* NIP2k */ |
|
2475 |
+ case 0xa4: /* NIPkr */ |
|
2478 | 2476 |
{ |
2479 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
2480 |
- (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
2481 |
- u->wst.dat[u->wst.ptr] = a >> 8; |
|
2482 |
- u->wst.dat[u->wst.ptr + 1] = a & 0xff; |
|
2477 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
2478 |
+ u->rst.dat[u->rst.ptr - 2]; |
|
2479 |
+ u->rst.dat[u->rst.ptr] = a; |
|
2483 | 2480 |
#ifndef NO_STACK_CHECKS |
2484 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2485 |
- u->wst.error = 1; |
|
2481 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2482 |
+ u->rst.error = 1; |
|
2486 | 2483 |
goto error; |
2487 | 2484 |
} |
2488 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2489 |
- u->wst.error = 2; |
|
2485 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2486 |
+ u->rst.error = 2; |
|
2490 | 2487 |
goto error; |
2491 | 2488 |
} |
2492 | 2489 |
#endif |
2493 |
- u->wst.ptr += 2; |
|
2490 |
+ u->rst.ptr += 1; |
|
2494 | 2491 |
} |
2495 | 2492 |
break; |
2496 |
- case 0xa5: /* SWP2k */ |
|
2493 |
+ case 0xa5: /* SWPkr */ |
|
2497 | 2494 |
{ |
2498 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
2499 |
- u->wst.dat[u->wst.ptr] = b; |
|
2500 |
- u->wst.dat[u->wst.ptr + 1] = a; |
|
2501 |
- u->wst.dat[u->wst.ptr + 2] = d; |
|
2502 |
- u->wst.dat[u->wst.ptr + 3] = c; |
|
2495 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2496 |
+ u->rst.dat[u->rst.ptr] = a; |
|
2497 |
+ u->rst.dat[u->rst.ptr + 1] = b; |
|
2503 | 2498 |
#ifndef NO_STACK_CHECKS |
2504 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2505 |
- u->wst.error = 1; |
|
2499 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2500 |
+ u->rst.error = 1; |
|
2506 | 2501 |
goto error; |
2507 | 2502 |
} |
2508 |
- if(__builtin_expect(u->wst.ptr > 251, 0)) { |
|
2509 |
- u->wst.error = 2; |
|
2503 |
+ if(__builtin_expect(u->rst.ptr > 253, 0)) { |
|
2504 |
+ u->rst.error = 2; |
|
2510 | 2505 |
goto error; |
2511 | 2506 |
} |
2512 | 2507 |
#endif |
2513 |
- u->wst.ptr += 4; |
|
2508 |
+ u->rst.ptr += 2; |
|
2514 | 2509 |
} |
2515 | 2510 |
break; |
2516 |
- case 0xa6: /* OVR2k */ |
|
2511 |
+ case 0xa6: /* OVRkr */ |
|
2517 | 2512 |
{ |
2518 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
2519 |
- u->wst.dat[u->wst.ptr] = d; |
|
2520 |
- u->wst.dat[u->wst.ptr + 1] = c; |
|
2521 |
- u->wst.dat[u->wst.ptr + 2] = b; |
|
2522 |
- u->wst.dat[u->wst.ptr + 3] = a; |
|
2523 |
- u->wst.dat[u->wst.ptr + 4] = d; |
|
2524 |
- u->wst.dat[u->wst.ptr + 5] = c; |
|
2513 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2514 |
+ u->rst.dat[u->rst.ptr] = b; |
|
2515 |
+ u->rst.dat[u->rst.ptr + 1] = a; |
|
2516 |
+ u->rst.dat[u->rst.ptr + 2] = b; |
|
2525 | 2517 |
#ifndef NO_STACK_CHECKS |
2526 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2527 |
- u->wst.error = 1; |
|
2518 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2519 |
+ u->rst.error = 1; |
|
2528 | 2520 |
goto error; |
2529 | 2521 |
} |
2530 |
- if(__builtin_expect(u->wst.ptr > 249, 0)) { |
|
2531 |
- u->wst.error = 2; |
|
2522 |
+ if(__builtin_expect(u->rst.ptr > 252, 0)) { |
|
2523 |
+ u->rst.error = 2; |
|
2532 | 2524 |
goto error; |
2533 | 2525 |
} |
2534 | 2526 |
#endif |
2535 |
- u->wst.ptr += 6; |
|
2527 |
+ u->rst.ptr += 3; |
|
2536 | 2528 |
} |
2537 | 2529 |
break; |
2538 |
- case 0xa7: /* ROT2k */ |
|
2530 |
+ case 0xa7: /* ROTkr */ |
|
2539 | 2531 |
{ |
2540 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4], e = u->wst.dat[u->wst.ptr - 5], f = u->wst.dat[u->wst.ptr - 6]; |
|
2541 |
- u->wst.dat[u->wst.ptr] = d; |
|
2542 |
- u->wst.dat[u->wst.ptr + 1] = c; |
|
2543 |
- u->wst.dat[u->wst.ptr + 2] = b; |
|
2544 |
- u->wst.dat[u->wst.ptr + 3] = a; |
|
2545 |
- u->wst.dat[u->wst.ptr + 4] = f; |
|
2546 |
- u->wst.dat[u->wst.ptr + 5] = e; |
|
2532 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3]; |
|
2533 |
+ u->rst.dat[u->rst.ptr] = b; |
|
2534 |
+ u->rst.dat[u->rst.ptr + 1] = a; |
|
2535 |
+ u->rst.dat[u->rst.ptr + 2] = c; |
|
2547 | 2536 |
#ifndef NO_STACK_CHECKS |
2548 |
- if(__builtin_expect(u->wst.ptr < 6, 0)) { |
|
2549 |
- u->wst.error = 1; |
|
2537 |
+ if(__builtin_expect(u->rst.ptr < 3, 0)) { |
|
2538 |
+ u->rst.error = 1; |
|
2550 | 2539 |
goto error; |
2551 | 2540 |
} |
2552 |
- if(__builtin_expect(u->wst.ptr > 249, 0)) { |
|
2553 |
- u->wst.error = 2; |
|
2541 |
+ if(__builtin_expect(u->rst.ptr > 252, 0)) { |
|
2542 |
+ u->rst.error = 2; |
|
2554 | 2543 |
goto error; |
2555 | 2544 |
} |
2556 | 2545 |
#endif |
2557 |
- u->wst.ptr += 6; |
|
2546 |
+ u->rst.ptr += 3; |
|
2558 | 2547 |
} |
2559 | 2548 |
break; |
2560 |
- case 0xa8: /* EQU2k */ |
|
2549 |
+ case 0xa8: /* EQUkr */ |
|
2561 | 2550 |
{ |
2562 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
2563 |
- u->wst.dat[u->wst.ptr] = b == a; |
|
2551 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2552 |
+ u->rst.dat[u->rst.ptr] = b == a; |
|
2564 | 2553 |
#ifndef NO_STACK_CHECKS |
2565 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2566 |
- u->wst.error = 1; |
|
2554 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2555 |
+ u->rst.error = 1; |
|
2567 | 2556 |
goto error; |
2568 | 2557 |
} |
2569 |
- if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
2570 |
- u->wst.error = 2; |
|
2558 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2559 |
+ u->rst.error = 2; |
|
2571 | 2560 |
goto error; |
2572 | 2561 |
} |
2573 | 2562 |
#endif |
2574 |
- u->wst.ptr += 1; |
|
2563 |
+ u->rst.ptr += 1; |
|
2575 | 2564 |
} |
2576 | 2565 |
break; |
2577 |
- case 0xa9: /* NEQ2k */ |
|
2566 |
+ case 0xa9: /* NEQkr */ |
|
2578 | 2567 |
{ |
2579 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
2580 |
- u->wst.dat[u->wst.ptr] = b != a; |
|
2568 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2569 |
+ u->rst.dat[u->rst.ptr] = b != a; |
|
2581 | 2570 |
#ifndef NO_STACK_CHECKS |
2582 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2583 |
- u->wst.error = 1; |
|
2571 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2572 |
+ u->rst.error = 1; |
|
2584 | 2573 |
goto error; |
2585 | 2574 |
} |
2586 |
- if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
2587 |
- u->wst.error = 2; |
|
2575 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2576 |
+ u->rst.error = 2; |
|
2588 | 2577 |
goto error; |
2589 | 2578 |
} |
2590 | 2579 |
#endif |
2591 |
- u->wst.ptr += 1; |
|
2580 |
+ u->rst.ptr += 1; |
|
2592 | 2581 |
} |
2593 | 2582 |
break; |
2594 |
- case 0xaa: /* GTH2k */ |
|
2583 |
+ case 0xaa: /* GTHkr */ |
|
2595 | 2584 |
{ |
2596 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
2597 |
- u->wst.dat[u->wst.ptr] = b > a; |
|
2585 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2586 |
+ u->rst.dat[u->rst.ptr] = b > a; |
|
2598 | 2587 |
#ifndef NO_STACK_CHECKS |
2599 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2600 |
- u->wst.error = 1; |
|
2588 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2589 |
+ u->rst.error = 1; |
|
2601 | 2590 |
goto error; |
2602 | 2591 |
} |
2603 |
- if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
2604 |
- u->wst.error = 2; |
|
2592 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2593 |
+ u->rst.error = 2; |
|
2605 | 2594 |
goto error; |
2606 | 2595 |
} |
2607 | 2596 |
#endif |
2608 |
- u->wst.ptr += 1; |
|
2597 |
+ u->rst.ptr += 1; |
|
2609 | 2598 |
} |
2610 | 2599 |
break; |
2611 |
- case 0xab: /* LTH2k */ |
|
2600 |
+ case 0xab: /* LTHkr */ |
|
2612 | 2601 |
{ |
2613 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
2614 |
- u->wst.dat[u->wst.ptr] = b < a; |
|
2602 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2603 |
+ u->rst.dat[u->rst.ptr] = b < a; |
|
2615 | 2604 |
#ifndef NO_STACK_CHECKS |
2616 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2617 |
- u->wst.error = 1; |
|
2605 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2606 |
+ u->rst.error = 1; |
|
2618 | 2607 |
goto error; |
2619 | 2608 |
} |
2620 |
- if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
2621 |
- u->wst.error = 2; |
|
2609 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2610 |
+ u->rst.error = 2; |
|
2622 | 2611 |
goto error; |
2623 | 2612 |
} |
2624 | 2613 |
#endif |
2625 |
- u->wst.ptr += 1; |
|
2614 |
+ u->rst.ptr += 1; |
|
2626 | 2615 |
} |
2627 | 2616 |
break; |
2628 |
- case 0xac: /* JMP2k */ |
|
2617 |
+ case 0xac: /* JMPkr */ |
|
2629 | 2618 |
{ |
2630 |
- u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
2619 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
2620 |
+ u->ram.ptr += (Sint8)a; |
|
2631 | 2621 |
#ifndef NO_STACK_CHECKS |
2632 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
2633 |
- u->wst.error = 1; |
|
2622 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
2623 |
+ u->rst.error = 1; |
|
2634 | 2624 |
goto error; |
2635 | 2625 |
} |
2636 | 2626 |
#endif |
2637 | 2627 |
} |
2638 | 2628 |
break; |
2639 |
- case 0xad: /* JCN2k */ |
|
2629 |
+ case 0xad: /* JCNkr */ |
|
2640 | 2630 |
{ |
2641 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
2642 |
- if(u->wst.dat[u->wst.ptr - 3]) u->ram.ptr = a; |
|
2631 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
2632 |
+ if(u->rst.dat[u->rst.ptr - 2]) u->ram.ptr += (Sint8)a; |
|
2643 | 2633 |
#ifndef NO_STACK_CHECKS |
2644 |
- if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
2645 |
- u->wst.error = 1; |
|
2634 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2635 |
+ u->rst.error = 1; |
|
2646 | 2636 |
goto error; |
2647 | 2637 |
} |
2648 | 2638 |
#endif |
2649 | 2639 |
} |
2650 | 2640 |
break; |
2651 |
- case 0xae: /* JSR2k */ |
|
2641 |
+ case 0xae: /* JSRkr */ |
|
2652 | 2642 |
{ |
2653 |
- u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8; |
|
2654 |
- u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff; |
|
2655 |
- u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
2643 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
2644 |
+ u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8; |
|
2645 |
+ u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff; |
|
2646 |
+ u->ram.ptr += (Sint8)a; |
|
2656 | 2647 |
#ifndef NO_STACK_CHECKS |
2657 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
2658 |
- u->wst.error = 1; |
|
2648 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
2649 |
+ u->rst.error = 1; |
|
2659 | 2650 |
goto error; |
2660 | 2651 |
} |
2661 |
- if(__builtin_expect(u->rst.ptr > 253, 0)) { |
|
2662 |
- u->rst.error = 2; |
|
2652 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2653 |
+ u->wst.error = 2; |
|
2663 | 2654 |
goto error; |
2664 | 2655 |
} |
2665 | 2656 |
#endif |
2666 |
- u->rst.ptr += 2; |
|
2657 |
+ u->wst.ptr += 2; |
|
2667 | 2658 |
} |
2668 | 2659 |
break; |
2669 |
- case 0xaf: /* STH2k */ |
|
2660 |
+ case 0xaf: /* STHkr */ |
|
2670 | 2661 |
{ |
2671 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
|
2672 |
- u->rst.dat[u->rst.ptr] = b; |
|
2673 |
- u->rst.dat[u->rst.ptr + 1] = a; |
|
2662 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
2663 |
+ u->wst.dat[u->wst.ptr] = a; |
|
2674 | 2664 |
#ifndef NO_STACK_CHECKS |
2675 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
2676 |
- u->wst.error = 1; |
|
2665 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
2666 |
+ u->rst.error = 1; |
|
2677 | 2667 |
goto error; |
2678 | 2668 |
} |
2679 |
- if(__builtin_expect(u->rst.ptr > 253, 0)) { |
|
2680 |
- u->rst.error = 2; |
|
2669 |
+ if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
2670 |
+ u->wst.error = 2; |
|
2681 | 2671 |
goto error; |
2682 | 2672 |
} |
2683 | 2673 |
#endif |
2684 |
- u->rst.ptr += 2; |
|
2674 |
+ u->wst.ptr += 1; |
|
2685 | 2675 |
} |
2686 | 2676 |
break; |
2687 |
- case 0xb0: /* LDZ2k */ |
|
2677 |
+ case 0xb0: /* LDZkr */ |
|
2688 | 2678 |
{ |
2689 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
2690 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); |
|
2691 |
- u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, a + 1); |
|
2679 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
2680 |
+ u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); |
|
2692 | 2681 |
#ifndef NO_STACK_CHECKS |
2693 |
- if(__builtin_expect(u->wst.ptr < 1, 0)) { |
|
2694 |
- u->wst.error = 1; |
|
2682 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
2683 |
+ u->rst.error = 1; |
|
2695 | 2684 |
goto error; |
2696 | 2685 |
} |
2697 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2698 |
- u->wst.error = 2; |
|
2686 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2687 |
+ u->rst.error = 2; |
|
2699 | 2688 |
goto error; |
2700 | 2689 |
} |
2701 | 2690 |
#endif |
2702 |
- u->wst.ptr += 2; |
|
2691 |
+ u->rst.ptr += 1; |
|
2703 | 2692 |
} |
2704 | 2693 |
break; |
2705 |
- case 0xb1: /* STZ2k */ |
|
2694 |
+ case 0xb1: /* STZkr */ |
|
2706 | 2695 |
{ |
2707 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
2708 |
- Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
|
2709 |
- mempoke16(u->ram.dat, a, b); |
|
2696 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
2697 |
+ Uint8 b = u->rst.dat[u->rst.ptr - 2]; |
|
2698 |
+ mempoke8(u->ram.dat, a, b); |
|
2710 | 2699 |
#ifndef NO_STACK_CHECKS |
2711 |
- if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
2712 |
- u->wst.error = 1; |
|
2700 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2701 |
+ u->rst.error = 1; |
|
2713 | 2702 |
goto error; |
2714 | 2703 |
} |
2715 | 2704 |
#endif |
2716 | 2705 |
} |
2717 | 2706 |
break; |
2718 |
- case 0xb2: /* LDR2k */ |
|
2707 |
+ case 0xb2: /* LDRkr */ |
|
2719 | 2708 |
{ |
2720 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
2721 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
2722 |
- u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); |
|
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); |
|
2723 | 2711 |
#ifndef NO_STACK_CHECKS |
2724 |
- if(__builtin_expect(u->wst.ptr < 1, 0)) { |
|
2725 |
- u->wst.error = 1; |
|
2712 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
2713 |
+ u->rst.error = 1; |
|
2726 | 2714 |
goto error; |
2727 | 2715 |
} |
2728 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2729 |
- u->wst.error = 2; |
|
2716 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2717 |
+ u->rst.error = 2; |
|
2730 | 2718 |
goto error; |
2731 | 2719 |
} |
2732 | 2720 |
#endif |
2733 |
- u->wst.ptr += 2; |
|
2721 |
+ u->rst.ptr += 1; |
|
2734 | 2722 |
} |
2735 | 2723 |
break; |
2736 |
- case 0xb3: /* STR2k */ |
|
2724 |
+ case 0xb3: /* STRkr */ |
|
2737 | 2725 |
{ |
2738 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
2739 |
- Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
|
2740 |
- mempoke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
2726 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
2727 |
+ Uint8 b = u->rst.dat[u->rst.ptr - 2]; |
|
2728 |
+ mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
2741 | 2729 |
#ifndef NO_STACK_CHECKS |
2742 |
- if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
2743 |
- u->wst.error = 1; |
|
2730 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2731 |
+ u->rst.error = 1; |
|
2744 | 2732 |
goto error; |
2745 | 2733 |
} |
2746 | 2734 |
#endif |
2747 | 2735 |
} |
2748 | 2736 |
break; |
2749 |
- case 0xb4: /* LDA2k */ |
|
2737 |
+ case 0xb4: /* LDAkr */ |
|
2750 | 2738 |
{ |
2751 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
2752 |
- u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); |
|
2753 |
- u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, a + 1); |
|
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); |
|
2754 | 2741 |
#ifndef NO_STACK_CHECKS |
2755 |
- if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
2756 |
- u->wst.error = 1; |
|
2742 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2743 |
+ u->rst.error = 1; |
|
2757 | 2744 |
goto error; |
2758 | 2745 |
} |
2759 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2760 |
- u->wst.error = 2; |
|
2746 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2747 |
+ u->rst.error = 2; |
|
2761 | 2748 |
goto error; |
2762 | 2749 |
} |
2763 | 2750 |
#endif |
2764 |
- u->wst.ptr += 2; |
|
2751 |
+ u->rst.ptr += 1; |
|
2765 | 2752 |
} |
2766 | 2753 |
break; |
2767 |
- case 0xb5: /* STA2k */ |
|
2754 |
+ case 0xb5: /* STAkr */ |
|
2768 | 2755 |
{ |
2769 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
2770 |
- Uint16 b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
2771 |
- mempoke16(u->ram.dat, a, b); |
|
2756 |
+ Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
|
2757 |
+ Uint8 b = u->rst.dat[u->rst.ptr - 3]; |
|
2758 |
+ mempoke8(u->ram.dat, a, b); |
|
2772 | 2759 |
#ifndef NO_STACK_CHECKS |
2773 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2774 |
- u->wst.error = 1; |
|
2760 |
+ if(__builtin_expect(u->rst.ptr < 3, 0)) { |
|
2761 |
+ u->rst.error = 1; |
|
2775 | 2762 |
goto error; |
2776 | 2763 |
} |
2777 | 2764 |
#endif |
2778 | 2765 |
} |
2779 | 2766 |
break; |
2780 |
- case 0xb6: /* DEI2k */ |
|
2767 |
+ case 0xb6: /* DEIkr */ |
|
2781 | 2768 |
{ |
2782 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
2783 |
- u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a); |
|
2784 |
- u->wst.dat[u->wst.ptr + 1] = devpeek8(&u->dev[a >> 4], a + 1); |
|
2769 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
2770 |
+ u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a); |
|
2785 | 2771 |
#ifndef NO_STACK_CHECKS |
2786 |
- if(__builtin_expect(u->wst.ptr < 1, 0)) { |
|
2787 |
- u->wst.error = 1; |
|
2772 |
+ if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
2773 |
+ u->rst.error = 1; |
|
2788 | 2774 |
goto error; |
2789 | 2775 |
} |
2790 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2791 |
- u->wst.error = 2; |
|
2776 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2777 |
+ u->rst.error = 2; |
|
2792 | 2778 |
goto error; |
2793 | 2779 |
} |
2794 | 2780 |
#endif |
2795 |
- u->wst.ptr += 2; |
|
2781 |
+ u->rst.ptr += 1; |
|
2796 | 2782 |
} |
2797 | 2783 |
break; |
2798 |
- case 0xb7: /* DEO2k */ |
|
2784 |
+ case 0xb7: /* DEOkr */ |
|
2799 | 2785 |
{ |
2800 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
2801 |
- Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
|
2802 |
- devpoke16(&u->dev[a >> 4], a, b); |
|
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); |
|
2803 | 2788 |
#ifndef NO_STACK_CHECKS |
2804 |
- if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
2805 |
- u->wst.error = 1; |
|
2789 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2790 |
+ u->rst.error = 1; |
|
2806 | 2791 |
goto error; |
2807 | 2792 |
} |
2808 | 2793 |
#endif |
2809 | 2794 |
} |
2810 | 2795 |
break; |
2811 |
- case 0xb8: /* ADD2k */ |
|
2796 |
+ case 0xb8: /* ADDkr */ |
|
2812 | 2797 |
{ |
2813 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
2814 |
- u->wst.dat[u->wst.ptr] = (b + a) >> 8; |
|
2815 |
- u->wst.dat[u->wst.ptr + 1] = (b + a) & 0xff; |
|
2798 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2799 |
+ u->rst.dat[u->rst.ptr] = b + a; |
|
2816 | 2800 |
#ifndef NO_STACK_CHECKS |
2817 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2818 |
- u->wst.error = 1; |
|
2801 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2802 |
+ u->rst.error = 1; |
|
2819 | 2803 |
goto error; |
2820 | 2804 |
} |
2821 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2822 |
- u->wst.error = 2; |
|
2805 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2806 |
+ u->rst.error = 2; |
|
2823 | 2807 |
goto error; |
2824 | 2808 |
} |
2825 | 2809 |
#endif |
2826 |
- u->wst.ptr += 2; |
|
2810 |
+ u->rst.ptr += 1; |
|
2827 | 2811 |
} |
2828 | 2812 |
break; |
2829 |
- case 0xb9: /* SUB2k */ |
|
2813 |
+ case 0xb9: /* SUBkr */ |
|
2830 | 2814 |
{ |
2831 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
2832 |
- u->wst.dat[u->wst.ptr] = (b - a) >> 8; |
|
2833 |
- u->wst.dat[u->wst.ptr + 1] = (b - a) & 0xff; |
|
2815 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2816 |
+ u->rst.dat[u->rst.ptr] = b - a; |
|
2834 | 2817 |
#ifndef NO_STACK_CHECKS |
2835 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2836 |
- u->wst.error = 1; |
|
2818 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2819 |
+ u->rst.error = 1; |
|
2837 | 2820 |
goto error; |
2838 | 2821 |
} |
2839 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2840 |
- u->wst.error = 2; |
|
2822 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2823 |
+ u->rst.error = 2; |
|
2841 | 2824 |
goto error; |
2842 | 2825 |
} |
2843 | 2826 |
#endif |
2844 |
- u->wst.ptr += 2; |
|
2827 |
+ u->rst.ptr += 1; |
|
2845 | 2828 |
} |
2846 | 2829 |
break; |
2847 |
- case 0xba: /* MUL2k */ |
|
2830 |
+ case 0xba: /* MULkr */ |
|
2848 | 2831 |
{ |
2849 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
2850 |
- u->wst.dat[u->wst.ptr] = (b * a) >> 8; |
|
2851 |
- u->wst.dat[u->wst.ptr + 1] = (b * a) & 0xff; |
|
2832 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2833 |
+ u->rst.dat[u->rst.ptr] = b * a; |
|
2852 | 2834 |
#ifndef NO_STACK_CHECKS |
2853 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2854 |
- u->wst.error = 1; |
|
2835 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2836 |
+ u->rst.error = 1; |
|
2855 | 2837 |
goto error; |
2856 | 2838 |
} |
2857 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2858 |
- u->wst.error = 2; |
|
2839 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2840 |
+ u->rst.error = 2; |
|
2859 | 2841 |
goto error; |
2860 | 2842 |
} |
2861 | 2843 |
#endif |
2862 |
- u->wst.ptr += 2; |
|
2844 |
+ u->rst.ptr += 1; |
|
2863 | 2845 |
} |
2864 | 2846 |
break; |
2865 |
- case 0xbb: /* DIV2k */ |
|
2847 |
+ case 0xbb: /* DIVkr */ |
|
2866 | 2848 |
{ |
2867 |
- Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
2849 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2868 | 2850 |
if(a == 0) { |
2869 |
- u->wst.error = 3; |
|
2851 |
+ u->rst.error = 3; |
|
2870 | 2852 |
#ifndef NO_STACK_CHECKS |
2871 | 2853 |
goto error; |
2872 | 2854 |
#endif |
2873 | 2855 |
a = 1; |
2874 | 2856 |
} |
2875 |
- u->wst.dat[u->wst.ptr] = (b / a) >> 8; |
|
2876 |
- u->wst.dat[u->wst.ptr + 1] = (b / a) & 0xff; |
|
2857 |
+ u->rst.dat[u->rst.ptr] = b / a; |
|
2877 | 2858 |
#ifndef NO_STACK_CHECKS |
2878 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2879 |
- u->wst.error = 1; |
|
2859 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2860 |
+ u->rst.error = 1; |
|
2880 | 2861 |
goto error; |
2881 | 2862 |
} |
2882 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2883 |
- u->wst.error = 2; |
|
2863 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2864 |
+ u->rst.error = 2; |
|
2884 | 2865 |
goto error; |
2885 | 2866 |
} |
2886 | 2867 |
#endif |
2887 |
- u->wst.ptr += 2; |
|
2868 |
+ u->rst.ptr += 1; |
|
2888 | 2869 |
} |
2889 | 2870 |
break; |
2890 |
- case 0xbc: /* AND2k */ |
|
2871 |
+ case 0xbc: /* ANDkr */ |
|
2891 | 2872 |
{ |
2892 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
2893 |
- u->wst.dat[u->wst.ptr] = d & b; |
|
2894 |
- u->wst.dat[u->wst.ptr + 1] = c & a; |
|
2873 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2874 |
+ u->rst.dat[u->rst.ptr] = b & a; |
|
2895 | 2875 |
#ifndef NO_STACK_CHECKS |
2896 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2897 |
- u->wst.error = 1; |
|
2876 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2877 |
+ u->rst.error = 1; |
|
2898 | 2878 |
goto error; |
2899 | 2879 |
} |
2900 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2901 |
- u->wst.error = 2; |
|
2880 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2881 |
+ u->rst.error = 2; |
|
2902 | 2882 |
goto error; |
2903 | 2883 |
} |
2904 | 2884 |
#endif |
2905 |
- u->wst.ptr += 2; |
|
2885 |
+ u->rst.ptr += 1; |
|
2906 | 2886 |
} |
2907 | 2887 |
break; |
2908 |
- case 0xbd: /* ORA2k */ |
|
2888 |
+ case 0xbd: /* ORAkr */ |
|
2909 | 2889 |
{ |
2910 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
2911 |
- u->wst.dat[u->wst.ptr] = d | b; |
|
2912 |
- u->wst.dat[u->wst.ptr + 1] = c | a; |
|
2890 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2891 |
+ u->rst.dat[u->rst.ptr] = b | a; |
|
2913 | 2892 |
#ifndef NO_STACK_CHECKS |
2914 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2915 |
- u->wst.error = 1; |
|
2893 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2894 |
+ u->rst.error = 1; |
|
2916 | 2895 |
goto error; |
2917 | 2896 |
} |
2918 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2919 |
- u->wst.error = 2; |
|
2897 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2898 |
+ u->rst.error = 2; |
|
2920 | 2899 |
goto error; |
2921 | 2900 |
} |
2922 | 2901 |
#endif |
2923 |
- u->wst.ptr += 2; |
|
2902 |
+ u->rst.ptr += 1; |
|
2924 | 2903 |
} |
2925 | 2904 |
break; |
2926 |
- case 0xbe: /* EOR2k */ |
|
2905 |
+ case 0xbe: /* EORkr */ |
|
2927 | 2906 |
{ |
2928 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
2929 |
- u->wst.dat[u->wst.ptr] = d ^ b; |
|
2930 |
- u->wst.dat[u->wst.ptr + 1] = c ^ a; |
|
2907 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2908 |
+ u->rst.dat[u->rst.ptr] = b ^ a; |
|
2931 | 2909 |
#ifndef NO_STACK_CHECKS |
2932 |
- if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2933 |
- u->wst.error = 1; |
|
2910 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2911 |
+ u->rst.error = 1; |
|
2934 | 2912 |
goto error; |
2935 | 2913 |
} |
2936 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2937 |
- u->wst.error = 2; |
|
2914 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2915 |
+ u->rst.error = 2; |
|
2938 | 2916 |
goto error; |
2939 | 2917 |
} |
2940 | 2918 |
#endif |
2941 |
- u->wst.ptr += 2; |
|
2919 |
+ u->rst.ptr += 1; |
|
2942 | 2920 |
} |
2943 | 2921 |
break; |
2944 |
- case 0xbf: /* SFT2k */ |
|
2922 |
+ case 0xbf: /* SFTkr */ |
|
2945 | 2923 |
{ |
2946 |
- Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
2947 |
- Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
|
2948 |
- u->wst.dat[u->wst.ptr] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) >> 8; |
|
2949 |
- u->wst.dat[u->wst.ptr + 1] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) & 0xff; |
|
2924 |
+ Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
2925 |
+ u->rst.dat[u->rst.ptr] = b >> (a & 0x07) << ((a & 0x70) >> 4); |
|
2950 | 2926 |
#ifndef NO_STACK_CHECKS |
2951 |
- if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
2952 |
- u->wst.error = 1; |
|
2927 |
+ if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
2928 |
+ u->rst.error = 1; |
|
2953 | 2929 |
goto error; |
2954 | 2930 |
} |
2955 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2956 |
- u->wst.error = 2; |
|
2931 |
+ if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2932 |
+ u->rst.error = 2; |
|
2957 | 2933 |
goto error; |
2958 | 2934 |
} |
2959 | 2935 |
#endif |
2960 |
- u->wst.ptr += 2; |
|
2936 |
+ u->rst.ptr += 1; |
|
2961 | 2937 |
} |
2962 | 2938 |
break; |
2963 |
- case 0xc1: /* INCkr */ |
|
2939 |
+ case 0xc1: /* INC2k */ |
|
2964 | 2940 |
{ |
2965 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
2966 |
- u->rst.dat[u->rst.ptr] = a + 1; |
|
2941 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
2942 |
+ u->wst.dat[u->wst.ptr] = (a + 1) >> 8; |
|
2943 |
+ u->wst.dat[u->wst.ptr + 1] = (a + 1) & 0xff; |
|
2967 | 2944 |
#ifndef NO_STACK_CHECKS |
2968 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
2969 |
- u->rst.error = 1; |
|
2945 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
2946 |
+ u->wst.error = 1; |
|
2970 | 2947 |
goto error; |
2971 | 2948 |
} |
2972 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
2973 |
- u->rst.error = 2; |
|
2949 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
2950 |
+ u->wst.error = 2; |
|
2974 | 2951 |
goto error; |
2975 | 2952 |
} |
2976 | 2953 |
#endif |
2977 |
- u->rst.ptr += 1; |
|
2954 |
+ u->wst.ptr += 2; |
|
2978 | 2955 |
} |
2979 | 2956 |
break; |
2980 |
- case 0xc2: /* POPkr */ |
|
2957 |
+ case 0xc2: /* POP2k */ |
|
2981 | 2958 |
{ |
2982 |
- u->rst.dat[u->rst.ptr - 1]; |
|
2959 |
+ (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
2983 | 2960 |
#ifndef NO_STACK_CHECKS |
2984 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
2985 |
- u->rst.error = 1; |
|
2961 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
2962 |
+ u->wst.error = 1; |
|
2986 | 2963 |
goto error; |
2987 | 2964 |
} |
2988 | 2965 |
#endif |
2989 | 2966 |
} |
2990 | 2967 |
break; |
2991 |
- case 0xc3: /* DUPkr */ |
|
2968 |
+ case 0xc3: /* DUP2k */ |
|
2992 | 2969 |
{ |
2993 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
2994 |
- u->rst.dat[u->rst.ptr] = a; |
|
2995 |
- u->rst.dat[u->rst.ptr + 1] = a; |
|
2970 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
|
2971 |
+ u->wst.dat[u->wst.ptr] = b; |
|
2972 |
+ u->wst.dat[u->wst.ptr + 1] = a; |
|
2973 |
+ u->wst.dat[u->wst.ptr + 2] = b; |
|
2974 |
+ u->wst.dat[u->wst.ptr + 3] = a; |
|
2996 | 2975 |
#ifndef NO_STACK_CHECKS |
2997 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
2998 |
- u->rst.error = 1; |
|
2976 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
2977 |
+ u->wst.error = 1; |
|
2999 | 2978 |
goto error; |
3000 | 2979 |
} |
3001 |
- if(__builtin_expect(u->rst.ptr > 253, 0)) { |
|
3002 |
- u->rst.error = 2; |
|
2980 |
+ if(__builtin_expect(u->wst.ptr > 251, 0)) { |
|
2981 |
+ u->wst.error = 2; |
|
3003 | 2982 |
goto error; |
3004 | 2983 |
} |
3005 | 2984 |
#endif |
3006 |
- u->rst.ptr += 2; |
|
2985 |
+ u->wst.ptr += 4; |
|
3007 | 2986 |
} |
3008 | 2987 |
break; |
3009 |
- case 0xc4: /* NIPkr */ |
|
2988 |
+ case 0xc4: /* NIP2k */ |
|
3010 | 2989 |
{ |
3011 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
3012 |
- u->rst.dat[u->rst.ptr - 2]; |
|
3013 |
- u->rst.dat[u->rst.ptr] = a; |
|
2990 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
2991 |
+ (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
2992 |
+ u->wst.dat[u->wst.ptr] = a >> 8; |
|
2993 |
+ u->wst.dat[u->wst.ptr + 1] = a & 0xff; |
|
3014 | 2994 |
#ifndef NO_STACK_CHECKS |
3015 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3016 |
- u->rst.error = 1; |
|
2995 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
2996 |
+ u->wst.error = 1; |
|
3017 | 2997 |
goto error; |
3018 | 2998 |
} |
3019 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3020 |
- u->rst.error = 2; |
|
2999 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3000 |
+ u->wst.error = 2; |
|
3021 | 3001 |
goto error; |
3022 | 3002 |
} |
3023 | 3003 |
#endif |
3024 |
- u->rst.ptr += 1; |
|
3004 |
+ u->wst.ptr += 2; |
|
3025 | 3005 |
} |
3026 | 3006 |
break; |
3027 |
- case 0xc5: /* SWPkr */ |
|
3007 |
+ case 0xc5: /* SWP2k */ |
|
3028 | 3008 |
{ |
3029 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3030 |
- u->rst.dat[u->rst.ptr] = a; |
|
3031 |
- u->rst.dat[u->rst.ptr + 1] = b; |
|
3009 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
3010 |
+ u->wst.dat[u->wst.ptr] = b; |
|
3011 |
+ u->wst.dat[u->wst.ptr + 1] = a; |
|
3012 |
+ u->wst.dat[u->wst.ptr + 2] = d; |
|
3013 |
+ u->wst.dat[u->wst.ptr + 3] = c; |
|
3032 | 3014 |
#ifndef NO_STACK_CHECKS |
3033 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3034 |
- u->rst.error = 1; |
|
3015 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3016 |
+ u->wst.error = 1; |
|
3035 | 3017 |
goto error; |
3036 | 3018 |
} |
3037 |
- if(__builtin_expect(u->rst.ptr > 253, 0)) { |
|
3038 |
- u->rst.error = 2; |
|
3019 |
+ if(__builtin_expect(u->wst.ptr > 251, 0)) { |
|
3020 |
+ u->wst.error = 2; |
|
3039 | 3021 |
goto error; |
3040 | 3022 |
} |
3041 | 3023 |
#endif |
3042 |
- u->rst.ptr += 2; |
|
3024 |
+ u->wst.ptr += 4; |
|
3043 | 3025 |
} |
3044 | 3026 |
break; |
3045 |
- case 0xc6: /* OVRkr */ |
|
3027 |
+ case 0xc6: /* OVR2k */ |
|
3046 | 3028 |
{ |
3047 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3048 |
- u->rst.dat[u->rst.ptr] = b; |
|
3049 |
- u->rst.dat[u->rst.ptr + 1] = a; |
|
3050 |
- u->rst.dat[u->rst.ptr + 2] = b; |
|
3029 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
3030 |
+ u->wst.dat[u->wst.ptr] = d; |
|
3031 |
+ u->wst.dat[u->wst.ptr + 1] = c; |
|
3032 |
+ u->wst.dat[u->wst.ptr + 2] = b; |
|
3033 |
+ u->wst.dat[u->wst.ptr + 3] = a; |
|
3034 |
+ u->wst.dat[u->wst.ptr + 4] = d; |
|
3035 |
+ u->wst.dat[u->wst.ptr + 5] = c; |
|
3051 | 3036 |
#ifndef NO_STACK_CHECKS |
3052 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3053 |
- u->rst.error = 1; |
|
3037 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3038 |
+ u->wst.error = 1; |
|
3054 | 3039 |
goto error; |
3055 | 3040 |
} |
3056 |
- if(__builtin_expect(u->rst.ptr > 252, 0)) { |
|
3057 |
- u->rst.error = 2; |
|
3041 |
+ if(__builtin_expect(u->wst.ptr > 249, 0)) { |
|
3042 |
+ u->wst.error = 2; |
|
3058 | 3043 |
goto error; |
3059 | 3044 |
} |
3060 | 3045 |
#endif |
3061 |
- u->rst.ptr += 3; |
|
3046 |
+ u->wst.ptr += 6; |
|
3062 | 3047 |
} |
3063 | 3048 |
break; |
3064 |
- case 0xc7: /* ROTkr */ |
|
3049 |
+ case 0xc7: /* ROT2k */ |
|
3065 | 3050 |
{ |
3066 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3]; |
|
3067 |
- u->rst.dat[u->rst.ptr] = b; |
|
3068 |
- u->rst.dat[u->rst.ptr + 1] = a; |
|
3069 |
- u->rst.dat[u->rst.ptr + 2] = c; |
|
3051 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4], e = u->wst.dat[u->wst.ptr - 5], f = u->wst.dat[u->wst.ptr - 6]; |
|
3052 |
+ u->wst.dat[u->wst.ptr] = d; |
|
3053 |
+ u->wst.dat[u->wst.ptr + 1] = c; |
|
3054 |
+ u->wst.dat[u->wst.ptr + 2] = b; |
|
3055 |
+ u->wst.dat[u->wst.ptr + 3] = a; |
|
3056 |
+ u->wst.dat[u->wst.ptr + 4] = f; |
|
3057 |
+ u->wst.dat[u->wst.ptr + 5] = e; |
|
3070 | 3058 |
#ifndef NO_STACK_CHECKS |
3071 |
- if(__builtin_expect(u->rst.ptr < 3, 0)) { |
|
3072 |
- u->rst.error = 1; |
|
3059 |
+ if(__builtin_expect(u->wst.ptr < 6, 0)) { |
|
3060 |
+ u->wst.error = 1; |
|
3073 | 3061 |
goto error; |
3074 | 3062 |
} |
3075 |
- if(__builtin_expect(u->rst.ptr > 252, 0)) { |
|
3076 |
- u->rst.error = 2; |
|
3063 |
+ if(__builtin_expect(u->wst.ptr > 249, 0)) { |
|
3064 |
+ u->wst.error = 2; |
|
3077 | 3065 |
goto error; |
3078 | 3066 |
} |
3079 | 3067 |
#endif |
3080 |
- u->rst.ptr += 3; |
|
3068 |
+ u->wst.ptr += 6; |
|
3081 | 3069 |
} |
3082 | 3070 |
break; |
3083 |
- case 0xc8: /* EQUkr */ |
|
3071 |
+ case 0xc8: /* EQU2k */ |
|
3084 | 3072 |
{ |
3085 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3086 |
- u->rst.dat[u->rst.ptr] = b == a; |
|
3073 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
3074 |
+ u->wst.dat[u->wst.ptr] = b == a; |
|
3087 | 3075 |
#ifndef NO_STACK_CHECKS |
3088 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3089 |
- u->rst.error = 1; |
|
3076 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3077 |
+ u->wst.error = 1; |
|
3090 | 3078 |
goto error; |
3091 | 3079 |
} |
3092 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3093 |
- u->rst.error = 2; |
|
3080 |
+ if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
3081 |
+ u->wst.error = 2; |
|
3094 | 3082 |
goto error; |
3095 | 3083 |
} |
3096 | 3084 |
#endif |
3097 |
- u->rst.ptr += 1; |
|
3085 |
+ u->wst.ptr += 1; |
|
3098 | 3086 |
} |
3099 | 3087 |
break; |
3100 |
- case 0xc9: /* NEQkr */ |
|
3088 |
+ case 0xc9: /* NEQ2k */ |
|
3101 | 3089 |
{ |
3102 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3103 |
- u->rst.dat[u->rst.ptr] = b != a; |
|
3090 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
3091 |
+ u->wst.dat[u->wst.ptr] = b != a; |
|
3104 | 3092 |
#ifndef NO_STACK_CHECKS |
3105 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3106 |
- u->rst.error = 1; |
|
3093 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3094 |
+ u->wst.error = 1; |
|
3107 | 3095 |
goto error; |
3108 | 3096 |
} |
3109 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3110 |
- u->rst.error = 2; |
|
3097 |
+ if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
3098 |
+ u->wst.error = 2; |
|
3111 | 3099 |
goto error; |
3112 | 3100 |
} |
3113 | 3101 |
#endif |
3114 |
- u->rst.ptr += 1; |
|
3102 |
+ u->wst.ptr += 1; |
|
3115 | 3103 |
} |
3116 | 3104 |
break; |
3117 |
- case 0xca: /* GTHkr */ |
|
3105 |
+ case 0xca: /* GTH2k */ |
|
3118 | 3106 |
{ |
3119 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3120 |
- u->rst.dat[u->rst.ptr] = b > a; |
|
3107 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
3108 |
+ u->wst.dat[u->wst.ptr] = b > a; |
|
3121 | 3109 |
#ifndef NO_STACK_CHECKS |
3122 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3123 |
- u->rst.error = 1; |
|
3110 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3111 |
+ u->wst.error = 1; |
|
3124 | 3112 |
goto error; |
3125 | 3113 |
} |
3126 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3127 |
- u->rst.error = 2; |
|
3114 |
+ if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
3115 |
+ u->wst.error = 2; |
|
3128 | 3116 |
goto error; |
3129 | 3117 |
} |
3130 | 3118 |
#endif |
3131 |
- u->rst.ptr += 1; |
|
3119 |
+ u->wst.ptr += 1; |
|
3132 | 3120 |
} |
3133 | 3121 |
break; |
3134 |
- case 0xcb: /* LTHkr */ |
|
3122 |
+ case 0xcb: /* LTH2k */ |
|
3135 | 3123 |
{ |
3136 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3137 |
- u->rst.dat[u->rst.ptr] = b < a; |
|
3124 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
3125 |
+ u->wst.dat[u->wst.ptr] = b < a; |
|
3138 | 3126 |
#ifndef NO_STACK_CHECKS |
3139 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3140 |
- u->rst.error = 1; |
|
3127 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3128 |
+ u->wst.error = 1; |
|
3141 | 3129 |
goto error; |
3142 | 3130 |
} |
3143 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3144 |
- u->rst.error = 2; |
|
3131 |
+ if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
3132 |
+ u->wst.error = 2; |
|
3145 | 3133 |
goto error; |
3146 | 3134 |
} |
3147 | 3135 |
#endif |
3148 |
- u->rst.ptr += 1; |
|
3136 |
+ u->wst.ptr += 1; |
|
3149 | 3137 |
} |
3150 | 3138 |
break; |
3151 |
- case 0xcc: /* JMPkr */ |
|
3139 |
+ case 0xcc: /* JMP2k */ |
|
3152 | 3140 |
{ |
3153 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
3154 |
- u->ram.ptr += (Sint8)a; |
|
3141 |
+ u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
3155 | 3142 |
#ifndef NO_STACK_CHECKS |
3156 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
3157 |
- u->rst.error = 1; |
|
3143 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
3144 |
+ u->wst.error = 1; |
|
3158 | 3145 |
goto error; |
3159 | 3146 |
} |
3160 | 3147 |
#endif |
3161 | 3148 |
} |
3162 | 3149 |
break; |
3163 |
- case 0xcd: /* JCNkr */ |
|
3150 |
+ case 0xcd: /* JCN2k */ |
|
3164 | 3151 |
{ |
3165 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
3166 |
- if(u->rst.dat[u->rst.ptr - 2]) u->ram.ptr += (Sint8)a; |
|
3152 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
3153 |
+ if(u->wst.dat[u->wst.ptr - 3]) u->ram.ptr = a; |
|
3167 | 3154 |
#ifndef NO_STACK_CHECKS |
3168 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3169 |
- u->rst.error = 1; |
|
3155 |
+ if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
3156 |
+ u->wst.error = 1; |
|
3170 | 3157 |
goto error; |
3171 | 3158 |
} |
3172 | 3159 |
#endif |
3173 | 3160 |
} |
3174 | 3161 |
break; |
3175 |
- case 0xce: /* JSRkr */ |
|
3162 |
+ case 0xce: /* JSR2k */ |
|
3176 | 3163 |
{ |
3177 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
3178 |
- u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8; |
|
3179 |
- u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff; |
|
3180 |
- u->ram.ptr += (Sint8)a; |
|
3164 |
+ u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8; |
|
3165 |
+ u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff; |
|
3166 |
+ u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
3181 | 3167 |
#ifndef NO_STACK_CHECKS |
3182 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
3183 |
- u->rst.error = 1; |
|
3168 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
3169 |
+ u->wst.error = 1; |
|
3184 | 3170 |
goto error; |
3185 | 3171 |
} |
3186 |
- if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3187 |
- u->wst.error = 2; |
|
3172 |
+ if(__builtin_expect(u->rst.ptr > 253, 0)) { |
|
3173 |
+ u->rst.error = 2; |
|
3188 | 3174 |
goto error; |
3189 | 3175 |
} |
3190 | 3176 |
#endif |
3191 |
- u->wst.ptr += 2; |
|
3177 |
+ u->rst.ptr += 2; |
|
3192 | 3178 |
} |
3193 | 3179 |
break; |
3194 |
- case 0xcf: /* STHkr */ |
|
3180 |
+ case 0xcf: /* STH2k */ |
|
3195 | 3181 |
{ |
3196 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
3197 |
- u->wst.dat[u->wst.ptr] = a; |
|
3182 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
|
3183 |
+ u->rst.dat[u->rst.ptr] = b; |
|
3184 |
+ u->rst.dat[u->rst.ptr + 1] = a; |
|
3198 | 3185 |
#ifndef NO_STACK_CHECKS |
3199 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
3200 |
- u->rst.error = 1; |
|
3186 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
3187 |
+ u->wst.error = 1; |
|
3201 | 3188 |
goto error; |
3202 | 3189 |
} |
3203 |
- if(__builtin_expect(u->wst.ptr > 254, 0)) { |
|
3204 |
- u->wst.error = 2; |
|
3190 |
+ if(__builtin_expect(u->rst.ptr > 253, 0)) { |
|
3191 |
+ u->rst.error = 2; |
|
3205 | 3192 |
goto error; |
3206 | 3193 |
} |
3207 | 3194 |
#endif |
3208 |
- u->wst.ptr += 1; |
|
3195 |
+ u->rst.ptr += 2; |
|
3209 | 3196 |
} |
3210 | 3197 |
break; |
3211 |
- case 0xd0: /* LDZkr */ |
|
3198 |
+ case 0xd0: /* LDZ2k */ |
|
3212 | 3199 |
{ |
3213 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
3214 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); |
|
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); |
|
3215 | 3203 |
#ifndef NO_STACK_CHECKS |
3216 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
3217 |
- u->rst.error = 1; |
|
3204 |
+ if(__builtin_expect(u->wst.ptr < 1, 0)) { |
|
3205 |
+ u->wst.error = 1; |
|
3218 | 3206 |
goto error; |
3219 | 3207 |
} |
3220 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3221 |
- u->rst.error = 2; |
|
3208 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3209 |
+ u->wst.error = 2; |
|
3222 | 3210 |
goto error; |
3223 | 3211 |
} |
3224 | 3212 |
#endif |
3225 |
- u->rst.ptr += 1; |
|
3213 |
+ u->wst.ptr += 2; |
|
3226 | 3214 |
} |
3227 | 3215 |
break; |
3228 |
- case 0xd1: /* STZkr */ |
|
3216 |
+ case 0xd1: /* STZ2k */ |
|
3229 | 3217 |
{ |
3230 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
3231 |
- Uint8 b = u->rst.dat[u->rst.ptr - 2]; |
|
3232 |
- mempoke8(u->ram.dat, a, b); |
|
3218 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
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); |
|
3233 | 3221 |
#ifndef NO_STACK_CHECKS |
3234 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3235 |
- u->rst.error = 1; |
|
3222 |
+ if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
3223 |
+ u->wst.error = 1; |
|
3236 | 3224 |
goto error; |
3237 | 3225 |
} |
3238 | 3226 |
#endif |
3239 | 3227 |
} |
3240 | 3228 |
break; |
3241 |
- case 0xd2: /* LDRkr */ |
|
3229 |
+ case 0xd2: /* LDR2k */ |
|
3242 | 3230 |
{ |
3243 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
3244 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); |
|
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); |
|
3245 | 3234 |
#ifndef NO_STACK_CHECKS |
3246 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
3247 |
- u->rst.error = 1; |
|
3235 |
+ if(__builtin_expect(u->wst.ptr < 1, 0)) { |
|
3236 |
+ u->wst.error = 1; |
|
3248 | 3237 |
goto error; |
3249 | 3238 |
} |
3250 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3251 |
- u->rst.error = 2; |
|
3239 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3240 |
+ u->wst.error = 2; |
|
3252 | 3241 |
goto error; |
3253 | 3242 |
} |
3254 | 3243 |
#endif |
3255 |
- u->rst.ptr += 1; |
|
3244 |
+ u->wst.ptr += 2; |
|
3256 | 3245 |
} |
3257 | 3246 |
break; |
3258 |
- case 0xd3: /* STRkr */ |
|
3247 |
+ case 0xd3: /* STR2k */ |
|
3259 | 3248 |
{ |
3260 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
3261 |
- Uint8 b = u->rst.dat[u->rst.ptr - 2]; |
|
3262 |
- mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); |
|
3249 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
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); |
|
3263 | 3252 |
#ifndef NO_STACK_CHECKS |
3264 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3265 |
- u->rst.error = 1; |
|
3253 |
+ if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
3254 |
+ u->wst.error = 1; |
|
3266 | 3255 |
goto error; |
3267 | 3256 |
} |
3268 | 3257 |
#endif |
3269 | 3258 |
} |
3270 | 3259 |
break; |
3271 |
- case 0xd4: /* LDAkr */ |
|
3260 |
+ case 0xd4: /* LDA2k */ |
|
3272 | 3261 |
{ |
3273 |
- Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
|
3274 |
- u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); |
|
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); |
|
3275 | 3265 |
#ifndef NO_STACK_CHECKS |
3276 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3277 |
- u->rst.error = 1; |
|
3266 |
+ if(__builtin_expect(u->wst.ptr < 2, 0)) { |
|
3267 |
+ u->wst.error = 1; |
|
3278 | 3268 |
goto error; |
3279 | 3269 |
} |
3280 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3281 |
- u->rst.error = 2; |
|
3270 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3271 |
+ u->wst.error = 2; |
|
3282 | 3272 |
goto error; |
3283 | 3273 |
} |
3284 | 3274 |
#endif |
3285 |
- u->rst.ptr += 1; |
|
3275 |
+ u->wst.ptr += 2; |
|
3286 | 3276 |
} |
3287 | 3277 |
break; |
3288 |
- case 0xd5: /* STAkr */ |
|
3278 |
+ case 0xd5: /* STA2k */ |
|
3289 | 3279 |
{ |
3290 |
- Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
|
3291 |
- Uint8 b = u->rst.dat[u->rst.ptr - 3]; |
|
3292 |
- mempoke8(u->ram.dat, a, b); |
|
3280 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
|
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); |
|
3293 | 3283 |
#ifndef NO_STACK_CHECKS |
3294 |
- if(__builtin_expect(u->rst.ptr < 3, 0)) { |
|
3295 |
- u->rst.error = 1; |
|
3284 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3285 |
+ u->wst.error = 1; |
|
3296 | 3286 |
goto error; |
3297 | 3287 |
} |
3298 | 3288 |
#endif |
3299 | 3289 |
} |
3300 | 3290 |
break; |
3301 |
- case 0xd6: /* DEIkr */ |
|
3291 |
+ case 0xd6: /* DEI2k */ |
|
3302 | 3292 |
{ |
3303 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1]; |
|
3304 |
- u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a); |
|
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); |
|
3305 | 3296 |
#ifndef NO_STACK_CHECKS |
3306 |
- if(__builtin_expect(u->rst.ptr < 1, 0)) { |
|
3307 |
- u->rst.error = 1; |
|
3297 |
+ if(__builtin_expect(u->wst.ptr < 1, 0)) { |
|
3298 |
+ u->wst.error = 1; |
|
3308 | 3299 |
goto error; |
3309 | 3300 |
} |
3310 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3311 |
- u->rst.error = 2; |
|
3301 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3302 |
+ u->wst.error = 2; |
|
3312 | 3303 |
goto error; |
3313 | 3304 |
} |
3314 | 3305 |
#endif |
3315 |
- u->rst.ptr += 1; |
|
3306 |
+ u->wst.ptr += 2; |
|
3316 | 3307 |
} |
3317 | 3308 |
break; |
3318 |
- case 0xd7: /* DEOkr */ |
|
3309 |
+ case 0xd7: /* DEO2k */ |
|
3319 | 3310 |
{ |
3320 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3321 |
- devpoke8(&u->dev[a >> 4], a, b); |
|
3311 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
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); |
|
3322 | 3314 |
#ifndef NO_STACK_CHECKS |
3323 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3324 |
- u->rst.error = 1; |
|
3315 |
+ if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
3316 |
+ u->wst.error = 1; |
|
3325 | 3317 |
goto error; |
3326 | 3318 |
} |
3327 | 3319 |
#endif |
3328 | 3320 |
} |
3329 | 3321 |
break; |
3330 |
- case 0xd8: /* ADDkr */ |
|
3322 |
+ case 0xd8: /* ADD2k */ |
|
3331 | 3323 |
{ |
3332 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3333 |
- u->rst.dat[u->rst.ptr] = b + a; |
|
3324 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
3325 |
+ u->wst.dat[u->wst.ptr] = (b + a) >> 8; |
|
3326 |
+ u->wst.dat[u->wst.ptr + 1] = (b + a) & 0xff; |
|
3334 | 3327 |
#ifndef NO_STACK_CHECKS |
3335 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3336 |
- u->rst.error = 1; |
|
3328 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3329 |
+ u->wst.error = 1; |
|
3337 | 3330 |
goto error; |
3338 | 3331 |
} |
3339 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3340 |
- u->rst.error = 2; |
|
3332 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3333 |
+ u->wst.error = 2; |
|
3341 | 3334 |
goto error; |
3342 | 3335 |
} |
3343 | 3336 |
#endif |
3344 |
- u->rst.ptr += 1; |
|
3337 |
+ u->wst.ptr += 2; |
|
3345 | 3338 |
} |
3346 | 3339 |
break; |
3347 |
- case 0xd9: /* SUBkr */ |
|
3340 |
+ case 0xd9: /* SUB2k */ |
|
3348 | 3341 |
{ |
3349 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3350 |
- u->rst.dat[u->rst.ptr] = b - a; |
|
3342 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
3343 |
+ u->wst.dat[u->wst.ptr] = (b - a) >> 8; |
|
3344 |
+ u->wst.dat[u->wst.ptr + 1] = (b - a) & 0xff; |
|
3351 | 3345 |
#ifndef NO_STACK_CHECKS |
3352 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3353 |
- u->rst.error = 1; |
|
3346 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3347 |
+ u->wst.error = 1; |
|
3354 | 3348 |
goto error; |
3355 | 3349 |
} |
3356 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3357 |
- u->rst.error = 2; |
|
3350 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3351 |
+ u->wst.error = 2; |
|
3358 | 3352 |
goto error; |
3359 | 3353 |
} |
3360 | 3354 |
#endif |
3361 |
- u->rst.ptr += 1; |
|
3355 |
+ u->wst.ptr += 2; |
|
3362 | 3356 |
} |
3363 | 3357 |
break; |
3364 |
- case 0xda: /* MULkr */ |
|
3358 |
+ case 0xda: /* MUL2k */ |
|
3365 | 3359 |
{ |
3366 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3367 |
- u->rst.dat[u->rst.ptr] = b * a; |
|
3360 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
3361 |
+ u->wst.dat[u->wst.ptr] = (b * a) >> 8; |
|
3362 |
+ u->wst.dat[u->wst.ptr + 1] = (b * a) & 0xff; |
|
3368 | 3363 |
#ifndef NO_STACK_CHECKS |
3369 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3370 |
- u->rst.error = 1; |
|
3364 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3365 |
+ u->wst.error = 1; |
|
3371 | 3366 |
goto error; |
3372 | 3367 |
} |
3373 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3374 |
- u->rst.error = 2; |
|
3368 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3369 |
+ u->wst.error = 2; |
|
3375 | 3370 |
goto error; |
3376 | 3371 |
} |
3377 | 3372 |
#endif |
3378 |
- u->rst.ptr += 1; |
|
3373 |
+ u->wst.ptr += 2; |
|
3379 | 3374 |
} |
3380 | 3375 |
break; |
3381 |
- case 0xdb: /* DIVkr */ |
|
3376 |
+ case 0xdb: /* DIV2k */ |
|
3382 | 3377 |
{ |
3383 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3378 |
+ Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
|
3384 | 3379 |
if(a == 0) { |
3385 |
- u->rst.error = 3; |
|
3380 |
+ u->wst.error = 3; |
|
3386 | 3381 |
#ifndef NO_STACK_CHECKS |
3387 | 3382 |
goto error; |
3388 | 3383 |
#endif |
3389 | 3384 |
a = 1; |
3390 | 3385 |
} |
3391 |
- u->rst.dat[u->rst.ptr] = b / a; |
|
3386 |
+ u->wst.dat[u->wst.ptr] = (b / a) >> 8; |
|
3387 |
+ u->wst.dat[u->wst.ptr + 1] = (b / a) & 0xff; |
|
3392 | 3388 |
#ifndef NO_STACK_CHECKS |
3393 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3394 |
- u->rst.error = 1; |
|
3389 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3390 |
+ u->wst.error = 1; |
|
3395 | 3391 |
goto error; |
3396 | 3392 |
} |
3397 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3398 |
- u->rst.error = 2; |
|
3393 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3394 |
+ u->wst.error = 2; |
|
3399 | 3395 |
goto error; |
3400 | 3396 |
} |
3401 | 3397 |
#endif |
3402 |
- u->rst.ptr += 1; |
|
3398 |
+ u->wst.ptr += 2; |
|
3403 | 3399 |
} |
3404 | 3400 |
break; |
3405 |
- case 0xdc: /* ANDkr */ |
|
3401 |
+ case 0xdc: /* AND2k */ |
|
3406 | 3402 |
{ |
3407 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3408 |
- u->rst.dat[u->rst.ptr] = b & a; |
|
3403 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
3404 |
+ u->wst.dat[u->wst.ptr] = d & b; |
|
3405 |
+ u->wst.dat[u->wst.ptr + 1] = c & a; |
|
3409 | 3406 |
#ifndef NO_STACK_CHECKS |
3410 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3411 |
- u->rst.error = 1; |
|
3407 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3408 |
+ u->wst.error = 1; |
|
3412 | 3409 |
goto error; |
3413 | 3410 |
} |
3414 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3415 |
- u->rst.error = 2; |
|
3411 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3412 |
+ u->wst.error = 2; |
|
3416 | 3413 |
goto error; |
3417 | 3414 |
} |
3418 | 3415 |
#endif |
3419 |
- u->rst.ptr += 1; |
|
3416 |
+ u->wst.ptr += 2; |
|
3420 | 3417 |
} |
3421 | 3418 |
break; |
3422 |
- case 0xdd: /* ORAkr */ |
|
3419 |
+ case 0xdd: /* ORA2k */ |
|
3423 | 3420 |
{ |
3424 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3425 |
- u->rst.dat[u->rst.ptr] = b | a; |
|
3421 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
3422 |
+ u->wst.dat[u->wst.ptr] = d | b; |
|
3423 |
+ u->wst.dat[u->wst.ptr + 1] = c | a; |
|
3426 | 3424 |
#ifndef NO_STACK_CHECKS |
3427 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3428 |
- u->rst.error = 1; |
|
3425 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3426 |
+ u->wst.error = 1; |
|
3429 | 3427 |
goto error; |
3430 | 3428 |
} |
3431 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3432 |
- u->rst.error = 2; |
|
3429 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3430 |
+ u->wst.error = 2; |
|
3433 | 3431 |
goto error; |
3434 | 3432 |
} |
3435 | 3433 |
#endif |
3436 |
- u->rst.ptr += 1; |
|
3434 |
+ u->wst.ptr += 2; |
|
3437 | 3435 |
} |
3438 | 3436 |
break; |
3439 |
- case 0xde: /* EORkr */ |
|
3437 |
+ case 0xde: /* EOR2k */ |
|
3440 | 3438 |
{ |
3441 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3442 |
- u->rst.dat[u->rst.ptr] = b ^ a; |
|
3439 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; |
|
3440 |
+ u->wst.dat[u->wst.ptr] = d ^ b; |
|
3441 |
+ u->wst.dat[u->wst.ptr + 1] = c ^ a; |
|
3443 | 3442 |
#ifndef NO_STACK_CHECKS |
3444 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3445 |
- u->rst.error = 1; |
|
3443 |
+ if(__builtin_expect(u->wst.ptr < 4, 0)) { |
|
3444 |
+ u->wst.error = 1; |
|
3446 | 3445 |
goto error; |
3447 | 3446 |
} |
3448 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3449 |
- u->rst.error = 2; |
|
3447 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3448 |
+ u->wst.error = 2; |
|
3450 | 3449 |
goto error; |
3451 | 3450 |
} |
3452 | 3451 |
#endif |
3453 |
- u->rst.ptr += 1; |
|
3452 |
+ u->wst.ptr += 2; |
|
3454 | 3453 |
} |
3455 | 3454 |
break; |
3456 |
- case 0xdf: /* SFTkr */ |
|
3455 |
+ case 0xdf: /* SFT2k */ |
|
3457 | 3456 |
{ |
3458 |
- Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
|
3459 |
- u->rst.dat[u->rst.ptr] = b >> (a & 0x07) << ((a & 0x70) >> 4); |
|
3457 |
+ Uint8 a = u->wst.dat[u->wst.ptr - 1]; |
|
3458 |
+ Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
|
3459 |
+ u->wst.dat[u->wst.ptr] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) >> 8; |
|
3460 |
+ u->wst.dat[u->wst.ptr + 1] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) & 0xff; |
|
3460 | 3461 |
#ifndef NO_STACK_CHECKS |
3461 |
- if(__builtin_expect(u->rst.ptr < 2, 0)) { |
|
3462 |
- u->rst.error = 1; |
|
3462 |
+ if(__builtin_expect(u->wst.ptr < 3, 0)) { |
|
3463 |
+ u->wst.error = 1; |
|
3463 | 3464 |
goto error; |
3464 | 3465 |
} |
3465 |
- if(__builtin_expect(u->rst.ptr > 254, 0)) { |
|
3466 |
- u->rst.error = 2; |
|
3466 |
+ if(__builtin_expect(u->wst.ptr > 253, 0)) { |
|
3467 |
+ u->wst.error = 2; |
|
3467 | 3468 |
goto error; |
3468 | 3469 |
} |
3469 | 3470 |
#endif |
3470 |
- u->rst.ptr += 1; |
|
3471 |
+ u->wst.ptr += 2; |
|
3471 | 3472 |
} |
3472 | 3473 |
break; |
3473 | 3474 |
case 0xe1: /* INC2kr */ |
... | ... |
@@ -4024,7 +4025,7 @@ uxn_boot(Uxn *u) |
4024 | 4025 |
unsigned int i; |
4025 | 4026 |
char *cptr = (char *)u; |
4026 | 4027 |
for(i = 0; i < sizeof(*u); i++) |
4027 |
- cptr[i] = 0; |
|
4028 |
+ cptr[i] = 0x00; |
|
4028 | 4029 |
return 1; |
4029 | 4030 |
} |
4030 | 4031 |
|
... | ... |
@@ -12,7 +12,8 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
12 | 12 |
WITH REGARD TO THIS SOFTWARE. |
13 | 13 |
*/ |
14 | 14 |
|
15 |
-#define MODE_RETURN 0x40 |
|
15 |
+#define MODE_RETURN 0x20 |
|
16 |
+#define MODE_SHORT 0x40 |
|
16 | 17 |
#define MODE_KEEP 0x80 |
17 | 18 |
|
18 | 19 |
#pragma mark - Operations |
... | ... |
@@ -145,7 +146,7 @@ uxn_eval(Uxn *u, Uint16 vec) |
145 | 146 |
} else { |
146 | 147 |
pop8 = pop8_nokeep; |
147 | 148 |
} |
148 |
- (*ops[instr & 0x3f])(u); |
|
149 |
+ (*ops[(instr & 0x1f) | ((instr & MODE_SHORT) >> 1)])(u); |
|
149 | 150 |
if(u->wst.error) |
150 | 151 |
return uxn_halt(u, u->wst.error, "Working-stack", instr); |
151 | 152 |
if(u->rst.error) |
... | ... |
@@ -88,10 +88,10 @@ findopcode(char *s) |
88 | 88 |
if(!scmp(ops[i], s, 3)) |
89 | 89 |
continue; |
90 | 90 |
while(s[3 + m]) { |
91 |
- if(s[3 + m] == '2') |
|
92 |
- i |= (1 << 5); /* mode: short */ |
|
93 |
- else if(s[3 + m] == 'r') |
|
94 |
- i |= (1 << 6); /* mode: return */ |
|
91 |
+ if(s[3 + m] == 'r') |
|
92 |
+ i |= (1 << 5); /* mode: return */ |
|
93 |
+ else if(s[3 + m] == '2') |
|
94 |
+ i |= (1 << 6); /* mode: short */ |
|
95 | 95 |
else if(s[3 + m] == 'k') |
96 | 96 |
i |= (1 << 7); /* mode: keep */ |
97 | 97 |
else |