Browse code

Reverted flags in uxn-fast.c

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