Mercurial > repos > blastem
comparison z80.cpu @ 1718:c7d18b8ec29a
Implemented the rest of the dd/fd prefixes for the add/adc/sub/sbc/inc/dec instructions in new Z80 core
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 30 Jan 2019 18:55:58 -0800 |
parents | b11cfa655c61 |
children | fb5ae8c20b85 |
comparison
equal
deleted
inserted
replaced
1717:b11cfa655c61 | 1718:c7d18b8ec29a |
---|---|
511 | 511 |
512 10000RRR add_reg | 512 10000RRR add_reg |
513 add a main.R a | 513 add a main.R a |
514 update_flags SZYHVXN0C | 514 update_flags SZYHVXN0C |
515 | 515 |
516 dd 10000100 add_ixh | |
517 lsr ix 8 scratch1 | |
518 add a scratch1 a | |
519 update_flags SZYHVXN0C | |
520 | |
521 dd 10000101 add_ixl | |
522 and ix 0xFF scratch1 | |
523 add a scratch1 a | |
524 update_flags SZYHVXN0C | |
525 | |
526 fd 10000100 add_iyh | |
527 lsr iy 8 scratch1 | |
528 add a scratch1 a | |
529 update_flags SZYHVXN0C | |
530 | |
531 fd 10000101 add_iyl | |
532 and iy 0xFF scratch1 | |
533 add a scratch1 a | |
534 update_flags SZYHVXN0C | |
535 | |
516 10000110 add_hl | 536 10000110 add_hl |
517 z80_fetch_hl | 537 z80_fetch_hl |
518 add a scratch1 a | 538 add a scratch1 a |
519 update_flags SZYHVXN0C | 539 update_flags SZYHVXN0C |
520 | 540 |
561 | 581 |
562 00101001 add_hl_hl | 582 00101001 add_hl_hl |
563 local hlw 16 | 583 local hlw 16 |
564 meta hlt hlw | 584 meta hlt hlw |
565 z80_add16_hl hlw | 585 z80_add16_hl hlw |
566 | |
567 | 586 |
568 00111001 add_hl_sp | 587 00111001 add_hl_sp |
569 local hlw 16 | 588 local hlw 16 |
570 meta hlt hlw | 589 meta hlt hlw |
571 z80_add16_hl sp | 590 z80_add16_hl sp |
572 | 591 |
592 dd 00001001 add_ix_bc | |
593 lsl b 8 scratch1 | |
594 or c scratch1 scratch1 | |
595 add scratch1 ix ix | |
596 update_flags YHXN0C | |
597 | |
598 dd 00011001 add_ix_de | |
599 lsl d 8 scratch1 | |
600 or e scratch1 scratch1 | |
601 add scratch1 ix ix | |
602 update_flags YHXN0C | |
603 | |
604 dd 00101001 add_ix_ix | |
605 add ix ix ix | |
606 update_flags YHXN0C | |
607 | |
608 dd 00111001 add_ix_sp | |
609 add sp ix ix | |
610 update_flags YHXN0C | |
611 | |
612 fd 00001001 add_iy_bc | |
613 lsl b 8 scratch1 | |
614 or c scratch1 scratch1 | |
615 add scratch1 iy iy | |
616 update_flags YHXN0C | |
617 | |
618 fd 00011001 add_iy_de | |
619 lsl d 8 scratch1 | |
620 or e scratch1 scratch1 | |
621 add scratch1 iy iy | |
622 update_flags YHXN0C | |
623 | |
624 fd 00101001 add_iy_iy | |
625 add iy iy iy | |
626 update_flags YHXN0C | |
627 | |
628 fd 00111001 add_iy_sp | |
629 add sp iy iy | |
630 update_flags YHXN0C | |
631 | |
573 10001RRR adc_reg | 632 10001RRR adc_reg |
574 adc a main.R a | 633 adc a main.R a |
575 update_flags SZYHVXN0C | 634 update_flags SZYHVXN0C |
635 | |
636 dd 10001100 adc_ixh | |
637 lsr ix 8 scratch1 | |
638 adc a scratch1 a | |
639 update_flags SZYHVXN0C | |
640 | |
641 dd 10001101 adc_ixl | |
642 and ix 0xFF scratch1 | |
643 adc a scratch1 a | |
644 update_flags SZYHVXN0C | |
645 | |
646 fd 10001100 adc_iyh | |
647 lsr iy 8 scratch1 | |
648 adc a scratch1 a | |
649 update_flags SZYHVXN0C | |
650 | |
651 fd 10001101 adc_iyl | |
652 and iy 0xFF scratch1 | |
653 adc a scratch1 a | |
654 update_flags SZYHVXN0C | |
576 | 655 |
577 10001110 adc_hl | 656 10001110 adc_hl |
578 z80_fetch_hl | 657 z80_fetch_hl |
658 adc a scratch1 a | |
659 update_flags SZYHVXN0C | |
660 | |
661 dd 10001110 adc_ixd | |
662 z80_fetch_index ix | |
663 adc a scratch1 a | |
664 update_flags SZYHVXN0C | |
665 | |
666 fd 10001110 adc_iyd | |
667 z80_fetch_index iy | |
579 adc a scratch1 a | 668 adc a scratch1 a |
580 update_flags SZYHVXN0C | 669 update_flags SZYHVXN0C |
581 | 670 |
582 11001110 adc_immed | 671 11001110 adc_immed |
583 z80_fetch_immed | 672 z80_fetch_immed |
623 | 712 |
624 10010RRR sub_reg | 713 10010RRR sub_reg |
625 sub main.R a a | 714 sub main.R a a |
626 update_flags SZYHVXN1C | 715 update_flags SZYHVXN1C |
627 | 716 |
717 dd 10010100 sub_ixh | |
718 lsr ix 8 scratch1 | |
719 sub scratch1 a a | |
720 update_flags SZYHVXN1C | |
721 | |
722 dd 10010101 sub_ixl | |
723 and ix 0xFF scratch1 | |
724 sub scratch1 a a | |
725 update_flags SZYHVXN1C | |
726 | |
727 fd 10010100 sub_iyh | |
728 lsr iy 8 scratch1 | |
729 sub scratch1 a a | |
730 update_flags SZYHVXN1C | |
731 | |
732 fd 10010101 sub_iyl | |
733 and iy 0xFF scratch1 | |
734 sub scratch1 a a | |
735 update_flags SZYHVXN1C | |
736 | |
628 10010110 sub_hl | 737 10010110 sub_hl |
629 z80_fetch_hl | 738 z80_fetch_hl |
630 sub scratch1 a a | 739 sub scratch1 a a |
631 update_flags SZYHVXN1C | 740 update_flags SZYHVXN1C |
741 | |
742 dd 10010110 sub_ixd | |
743 z80_fetch_index ix | |
744 sub scratch1 a a | |
745 update_flags SZYHVXN1C | |
746 | |
747 fd 10010110 sub_iyd | |
748 z80_fetch_index iy | |
749 sub scratch1 a a | |
750 update_flags SZYHVXN1C | |
632 | 751 |
633 11010110 sub_immed | 752 11010110 sub_immed |
634 z80_fetch_immed | 753 z80_fetch_immed |
635 sub scratch1 a a | 754 sub scratch1 a a |
636 update_flags SZYHVXN1C | 755 update_flags SZYHVXN1C |
637 | 756 |
638 10011RRR sbc_reg | 757 10011RRR sbc_reg |
639 sbc main.R a a | 758 sbc main.R a a |
640 update_flags SZYHVXN1C | 759 update_flags SZYHVXN1C |
641 | 760 |
761 dd 10011100 sbc_ixh | |
762 lsr ix 8 scratch1 | |
763 sbc scratch1 a a | |
764 update_flags SZYHVXN1C | |
765 | |
766 dd 10011101 sbc_ixl | |
767 and ix 0xFF scratch1 | |
768 sbc scratch1 a a | |
769 update_flags SZYHVXN1C | |
770 | |
771 fd 10011100 sbc_iyh | |
772 lsr iy 8 scratch1 | |
773 sbc scratch1 a a | |
774 update_flags SZYHVXN1C | |
775 | |
776 fd 10011101 sbc_iyl | |
777 and iy 0xFF scratch1 | |
778 sbc scratch1 a a | |
779 update_flags SZYHVXN1C | |
780 | |
781 | |
642 10011110 sbc_hl | 782 10011110 sbc_hl |
643 z80_fetch_hl | 783 z80_fetch_hl |
784 sbc scratch1 a a | |
785 update_flags SZYHVXN1C | |
786 | |
787 dd 10011110 sbc_ixd | |
788 z80_fetch_index ix | |
789 sbc scratch1 a a | |
790 update_flags SZYHVXN1C | |
791 | |
792 fd 10011110 sbc_iyd | |
793 z80_fetch_index iy | |
644 sbc scratch1 a a | 794 sbc scratch1 a a |
645 update_flags SZYHVXN1C | 795 update_flags SZYHVXN1C |
646 | 796 |
647 11011110 sbc_immed | 797 11011110 sbc_immed |
648 z80_fetch_immed | 798 z80_fetch_immed |
743 update_flags SZYHVXN1C | 893 update_flags SZYHVXN1C |
744 | 894 |
745 00RRR100 inc_reg | 895 00RRR100 inc_reg |
746 add 1 main.R main.R | 896 add 1 main.R main.R |
747 update_flags SZYHVXN0 | 897 update_flags SZYHVXN0 |
898 | |
899 dd 00100100 inc_ixh | |
900 add 0x100 ix ix | |
901 update_flags SZYHVXN0 | |
902 | |
903 dd 00101100 inc_ixl | |
904 local tmp 8 | |
905 mov ix tmp | |
906 add 1 tmp tmp | |
907 update_flags SZYHVXN0 | |
908 and 0xFF00 ix ix | |
909 or tmp ix ix | |
910 | |
911 fd 00100100 inc_iyh | |
912 add 0x100 iy iy | |
913 update_flags SZYHVXN0 | |
914 | |
915 fd 00101100 inc_iyl | |
916 local tmp 8 | |
917 mov iy tmp | |
918 add 1 tmp tmp | |
919 update_flags SZYHVXN0 | |
920 and 0xFF00 iy iy | |
921 or tmp iy iy | |
748 | 922 |
749 00110100 inc_hl | 923 00110100 inc_hl |
750 local tmp 8 | 924 local tmp 8 |
751 z80_fetch_hl | 925 z80_fetch_hl |
752 #TODO: Either make DSL compiler smart enough to optimize these unnecessary moves out | 926 #TODO: Either make DSL compiler smart enough to optimize these unnecessary moves out |
811 | 985 |
812 00RRR101 dec_reg | 986 00RRR101 dec_reg |
813 sub 1 main.R main.R | 987 sub 1 main.R main.R |
814 update_flags SZYHVXN1 | 988 update_flags SZYHVXN1 |
815 | 989 |
990 dd 00100101 dec_ixh | |
991 sub 0x100 ix ix | |
992 update_flags SZYHVXN1 | |
993 | |
994 dd 00101101 dec_ixl | |
995 local tmp 8 | |
996 mov ix tmp | |
997 sub 1 tmp tmp | |
998 update_flags SZYHVXN1 | |
999 and 0xFF00 ix ix | |
1000 or tmp ix ix | |
1001 | |
1002 fd 00100101 dec_iyh | |
1003 sub 0x100 iy iy | |
1004 update_flags SZYHVXN1 | |
1005 | |
1006 fd 00101101 dec_iyl | |
1007 local tmp 8 | |
1008 mov iy tmp | |
1009 sub 1 tmp tmp | |
1010 update_flags SZYHVXN1 | |
1011 and 0xFF00 iy iy | |
1012 or tmp iy iy | |
1013 | |
816 00110101 dec_hl | 1014 00110101 dec_hl |
817 z80_fetch_hl | 1015 z80_fetch_hl |
818 #TODO: fix size | 1016 #TODO: fix size |
819 sub 1 scratch1 scratch1 | 1017 sub 1 scratch1 scratch1 |
820 update_flags SZYHVXN1 | 1018 update_flags SZYHVXN1 |