src/mame/machine/neocrypt.c
| r3485 | r3486 | |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | |
| 672 | | /* svc has an additional scramble on top of the standard CMC scrambling */ |
| 672 | /* ms5pcb and svcpcb have an additional scramble on top of the standard CMC scrambling */ |
| 673 | 673 | void svcpcb_gfx_decrypt(running_machine *machine) |
| 674 | 674 | { |
| 675 | 675 | static const UINT8 xor[ 4 ] = { 0x34, 0x21, 0xc4, 0xe9 }; |
| r3485 | r3486 | |
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | |
| 721 | | /* Razoola & Halrin */ |
| 721 | /* kf2k3pcb has an additional scramble on top of the standard CMC scrambling */ |
| 722 | /* Thanks to Razoola & Halrin for the info */ |
| 722 | 723 | void kf2k3pcb_gfx_decrypt(running_machine *machine) |
| 723 | 724 | { |
| 724 | 725 | static const UINT8 xor[ 4 ] = { 0x34, 0x21, 0xc4, 0xe9 }; |
| r3485 | r3486 | |
| 749 | 750 | } |
| 750 | 751 | |
| 751 | 752 | |
| 753 | /* and a further swap on the s1 data */ |
| 754 | void kf2k3pcb_decrypt_s1data(running_machine *machine) |
| 755 | { |
| 756 | UINT8 *src; |
| 757 | UINT8 *dst; |
| 758 | int i; |
| 759 | int tx_size = memory_region_length( machine, "fixed" ); |
| 760 | int srom_size = memory_region_length( machine, "sprites" ); |
| 761 | |
| 762 | src = memory_region( machine, "sprites" ) + srom_size - 0x1000000 - 0x80000; // Decrypt S |
| 763 | dst = memory_region( machine, "fixed" ); |
| 764 | |
| 765 | for( i = 0; i < tx_size / 2; i++ ) |
| 766 | { |
| 767 | dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ]; |
| 768 | } |
| 769 | |
| 770 | src = memory_region( machine, "sprites" ) + srom_size - 0x80000; |
| 771 | dst = memory_region( machine, "fixed" ) + 0x80000; |
| 772 | |
| 773 | for( i = 0; i < tx_size / 2; i++ ) |
| 774 | { |
| 775 | dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ]; |
| 776 | } |
| 777 | |
| 778 | dst = memory_region( machine, "fixed" ); |
| 779 | |
| 780 | for( i = 0; i < tx_size; i++ ) |
| 781 | { |
| 782 | dst[ i ] = BITSWAP8( dst[ i ] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3 ); |
| 783 | } |
| 784 | } |
| 785 | |
| 786 | |
| 752 | 787 | /*************************************************************************** |
| 753 | 788 | |
| 789 | NeoGeo 'M' ROM encryption |
| 790 | CMC50 protection chip |
| 791 | |
| 792 | ***************************************************************************/ |
| 793 | |
| 794 | |
| 795 | static const UINT8 m1_address_8_15_xor[256] = |
| 796 | { |
| 797 | 0x0a, 0x72, 0xb7, 0xaf, 0x67, 0xde, 0x1d, 0xb1, 0x78, 0xc4, 0x4f, 0xb5, 0x4b, 0x18, 0x76, 0xdd, |
| 798 | 0x11, 0xe2, 0x36, 0xa1, 0x82, 0x03, 0x98, 0xa0, 0x10, 0x5f, 0x3f, 0xd6, 0x1f, 0x90, 0x6a, 0x0b, |
| 799 | 0x70, 0xe0, 0x64, 0xcb, 0x9f, 0x38, 0x8b, 0x53, 0x04, 0xca, 0xf8, 0xd0, 0x07, 0x68, 0x56, 0x32, |
| 800 | 0xae, 0x1c, 0x2e, 0x48, 0x63, 0x92, 0x9a, 0x9c, 0x44, 0x85, 0x41, 0x40, 0x09, 0xc0, 0xc8, 0xbf, |
| 801 | 0xea, 0xbb, 0xf7, 0x2d, 0x99, 0x21, 0xf6, 0xba, 0x15, 0xce, 0xab, 0xb0, 0x2a, 0x60, 0xbc, 0xf1, |
| 802 | 0xf0, 0x9e, 0xd5, 0x97, 0xd8, 0x4e, 0x14, 0x9d, 0x42, 0x4d, 0x2c, 0x5c, 0x2b, 0xa6, 0xe1, 0xa7, |
| 803 | 0xef, 0x25, 0x33, 0x7a, 0xeb, 0xe7, 0x1b, 0x6d, 0x4c, 0x52, 0x26, 0x62, 0xb6, 0x35, 0xbe, 0x80, |
| 804 | 0x01, 0xbd, 0xfd, 0x37, 0xf9, 0x47, 0x55, 0x71, 0xb4, 0xf2, 0xff, 0x27, 0xfa, 0x23, 0xc9, 0x83, |
| 805 | 0x17, 0x39, 0x13, 0x0d, 0xc7, 0x86, 0x16, 0xec, 0x49, 0x6f, 0xfe, 0x34, 0x05, 0x8f, 0x00, 0xe6, |
| 806 | 0xa4, 0xda, 0x7b, 0xc1, 0xf3, 0xf4, 0xd9, 0x75, 0x28, 0x66, 0x87, 0xa8, 0x45, 0x6c, 0x20, 0xe9, |
| 807 | 0x77, 0x93, 0x7e, 0x3c, 0x1e, 0x74, 0xf5, 0x8c, 0x3e, 0x94, 0xd4, 0xc2, 0x5a, 0x06, 0x0e, 0xe8, |
| 808 | 0x3d, 0xa9, 0xb2, 0xe3, 0xe4, 0x22, 0xcf, 0x24, 0x8e, 0x6b, 0x8a, 0x8d, 0x84, 0x4a, 0xd2, 0x91, |
| 809 | 0x88, 0x79, 0x57, 0xa5, 0x0f, 0xcd, 0xb9, 0xac, 0x3b, 0xaa, 0xb3, 0xd1, 0xee, 0x31, 0x81, 0x7c, |
| 810 | 0xd7, 0x89, 0xd3, 0x96, 0x43, 0xc5, 0xc6, 0xc3, 0x69, 0x7f, 0x46, 0xdf, 0x30, 0x5b, 0x6e, 0xe5, |
| 811 | 0x08, 0x95, 0x9b, 0xfb, 0xb8, 0x58, 0x0c, 0x61, 0x50, 0x5d, 0x3a, 0xa2, 0x29, 0x12, 0xfc, 0x51, |
| 812 | 0x7d, 0x1a, 0x02, 0x65, 0x54, 0x5e, 0x19, 0xcc, 0xdc, 0xdb, 0x73, 0xed, 0xad, 0x59, 0x2f, 0xa3, |
| 813 | }; |
| 814 | |
| 815 | static const UINT8 m1_address_0_7_xor[256] = |
| 816 | { |
| 817 | 0xf4, 0xbc, 0x02, 0xf7, 0x2c, 0x3d, 0xe8, 0xd9, 0x50, 0x62, 0xec, 0xbd, 0x53, 0x73, 0x79, 0x61, |
| 818 | 0x00, 0x34, 0xcf, 0xa2, 0x63, 0x28, 0x90, 0xaf, 0x44, 0x3b, 0xc5, 0x8d, 0x3a, 0x46, 0x07, 0x70, |
| 819 | 0x66, 0xbe, 0xd8, 0x8b, 0xe9, 0xa0, 0x4b, 0x98, 0xdc, 0xdf, 0xe2, 0x16, 0x74, 0xf1, 0x37, 0xf5, |
| 820 | 0xb7, 0x21, 0x81, 0x01, 0x1c, 0x1b, 0x94, 0x36, 0x09, 0xa1, 0x4a, 0x91, 0x30, 0x92, 0x9b, 0x9a, |
| 821 | 0x29, 0xb1, 0x38, 0x4d, 0x55, 0xf2, 0x56, 0x18, 0x24, 0x47, 0x9d, 0x3f, 0x80, 0x1f, 0x22, 0xa4, |
| 822 | 0x11, 0x54, 0x84, 0x0d, 0x25, 0x48, 0xee, 0xc6, 0x59, 0x15, 0x03, 0x7a, 0xfd, 0x6c, 0xc3, 0x33, |
| 823 | 0x5b, 0xc4, 0x7b, 0x5a, 0x05, 0x7f, 0xa6, 0x40, 0xa9, 0x5d, 0x41, 0x8a, 0x96, 0x52, 0xd3, 0xf0, |
| 824 | 0xab, 0x72, 0x10, 0x88, 0x6f, 0x95, 0x7c, 0xa8, 0xcd, 0x9c, 0x5f, 0x32, 0xae, 0x85, 0x39, 0xac, |
| 825 | 0xe5, 0xd7, 0xfb, 0xd4, 0x08, 0x23, 0x19, 0x65, 0x6b, 0xa7, 0x93, 0xbb, 0x2b, 0xbf, 0xb8, 0x35, |
| 826 | 0xd0, 0x06, 0x26, 0x68, 0x3e, 0xdd, 0xb9, 0x69, 0x2a, 0xb2, 0xde, 0x87, 0x45, 0x58, 0xff, 0x3c, |
| 827 | 0x9e, 0x7d, 0xda, 0xed, 0x49, 0x8c, 0x14, 0x8e, 0x75, 0x2f, 0xe0, 0x6e, 0x78, 0x6d, 0x20, 0xd2, |
| 828 | 0xfa, 0x2d, 0x51, 0xcc, 0xc7, 0xe7, 0x1d, 0x27, 0x97, 0xfc, 0x31, 0xdb, 0xf8, 0x42, 0xe3, 0x99, |
| 829 | 0x5e, 0x83, 0x0e, 0xb4, 0x2e, 0xf6, 0xc0, 0x0c, 0x4c, 0x57, 0xb6, 0x64, 0x0a, 0x17, 0xa3, 0xc1, |
| 830 | 0x77, 0x12, 0xfe, 0xe6, 0x8f, 0x13, 0x71, 0xe4, 0xf9, 0xad, 0x9f, 0xce, 0xd5, 0x89, 0x7e, 0x0f, |
| 831 | 0xc2, 0x86, 0xf3, 0x67, 0xba, 0x60, 0x43, 0xc9, 0x04, 0xb3, 0xb0, 0x1e, 0xb5, 0xc8, 0xeb, 0xa5, |
| 832 | 0x76, 0xea, 0x5c, 0x82, 0x1a, 0x4f, 0xaa, 0xca, 0xe1, 0x0b, 0x4e, 0xcb, 0x6a, 0xef, 0xd1, 0xd6, |
| 833 | }; |
| 834 | |
| 835 | |
| 836 | /* The CMC50 hardware does a checksum of the first 64kb of the M1 rom, |
| 837 | ,and uses this checksum as the basis of the key with which to decrypt |
| 838 | the rom */ |
| 839 | |
| 840 | static UINT16 generate_cs16(UINT8 *rom, int size) |
| 841 | { |
| 842 | UINT16 cs16; |
| 843 | int i; |
| 844 | cs16 = 0x0000; |
| 845 | for (i=0;i<size;i++ ) |
| 846 | { |
| 847 | cs16 += rom[i]; |
| 848 | } |
| 849 | return cs16&0xFFFF; |
| 850 | } |
| 851 | |
| 852 | |
| 853 | int m1_address_scramble(int address, UINT16 key) |
| 854 | { |
| 855 | int block; |
| 856 | int aux; |
| 857 | |
| 858 | const int p1[8][16] = { |
| 859 | {15,14,10,7,1,2,3,8,0,12,11,13,6,9,5,4}, |
| 860 | {7,1,8,11,15,9,2,3,5,13,4,14,10,0,6,12}, |
| 861 | {8,6,14,3,10,7,15,1,4,0,2,5,13,11,12,9}, |
| 862 | {2,8,15,9,3,4,11,7,13,6,0,10,1,12,14,5}, |
| 863 | {1,13,6,15,14,3,8,10,9,4,7,12,5,2,0,11}, |
| 864 | {11,15,3,4,7,0,9,2,6,14,12,1,8,5,10,13}, |
| 865 | {10,5,13,8,6,15,1,14,11,9,3,0,12,7,4,2}, |
| 866 | {9,3,7,0,2,12,4,11,14,10,5,8,15,13,1,6}, |
| 867 | }; |
| 868 | |
| 869 | block = (address>>16)&7; |
| 870 | aux = address&0xffff; |
| 871 | |
| 872 | aux ^= BITSWAP16(key,12,0,2,4,8,15,7,13,10,1,3,6,11,9,14,5); |
| 873 | aux = BITSWAP16(aux, |
| 874 | p1[block][15],p1[block][14],p1[block][13],p1[block][12], |
| 875 | p1[block][11],p1[block][10],p1[block][9],p1[block][8], |
| 876 | p1[block][7],p1[block][6],p1[block][5],p1[block][4], |
| 877 | p1[block][3],p1[block][2],p1[block][1],p1[block][0]); |
| 878 | aux ^= m1_address_0_7_xor[(aux>>8)&0xff]; |
| 879 | aux ^= m1_address_8_15_xor[aux&0xff]<<8; |
| 880 | aux = BITSWAP16(aux, 7,15,14,6,5,13,12,4,11,3,10,2,9,1,8,0); |
| 881 | |
| 882 | return (block<<16)|aux; |
| 883 | } |
| 884 | |
| 885 | |
| 886 | void neogeo_cmc50_m1_decrypt(running_machine *machine) |
| 887 | { |
| 888 | UINT8* rom = memory_region(machine, "audiocrypt"); |
| 889 | size_t rom_size = 0x80000; |
| 890 | UINT8* rom2 = memory_region(machine, "audio"); |
| 891 | |
| 892 | UINT8* buffer = malloc_or_die(rom_size); |
| 893 | |
| 894 | UINT32 i; |
| 895 | |
| 896 | UINT16 key=generate_cs16(rom,0x10000); |
| 897 | |
| 898 | //printf("key %04x\n",key); |
| 899 | |
| 900 | for (i=0; i<rom_size; i++) |
| 901 | { |
| 902 | buffer[i] = rom[m1_address_scramble(i,key)]; |
| 903 | } |
| 904 | |
| 905 | memcpy(rom,buffer,rom_size); |
| 906 | |
| 907 | memcpy(rom2,rom,0x10000); |
| 908 | memcpy(rom2+0x10000,rom,0x80000); |
| 909 | |
| 910 | #if 0 |
| 911 | { |
| 912 | FILE *fp; |
| 913 | const char *gamename = machine->gamedrv->name; |
| 914 | char filename[256]; |
| 915 | sprintf(filename, "%s_m1.dump", gamename); |
| 916 | |
| 917 | fp=fopen(filename, "w+b"); |
| 918 | if (fp) |
| 919 | { |
| 920 | fwrite(rom, rom_size, 1, fp); |
| 921 | fclose(fp); |
| 922 | } |
| 923 | } |
| 924 | #endif |
| 925 | |
| 926 | |
| 927 | #if 0 |
| 928 | { |
| 929 | FILE *fp; |
| 930 | const char *gamename = machine->gamedrv->name; |
| 931 | char filename[256]; |
| 932 | sprintf(filename, "%s_m1extra.dump", gamename); |
| 933 | |
| 934 | fp=fopen(filename, "w+b"); |
| 935 | if (fp) |
| 936 | { |
| 937 | fwrite(&rom[0xf800], 0x800, 1, fp); |
| 938 | fclose(fp); |
| 939 | } |
| 940 | } |
| 941 | #endif |
| 942 | |
| 943 | free( buffer ); |
| 944 | } |
| 945 | |
| 946 | |
| 947 | /*************************************************************************** |
| 948 | |
| 754 | 949 | NeoGeo 'P' ROM encryption |
| 755 | 950 | |
| 756 | 951 | ***************************************************************************/ |
| 757 | 952 | |
| 953 | |
| 758 | 954 | /* Kof98 uses an early encryption, quite different from the others */ |
| 759 | 955 | void kof98_decrypt_68k(running_machine *machine) |
| 760 | 956 | { |
| r3485 | r3486 | |
| 1033 | 1229 | } |
| 1034 | 1230 | |
| 1035 | 1231 | |
| 1036 | | /* mslug5, svc, kof2003 have updated P rom scramble */ |
| 1232 | /* kf2k3pcb, kof2003, kof2003h, mslug5 and svc have updated P rom scramble */ |
| 1037 | 1233 | void mslug5_decrypt_68k(running_machine *machine) |
| 1038 | 1234 | { |
| 1039 | 1235 | static const UINT8 xor1[ 0x20 ] = { 0xc2, 0x4b, 0x74, 0xfd, 0x0b, 0x34, 0xeb, 0xd7, 0x10, 0x6d, 0xf9, 0xce, 0x5d, 0xd5, 0x61, 0x29, 0xf5, 0xbe, 0x0d, 0x82, 0x72, 0x45, 0x0f, 0x24, 0xb3, 0x34, 0x1b, 0x99, 0xea, 0x09, 0xf3, 0x03 }; |
| r3485 | r3486 | |
| 1124 | 1320 | } |
| 1125 | 1321 | |
| 1126 | 1322 | |
| 1127 | | void kf2k3pcb_decrypt_s1data(running_machine *machine) |
| 1128 | | { |
| 1129 | | UINT8 *src; |
| 1130 | | UINT8 *dst; |
| 1131 | | int i; |
| 1132 | | int tx_size = memory_region_length( machine, "fixed" ); |
| 1133 | | int srom_size = memory_region_length( machine, "sprites" ); |
| 1134 | | |
| 1135 | | src = memory_region( machine, "sprites" ) + srom_size - 0x1000000 - 0x80000; // Decrypt S |
| 1136 | | dst = memory_region( machine, "fixed" ); |
| 1137 | | |
| 1138 | | for( i = 0; i < tx_size / 2; i++ ) |
| 1139 | | { |
| 1140 | | dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ]; |
| 1141 | | } |
| 1142 | | |
| 1143 | | src = memory_region( machine, "sprites" ) + srom_size - 0x80000; |
| 1144 | | dst = memory_region( machine, "fixed" ) + 0x80000; |
| 1145 | | |
| 1146 | | for( i = 0; i < tx_size / 2; i++ ) |
| 1147 | | { |
| 1148 | | dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ]; |
| 1149 | | } |
| 1150 | | |
| 1151 | | dst = memory_region( machine, "fixed" ); |
| 1152 | | |
| 1153 | | for( i = 0; i < tx_size; i++ ) |
| 1154 | | { |
| 1155 | | dst[ i ] = BITSWAP8( dst[ i ] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3 ); |
| 1156 | | } |
| 1157 | | } |
| 1158 | | |
| 1159 | | |
| 1160 | 1323 | void kf2k3pcb_decrypt_68k(running_machine *machine) |
| 1161 | 1324 | { |
| 1162 | 1325 | static const UINT8 xor2[ 0x20 ] = { 0xb4, 0x0f, 0x40, 0x6c, 0x38, 0x07, 0xd0, 0x3f, 0x53, 0x08, 0x80, 0xaa, 0xbe, 0x07, 0xc0, 0xfa, 0xd0, 0x08, 0x10, 0xd2, 0xf1, 0x03, 0x70, 0x7e, 0x87, 0x0b, 0x40, 0xf6, 0x2a, 0x0a, 0xe0, 0xf9 }; |
| r3485 | r3486 | |
| 1293 | 1456 | } |
| 1294 | 1457 | |
| 1295 | 1458 | |
| 1296 | | void kof2003biosdecode(running_machine *machine) |
| 1297 | | { |
| 1298 | | static const UINT8 address[0x80]={ |
| 1299 | | 0xb9,0xb8,0x36,0x37,0x3d,0x3c,0xb2,0xb3, |
| 1300 | | 0xb9,0xb8,0x36,0x37,0x3d,0x3c,0xb2,0xb3, |
| 1301 | | 0x65,0xea,0x6f,0xe0,0xe1,0x6e,0xeb,0x64, |
| 1302 | | 0x65,0xea,0x6f,0xe0,0xe1,0x6e,0xeb,0x64, |
| 1303 | | 0x45,0xca,0x47,0xc8,0xc9,0x46,0xcb,0x44, |
| 1304 | | 0x45,0xca,0x47,0xc8,0xc9,0x46,0xcb,0x44, |
| 1305 | | 0x9a,0x15,0x98,0x17,0x1e,0x91,0x1c,0x93, |
| 1306 | | 0x9a,0x15,0x98,0x17,0x1e,0x91,0x1c,0x93, |
| 1307 | | 0x7e,0xf1,0x7c,0xf3,0xf0,0x7f,0xf2,0x7d, |
| 1308 | | 0x7e,0xf1,0x7c,0xf3,0xf0,0x7f,0xf2,0x7d, |
| 1309 | | 0x27,0xa8,0x25,0xaa,0xa3,0x2c,0xa1,0x2e, |
| 1310 | | 0x27,0xa8,0x25,0xaa,0xa3,0x2c,0xa1,0x2e, |
| 1311 | | 0x04,0x8b,0x06,0x89,0x80,0x0f,0x82,0x0d, |
| 1312 | | 0x04,0x8b,0x06,0x89,0x80,0x0f,0x82,0x0d, |
| 1313 | | 0xd3,0xd2,0x5c,0x5d,0x57,0x56,0xd8,0xd9, |
| 1314 | | 0xd3,0xd2,0x5c,0x5d,0x57,0x56,0xd8,0xd9, |
| 1315 | | }; |
| 1316 | | UINT16*src= (UINT16*)memory_region( machine, "mainbios" ); |
| 1317 | | UINT16*buf= malloc_or_die(0x80000); |
| 1318 | | int a,addr; |
| 1319 | | |
| 1320 | | for (a=0;a<0x80000/2;a++) |
| 1321 | | { |
| 1322 | | //data xor |
| 1323 | | #ifdef LSB_FIRST |
| 1324 | | if (src[a] & 0x0004) src[a] ^= 0x0001; |
| 1325 | | if (src[a] & 0x0010) src[a] ^= 0x0002; |
| 1326 | | if (src[a] & 0x0020) src[a] ^= 0x0008; |
| 1327 | | #else |
| 1328 | | if (src[a] & 0x0400) src[a] ^= 0x0100; |
| 1329 | | if (src[a] & 0x1000) src[a] ^= 0x0200; |
| 1330 | | if (src[a] & 0x2000) src[a] ^= 0x0800; |
| 1331 | | #endif |
| 1332 | | //address xor |
| 1333 | | addr = a & ~0xff; |
| 1334 | | addr |= address[BYTE_XOR_LE(a & 0x7f)]; |
| 1335 | | if ( a & 0x00008) addr ^= 0x0008; |
| 1336 | | if ( a & 0x00080) addr ^= 0x0080; |
| 1337 | | if ( a & 0x00200) addr ^= 0x0100; |
| 1338 | | if (~a & 0x02000) addr ^= 0x0400; |
| 1339 | | if (~a & 0x10000) addr ^= 0x1000; |
| 1340 | | if ( a & 0x02000) addr ^= 0x8000; |
| 1341 | | buf[addr]=src[a]; |
| 1342 | | } |
| 1343 | | memcpy(src,buf,0x80000); |
| 1344 | | free(buf); |
| 1345 | | } |
| 1346 | | |
| 1347 | | |
| 1348 | 1459 | /*************************************************************************** |
| 1349 | 1460 | |
| 1350 | 1461 | NeoGeo 'V' (PCM) ROM encryption |
| r3485 | r3486 | |
| 1411 | 1522 | } |
| 1412 | 1523 | |
| 1413 | 1524 | |
| 1414 | | static const UINT8 m1_address_8_15_xor[256] = |
| 1415 | | { |
| 1416 | | 0x0a, 0x72, 0xb7, 0xaf, 0x67, 0xde, 0x1d, 0xb1, 0x78, 0xc4, 0x4f, 0xb5, 0x4b, 0x18, 0x76, 0xdd, |
| 1417 | | 0x11, 0xe2, 0x36, 0xa1, 0x82, 0x03, 0x98, 0xa0, 0x10, 0x5f, 0x3f, 0xd6, 0x1f, 0x90, 0x6a, 0x0b, |
| 1418 | | 0x70, 0xe0, 0x64, 0xcb, 0x9f, 0x38, 0x8b, 0x53, 0x04, 0xca, 0xf8, 0xd0, 0x07, 0x68, 0x56, 0x32, |
| 1419 | | 0xae, 0x1c, 0x2e, 0x48, 0x63, 0x92, 0x9a, 0x9c, 0x44, 0x85, 0x41, 0x40, 0x09, 0xc0, 0xc8, 0xbf, |
| 1420 | | 0xea, 0xbb, 0xf7, 0x2d, 0x99, 0x21, 0xf6, 0xba, 0x15, 0xce, 0xab, 0xb0, 0x2a, 0x60, 0xbc, 0xf1, |
| 1421 | | 0xf0, 0x9e, 0xd5, 0x97, 0xd8, 0x4e, 0x14, 0x9d, 0x42, 0x4d, 0x2c, 0x5c, 0x2b, 0xa6, 0xe1, 0xa7, |
| 1422 | | 0xef, 0x25, 0x33, 0x7a, 0xeb, 0xe7, 0x1b, 0x6d, 0x4c, 0x52, 0x26, 0x62, 0xb6, 0x35, 0xbe, 0x80, |
| 1423 | | 0x01, 0xbd, 0xfd, 0x37, 0xf9, 0x47, 0x55, 0x71, 0xb4, 0xf2, 0xff, 0x27, 0xfa, 0x23, 0xc9, 0x83, |
| 1424 | | 0x17, 0x39, 0x13, 0x0d, 0xc7, 0x86, 0x16, 0xec, 0x49, 0x6f, 0xfe, 0x34, 0x05, 0x8f, 0x00, 0xe6, |
| 1425 | | 0xa4, 0xda, 0x7b, 0xc1, 0xf3, 0xf4, 0xd9, 0x75, 0x28, 0x66, 0x87, 0xa8, 0x45, 0x6c, 0x20, 0xe9, |
| 1426 | | 0x77, 0x93, 0x7e, 0x3c, 0x1e, 0x74, 0xf5, 0x8c, 0x3e, 0x94, 0xd4, 0xc2, 0x5a, 0x06, 0x0e, 0xe8, |
| 1427 | | 0x3d, 0xa9, 0xb2, 0xe3, 0xe4, 0x22, 0xcf, 0x24, 0x8e, 0x6b, 0x8a, 0x8d, 0x84, 0x4a, 0xd2, 0x91, |
| 1428 | | 0x88, 0x79, 0x57, 0xa5, 0x0f, 0xcd, 0xb9, 0xac, 0x3b, 0xaa, 0xb3, 0xd1, 0xee, 0x31, 0x81, 0x7c, |
| 1429 | | 0xd7, 0x89, 0xd3, 0x96, 0x43, 0xc5, 0xc6, 0xc3, 0x69, 0x7f, 0x46, 0xdf, 0x30, 0x5b, 0x6e, 0xe5, |
| 1430 | | 0x08, 0x95, 0x9b, 0xfb, 0xb8, 0x58, 0x0c, 0x61, 0x50, 0x5d, 0x3a, 0xa2, 0x29, 0x12, 0xfc, 0x51, |
| 1431 | | 0x7d, 0x1a, 0x02, 0x65, 0x54, 0x5e, 0x19, 0xcc, 0xdc, 0xdb, 0x73, 0xed, 0xad, 0x59, 0x2f, 0xa3, |
| 1432 | | }; |
| 1525 | /*************************************************************************** |
| 1433 | 1526 | |
| 1434 | | static const UINT8 m1_address_0_7_xor[256] = |
| 1435 | | { |
| 1436 | | 0xf4, 0xbc, 0x02, 0xf7, 0x2c, 0x3d, 0xe8, 0xd9, 0x50, 0x62, 0xec, 0xbd, 0x53, 0x73, 0x79, 0x61, |
| 1437 | | 0x00, 0x34, 0xcf, 0xa2, 0x63, 0x28, 0x90, 0xaf, 0x44, 0x3b, 0xc5, 0x8d, 0x3a, 0x46, 0x07, 0x70, |
| 1438 | | 0x66, 0xbe, 0xd8, 0x8b, 0xe9, 0xa0, 0x4b, 0x98, 0xdc, 0xdf, 0xe2, 0x16, 0x74, 0xf1, 0x37, 0xf5, |
| 1439 | | 0xb7, 0x21, 0x81, 0x01, 0x1c, 0x1b, 0x94, 0x36, 0x09, 0xa1, 0x4a, 0x91, 0x30, 0x92, 0x9b, 0x9a, |
| 1440 | | 0x29, 0xb1, 0x38, 0x4d, 0x55, 0xf2, 0x56, 0x18, 0x24, 0x47, 0x9d, 0x3f, 0x80, 0x1f, 0x22, 0xa4, |
| 1441 | | 0x11, 0x54, 0x84, 0x0d, 0x25, 0x48, 0xee, 0xc6, 0x59, 0x15, 0x03, 0x7a, 0xfd, 0x6c, 0xc3, 0x33, |
| 1442 | | 0x5b, 0xc4, 0x7b, 0x5a, 0x05, 0x7f, 0xa6, 0x40, 0xa9, 0x5d, 0x41, 0x8a, 0x96, 0x52, 0xd3, 0xf0, |
| 1443 | | 0xab, 0x72, 0x10, 0x88, 0x6f, 0x95, 0x7c, 0xa8, 0xcd, 0x9c, 0x5f, 0x32, 0xae, 0x85, 0x39, 0xac, |
| 1444 | | 0xe5, 0xd7, 0xfb, 0xd4, 0x08, 0x23, 0x19, 0x65, 0x6b, 0xa7, 0x93, 0xbb, 0x2b, 0xbf, 0xb8, 0x35, |
| 1445 | | 0xd0, 0x06, 0x26, 0x68, 0x3e, 0xdd, 0xb9, 0x69, 0x2a, 0xb2, 0xde, 0x87, 0x45, 0x58, 0xff, 0x3c, |
| 1446 | | 0x9e, 0x7d, 0xda, 0xed, 0x49, 0x8c, 0x14, 0x8e, 0x75, 0x2f, 0xe0, 0x6e, 0x78, 0x6d, 0x20, 0xd2, |
| 1447 | | 0xfa, 0x2d, 0x51, 0xcc, 0xc7, 0xe7, 0x1d, 0x27, 0x97, 0xfc, 0x31, 0xdb, 0xf8, 0x42, 0xe3, 0x99, |
| 1448 | | 0x5e, 0x83, 0x0e, 0xb4, 0x2e, 0xf6, 0xc0, 0x0c, 0x4c, 0x57, 0xb6, 0x64, 0x0a, 0x17, 0xa3, 0xc1, |
| 1449 | | 0x77, 0x12, 0xfe, 0xe6, 0x8f, 0x13, 0x71, 0xe4, 0xf9, 0xad, 0x9f, 0xce, 0xd5, 0x89, 0x7e, 0x0f, |
| 1450 | | 0xc2, 0x86, 0xf3, 0x67, 0xba, 0x60, 0x43, 0xc9, 0x04, 0xb3, 0xb0, 0x1e, 0xb5, 0xc8, 0xeb, 0xa5, |
| 1451 | | 0x76, 0xea, 0x5c, 0x82, 0x1a, 0x4f, 0xaa, 0xca, 0xe1, 0x0b, 0x4e, 0xcb, 0x6a, 0xef, 0xd1, 0xd6, |
| 1452 | | }; |
| 1527 | NeoGeo 'SP1' (BIOS) ROM encryption |
| 1453 | 1528 | |
| 1529 | ***************************************************************************/ |
| 1454 | 1530 | |
| 1455 | | /* The CMC50 hardware does a checksum of the first 64kb of the M1 rom, |
| 1456 | | ,and uses this checksum as the basis of the key with which to decrypt |
| 1457 | | the rom */ |
| 1458 | 1531 | |
| 1459 | | static UINT16 generate_cs16(UINT8 *rom, int size) |
| 1532 | /* only found on kf2k3pcb */ |
| 1533 | void kof2003biosdecode(running_machine *machine) |
| 1460 | 1534 | { |
| 1461 | | UINT16 cs16; |
| 1462 | | int i; |
| 1463 | | cs16 = 0x0000; |
| 1464 | | for (i=0;i<size;i++ ) |
| 1465 | | { |
| 1466 | | cs16 += rom[i]; |
| 1467 | | } |
| 1468 | | return cs16&0xFFFF; |
| 1469 | | } |
| 1470 | | |
| 1471 | | |
| 1472 | | int m1_address_scramble(int address, UINT16 key) |
| 1473 | | { |
| 1474 | | int block; |
| 1475 | | int aux; |
| 1476 | | |
| 1477 | | const int p1[8][16] = { |
| 1478 | | {15,14,10,7,1,2,3,8,0,12,11,13,6,9,5,4}, |
| 1479 | | {7,1,8,11,15,9,2,3,5,13,4,14,10,0,6,12}, |
| 1480 | | {8,6,14,3,10,7,15,1,4,0,2,5,13,11,12,9}, |
| 1481 | | {2,8,15,9,3,4,11,7,13,6,0,10,1,12,14,5}, |
| 1482 | | {1,13,6,15,14,3,8,10,9,4,7,12,5,2,0,11}, |
| 1483 | | {11,15,3,4,7,0,9,2,6,14,12,1,8,5,10,13}, |
| 1484 | | {10,5,13,8,6,15,1,14,11,9,3,0,12,7,4,2}, |
| 1485 | | {9,3,7,0,2,12,4,11,14,10,5,8,15,13,1,6}, |
| 1535 | static const UINT8 address[0x80]={ |
| 1536 | 0xb9,0xb8,0x36,0x37,0x3d,0x3c,0xb2,0xb3, |
| 1537 | 0xb9,0xb8,0x36,0x37,0x3d,0x3c,0xb2,0xb3, |
| 1538 | 0x65,0xea,0x6f,0xe0,0xe1,0x6e,0xeb,0x64, |
| 1539 | 0x65,0xea,0x6f,0xe0,0xe1,0x6e,0xeb,0x64, |
| 1540 | 0x45,0xca,0x47,0xc8,0xc9,0x46,0xcb,0x44, |
| 1541 | 0x45,0xca,0x47,0xc8,0xc9,0x46,0xcb,0x44, |
| 1542 | 0x9a,0x15,0x98,0x17,0x1e,0x91,0x1c,0x93, |
| 1543 | 0x9a,0x15,0x98,0x17,0x1e,0x91,0x1c,0x93, |
| 1544 | 0x7e,0xf1,0x7c,0xf3,0xf0,0x7f,0xf2,0x7d, |
| 1545 | 0x7e,0xf1,0x7c,0xf3,0xf0,0x7f,0xf2,0x7d, |
| 1546 | 0x27,0xa8,0x25,0xaa,0xa3,0x2c,0xa1,0x2e, |
| 1547 | 0x27,0xa8,0x25,0xaa,0xa3,0x2c,0xa1,0x2e, |
| 1548 | 0x04,0x8b,0x06,0x89,0x80,0x0f,0x82,0x0d, |
| 1549 | 0x04,0x8b,0x06,0x89,0x80,0x0f,0x82,0x0d, |
| 1550 | 0xd3,0xd2,0x5c,0x5d,0x57,0x56,0xd8,0xd9, |
| 1551 | 0xd3,0xd2,0x5c,0x5d,0x57,0x56,0xd8,0xd9, |
| 1486 | 1552 | }; |
| 1553 | UINT16*src= (UINT16*)memory_region( machine, "mainbios" ); |
| 1554 | UINT16*buf= malloc_or_die(0x80000); |
| 1555 | int a,addr; |
| 1487 | 1556 | |
| 1488 | | block = (address>>16)&7; |
| 1489 | | aux = address&0xffff; |
| 1490 | | |
| 1491 | | aux ^= BITSWAP16(key,12,0,2,4,8,15,7,13,10,1,3,6,11,9,14,5); |
| 1492 | | aux = BITSWAP16(aux, |
| 1493 | | p1[block][15],p1[block][14],p1[block][13],p1[block][12], |
| 1494 | | p1[block][11],p1[block][10],p1[block][9],p1[block][8], |
| 1495 | | p1[block][7],p1[block][6],p1[block][5],p1[block][4], |
| 1496 | | p1[block][3],p1[block][2],p1[block][1],p1[block][0]); |
| 1497 | | aux ^= m1_address_0_7_xor[(aux>>8)&0xff]; |
| 1498 | | aux ^= m1_address_8_15_xor[aux&0xff]<<8; |
| 1499 | | aux = BITSWAP16(aux, 7,15,14,6,5,13,12,4,11,3,10,2,9,1,8,0); |
| 1500 | | |
| 1501 | | return (block<<16)|aux; |
| 1502 | | } |
| 1503 | | |
| 1504 | | |
| 1505 | | void neogeo_cmc50_m1_decrypt(running_machine *machine) |
| 1506 | | { |
| 1507 | | UINT8* rom = memory_region(machine, "audiocrypt"); |
| 1508 | | size_t rom_size = 0x80000; |
| 1509 | | UINT8* rom2 = memory_region(machine, "audio"); |
| 1510 | | |
| 1511 | | UINT8* buffer = malloc_or_die(rom_size); |
| 1512 | | |
| 1513 | | UINT32 i; |
| 1514 | | |
| 1515 | | UINT16 key=generate_cs16(rom,0x10000); |
| 1516 | | |
| 1517 | | //printf("key %04x\n",key); |
| 1518 | | |
| 1519 | | for (i=0; i<rom_size; i++) |
| 1520 | | { |
| 1521 | | buffer[i] = rom[m1_address_scramble(i,key)]; |
| 1522 | | } |
| 1523 | | |
| 1524 | | memcpy(rom,buffer,rom_size); |
| 1525 | | |
| 1526 | | memcpy(rom2,rom,0x10000); |
| 1527 | | memcpy(rom2+0x10000,rom,0x80000); |
| 1528 | | |
| 1529 | | #if 0 |
| 1530 | | { |
| 1531 | | FILE *fp; |
| 1532 | | const char *gamename = machine->gamedrv->name; |
| 1533 | | char filename[256]; |
| 1534 | | sprintf(filename, "%s_m1.dump", gamename); |
| 1535 | | |
| 1536 | | fp=fopen(filename, "w+b"); |
| 1537 | | if (fp) |
| 1557 | for (a=0;a<0x80000/2;a++) |
| 1538 | 1558 | { |
| 1539 | | fwrite(rom, rom_size, 1, fp); |
| 1540 | | fclose(fp); |
| 1559 | //data xor |
| 1560 | #ifdef LSB_FIRST |
| 1561 | if (src[a] & 0x0004) src[a] ^= 0x0001; |
| 1562 | if (src[a] & 0x0010) src[a] ^= 0x0002; |
| 1563 | if (src[a] & 0x0020) src[a] ^= 0x0008; |
| 1564 | #else |
| 1565 | if (src[a] & 0x0400) src[a] ^= 0x0100; |
| 1566 | if (src[a] & 0x1000) src[a] ^= 0x0200; |
| 1567 | if (src[a] & 0x2000) src[a] ^= 0x0800; |
| 1568 | #endif |
| 1569 | //address xor |
| 1570 | addr = a & ~0xff; |
| 1571 | addr |= address[BYTE_XOR_LE(a & 0x7f)]; |
| 1572 | if ( a & 0x00008) addr ^= 0x0008; |
| 1573 | if ( a & 0x00080) addr ^= 0x0080; |
| 1574 | if ( a & 0x00200) addr ^= 0x0100; |
| 1575 | if (~a & 0x02000) addr ^= 0x0400; |
| 1576 | if (~a & 0x10000) addr ^= 0x1000; |
| 1577 | if ( a & 0x02000) addr ^= 0x8000; |
| 1578 | buf[addr]=src[a]; |
| 1541 | 1579 | } |
| 1542 | | } |
| 1543 | | #endif |
| 1580 | memcpy(src,buf,0x80000); |
| 1581 | free(buf); |
| 1582 | } |
| 1544 | 1583 | |
| 1545 | 1584 | |
| 1546 | | #if 0 |
| 1547 | | { |
| 1548 | | FILE *fp; |
| 1549 | | const char *gamename = machine->gamedrv->name; |
| 1550 | | char filename[256]; |
| 1551 | | sprintf(filename, "%s_m1extra.dump", gamename); |
| 1552 | | |
| 1553 | | fp=fopen(filename, "w+b"); |
| 1554 | | if (fp) |
| 1555 | | { |
| 1556 | | fwrite(&rom[0xf800], 0x800, 1, fp); |
| 1557 | | fclose(fp); |
| 1558 | | } |
| 1559 | | } |
| 1560 | | #endif |
| 1561 | | |
| 1562 | | free( buffer ); |
| 1563 | | } |
src/mame/drivers/itech8.c
| r3485 | r3486 | |
| 9 | 9 | * Strata Bowling [2 sets] |
| 10 | 10 | * Super Strike Bowling |
| 11 | 11 | * Wheel of Fortune [2 sets] |
| 12 | * Grudge Match |
| 12 | 13 | * Golden Tee Golf [2 sets] |
| 13 | 14 | * Golden Tee Golf II [3 sets] |
| 14 | 15 | * Slick Shot [3 sets] |
| r3485 | r3486 | |
| 143 | 144 | |
| 144 | 145 | Summary: |
| 145 | 146 | |
| 146 | | There are 7 known variants of PCBs for these games. All the PCBs |
| 147 | There are 8 known variants of PCBs for these games. All the PCBs |
| 147 | 148 | have the following features in common: |
| 148 | 149 | |
| 149 | 150 | 68B09 @ 2 MHz for the main CPU |
| r3485 | r3486 | |
| 151 | 152 | |
| 152 | 153 | 68B09 @ 2 MHz for the sound CPU |
| 153 | 154 | 2k RAM for the sound CPU |
| 154 | | YM2203C or YM3812 for music |
| 155 | | OKI M6295 for speech |
| 155 | YM2203C, YM2608B or YM3812 for music |
| 156 | OKI M6295 for speech (except for YM2608B-based system) |
| 156 | 157 | |
| 157 | 158 | TMS34061 for the video controller |
| 158 | 159 | ITV4400 custom blitter for rendering |
| 159 | | 6-bit RAMDAC for palette |
| 160 | 6-bit RAMDAC for palette, or 2xTMS34070NL (Grudge Match only) |
| 160 | 161 | From 2-8 64k x 4-bit VRAM chips for frame buffers |
| 161 | 162 | |
| 162 | 163 | An overview of each style PCB is given below: |
| 163 | 164 | |
| 164 | | Wheel of Fortune-style |
| 165 | Wheel Watcher (Wheel of Fortune)-style |
| 165 | 166 | * Single board |
| 166 | 167 | * YM2203C for music |
| 167 | 168 | * 2 VRAM chips for a single 8-bit 256x256 video page |
| 168 | 169 | |
| 170 | Grudge Match-style |
| 171 | * Single board |
| 172 | * YM2608B for music |
| 173 | * 4 VRAM chips for two 4-bit 512x256 layers |
| 174 | |
| 169 | 175 | Strata Bowling-style |
| 170 | 176 | * Single board |
| 171 | 177 | * YM2203C for music |
| r3485 | r3486 | |
| 202 | 208 | |
| 203 | 209 | **************************************************************************** |
| 204 | 210 | |
| 205 | | ---------------- |
| 206 | | Wheel of Fortune |
| 207 | | ---------------- |
| 211 | -------------------------------- |
| 212 | Wheel Watcher (Wheel of Fortune) |
| 213 | -------------------------------- |
| 208 | 214 | |
| 209 | 215 | +------------------------------------+-+ |
| 210 | 216 | | Bt476KP35 | | |
| r3485 | r3486 | |
| 240 | 246 | ITV4400 = IT custom blitter |
| 241 | 247 | |
| 242 | 248 | |
| 249 | ------------- |
| 250 | Grudge Match |
| 251 | ------------ |
| 252 | |
| 253 | +------------------------------------+-+ |
| 254 | | TMS34070NL | | |
| 255 | | TMS34070NL DIPSW4 | | |
| 256 | | TMS4461-15 8MHz | | |
| 257 | | TMS4461-15 | | |
| 258 | | TMS4461-15 | | |
| 259 | | TMS4461-15 | | |
| 260 | | | | |
| 261 | | TMS34061 +- |
| 262 | | | |
| 263 | | ITV4400 | |
| 264 | | GROM6 SROM0 | |
| 265 | | GROM5 | |
| 266 | | GROM4 | |
| 267 | | GROM3 MK40702B-20 YM2608B | |
| 268 | | GROM2 U5-PGM MK6116 | |
| 269 | | GROM1 U27-SND | |
| 270 | | GROM0 | |
| 271 | | MC68B09 MC68B09 | |
| 272 | +--------------------------------------+ |
| 273 | |
| 274 | GROM0-6 = AM27C010-25 |
| 275 | U5-PGM = D27512-25 |
| 276 | U27-SND = 27C256-20 |
| 277 | SROM0 = AM27C010-25 |
| 278 | ITVS = ??? |
| 279 | MT42C4064Z = 64k x 4 VRAM (2 populated on Wheel of Fortune) |
| 280 | MK40702B = zero-power RAM |
| 281 | MK6116 = 2k x 8 RAM |
| 282 | TMS34070NL = 16-color RAMDAC |
| 283 | TMS34061 = video controller |
| 284 | ITV4400 = IT custom blitter |
| 285 | |
| 286 | |
| 243 | 287 | ------------------------------ |
| 244 | 288 | Strata Bowling/Golden Tee Golf |
| 245 | 289 | ------------------------------ |
| r3485 | r3486 | |
| 459 | 503 | #include "video/tlc34076.h" |
| 460 | 504 | #include "itech8.h" |
| 461 | 505 | #include "sound/2203intf.h" |
| 506 | #include "sound/2608intf.h" |
| 462 | 507 | #include "sound/3812intf.h" |
| 463 | 508 | #include "sound/okim6295.h" |
| 464 | 509 | |
| r3485 | r3486 | |
| 944 | 989 | ADDRESS_MAP_END |
| 945 | 990 | |
| 946 | 991 | |
| 992 | /*------ YM2608B-based sound ------*/ |
| 993 | static ADDRESS_MAP_START( sound2608b_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 994 | AM_RANGE(0x1000, 0x1000) AM_WRITENOP |
| 995 | AM_RANGE(0x2000, 0x2000) AM_READ(sound_data_r) |
| 996 | AM_RANGE(0x4000, 0x4000) AM_READWRITE(ym2608_status_port_0_a_r, ym2608_control_port_0_a_w) |
| 997 | AM_RANGE(0x4001, 0x4001) AM_WRITE(ym2608_data_port_0_a_w) |
| 998 | AM_RANGE(0x4002, 0x4002) AM_READWRITE(ym2608_status_port_0_b_r, ym2608_control_port_0_b_w) |
| 999 | AM_RANGE(0x4003, 0x4003) AM_WRITE(ym2608_data_port_0_b_w) |
| 1000 | AM_RANGE(0x6000, 0x67ff) AM_RAM |
| 1001 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| 1002 | ADDRESS_MAP_END |
| 1003 | |
| 1004 | |
| 947 | 1005 | /*------ YM3812-based sound ------*/ |
| 948 | 1006 | static ADDRESS_MAP_START( sound3812_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 949 | 1007 | AM_RANGE(0x0000, 0x0000) AM_WRITENOP |
| r3485 | r3486 | |
| 1024 | 1082 | INPUT_PORTS_END |
| 1025 | 1083 | |
| 1026 | 1084 | |
| 1085 | static INPUT_PORTS_START( grmatch ) |
| 1086 | PORT_START("40") |
| 1087 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL) /* input from sound board */ |
| 1088 | PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1089 | PORT_DIPNAME( 0x08, 0x08, "Adjustments Lockout" ) |
| 1090 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1091 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1092 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Coinage ) ) |
| 1093 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) |
| 1094 | PORT_DIPSETTING( 0x10, DEF_STR( 1C_1C ) ) |
| 1095 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Difficulty ) ) |
| 1096 | PORT_DIPSETTING( 0x20, "1" ) |
| 1097 | PORT_DIPSETTING( 0x00, "3" ) |
| 1098 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1099 | PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW ) |
| 1100 | |
| 1101 | PORT_START("60") |
| 1102 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 1103 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 1104 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) |
| 1105 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) |
| 1106 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 1107 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 1108 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) |
| 1109 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 1110 | |
| 1111 | PORT_START("80") |
| 1112 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 1113 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 1114 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) |
| 1115 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) |
| 1116 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 1117 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 1118 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) |
| 1119 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1120 | INPUT_PORTS_END |
| 1121 | |
| 1122 | |
| 1027 | 1123 | static INPUT_PORTS_START( stratab ) |
| 1028 | 1124 | PORT_START("40") |
| 1029 | 1125 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL) /* input from sound board */ |
| r3485 | r3486 | |
| 1615 | 1711 | }; |
| 1616 | 1712 | |
| 1617 | 1713 | |
| 1714 | static const ym2608_interface ym2608b_config = |
| 1715 | { |
| 1716 | { |
| 1717 | AY8910_LEGACY_OUTPUT, |
| 1718 | AY8910_DEFAULT_LOADS, |
| 1719 | NULL, |
| 1720 | NULL, |
| 1721 | NULL, |
| 1722 | ym2203_portb_out, |
| 1723 | }, |
| 1724 | generate_sound_irq |
| 1725 | }; |
| 1726 | |
| 1727 | |
| 1618 | 1728 | static const ym3812_interface ym3812_config = |
| 1619 | 1729 | { |
| 1620 | 1730 | generate_sound_irq |
| r3485 | r3486 | |
| 1652 | 1762 | |
| 1653 | 1763 | /* sound hardware */ |
| 1654 | 1764 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1655 | | |
| 1656 | | MDRV_SOUND_ADD("oki", OKIM6295, CLOCK_8MHz/8) // was /128?? |
| 1657 | | MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // was /128, not /132, so unsure so pin 7 not verified |
| 1658 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 1659 | 1765 | MACHINE_DRIVER_END |
| 1660 | 1766 | |
| 1661 | 1767 | |
| r3485 | r3486 | |
| 1681 | 1787 | MDRV_SOUND_ROUTE(1, "mono", 0.07) |
| 1682 | 1788 | MDRV_SOUND_ROUTE(2, "mono", 0.07) |
| 1683 | 1789 | MDRV_SOUND_ROUTE(3, "mono", 0.75) |
| 1790 | |
| 1791 | MDRV_SOUND_ADD("oki", OKIM6295, CLOCK_8MHz/8) // was /128?? |
| 1792 | MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // was /128, not /132, so unsure so pin 7 not verified |
| 1793 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 1684 | 1794 | MACHINE_DRIVER_END |
| 1685 | 1795 | |
| 1686 | 1796 | |
| 1797 | static MACHINE_DRIVER_START( itech8_sound_ym2608b ) |
| 1798 | |
| 1799 | /* basic machine hardware */ |
| 1800 | MDRV_CPU_ADD("sound", M6809, CLOCK_8MHz/4) |
| 1801 | MDRV_CPU_PROGRAM_MAP(sound2608b_map,0) |
| 1802 | |
| 1803 | /* sound hardware */ |
| 1804 | MDRV_SOUND_ADD("ym", YM2608, CLOCK_8MHz) |
| 1805 | MDRV_SOUND_CONFIG(ym2608b_config) |
| 1806 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 1807 | MACHINE_DRIVER_END |
| 1808 | |
| 1809 | |
| 1687 | 1810 | static MACHINE_DRIVER_START( itech8_sound_ym3812 ) |
| 1688 | 1811 | |
| 1689 | 1812 | /* basic machine hardware */ |
| r3485 | r3486 | |
| 1694 | 1817 | MDRV_SOUND_ADD("ym", YM3812, CLOCK_8MHz/2) |
| 1695 | 1818 | MDRV_SOUND_CONFIG(ym3812_config) |
| 1696 | 1819 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 1820 | |
| 1821 | MDRV_SOUND_ADD("oki", OKIM6295, CLOCK_8MHz/8) // was /128?? |
| 1822 | MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // was /128, not /132, so unsure so pin 7 not verified |
| 1823 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 1697 | 1824 | MACHINE_DRIVER_END |
| 1698 | 1825 | |
| 1699 | 1826 | |
| r3485 | r3486 | |
| 1707 | 1834 | MDRV_SOUND_ADD("ym", YM3812, CLOCK_8MHz/2) |
| 1708 | 1835 | MDRV_SOUND_CONFIG(ym3812_config) |
| 1709 | 1836 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 1837 | |
| 1838 | MDRV_SOUND_ADD("oki", OKIM6295, CLOCK_8MHz/8) // was /128?? |
| 1839 | MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // was /128, not /132, so unsure so pin 7 not verified |
| 1840 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 1710 | 1841 | MACHINE_DRIVER_END |
| 1711 | 1842 | |
| 1712 | 1843 | |
| r3485 | r3486 | |
| 1725 | 1856 | MACHINE_DRIVER_END |
| 1726 | 1857 | |
| 1727 | 1858 | |
| 1859 | static MACHINE_DRIVER_START( grmatch ) |
| 1860 | |
| 1861 | /* basic machine hardware */ |
| 1862 | MDRV_IMPORT_FROM(itech8_core_hi) |
| 1863 | MDRV_IMPORT_FROM(itech8_sound_ym2608b) |
| 1864 | |
| 1865 | /* video hardware */ |
| 1866 | MDRV_SCREEN_MODIFY("main") |
| 1867 | MDRV_SCREEN_VISIBLE_AREA(0, 399, 0, 239) |
| 1868 | MDRV_VIDEO_UPDATE(itech8_grmatch) |
| 1869 | |
| 1870 | /* palette updater */ |
| 1871 | MDRV_TIMER_ADD_SCANLINE("palette", grmatch_palette_update, "main", 0, 0) |
| 1872 | MACHINE_DRIVER_END |
| 1873 | |
| 1874 | |
| 1728 | 1875 | static MACHINE_DRIVER_START( stratab_hi ) |
| 1729 | 1876 | |
| 1730 | 1877 | /* basic machine hardware */ |
| r3485 | r3486 | |
| 1896 | 2043 | ROM_REGION( 0x10000, "sound", 0 ) |
| 1897 | 2044 | ROM_LOAD( "wofsnd", 0x08000, 0x8000, CRC(0a6aa5dc) SHA1(42eef40a4300d6d16d9e2af678432a02be05f104) ) |
| 1898 | 2045 | |
| 1899 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2046 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 1900 | 2047 | ROM_LOAD( "wofgrom0", 0x00000, 0x10000, CRC(9a157b2c) SHA1(c349b41ba00cf6e2fec32872627c8cfdd8b5c1b9) ) |
| 1901 | 2048 | ROM_LOAD( "wofgrom1", 0x10000, 0x10000, CRC(5064739b) SHA1(424e3f94333f8ca21ac39b64b684cf6b487164d3) ) |
| 1902 | 2049 | ROM_LOAD( "wofgrom2", 0x20000, 0x10000, CRC(3d393b2b) SHA1(2c94d2dab7369c099c470cf96391b033f39add78) ) |
| r3485 | r3486 | |
| 1916 | 2063 | ROM_REGION( 0x10000, "sound", 0 ) |
| 1917 | 2064 | ROM_LOAD( "wofsnd", 0x08000, 0x8000, CRC(0a6aa5dc) SHA1(42eef40a4300d6d16d9e2af678432a02be05f104) ) |
| 1918 | 2065 | |
| 1919 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2066 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 1920 | 2067 | ROM_LOAD( "wofgrom0", 0x00000, 0x10000, CRC(9a157b2c) SHA1(c349b41ba00cf6e2fec32872627c8cfdd8b5c1b9) ) |
| 1921 | 2068 | ROM_LOAD( "wofgrom1", 0x10000, 0x10000, CRC(5064739b) SHA1(424e3f94333f8ca21ac39b64b684cf6b487164d3) ) |
| 1922 | 2069 | ROM_LOAD( "wofgrom2", 0x20000, 0x10000, CRC(3d393b2b) SHA1(2c94d2dab7369c099c470cf96391b033f39add78) ) |
| r3485 | r3486 | |
| 1927 | 2074 | ROM_END |
| 1928 | 2075 | |
| 1929 | 2076 | |
| 2077 | ROM_START( grmatch ) |
| 2078 | ROM_REGION( 0x1c000, "main", 0 ) |
| 2079 | ROM_LOAD( "grudgematch.u5", 0x04000, 0x4000, CRC(11cadec9) SHA1(e21df623d1311ea63bafa2d6d0d94eb7d13232da) ) |
| 2080 | ROM_CONTINUE( 0x10000, 0xc000 ) |
| 2081 | ROM_COPY( "main", 0x14000, 0x8000, 0x8000 ) |
| 2082 | |
| 2083 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2084 | ROM_LOAD( "grudgematch.u27", 0x08000, 0x8000, CRC(59c18e63) SHA1(0d00c9cc683ff17e3213ba343ae65d533b57a243) ) |
| 2085 | |
| 2086 | ROM_REGION( 0xe0000, "grom", 0 ) |
| 2087 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(9064eff9) SHA1(4c80432ef359266c43b4691b503f529ed018a655) ) |
| 2088 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(6919c314) SHA1(e4a7ca77ee27ea8e41a236806e689c964d981210) ) |
| 2089 | ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(36b1682c) SHA1(6098b8aa576522c3cea66b5ac8f9406bf4222008) ) |
| 2090 | ROM_LOAD( "grom3.bin", 0x60000, 0x20000, CRC(7bf05f61) SHA1(269e1cacf319d9f2a2b865ac6573e690f36827a1) ) |
| 2091 | ROM_LOAD( "grom4.bin", 0x80000, 0x20000, CRC(55bded89) SHA1(61e0c60e391327a5fdda704c7756fcd6e11253c5) ) |
| 2092 | ROM_LOAD( "grom5.bin", 0xa0000, 0x20000, CRC(37b47b2e) SHA1(352204d3e95e6db556aacf053c42d0d5871245a7) ) |
| 2093 | ROM_LOAD( "grom6.bin", 0xc0000, 0x20000, CRC(860ee822) SHA1(2ca821c2fa220065b99b99b7487fe9666f338c75) ) |
| 2094 | |
| 2095 | ROM_REGION( 0x20000, "ym", 0 ) |
| 2096 | ROM_LOAD( "srom0.bin", 0x00000, 0x20000, CRC(49bce954) SHA1(68a8b11c03722349d673f7383288c63054f0d6f6) ) |
| 2097 | ROM_END |
| 2098 | |
| 2099 | |
| 1930 | 2100 | ROM_START( stratab ) |
| 1931 | 2101 | ROM_REGION( 0x1c000, "main", 0 ) |
| 1932 | 2102 | ROM_LOAD( "sbprogv3.bin", 0x08000, 0x8000, CRC(a5ae728f) SHA1(85098eef1614d5148e8082df4c936883662292ee) ) |
| r3485 | r3486 | |
| 1935 | 2105 | ROM_REGION( 0x10000, "sound", 0 ) |
| 1936 | 2106 | ROM_LOAD( "sbsnds.bin", 0x08000, 0x8000, CRC(b36c8f0a) SHA1(c4c3edf3352d95561f76705087338c1946137447) ) |
| 1937 | 2107 | |
| 1938 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2108 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 1939 | 2109 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(a915b0bd) SHA1(0955c7ebb48e97ccffc18c5deec6eccce1d68de8) ) |
| 1940 | 2110 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(340c661f) SHA1(150f9158fa6d956d08051c67c17723b1d8c66867) ) |
| 1941 | 2111 | ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(5df9f1cf) SHA1(cad87f63ac0e902dffeeaa42538fc73f792d87d9) ) |
| r3485 | r3486 | |
| 1953 | 2123 | ROM_REGION( 0x10000, "sound", 0 ) |
| 1954 | 2124 | ROM_LOAD( "sbsnds.bin", 0x08000, 0x8000, CRC(b36c8f0a) SHA1(c4c3edf3352d95561f76705087338c1946137447) ) |
| 1955 | 2125 | |
| 1956 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2126 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 1957 | 2127 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(a915b0bd) SHA1(0955c7ebb48e97ccffc18c5deec6eccce1d68de8) ) |
| 1958 | 2128 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(340c661f) SHA1(150f9158fa6d956d08051c67c17723b1d8c66867) ) |
| 1959 | 2129 | ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(5df9f1cf) SHA1(cad87f63ac0e902dffeeaa42538fc73f792d87d9) ) |
| r3485 | r3486 | |
| 1972 | 2142 | ROM_REGION( 0x10000, "sound", 0 ) |
| 1973 | 2143 | ROM_LOAD( "u27.bin", 0x08000, 0x8000, CRC(358d2440) SHA1(7b09350c89f9d2c86dc187d8812bbf26b576a38f) ) |
| 1974 | 2144 | |
| 1975 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2145 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 1976 | 2146 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(a29c688a) SHA1(32dbb996a5e4c23cfd44b79312ac4a767658f20a) ) |
| 1977 | 2147 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(b52a23f6) SHA1(092961acf47875179b44342e2dd8955670e67ea2) ) |
| 1978 | 2148 | ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(9b8e3a61) SHA1(1b5682b1328d6c97b604fb71512e8f72322a688f) ) |
| r3485 | r3486 | |
| 1994 | 2164 | ROM_REGION( 0x10000, "sound", 0 ) |
| 1995 | 2165 | ROM_LOAD( "snd-u27.256", 0x08000, 0x8000, CRC(471da557) SHA1(32bfe450a42d9eb6c14edcfa2b4e33f65a11126e) ) |
| 1996 | 2166 | |
| 1997 | | ROM_REGION( 0xb0000, "gfx1", 0 ) |
| 2167 | ROM_REGION( 0xb0000, "grom", 0 ) |
| 1998 | 2168 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(a29c688a) SHA1(32dbb996a5e4c23cfd44b79312ac4a767658f20a) ) |
| 1999 | 2169 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(b52a23f6) SHA1(092961acf47875179b44342e2dd8955670e67ea2) ) |
| 2000 | 2170 | ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(9b8e3a61) SHA1(1b5682b1328d6c97b604fb71512e8f72322a688f) ) |
| r3485 | r3486 | |
| 2017 | 2187 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2018 | 2188 | ROM_LOAD( "u27.bin", 0x08000, 0x8000, CRC(dd2a5905) SHA1(dc93f13de3953852a6757361eb9683a57d3ed326) ) |
| 2019 | 2189 | |
| 2020 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2190 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2021 | 2191 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(a29c688a) SHA1(32dbb996a5e4c23cfd44b79312ac4a767658f20a) ) |
| 2022 | 2192 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(a4182776) SHA1(9f4704d1a61a4fffce454c82cb3eb4629d9a2006) ) |
| 2023 | 2193 | ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(0580bb99) SHA1(012d473bc63632a5ed1a250daa54a00a4e30e8b2) ) |
| r3485 | r3486 | |
| 2042 | 2212 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2043 | 2213 | ROM_LOAD( "u27.bin", 0x08000, 0x8000, CRC(dd2a5905) SHA1(dc93f13de3953852a6757361eb9683a57d3ed326) ) |
| 2044 | 2214 | |
| 2045 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2215 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2046 | 2216 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(a29c688a) SHA1(32dbb996a5e4c23cfd44b79312ac4a767658f20a) ) |
| 2047 | 2217 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(a4182776) SHA1(9f4704d1a61a4fffce454c82cb3eb4629d9a2006) ) |
| 2048 | 2218 | ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(0580bb99) SHA1(012d473bc63632a5ed1a250daa54a00a4e30e8b2) ) |
| r3485 | r3486 | |
| 2073 | 2243 | ROM_CONTINUE( 0x00000, 0x0800 ) |
| 2074 | 2244 | ROM_CONTINUE( 0x00000, 0x0800 ) |
| 2075 | 2245 | |
| 2076 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2246 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2077 | 2247 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(e60c2804) SHA1(e62d11b6c4439a70a2f32df72c8c64e2f110351e) ) |
| 2078 | 2248 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(d764d542) SHA1(43fc0c9b627484a670d87da91e212741b137e995) ) |
| 2079 | 2249 | |
| r3485 | r3486 | |
| 2097 | 2267 | ROM_CONTINUE( 0x00000, 0x0800 ) |
| 2098 | 2268 | ROM_CONTINUE( 0x00000, 0x0800 ) |
| 2099 | 2269 | |
| 2100 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2270 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2101 | 2271 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(e60c2804) SHA1(e62d11b6c4439a70a2f32df72c8c64e2f110351e) ) |
| 2102 | 2272 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(d764d542) SHA1(43fc0c9b627484a670d87da91e212741b137e995) ) |
| 2103 | 2273 | |
| r3485 | r3486 | |
| 2121 | 2291 | ROM_CONTINUE( 0x00000, 0x0800 ) |
| 2122 | 2292 | ROM_CONTINUE( 0x00000, 0x0800 ) |
| 2123 | 2293 | |
| 2124 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2294 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2125 | 2295 | ROM_LOAD( "pool-grom.0", 0x00000, 0x10000, CRC(e6d0edc6) SHA1(5287a31bbdde1e4291d8e9e6b99d3aa12bfb6e18) ) |
| 2126 | 2296 | ROM_LOAD( "pool-grom.1", 0x10000, 0x10000, CRC(5a071aa2) SHA1(9c5506e37625d213429b1231d457d7ce8a7a81ff) ) |
| 2127 | 2297 | ROM_LOAD( "pool-grom.2", 0x20000, 0x10000, CRC(c0bdf4e0) SHA1(3b7c635375c5e5fddcbc1bd1b186c960081ec37e) ) |
| r3485 | r3486 | |
| 2147 | 2317 | ROM_CONTINUE( 0x00000, 0x0800 ) |
| 2148 | 2318 | ROM_CONTINUE( 0x00000, 0x0800 ) |
| 2149 | 2319 | |
| 2150 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2320 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2151 | 2321 | ROM_LOAD( "dynobop.gr0", 0x00000, 0x20000, CRC(3525a7a3) SHA1(fe0b08203c135d55507506936dc34e1503e4906b) ) |
| 2152 | 2322 | ROM_LOAD( "dynobop.gr1", 0x20000, 0x20000, CRC(1544a232) SHA1(60bba76537c82887db8e38c6a87c528afdd385d0) ) |
| 2153 | 2323 | |
| r3485 | r3486 | |
| 2170 | 2340 | ROM_CONTINUE( 0x00000, 0x0800 ) |
| 2171 | 2341 | ROM_CONTINUE( 0x00000, 0x0800 ) |
| 2172 | 2342 | |
| 2173 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2343 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2174 | 2344 | ROM_LOAD( "sstgrom0.bin", 0x00000, 0x20000, CRC(9cfb9849) SHA1(5aa860c0c6e3916ebdb8898ee44f633bf3347ca8) ) |
| 2175 | 2345 | ROM_LOAD( "sstgrom1.bin", 0x20000, 0x20000, CRC(d9ea14e1) SHA1(4cddf3237c203b0a3f7ae770f85f1be35e9e1b78) ) |
| 2176 | 2346 | ROM_LOAD( "sstgrom2.bin", 0x40000, 0x20000, CRC(dcd97bf7) SHA1(95361222ac58bf74539f2a7e80574bcd848c615e) ) |
| r3485 | r3486 | |
| 2189 | 2359 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2190 | 2360 | ROM_LOAD( "pd-snd.bin", 0x08000, 0x8000, CRC(4925401c) SHA1(e35983bec4a0dd4cb1d942fd909790b1adeb415d) ) |
| 2191 | 2361 | |
| 2192 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2362 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2193 | 2363 | ROM_LOAD( "pd-grom0.bin", 0x00000, 0x20000, CRC(7c2573e7) SHA1(d6a2a16277ad854c66927d88c5617d05eefe1057) ) |
| 2194 | 2364 | ROM_LOAD( "pd-grom1.bin", 0x20000, 0x20000, CRC(e7c06aeb) SHA1(4be54b078d886359bf6ed376019cc1f6f04f52d6) ) |
| 2195 | 2365 | |
| r3485 | r3486 | |
| 2207 | 2377 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2208 | 2378 | ROM_LOAD( "tensnd.v1", 0x08000, 0x8000, CRC(f034a694) SHA1(3540e2edff2ce47504260ec856bab9b638d9260d) ) |
| 2209 | 2379 | |
| 2210 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2380 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2211 | 2381 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(1e69ebae) SHA1(a32e2c2f4e4a527ae6b57adeccd2c4d2045ab5fe) ) |
| 2212 | 2382 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(4e6a22d5) SHA1(3c2d51dd874f61c0a557ea2c1968afa02d9bfc42) ) |
| 2213 | 2383 | ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(c0b643a9) SHA1(d240f703a55c39ce4a969612fbb9cd76e4b849ac) ) |
| r3485 | r3486 | |
| 2231 | 2401 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2232 | 2402 | ROM_LOAD( "tensnd.v1", 0x08000, 0x8000, CRC(f034a694) SHA1(3540e2edff2ce47504260ec856bab9b638d9260d) ) |
| 2233 | 2403 | |
| 2234 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2404 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2235 | 2405 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(1e69ebae) SHA1(a32e2c2f4e4a527ae6b57adeccd2c4d2045ab5fe) ) |
| 2236 | 2406 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(4e6a22d5) SHA1(3c2d51dd874f61c0a557ea2c1968afa02d9bfc42) ) |
| 2237 | 2407 | ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(c0b643a9) SHA1(d240f703a55c39ce4a969612fbb9cd76e4b849ac) ) |
| r3485 | r3486 | |
| 2256 | 2426 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2257 | 2427 | ROM_LOAD( "ahrsnd11.bin", 0x08000, 0x8000, CRC(dec57dca) SHA1(21a8ead10b0434629f41f6b067c49b6622569a6c) ) |
| 2258 | 2428 | |
| 2259 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2429 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2260 | 2430 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(5ef57fe5) SHA1(e877979e034a61968b432037501e25a302a17a9a) ) |
| 2261 | 2431 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(6aca95c0) SHA1(da7a899bf0812a7af178e48b5a626ce56a836579) ) |
| 2262 | 2432 | ROM_LOAD( "grom2.bin", 0x40000, 0x10000, CRC(6d6fde1b) SHA1(aaabc45d4b566be42e8d28d767e4771a96d9caae) ) |
| r3485 | r3486 | |
| 2275 | 2445 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2276 | 2446 | ROM_LOAD( "sound.u27", 0x08000, 0x8000, CRC(b99beb70) SHA1(8d82c3b081a1afb236afa658abb3aa605c6c2264) ) |
| 2277 | 2447 | |
| 2278 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2448 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2279 | 2449 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(5c02348d) SHA1(c85352728d94b3a5ca78c2493e98bdb4b3206bed) ) |
| 2280 | 2450 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(85a7a3a2) SHA1(7fb7be67c75867fcccf4272f1ce42f2af94c16e6) ) |
| 2281 | 2451 | ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(bfe11f18) SHA1(5e8d36c6a86a8eb883f50620fbfcea3d8398faeb) ) |
| r3485 | r3486 | |
| 2294 | 2464 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2295 | 2465 | ROM_LOAD( "sound.u27", 0x08000, 0x8000, CRC(b99beb70) SHA1(8d82c3b081a1afb236afa658abb3aa605c6c2264) ) |
| 2296 | 2466 | |
| 2297 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2467 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2298 | 2468 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(5c02348d) SHA1(c85352728d94b3a5ca78c2493e98bdb4b3206bed) ) |
| 2299 | 2469 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(85a7a3a2) SHA1(7fb7be67c75867fcccf4272f1ce42f2af94c16e6) ) |
| 2300 | 2470 | ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(bfe11f18) SHA1(5e8d36c6a86a8eb883f50620fbfcea3d8398faeb) ) |
| r3485 | r3486 | |
| 2314 | 2484 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2315 | 2485 | ROM_LOAD( "nn_snd10.u27", 0x08000, 0x8000, CRC(74771b2f) SHA1(0a963d2962699bb1b4d08bd486979151d0a228da) ) |
| 2316 | 2486 | |
| 2317 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2487 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2318 | 2488 | ROM_LOAD( "nn_grom0.bin", 0x00000, 0x20000, CRC(064d1464) SHA1(4ce5bcadad93586c9af2b0c499d7a7140b080cdb) ) |
| 2319 | 2489 | ROM_LOAD( "nn_grom1.bin", 0x20000, 0x20000, CRC(622d9a0b) SHA1(f084dcf194cfc658f97f36972f2b2ff30e834fc5) ) |
| 2320 | 2490 | ROM_LOAD( "nn_grom2.bin", 0x40000, 0x20000, CRC(e7eb4020) SHA1(29ceb535d1dfddf8c12cf78919ea10f6b956b8b3) ) |
| r3485 | r3486 | |
| 2339 | 2509 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2340 | 2510 | ROM_LOAD( "u27", 0x08000, 0x8000, CRC(59f87f0e) SHA1(46f38aca35a7c2faee227b4c950d20a6076c6fa7) ) |
| 2341 | 2511 | |
| 2342 | | ROM_REGION( 0x100000, "gfx1", 0 ) |
| 2512 | ROM_REGION( 0x100000, "grom", 0 ) |
| 2343 | 2513 | ROM_LOAD( "grom00", 0x00000, 0x40000, CRC(3eacbad9) SHA1(bff1ec6a24ccf983434e4e9453c30f36fa397534) ) |
| 2344 | 2514 | ROM_LOAD( "grom01", 0x40000, 0x40000, CRC(864cc269) SHA1(06f92889cd20881faeb59ec06ca1578ead2294f4) ) |
| 2345 | 2515 | ROM_LOAD( "grom02-2.st2", 0x80000, 0x40000, CRC(47904233) SHA1(6a4d10e8f7b75582f706a74b37d59788613ffc61) ) |
| r3485 | r3486 | |
| 2369 | 2539 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2370 | 2540 | ROM_LOAD( "u27", 0x08000, 0x8000, CRC(59f87f0e) SHA1(46f38aca35a7c2faee227b4c950d20a6076c6fa7) ) |
| 2371 | 2541 | |
| 2372 | | ROM_REGION( 0x100000, "gfx1", 0 ) |
| 2542 | ROM_REGION( 0x100000, "grom", 0 ) |
| 2373 | 2543 | ROM_LOAD( "grom00", 0x00000, 0x40000, CRC(3eacbad9) SHA1(bff1ec6a24ccf983434e4e9453c30f36fa397534) ) |
| 2374 | 2544 | ROM_LOAD( "grom01", 0x40000, 0x40000, CRC(864cc269) SHA1(06f92889cd20881faeb59ec06ca1578ead2294f4) ) |
| 2375 | 2545 | ROM_LOAD( "grom02-2.st2", 0x80000, 0x40000, CRC(47904233) SHA1(6a4d10e8f7b75582f706a74b37d59788613ffc61) ) |
| r3485 | r3486 | |
| 2394 | 2564 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2395 | 2565 | ROM_LOAD( "u27", 0x08000, 0x8000, CRC(59f87f0e) SHA1(46f38aca35a7c2faee227b4c950d20a6076c6fa7) ) |
| 2396 | 2566 | |
| 2397 | | ROM_REGION( 0x100000, "gfx1", 0 ) |
| 2567 | ROM_REGION( 0x100000, "grom", 0 ) |
| 2398 | 2568 | ROM_LOAD( "grom00", 0x00000, 0x40000, CRC(3eacbad9) SHA1(bff1ec6a24ccf983434e4e9453c30f36fa397534) ) |
| 2399 | 2569 | ROM_LOAD( "grom01", 0x40000, 0x40000, CRC(864cc269) SHA1(06f92889cd20881faeb59ec06ca1578ead2294f4) ) |
| 2400 | 2570 | ROM_LOAD( "grom02", 0x80000, 0x40000, CRC(34e567d5) SHA1(d0eb6fd0da8b9c3bfe7d4ecfb4bd903e4926b63a) ) |
| r3485 | r3486 | |
| 2419 | 2589 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2420 | 2590 | ROM_LOAD( "rrbsndv1.u27", 0x08000, 0x8000, CRC(8eda5f53) SHA1(f256544a8c87125587719460ed0fef14efef9015) ) |
| 2421 | 2591 | |
| 2422 | | ROM_REGION( 0x100000, "gfx1", 0 ) |
| 2592 | ROM_REGION( 0x100000, "grom", 0 ) |
| 2423 | 2593 | ROM_LOAD( "grom00", 0x00000, 0x40000, CRC(3eacbad9) SHA1(bff1ec6a24ccf983434e4e9453c30f36fa397534) ) |
| 2424 | 2594 | ROM_LOAD( "grom01", 0x40000, 0x40000, CRC(864cc269) SHA1(06f92889cd20881faeb59ec06ca1578ead2294f4) ) |
| 2425 | 2595 | ROM_LOAD( "grom02", 0x80000, 0x40000, CRC(34e567d5) SHA1(d0eb6fd0da8b9c3bfe7d4ecfb4bd903e4926b63a) ) |
| r3485 | r3486 | |
| 2439 | 2609 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2440 | 2610 | ROM_LOAD( "nc-snd", 0x08000, 0x8000, CRC(f9d5b4e1) SHA1(e5c3774db349b60baf11baecf55ac432871e612c) ) |
| 2441 | 2611 | |
| 2442 | | ROM_REGION( 0x180000, "gfx1", 0 ) |
| 2612 | ROM_REGION( 0x180000, "grom", 0 ) |
| 2443 | 2613 | ROM_LOAD( "nc-grom0", 0x000000, 0x40000, CRC(532f7bff) SHA1(cc7a64ad1581f37ff4bcad78c11aad355a6e9aa8) ) |
| 2444 | 2614 | ROM_LOAD( "nc-grom1", 0x040000, 0x40000, CRC(45640d4a) SHA1(1b59ae2a74fef535c646586422f17b39c9ae247b) ) |
| 2445 | 2615 | ROM_LOAD( "nc-grom2", 0x080000, 0x40000, CRC(c8281d06) SHA1(f75d4e858f9bc19e5234f184b75818e448638c15) ) |
| r3485 | r3486 | |
| 2461 | 2631 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2462 | 2632 | ROM_LOAD( "sndv1.u27", 0x08000, 0x8000, CRC(55734876) SHA1(eb5ef816acbc6e35642749e38a2908b7ba359b9d) ) |
| 2463 | 2633 | |
| 2464 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2634 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2465 | 2635 | ROM_LOAD( "grom00.bin", 0x00000, 0x40000, CRC(c3a7b54b) SHA1(414d693bc5337d578d2630817dd647cf7e5cbcf7) ) |
| 2466 | 2636 | ROM_LOAD( "grom01.bin", 0x40000, 0x40000, BAD_DUMP CRC(2c834cf9) SHA1(49eb070ca4439d4fcd2d8a2db62d3c99b824bf99) ) /* Self test checksum reports BAD */ |
| 2467 | 2637 | ROM_LOAD( "grom02.bin", 0x80000, 0x40000, CRC(aebe6c45) SHA1(15e64fcb36cb1064988ee5cd45699d501a6e7f01) ) |
| r3485 | r3486 | |
| 2481 | 2651 | ROM_REGION( 0x10000, "sound", 0 ) |
| 2482 | 2652 | ROM_LOAD( "sndv1.u27", 0x08000, 0x8000, CRC(55734876) SHA1(eb5ef816acbc6e35642749e38a2908b7ba359b9d) ) |
| 2483 | 2653 | |
| 2484 | | ROM_REGION( 0xc0000, "gfx1", 0 ) |
| 2654 | ROM_REGION( 0xc0000, "grom", 0 ) |
| 2485 | 2655 | ROM_LOAD( "grom0.bin", 0x00000, 0x20000, CRC(a29c688a) SHA1(32dbb996a5e4c23cfd44b79312ac4a767658f20a) ) |
| 2486 | 2656 | ROM_LOAD( "grom1.bin", 0x20000, 0x20000, CRC(a4182776) SHA1(9f4704d1a61a4fffce454c82cb3eb4629d9a2006) ) |
| 2487 | 2657 | ROM_LOAD( "grom2.bin", 0x40000, 0x20000, CRC(0580bb99) SHA1(012d473bc63632a5ed1a250daa54a00a4e30e8b2) ) |
| r3485 | r3486 | |
| 2504 | 2674 | * |
| 2505 | 2675 | *************************************/ |
| 2506 | 2676 | |
| 2677 | static DRIVER_INIT( grmatch ) |
| 2678 | { |
| 2679 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0160, 0x0160, 0, 0, grmatch_palette_w); |
| 2680 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0180, 0x0180, 0, 0, grmatch_xscroll_w); |
| 2681 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01e0, 0x01ff, 0, 0, SMH_UNMAP); |
| 2682 | } |
| 2683 | |
| 2684 | |
| 2507 | 2685 | static DRIVER_INIT( slikshot ) |
| 2508 | 2686 | { |
| 2509 | 2687 | memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x0180, 0x0180, 0, 0, slikshot_z80_r); |
| r3485 | r3486 | |
| 2574 | 2752 | GAME( 1989, wfortune, 0, wfortune, wfortune, 0, ROT0, "GameTek", "Wheel Of Fortune", 0 ) |
| 2575 | 2753 | GAME( 1989, wfortuna, wfortune, wfortune, wfortune, 0, ROT0, "GameTek", "Wheel Of Fortune (alternate)", 0 ) |
| 2576 | 2754 | |
| 2755 | /* Grudge Match-style PCB */ |
| 2756 | GAME( 1989, grmatch, 0, grmatch, grmatch, grmatch, ROT0, "Yankee Game Technology", "Grudge Match (Yankee Game Technology)", 0 ) |
| 2757 | |
| 2577 | 2758 | /* Strata Bowling-style PCB */ |
| 2578 | 2759 | GAME( 1990, stratab, 0, stratab_hi, stratab, 0, ROT270, "Strata/Incredible Technologies", "Strata Bowling (V3)", 0 ) |
| 2579 | 2760 | GAME( 1990, stratab1, stratab, stratab_hi, stratab, 0, ROT270, "Strata/Incredible Technologies", "Strata Bowling (V1)", 0 ) |
src/mame/drivers/tnzs.c
| r3485 | r3486 | |
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | Notes: |
| 5 | | - There are three versions of TNZS supported. |
| 6 | | 1) "tnzs". New hardware revision. 3 Z80 and no M-Chip (8742 MPU). |
| 7 | | 2) "tnzsj". Standard hardware. 2 Z80 and the M-Chip. |
| 8 | | 3) "tnzso". Standard hardware. Harder gameplay, old Taito logo. Maybe a prototype? |
| 9 | | The three versions all have different levels! |
| 5 | - There are four versions of TNZS supported. |
| 6 | 1) "tnzs". New hardware revision. 3 Z80 and no M-Chip (8742 MPU). |
| 7 | 2) "tnzsj". New hardware revision. 3 Z80 and no M-Chip (8742 MPU). |
| 8 | 3) "tnzsjo". Standard hardware. 2 Z80 and the M-Chip. |
| 9 | 4) "tnzso". Standard hardware. Harder gameplay, old Taito logo. Maybe a prototype? |
| 10 | 10 | |
| 11 | 11 | - TNZS hidden level select: keep service coin pressed (default:9) and reset the game. |
| 12 | 12 | When SERVICE SWITCH ERROR appears, release service coin and press 1 player start |
| r3485 | r3486 | |
| 14 | 14 | starting level and press 1 player start to start. You'll also get 255 lives. |
| 15 | 15 | If you have enough patience and go up until the level reads "Q-1" (which corresponds |
| 16 | 16 | to 1-1), AND the "Invulnerability" dip switch is On, you'll be invulnerable. |
| 17 | Invulnerability isn't possible in 'tnzso' (level select is stucked to level 6-1). |
| 17 | 18 | |
| 18 | 19 | |
| 19 | 20 | Hardware datails for the newer tnzs board (from pictures): |
| r3485 | r3486 | |
| 43 | 44 | |
| 44 | 45 | |
| 45 | 46 | |
| 47 | Stephh's notes (based on the games Z80 code and some tests) : |
| 48 | |
| 49 | 1) 'plumppop' |
| 50 | |
| 51 | - Region stored at 0x7fff.b (CPU1) then 0xef49 (shared RAM) |
| 52 | - Sets : |
| 53 | * 'plumppop' : region = 0x00 |
| 54 | - Coinage relies on bit 0 of the region (code at 0x5141 in CPU1) : |
| 55 | * .......0 : TAITO_COINAGE_JAPAN_OLD |
| 56 | * .......1 : TAITO_COINAGE_WORLD |
| 57 | - Notice screen relies on bit 1 of the region (code at 0x16e8) : |
| 58 | * ......0. : Yes |
| 59 | * ......1. : No |
| 60 | - Copyright relies on bits 2 and 3 of the region (code at 0x276d) : |
| 61 | * ....00.. : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 62 | * ....01.. : "TAITO AMERICA CORP." / "ALL RIGHTS RESERVED" (US) |
| 63 | * ....10.. : "TAITO CORP. JAPAN" / "ALL RIGHTS RESERVED" (World) |
| 64 | * ....11.. : "TAITO CORP. JAPAN" / "LICENCED TO -------" |
| 65 | |
| 66 | |
| 67 | 2) 'extrmatn' and clones |
| 68 | |
| 69 | 2a) 'extrmatn' |
| 70 | |
| 71 | - Region stored at 0x7fff.b (CPU1) then 0x16 is stored at 0xef1d (shared RAM) ! |
| 72 | - Sets : |
| 73 | * 'extrmatn' : region = 0x16 |
| 74 | - New value is stored at 0xef1d (shared RAM) : |
| 75 | * 'extrmatn' : 0x16 |
| 76 | - Coinage relies on bit 0 of the region (code at 0x4703 in CPU1) : |
| 77 | * .......0 : TAITO_COINAGE_JAPAN_OLD |
| 78 | * .......1 : TAITO_COINAGE_WORLD |
| 79 | - Notice screen relies on bit 1 of the new value (code at 0x4285) : |
| 80 | * ......0. : Yes |
| 81 | * ......1. : No |
| 82 | - Copyright relies on bits 2 and 3 of the new value (code at 0x0cfe) : |
| 83 | * ....00.. : "TAITO CORPORATION" / " FOR U.S.A. " (Japan) |
| 84 | * ....01.. : "WORLD GAMES " / " FOR U.S.A. " (US) |
| 85 | * ....10.. : "TAITO CORP. JAPAN" / " FOR U.S.A. " (World) |
| 86 | * ....11.. : "TAITO CORP. JAPAN" / "LICENCED TO " |
| 87 | - 'ret' + modified byte to please checksum at 0x8df5 (bank = 0x07) : unknown effect |
| 88 | |
| 89 | 2b) 'extrmatj' |
| 90 | |
| 91 | - Region stored at 0x7fff.b (CPU1) then 0x00 is stored at 0xef1d (shared RAM) ! |
| 92 | - Sets : |
| 93 | * 'extrmatj' : region = 0x00 |
| 94 | - Coinage relies on bit 0 of the region (code at 0x4703 in CPU1) : |
| 95 | * .......0 : TAITO_COINAGE_JAPAN_OLD |
| 96 | * .......1 : TAITO_COINAGE_WORLD |
| 97 | - Notice screen relies on bit 1 of the new value (code at 0x4285) : |
| 98 | * ......0. : Yes |
| 99 | * ......1. : No |
| 100 | - Copyright relies on bits 2 and 3 of the new value (code at 0x0cfe) : |
| 101 | * ....00.. : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 102 | * ....01.. : "TAITO AMERICA CORP." / "ALL RIGHTS RESERVED" (US) |
| 103 | * ....10.. : "TAITO CORP. JAPAN" / "ALL RIGHTS RESERVED" (World) |
| 104 | * ....11.. : "TAITO CORP. JAPAN" / "LICENCED TO " |
| 105 | - Code and data differences : |
| 106 | * 0x8df5 (bank = 0x07) : normal routine but still unknown effect |
| 107 | * 0x01e0 (CPU1) : 0x00 instead of 0x16 (value for region tests) |
| 108 | |
| 109 | |
| 110 | 3) 'arknoid2' and clones |
| 111 | |
| 112 | 3a) 'arknoid2' and 'arknid2j' |
| 113 | |
| 114 | - Region stored at 0x9fde.b (CPU1 - bank = 0x00) then stored at 0xe7f0 (shared RAM) |
| 115 | - Coin mode stored at 0x9fff.b (CPU1 - bank = 0x00) then stored at 0xe7f1 (shared RAM) |
| 116 | - Sets : |
| 117 | * 'arknoid2' : region = 0x02 - coin mode = 0x01 |
| 118 | * 'arknid2j' : region = 0x00 - coin mode = 0x00 |
| 119 | - Coinage relies on coin mode (code at 0x0b17 in CPU1) : |
| 120 | * 0x00 : TAITO_COINAGE_JAPAN_OLD |
| 121 | * else : TAITO_COINAGE_WORLD |
| 122 | - Notice screen relies on region (code at 0x495b) : |
| 123 | * 0x00 : Yes |
| 124 | * else : No |
| 125 | - Copyright relies on region (code at 0x4774) : |
| 126 | * 0x00 : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 127 | * 0x01 : "TAITO AMERICA CORP." / "ALL RIGHTS RESERVED" (US) |
| 128 | * 0x02 : "TAITO CORP. JAPAN" / "ALL RIGHTS RESERVED" (World) |
| 129 | * 0x03 : "TAITO AMERICA CORP." / "LICENCED TO ROMSTAR" / "FOR U.S.A." |
| 130 | |
| 131 | 3b) 'arknid2u' |
| 132 | |
| 133 | - Region stored at 0x9fde.b (CPU1 - bank = 0x00) then stored at 0xe7f0 (shared RAM) |
| 134 | - Coin mode stored at 0x9fff.b (CPU1 - bank = 0x00) then stored at 0xe7f1 (shared RAM) |
| 135 | - Sets : |
| 136 | * 'arknid2u' : region = 0x03 - coin mode = 0x00 |
| 137 | - Coinage relies on coin mode (code at 0x0b17 in CPU1) : |
| 138 | * 0x00 : TAITO_COINAGE_JAPAN_OLD |
| 139 | * else : TAITO_COINAGE_WORLD |
| 140 | - Notice screen relies on region (code at 0x2e47) : |
| 141 | * 0x00 : Yes |
| 142 | * else : No |
| 143 | - Copyright relies on region (code at 0x475b) : |
| 144 | * 0x00 : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 145 | * 0x01 : "TAITO AMERICA CORP." / "ALL RIGHTS RESERVED" (US) |
| 146 | * 0x02 : "TAITO CORP. JAPAN" / "ALL RIGHTS RESERVED" (World) |
| 147 | * 0x03 : "TAITO AMERICA CORP." / "LICENCED TO ROMSTAR" / "FOR U.S.A." |
| 148 | - Levels differences : |
| 149 | * new level 1 |
| 150 | * levels 3 left and 17 left are swapped |
| 151 | * levels 17 right and 20 right are swapped |
| 152 | |
| 153 | |
| 154 | 4) 'drtoppel' and clones |
| 155 | |
| 156 | - Region stored at 0x7fff.b (CPU1) then 0xe000 (shared RAM) |
| 157 | - Sets : |
| 158 | * 'drtoppel' : region = 0x03 |
| 159 | * 'drtopplu' : region = 0x02 |
| 160 | * 'drtopplj' : region = 0x01 |
| 161 | - These 3 games are 100% the same, only region differs ! |
| 162 | However, dumps for 'drtoppel' and 'drtopplu' are unsure (wrong ROM numbers). |
| 163 | - Coinage relies on region (code at 0x5141 in CPU1) : |
| 164 | * 0x01 and 0x02 : TAITO_COINAGE_JAPAN_OLD |
| 165 | * 0x03 and 0x04 : TAITO_COINAGE_WORLD |
| 166 | - Notice screen relies on region (code at 0x9331 - bank = 0x03) : |
| 167 | * 0x01 : Yes |
| 168 | * else : No |
| 169 | - Title relies on region (code at 0x90a4 - bank = 0x03) : |
| 170 | * 0x01 : Japanese |
| 171 | * else : English |
| 172 | - Copyright relies on region (code at 0x9b62 - bank = 0x03) : |
| 173 | * 0x01 : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 174 | * 0x02 : "TAITO AMERICA CORP." / "ALL RIGHTS RESERVED" (US) |
| 175 | * else : "TAITO CORP. JAPAN" / "ALL RIGHTS RESERVED" (World / ???) |
| 176 | |
| 177 | |
| 178 | 5) 'kageki' and clones |
| 179 | |
| 180 | 5a) 'kageki' |
| 181 | |
| 182 | - Region stored at 0x9fff.b (CPU1 - bank = 0x03) then 0xe000 (shared RAM) |
| 183 | - Sets : |
| 184 | * 'kageki' : region = 0x02 |
| 185 | - Coinage relies on region (code at 0x0099 in CPU1) : |
| 186 | * 0x01 and 0x02 : TAITO_COINAGE_JAPAN_OLD |
| 187 | * 0x03 and 0x04 : TAITO_COINAGE_WORLD |
| 188 | - No notice screen |
| 189 | - Copyright relies on region (code at 0x1eeb) : |
| 190 | * 0x01 : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 191 | * 0x02 : "TAITO AMERICA CORP." / "LICENCED TO ROMSTAR" / "FOR U.S.A." (US) |
| 192 | * else : "TAITO CORP. JAPAN" / "ALL RIGHTS RESERVED" (World / ???) |
| 193 | - English text on bad guys screens when game starts + English samples |
| 194 | - 2 players gameplay : players fight against each other in a best of 3 VS match, |
| 195 | then the winner is allowed to fight against the CPU enemies. |
| 196 | This is the reason why I've named DSWA bit 0 as "Unused". |
| 197 | Note that if there is a draw (same energy for both players), player 1 wins. |
| 198 | |
| 199 | 5b) 'kagekij' |
| 200 | |
| 201 | - Region stored at 0x9fff.b (CPU1 - bank = 0x03) then 0xe000 (shared RAM) |
| 202 | - Sets : |
| 203 | * 'kagekij' : region = 0x01 |
| 204 | - Coinage relies on region (code at 0x0099 in CPU1) : |
| 205 | * 0x01 and 0x02 : TAITO_COINAGE_JAPAN_OLD |
| 206 | * 0x03 and 0x04 : TAITO_COINAGE_WORLD |
| 207 | - No notice screen |
| 208 | - Copyright relies on region (code at 0x1eb3) : |
| 209 | * 0x01 : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 210 | * 0x02 : "TAITO AMERICA CORP." / "ALL RIGHTS RESERVED" (US) |
| 211 | * else : "TAITO CORP. JAPAN" / "ALL RIGHTS RESERVED" (World / ???) |
| 212 | - Japanese text on bad guys screens when game starts + Japanese samples |
| 213 | - 2 players gameplay : players fight one after the other against CPU enemies. |
| 214 | Once an enemy is defeated or a player is dead, it's the other player turn. |
| 215 | - Code and data differences : |
| 216 | * CPU0 to be looked at carefully |
| 217 | * 0x9fff (CPU1 - bank = 0x03) : 0x01 instead of 0x02 (value for region tests) |
| 218 | |
| 219 | 5c) 'kagekih' |
| 220 | |
| 221 | - Region stored at 0x9fff.b (CPU1 - bank = 0x03) then 0xe000 (shared RAM) |
| 222 | - Sets : |
| 223 | * 'kagekij' : region = 0x01 |
| 224 | - This set really looks like a hack : |
| 225 | * year has been changed from 1988 to 1992 |
| 226 | * the game uses Japanese ROMS, but CPU0 ROM displays Engish text |
| 227 | on bad guys screens when game starts |
| 228 | - Coinage relies on region (code at 0x0099 in CPU1) : |
| 229 | * 0x01 and 0x02 : TAITO_COINAGE_JAPAN_OLD |
| 230 | * 0x03 and 0x04 : TAITO_COINAGE_WORLD |
| 231 | - No notice screen |
| 232 | - Copyright relies on region (code at 0x1ee0) : |
| 233 | * 0x01 : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 234 | * 0x02 : "TAITO AMERICA CORP." / "ALL RIGHTS RESERVED" (US) |
| 235 | * else : "TAITO CORP. JAPAN" / "ALL RIGHTS RESERVED" (World / ???) |
| 236 | - English text on bad guys screens when game starts but Japanese samples ! |
| 237 | - 2 players gameplay : players fight against each other in a best of 3 VS match, |
| 238 | then the winner is allowed to fight against the CPU enemies. |
| 239 | This is the reason why I've named DSWA bit 0 as "Unused". |
| 240 | Note that if there is a draw (same energy for both players), player 1 wins. |
| 241 | - Code and data differences : |
| 242 | * CPU0 to be looked at carefully |
| 243 | * 0x9fff (CPU1 - bank = 0x03) : 0x01 instead of 0x02 (value for region tests) |
| 244 | |
| 245 | |
| 246 | 6) 'chukatai' and clones |
| 247 | |
| 248 | - Region stored at 0x9fff.b (CPU1 - bank = 0x03) then 0xe01a (shared RAM) |
| 249 | - Sets : |
| 250 | * 'chukatai' : region = 0x03 |
| 251 | * 'chukatau' : region = 0x02 |
| 252 | * 'chukataj' : region = 0x01 |
| 253 | - These 3 games are 100% the same, only region differs ! |
| 254 | However, dumps for 'chukatai' and 'chukatau' are unsure (wrong ROM numbers). |
| 255 | - Coinage relies on region (code at 0x0114 in CPU1) : |
| 256 | * 0x01 and 0x02 : TAITO_COINAGE_JAPAN_OLD |
| 257 | * 0x03 and 0x04 : TAITO_COINAGE_WORLD |
| 258 | - Notice screen relies on region (code at 0x0253) : |
| 259 | * 0x01 : Yes |
| 260 | * else : No |
| 261 | - Copyright relies on region (code at 0x0b38) : |
| 262 | * 0x01 : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 263 | * 0x02 : "TAITO AMERICA CORPORATION" / "ALL RIGHTS RESERVED" (US) |
| 264 | * else : "TAITO CORPORATION JAPAN" / "ALL RIGHTS RESERVED" (World / ???) |
| 265 | I still need to understand how the strings are displayed though. |
| 266 | - Power-ups display is affected by the region |
| 267 | |
| 268 | |
| 269 | 7) 'tnzs' and clones |
| 270 | |
| 271 | 7a) 'tnzs' and 'tnzsj' |
| 272 | |
| 273 | - Region stored at 0x7fff.b (CPU1) |
| 274 | - Sets : |
| 275 | * 'tnzs' : region = 0x03 |
| 276 | * 'tnzsj' : region = 0x01 |
| 277 | - These 2 games are 100% the same, only region differs ! |
| 278 | - Code at 0x00fb (CPU1) changes region to another value : |
| 279 | * 0x01 -> 0x00 |
| 280 | * 0x02 -> 0x06 |
| 281 | * 0x03 -> 0x0b |
| 282 | * 0x04 -> 0x0e |
| 283 | This value is stored at 0xd035 (CPU1) then 0xef1d (shared RAM). |
| 284 | - Coinage relies on bit 0 of the new value (code at 0x0aa7 in CPU1) : |
| 285 | * .......0 : TAITO_COINAGE_JAPAN_OLD |
| 286 | * .......1 : TAITO_COINAGE_WORLD |
| 287 | - Notice screen relies on bit 1 of the new value (code at 0xbed0 - bank = 0x05) : |
| 288 | * ......0. : Yes |
| 289 | * ......1. : No |
| 290 | - Copyright relies on bits 2 and 3 of the new value (code at 0x12eb) : |
| 291 | * ....00.. : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 292 | * ....01.. : "TAITO AMERICA CORP." / "ALL RIGHTS RESERVED" (US) |
| 293 | * ....10.. : "TAITO CORP. JAPAN" / "ALL RIGHTS RESERVED" (World) |
| 294 | * ....11.. : "TAITO CORP. JAPAN" / "LICENCED TO " |
| 295 | - New Taito logo |
| 296 | |
| 297 | 7b) 'tnzsjo' |
| 298 | |
| 299 | - Region stored at 0x7fff.b (CPU1) |
| 300 | - Sets : |
| 301 | * 'tnzsjo' : region = 0x01 |
| 302 | - Code at 0x00f7 (CPU1) changes region to another value : |
| 303 | * 0x01 -> 0x00 |
| 304 | * 0x02 -> 0x06 |
| 305 | * 0x03 -> 0x0b |
| 306 | * 0x04 -> 0x0e |
| 307 | This value is stored at 0xd035 (CPU1) then 0xef1d (shared RAM). |
| 308 | - Coinage relies on bit 0 of the new value (code at 0x5f68 in CPU1) : |
| 309 | * .......0 : TAITO_COINAGE_JAPAN_OLD |
| 310 | * .......1 : TAITO_COINAGE_WORLD |
| 311 | - Notice screen relies on bit 1 of the new value (code at 0xbbb5 - bank = 0x05) : |
| 312 | * ......0. : Yes |
| 313 | * ......1. : No |
| 314 | - Copyright relies on bits 2 and 3 of the new value (code at 0x12ed) : |
| 315 | * ....00.. : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 316 | * ....01.. : "TAITO AMERICA CORP." / "ALL RIGHTS RESERVED" (US) |
| 317 | * ....10.. : "TAITO CORP. JAPAN" / "ALL RIGHTS RESERVED" (World) |
| 318 | * ....11.. : "TAITO CORP. JAPAN" / "LICENCED TO " |
| 319 | - New Taito logo |
| 320 | - levels are different from 'tnzs' |
| 321 | |
| 322 | 7c) 'tnzso' |
| 323 | |
| 324 | - Region stored at 0x7fff.b (CPU1) |
| 325 | - Sets : |
| 326 | * 'tnzso' : region = 0x03 |
| 327 | - Code at 0x021e (CPU1) changes region to another value : |
| 328 | * 0x01 -> 0x00 |
| 329 | * 0x02 -> 0x06 |
| 330 | * 0x03 -> 0x0b |
| 331 | * 0x04 -> 0x0e |
| 332 | This value is stored at 0xd46b (CPU1) then 0xef1d (shared RAM). |
| 333 | - Coinage relies on bit 0 of the new value (code at 0x5d91 in CPU1) : |
| 334 | * .......0 : TAITO_COINAGE_JAPAN_OLD |
| 335 | * .......1 : TAITO_COINAGE_WORLD |
| 336 | - Notice screen relies on bit 1 of the new value (code at 0x0cdd) : |
| 337 | * ......0. : Yes |
| 338 | * ......1. : No |
| 339 | - Copyright relies on bits 2 and 3 of the new value (code at 0x1062) : |
| 340 | * ....00.. : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 341 | * ....01.. : "TAITO AMERICA CORP." / "ALL RIGHTS RESERVED" (US) |
| 342 | * ....10.. : "TAITO CORP. JAPAN" / "ALL RIGHTS RESERVED" (World) |
| 343 | * ....11.. : "TAITO CORP. JAPAN" / "LICENCED TO " |
| 344 | - Old Taito logo |
| 345 | - levels are different from 'tnzs' and 'tnzsjo' |
| 346 | |
| 347 | |
| 348 | 8) 'kabukiz' and clones |
| 349 | |
| 350 | - No region byte : a value is loaded in register A each time it is needed ! |
| 351 | - Sets : |
| 352 | * 'kabukiz' : value = 0x02 |
| 353 | * 'kabukizj' : value = 0x00 |
| 354 | - Coinage relies on register A (code at 0x016c in CPU1) |
| 355 | * 0x02 : TAITO_COINAGE_WORLD |
| 356 | * else : TAITO_COINAGE_JAPAN_OLD |
| 357 | - Notice screen relies on register A (code at 0x0b30 in CPU1) : |
| 358 | * 0x00 : Yes |
| 359 | * else : No |
| 360 | - Copyright relies on register A (code at 0x0d4e in CPU1) |
| 361 | * 0x00 : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 362 | * 0x01 : "TAITO AMERICA CORP." / "ALL RIGHTS RESERVED" (US) |
| 363 | * else : "TAITO CORP. JAPAN" / "ALL RIGHTS RESERVED" (World) |
| 364 | - 'babukizj' has extra code in CPU1 to be looked at carefully. |
| 365 | |
| 366 | |
| 367 | 9) 'insectx' |
| 368 | |
| 369 | - Region stored at 0x9fff.b (CPU1 - bank = 0x03) then 0xec21 (shared RAM) |
| 370 | - Sets : |
| 371 | * 'insectx' : region = 0x03 |
| 372 | - Coinage relies on region (code at 0x025b in CPU1) : |
| 373 | * 0x01 : TAITO_COINAGE_JAPAN_OLD |
| 374 | * 0x02 : TAITO_COINAGE_US |
| 375 | * else : TAITO_COINAGE_WORLD |
| 376 | - Notice screen relies on region (code at 0x0a6c) : |
| 377 | * 0x01 : Yes |
| 378 | * else : No |
| 379 | - Copyright relies on region (code at 0xac16 - bank = 0x02) : |
| 380 | * 0x01 : "TAITO CORPORATION" / "ALL RIGHTS RESERVED" (Japan) |
| 381 | * 0x02 : "TAITO AMERICA CORPORATION" / "ALL RIGHTS RESERVED" (US) |
| 382 | * else : "TAITO CORPORATION JAPAN" / "ALL RIGHTS RESERVED" (World) |
| 383 | - This game doesn't use standard settings for "Difficulty" Dip Switch : |
| 384 | look at table at 0x1b86 (4 * 2 bytes) and especially table at 0x4731 |
| 385 | (4 bytes) which determines end of level boss energy via code at 0x46e2, |
| 386 | and you'll notice that "Easy" and "Hard" settings are swapped. |
| 387 | End of level boss energy is stored at 0xe484 and 0xe485 (LSB first). |
| 388 | |
| 389 | |
| 390 | 10) 'jpopnics' |
| 391 | |
| 392 | - Region stored at 0x7fff.b (CPU1) then 0xef49 (shared RAM) |
| 393 | - Sets : |
| 394 | * 'jpopnics' : region = 0x00 |
| 395 | - Coinage relies on bit 0 of the region (code at 0x5141 in CPU1) : |
| 396 | * .......0 : TAITO_COINAGE_JAPAN_OLD |
| 397 | * .......1 : TAITO_COINAGE_WORLD |
| 398 | However, coinage is in fact always 1C_1C for both coin slots due to |
| 399 | 'ret' instruction at 0x5151 and way coins are handled at 0x4f60. |
| 400 | - Notice screen relies on bit 1 of the region (code at 0x16e8) : |
| 401 | * ......0. : Yes |
| 402 | * ......1. : No |
| 403 | Notice screen displays "Korea" instead of "Japan". |
| 404 | - Copyright relies on bits 2 and 3 of the region (code at 0x276d), |
| 405 | but table at 0x2781 is the same for any combinaison : |
| 406 | * ....??.. : "NICS CO. LTD. 1992" / "ALL RIGHTS RESERVED" |
| 407 | |
| 408 | |
| 46 | 409 | TODO: |
| 47 | 410 | ----- |
| 48 | 411 | - Find out how the hardware credit-counter works (MPU) |
| 49 | | - Verify dip switches |
| 412 | - Fix MCU simulation errors : |
| 413 | * avoid credits to be increased when in "test mode" to avoid coin lockout |
| 414 | (needed to complete special test mode in 'extermatn' and 'arknoid2') |
| 415 | * why are credits limited to 9 in some games ? |
| 416 | pressing SERVICE1 allows to go up to 100 and cause this : |
| 417 | . 'plumppop' : freeze |
| 418 | . 'extrmatn' : reset |
| 419 | . 'arknoid2' : coin overflow |
| 50 | 420 | - Fix video offsets (See Dr Toppel in Flip-Screen - also affects Chuka Taisen) |
| 51 | 421 | - Video scroll side flicker in Chuka Taisen, Insector X, Dr Toppel, Kabuki Z |
| 52 | | - Sprite/background sync during scrolling, e.g. insectorx, kabukiz. |
| 422 | - Sprite/background sync during scrolling, e.g. insectx, kabukiz. |
| 53 | 423 | - Merge video driver with seta.c (it's the same thing but seta.c assumes a 16-bit CPU) |
| 424 | - Figure out remaining unknown Dip Switches in 'plumppop' and 'jpopnics' |
| 425 | - Get rid of the COMMON_* macros to use generic INPUT_PORTS definition |
| 426 | and PORT_INCLUDE macro by changing the ym2203_config definition |
| 54 | 427 | |
| 428 | |
| 55 | 429 | Arkanoid 2: |
| 56 | 430 | - What do writes at $f400 do ? |
| 57 | 431 | - Why does the game zero the $fd00 area ? |
| r3485 | r3486 | |
| 569 | 943 | AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(jpopnics_palette_w) AM_BASE(&paletteram) |
| 570 | 944 | ADDRESS_MAP_END |
| 571 | 945 | |
| 572 | | #ifdef UNUSED_FUNCTION |
| 573 | | READ8_HANDLER( moo_r ) |
| 574 | | { |
| 575 | | return mame_rand(machine); |
| 576 | | } |
| 577 | | |
| 578 | | READ8_HANDLER( bbb_r ) |
| 579 | | { |
| 580 | | return 0xff; |
| 581 | | } |
| 582 | | #endif |
| 583 | | |
| 584 | 946 | static WRITE8_HANDLER( jpopnics_subbankswitch_w ) |
| 585 | 947 | { |
| 586 | 948 | UINT8 *RAM = memory_region(machine, "sub"); |
| r3485 | r3486 | |
| 589 | 951 | memory_set_bankptr (2, &RAM[0x10000 + 0x2000 * (data & 3)]); |
| 590 | 952 | } |
| 591 | 953 | |
| 592 | | |
| 593 | 954 | static ADDRESS_MAP_START( jpopnics_sub_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 594 | 955 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 595 | 956 | AM_RANGE(0x8000, 0x9fff) AM_READWRITE(SMH_BANK2, SMH_ROM) |
| r3485 | r3486 | |
| 608 | 969 | AM_RANGE(0xf000, 0xf003) AM_READ(arknoid2_sh_f000_r) |
| 609 | 970 | ADDRESS_MAP_END |
| 610 | 971 | |
| 972 | |
| 611 | 973 | #define COMMON_IN2\ |
| 612 | 974 | PORT_START("IN2")\ |
| 613 | 975 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )\ |
| r3485 | r3486 | |
| 629 | 991 | PORT_BIT( 0x01, coinstate, IPT_COIN2 )\ |
| 630 | 992 | PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 631 | 993 | |
| 632 | | static INPUT_PORTS_START( extrmatn ) |
| 994 | |
| 995 | static INPUT_PORTS_START( plumppop ) |
| 996 | /* 0xb001 (CPU1) port 0 -> 0xef0e (shared RAM) */ |
| 633 | 997 | PORT_START("DSWA") |
| 634 | | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) |
| 998 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) /* code at 0x6e99 - is it ever called ? */ |
| 635 | 999 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 636 | 1000 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1001 | TAITO_DSWA_BITS_1_TO_3 |
| 1002 | TAITO_COINAGE_JAPAN_OLD |
| 1003 | |
| 1004 | /* 0xb001 (CPU1) port 1 -> 0xef0f (shared RAM) */ |
| 1005 | PORT_START("DSWB") |
| 1006 | TAITO_DIFFICULTY |
| 1007 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) /* table at 0x2b86 */ |
| 1008 | PORT_DIPSETTING( 0x08, "50k 200k 150k+" ) |
| 1009 | PORT_DIPSETTING( 0x0c, "50k 250k 200k+" ) |
| 1010 | PORT_DIPSETTING( 0x04, "100k 300k 200k+" ) |
| 1011 | PORT_DIPSETTING( 0x00, "100k 400k 300k+" ) |
| 1012 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) |
| 1013 | PORT_DIPSETTING( 0x20, "2" ) |
| 1014 | PORT_DIPSETTING( 0x30, "3" ) |
| 1015 | PORT_DIPSETTING( 0x10, "4" ) |
| 1016 | PORT_DIPSETTING( 0x00, "5" ) |
| 1017 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) /* code at 0x3dcc */ |
| 1018 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1019 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1020 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Allow_Continue ) ) |
| 1021 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 1022 | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) |
| 1023 | |
| 1024 | PORT_START("IN0") |
| 1025 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1026 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1027 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1028 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1029 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 1030 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Button 2 (Cheat)") |
| 1031 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1032 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 1033 | |
| 1034 | PORT_START("IN1") |
| 1035 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1036 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1037 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1038 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1039 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 1040 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Button 2 (Cheat)") /* not working ? */ |
| 1041 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1042 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) |
| 1043 | |
| 1044 | PORT_START("IN2") |
| 1045 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 1046 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT ) |
| 1047 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1048 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1049 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| 1050 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 ) |
| 1051 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1052 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1053 | |
| 1054 | COMMON_COIN1(IP_ACTIVE_HIGH) |
| 1055 | COMMON_COIN2(IP_ACTIVE_HIGH) |
| 1056 | |
| 1057 | PORT_START("AN1") /* spinner 1 - read at f000/1 */ |
| 1058 | PORT_BIT( 0xffff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15) PORT_PLAYER(1) |
| 1059 | |
| 1060 | PORT_START("AN2") /* spinner 2 - read at f002/3 */ |
| 1061 | PORT_BIT( 0xffff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15) PORT_PLAYER(2) |
| 1062 | INPUT_PORTS_END |
| 1063 | |
| 1064 | |
| 1065 | static INPUT_PORTS_START( extrmatn ) |
| 1066 | /* 0xb001 (CPU1) port 0 -> 0xef0e (shared RAM) */ |
| 1067 | PORT_START("DSWA") |
| 1068 | PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW ) |
| 637 | 1069 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) |
| 638 | 1070 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 639 | 1071 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 640 | 1072 | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) |
| 641 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) |
| 642 | | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 643 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1073 | PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW ) |
| 644 | 1074 | TAITO_COINAGE_JAPAN_OLD |
| 645 | 1075 | |
| 1076 | /* 0xb001 (CPU1) port 1 -> 0xef0f (shared RAM) */ |
| 646 | 1077 | PORT_START("DSWB") |
| 647 | | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) |
| 648 | | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| 649 | | PORT_DIPSETTING( 0x03, DEF_STR( Normal ) ) |
| 650 | | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 651 | | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 652 | | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) |
| 653 | | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 654 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 655 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) |
| 656 | | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 657 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 658 | | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) |
| 659 | | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 660 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 661 | | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) |
| 662 | | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 663 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1078 | TAITO_DIFFICULTY |
| 1079 | PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW ) |
| 1080 | PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW ) |
| 1081 | PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW ) |
| 1082 | PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW ) |
| 664 | 1083 | PORT_DIPNAME( 0xc0, 0xc0, "Damage Multiplier" ) |
| 665 | 1084 | PORT_DIPSETTING( 0xc0, "*1" ) |
| 666 | 1085 | PORT_DIPSETTING( 0x80, "*1.5" ) |
| r3485 | r3486 | |
| 678 | 1097 | COMMON_COIN2(IP_ACTIVE_HIGH) |
| 679 | 1098 | INPUT_PORTS_END |
| 680 | 1099 | |
| 1100 | |
| 681 | 1101 | static INPUT_PORTS_START( arknoid2 ) |
| 1102 | /* 0xb001 (CPU1) port 0 -> 0xe001 (shared RAM) */ |
| 682 | 1103 | PORT_START("DSWA") |
| 683 | | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 684 | | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 685 | | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| 686 | | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) |
| 687 | | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 688 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 689 | | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) |
| 690 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) |
| 691 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 692 | | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 1104 | TAITO_MACHINE_COCKTAIL |
| 693 | 1105 | TAITO_COINAGE_WORLD |
| 694 | 1106 | |
| 1107 | /* 0xb001 (CPU1) port 1 -> 0xe002 (shared RAM) */ |
| 695 | 1108 | PORT_START("DSWB") |
| 696 | | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) |
| 697 | | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| 698 | | PORT_DIPSETTING( 0x03, DEF_STR( Normal ) ) |
| 699 | | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 700 | | PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) ) |
| 701 | | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) |
| 702 | | PORT_DIPSETTING( 0x00, "50k 150k" ) |
| 703 | | PORT_DIPSETTING( 0x0c, "100k 200k" ) |
| 704 | | PORT_DIPSETTING( 0x04, "50k Only" ) |
| 705 | | PORT_DIPSETTING( 0x08, "100k Only" ) |
| 1109 | TAITO_DIFFICULTY |
| 1110 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) /* table at 0x6f1e (W and J) or 0x6f1b (Romstar) */ |
| 1111 | PORT_DIPSETTING( 0x00, "50k 150k 150k+" ) |
| 1112 | PORT_DIPSETTING( 0x0c, "100k 200k 200k+" ) |
| 1113 | PORT_DIPSETTING( 0x04, "50k only" ) |
| 1114 | PORT_DIPSETTING( 0x08, "100k only" ) |
| 706 | 1115 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) |
| 707 | 1116 | PORT_DIPSETTING( 0x20, "2" ) |
| 708 | 1117 | PORT_DIPSETTING( 0x30, "3" ) |
| 709 | 1118 | PORT_DIPSETTING( 0x10, "4" ) |
| 710 | 1119 | PORT_DIPSETTING( 0x00, "5" ) |
| 711 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 712 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 713 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1120 | PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) |
| 714 | 1121 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Allow_Continue ) ) |
| 715 | 1122 | PORT_DIPSETTING( 0x80, DEF_STR( No ) ) |
| 716 | 1123 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| r3485 | r3486 | |
| 751 | 1158 | TAITO_COINAGE_JAPAN_OLD |
| 752 | 1159 | INPUT_PORTS_END |
| 753 | 1160 | |
| 754 | | static INPUT_PORTS_START( plumppop ) |
| 1161 | |
| 1162 | static INPUT_PORTS_START( drtoppel ) |
| 1163 | /* 0xb001 (CPU1) port 0 -> 0xe042 (shared RAM) */ |
| 755 | 1164 | PORT_START("DSWA") |
| 756 | | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 757 | | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 758 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 759 | | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) |
| 760 | | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 761 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 762 | | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) |
| 763 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) |
| 764 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 765 | | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 766 | | TAITO_COINAGE_JAPAN_OLD |
| 1165 | TAITO_MACHINE_COCKTAIL |
| 1166 | TAITO_COINAGE_WORLD |
| 767 | 1167 | |
| 1168 | /* 0xb001 (CPU1) port 1 -> 0xe043 (shared RAM) */ |
| 768 | 1169 | PORT_START("DSWB") |
| 769 | | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) |
| 770 | | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| 771 | | PORT_DIPSETTING( 0x03, DEF_STR( Medium ) ) |
| 772 | | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 773 | | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 774 | | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) |
| 775 | | PORT_DIPSETTING( 0x08, "50k 150k" ) |
| 776 | | PORT_DIPSETTING( 0x0c, "70k 200k" ) |
| 777 | | PORT_DIPSETTING( 0x04, "100k 250k" ) |
| 778 | | PORT_DIPSETTING( 0x00, "200k 300k" ) |
| 1170 | TAITO_DIFFICULTY |
| 1171 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) /* table at 0x256d (4 * 9 bytes) */ |
| 1172 | PORT_DIPSETTING( 0x0c, "30k 100k 200k 100k+" ) /* 30k 100k 200k 300k 400k 500k 600k 700k */ |
| 1173 | PORT_DIPSETTING( 0x00, "50k 100k 200k 200k+" ) /* 50k 100k 200k 400k 600k 800k 1000k 1200k */ |
| 1174 | PORT_DIPSETTING( 0x04, "30k 100k" ) |
| 1175 | PORT_DIPSETTING( 0x08, "30k only" ) |
| 779 | 1176 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) |
| 780 | 1177 | PORT_DIPSETTING( 0x20, "2" ) |
| 781 | 1178 | PORT_DIPSETTING( 0x30, "3" ) |
| 782 | 1179 | PORT_DIPSETTING( 0x10, "4" ) |
| 783 | 1180 | PORT_DIPSETTING( 0x00, "5" ) |
| 784 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 785 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 786 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 787 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Allow_Continue ) ) |
| 788 | | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 789 | | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) |
| 1181 | PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) |
| 1182 | PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) |
| 790 | 1183 | |
| 791 | 1184 | PORT_START("IN0") |
| 792 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 793 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 794 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 795 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 796 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 797 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button 2 (Cheat)")// Cop out, I know, but I've never played this (EC) |
| 798 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 799 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 1185 | TAITO_JOY_LRUD_2_BUTTONS_START( 1 ) |
| 800 | 1186 | |
| 801 | 1187 | PORT_START("IN1") |
| 802 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 803 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 804 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 805 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 806 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 807 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button 2 (Cheat)") PORT_PLAYER(2) |
| 808 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 809 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) |
| 1188 | TAITO_JOY_LRUD_2_BUTTONS_START( 2 ) |
| 810 | 1189 | |
| 811 | | PORT_START("IN2") |
| 812 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 813 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT ) |
| 814 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 815 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 816 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| 817 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 ) |
| 818 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 819 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 820 | | |
| 1190 | COMMON_IN2 |
| 821 | 1191 | COMMON_COIN1(IP_ACTIVE_HIGH) |
| 822 | 1192 | COMMON_COIN2(IP_ACTIVE_HIGH) |
| 1193 | INPUT_PORTS_END |
| 823 | 1194 | |
| 824 | | PORT_START("AN1") /* spinner 1 - read at f000/1 */ |
| 825 | | PORT_BIT( 0xffff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15) |
| 1195 | static INPUT_PORTS_START( drtopplu ) |
| 1196 | PORT_INCLUDE( drtoppel ) |
| 826 | 1197 | |
| 827 | | PORT_START("AN2") /* spinner 2 - read at f002/3 */ |
| 828 | | PORT_BIT( 0xffff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15) PORT_PLAYER(2) |
| 1198 | PORT_MODIFY("DSWA") |
| 1199 | TAITO_COINAGE_JAPAN_OLD |
| 829 | 1200 | INPUT_PORTS_END |
| 830 | 1201 | |
| 831 | 1202 | |
| 832 | | static INPUT_PORTS_START( jpopnics ) |
| 1203 | static INPUT_PORTS_START( kageki ) |
| 1204 | /* special (see kageki_csport_* handlers) -> 0xe03b (shared RAM) */ |
| 1205 | PORT_START("DSWA") |
| 1206 | TAITO_MACHINE_NO_COCKTAIL /* see notes */ |
| 1207 | TAITO_COINAGE_JAPAN_OLD |
| 1208 | |
| 1209 | /* special (see kageki_csport_* handlers) -> 0xe03c (shared RAM) */ |
| 1210 | PORT_START("DSWB") |
| 1211 | TAITO_DIFFICULTY |
| 1212 | PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW ) |
| 1213 | PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW ) |
| 1214 | PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW ) |
| 1215 | PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW ) |
| 1216 | PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) |
| 1217 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Allow_Continue ) ) |
| 1218 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 1219 | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) |
| 1220 | |
| 833 | 1221 | PORT_START("IN0") |
| 834 | | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1222 | TAITO_JOY_LRUD_2_BUTTONS_START( 1 ) |
| 835 | 1223 | |
| 836 | 1224 | PORT_START("IN1") |
| 837 | | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 838 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 839 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button 2 (Cheat)") |
| 840 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 841 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 1225 | TAITO_JOY_LRUD_2_BUTTONS_START( 2 ) |
| 842 | 1226 | |
| 843 | 1227 | PORT_START("IN2") |
| 844 | | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 845 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 846 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button 2 (Cheat)") PORT_PLAYER(2) |
| 847 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 848 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) |
| 1228 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 1229 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT ) |
| 1230 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1231 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1232 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 1233 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1234 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1235 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1236 | INPUT_PORTS_END |
| 849 | 1237 | |
| 850 | | PORT_START("DSWA") |
| 851 | | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 852 | | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 853 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 854 | | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) |
| 855 | | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 856 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 857 | | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) |
| 858 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) |
| 859 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 860 | | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 861 | | TAITO_COINAGE_JAPAN_OLD |
| 1238 | static INPUT_PORTS_START( kagekij ) |
| 1239 | PORT_INCLUDE( kageki ) |
| 862 | 1240 | |
| 863 | | PORT_START("DSWB") |
| 864 | | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) |
| 865 | | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| 866 | | PORT_DIPSETTING( 0x03, DEF_STR( Medium ) ) |
| 867 | | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 868 | | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 869 | | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) |
| 870 | | PORT_DIPSETTING( 0x08, "50k 150k" ) |
| 871 | | PORT_DIPSETTING( 0x0c, "70k 200k" ) |
| 872 | | PORT_DIPSETTING( 0x04, "100k 250k" ) |
| 873 | | PORT_DIPSETTING( 0x00, "200k 300k" ) |
| 874 | | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) |
| 875 | | PORT_DIPSETTING( 0x20, "2" ) |
| 876 | | PORT_DIPSETTING( 0x30, "3" ) |
| 877 | | PORT_DIPSETTING( 0x10, "4" ) |
| 878 | | PORT_DIPSETTING( 0x00, "5" ) |
| 879 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 880 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 881 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 882 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Allow_Continue ) ) |
| 883 | | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 884 | | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) |
| 1241 | PORT_MODIFY("DSWA") |
| 1242 | TAITO_MACHINE_COCKTAIL /* see notes */ |
| 1243 | INPUT_PORTS_END |
| 885 | 1244 | |
| 886 | | PORT_START("COIN1") |
| 887 | | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 888 | 1245 | |
| 889 | | PORT_START("COIN2") |
| 890 | | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 891 | | |
| 892 | | PORT_START("AN1") /* spinner 1 - read at f000/1 */ |
| 893 | | PORT_BIT( 0xffff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15) |
| 894 | | |
| 895 | | PORT_START("AN2") /* spinner 2 - read at f002/3 */ |
| 896 | | PORT_BIT( 0xffff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15) PORT_PLAYER(2) |
| 897 | | INPUT_PORTS_END |
| 898 | | |
| 899 | | static INPUT_PORTS_START( drtoppel ) |
| 1246 | static INPUT_PORTS_START( chukatai ) |
| 1247 | /* 0xb001 (CPU1) port 0 -> 0xe015 (shared RAM) */ |
| 900 | 1248 | PORT_START("DSWA") |
| 901 | | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 902 | | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 903 | | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| 904 | | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) |
| 905 | | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 906 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 907 | | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) |
| 908 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) |
| 909 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 910 | | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 1249 | TAITO_MACHINE_COCKTAIL |
| 911 | 1250 | TAITO_COINAGE_WORLD |
| 912 | 1251 | |
| 1252 | /* 0xb001 (CPU1) port 1 -> 0xe016 (shared RAM) */ |
| 913 | 1253 | PORT_START("DSWB") |
| 914 | | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) |
| 915 | | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| 916 | | PORT_DIPSETTING( 0x03, DEF_STR( Medium ) ) |
| 917 | | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 918 | | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 919 | | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) |
| 920 | | PORT_DIPSETTING( 0x0c, "30000" ) |
| 921 | | PORT_DIPSETTING( 0x00, DEF_STR( Unknown ) ) |
| 922 | | PORT_DIPSETTING( 0x04, DEF_STR( Unknown ) ) |
| 923 | | PORT_DIPSETTING( 0x08, DEF_STR( Unknown ) ) |
| 1254 | TAITO_DIFFICULTY |
| 1255 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) /* tables : 1st at 0xb070 (bank = 0x02) and inc. at 0x09df */ |
| 1256 | PORT_DIPSETTING( 0x08, "40k 240k 200k+" ) |
| 1257 | PORT_DIPSETTING( 0x0c, "60k 360k 300k+" ) |
| 1258 | PORT_DIPSETTING( 0x04, "100k 500k 400k+" ) |
| 1259 | PORT_DIPSETTING( 0x00, "150k 650k 500k+" ) |
| 924 | 1260 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) |
| 925 | | PORT_DIPSETTING( 0x20, "2" ) |
| 1261 | PORT_DIPSETTING( 0x00, "1" ) |
| 1262 | PORT_DIPSETTING( 0x10, "2" ) |
| 926 | 1263 | PORT_DIPSETTING( 0x30, "3" ) |
| 927 | | PORT_DIPSETTING( 0x10, "4" ) |
| 928 | | PORT_DIPSETTING( 0x00, "5" ) |
| 929 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 930 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 931 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 932 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 933 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 934 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1264 | PORT_DIPSETTING( 0x20, "4" ) |
| 1265 | PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) |
| 1266 | PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) |
| 935 | 1267 | |
| 936 | 1268 | PORT_START("IN0") |
| 937 | 1269 | TAITO_JOY_LRUD_2_BUTTONS_START( 1 ) |
| r3485 | r3486 | |
| 944 | 1276 | COMMON_COIN2(IP_ACTIVE_HIGH) |
| 945 | 1277 | INPUT_PORTS_END |
| 946 | 1278 | |
| 947 | | static INPUT_PORTS_START( drtopplu ) |
| 948 | | PORT_INCLUDE( drtoppel ) |
| 1279 | static INPUT_PORTS_START( chukatau ) |
| 1280 | PORT_INCLUDE( chukatai ) |
| 949 | 1281 | |
| 950 | 1282 | PORT_MODIFY("DSWA") |
| 951 | 1283 | TAITO_COINAGE_JAPAN_OLD |
| 952 | 1284 | INPUT_PORTS_END |
| 953 | 1285 | |
| 954 | | static INPUT_PORTS_START( chukatai ) |
| 1286 | |
| 1287 | static INPUT_PORTS_START( tnzs ) |
| 1288 | /* 0xb002 (CPU1) -> 0xef0e (shared RAM) */ |
| 955 | 1289 | PORT_START("DSWA") |
| 956 | 1290 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 957 | 1291 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| r3485 | r3486 | |
| 960 | 1294 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 961 | 1295 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 962 | 1296 | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) |
| 963 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) |
| 964 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 965 | | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 1297 | PORT_DIPNAME( 0x08, 0x08, "Invulnerability (Debug)" ) // see notes |
| 1298 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1299 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 966 | 1300 | TAITO_COINAGE_WORLD |
| 967 | 1301 | |
| 1302 | /* 0xb003 (CPU1) -> 0xef0f (shared RAM) */ |
| 968 | 1303 | PORT_START("DSWB") |
| 969 | | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) |
| 970 | | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| 971 | | PORT_DIPSETTING( 0x03, DEF_STR( Medium ) ) |
| 972 | | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 973 | | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 974 | | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) |
| 975 | | PORT_DIPSETTING( 0x08, "100k 300k 440k" ) |
| 976 | | PORT_DIPSETTING( 0x00, "100k 300k 500k" ) |
| 977 | | PORT_DIPSETTING( 0x0c, "100k 400k" ) |
| 978 | | PORT_DIPSETTING( 0x04, "100k 500k" ) |
| 1304 | TAITO_DIFFICULTY |
| 1305 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) /* table at 0x09c84 */ |
| 1306 | PORT_DIPSETTING( 0x00, "50k 150k 150k+" ) |
| 1307 | PORT_DIPSETTING( 0x0c, "70k 200k 200k+" ) |
| 1308 | PORT_DIPSETTING( 0x04, "100k 250k 250k+" ) |
| 1309 | PORT_DIPSETTING( 0x08, "200k 300k 300k+" ) |
| 979 | 1310 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) |
| 980 | | PORT_DIPSETTING( 0x00, "1" ) |
| 981 | | PORT_DIPSETTING( 0x10, "2" ) |
| 1311 | PORT_DIPSETTING( 0x20, "2" ) |
| 982 | 1312 | PORT_DIPSETTING( 0x30, "3" ) |
| 983 | | PORT_DIPSETTING( 0x20, "4" ) |
| 984 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 985 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 986 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 987 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 988 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 989 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1313 | PORT_DIPSETTING( 0x00, "4" ) |
| 1314 | PORT_DIPSETTING( 0x10, "5" ) |
| 1315 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) |
| 1316 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 1317 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) |
| 1318 | PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) |
| 990 | 1319 | |
| 991 | 1320 | PORT_START("IN0") |
| 992 | 1321 | TAITO_JOY_LRUD_2_BUTTONS_START( 1 ) |
| r3485 | r3486 | |
| 994 | 1323 | PORT_START("IN1") |
| 995 | 1324 | TAITO_JOY_LRUD_2_BUTTONS_START( 2 ) |
| 996 | 1325 | |
| 997 | | COMMON_IN2 |
| 998 | | COMMON_COIN1(IP_ACTIVE_HIGH) |
| 999 | | COMMON_COIN2(IP_ACTIVE_HIGH) |
| 1326 | PORT_START("IN2") |
| 1327 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 1328 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT ) |
| 1329 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1330 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1331 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 1332 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1333 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1334 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1000 | 1335 | INPUT_PORTS_END |
| 1001 | 1336 | |
| 1002 | | static INPUT_PORTS_START( chukatau ) |
| 1003 | | PORT_INCLUDE( chukatai ) |
| 1337 | static INPUT_PORTS_START( tnzsj ) |
| 1338 | PORT_INCLUDE( tnzs ) |
| 1004 | 1339 | |
| 1005 | 1340 | PORT_MODIFY("DSWA") |
| 1006 | 1341 | TAITO_COINAGE_JAPAN_OLD |
| 1007 | 1342 | INPUT_PORTS_END |
| 1008 | 1343 | |
| 1009 | | static INPUT_PORTS_START( tnzs ) |
| 1344 | static INPUT_PORTS_START( tnzsjo ) |
| 1345 | /* 0xb001 (CPU1) port 0 -> 0xef0e (shared RAM) */ |
| 1010 | 1346 | PORT_START("DSWA") |
| 1011 | 1347 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 1012 | 1348 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| r3485 | r3486 | |
| 1020 | 1356 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1021 | 1357 | TAITO_COINAGE_JAPAN_OLD |
| 1022 | 1358 | |
| 1359 | /* 0xb001 (CPU1) port 1 -> 0xef0f (shared RAM) */ |
| 1023 | 1360 | PORT_START("DSWB") |
| 1024 | | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) |
| 1025 | | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| 1026 | | PORT_DIPSETTING( 0x03, DEF_STR( Medium ) ) |
| 1027 | | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 1028 | | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 1029 | | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) |
| 1030 | | PORT_DIPSETTING( 0x00, "50000 150000" ) |
| 1031 | | PORT_DIPSETTING( 0x0c, "70000 200000" ) |
| 1032 | | PORT_DIPSETTING( 0x04, "100000 250000" ) |
| 1033 | | PORT_DIPSETTING( 0x08, "200000 300000" ) |
| 1361 | TAITO_DIFFICULTY |
| 1362 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) /* table at 0x09caf */ |
| 1363 | PORT_DIPSETTING( 0x00, "50k 150k 150k+" ) |
| 1364 | PORT_DIPSETTING( 0x0c, "70k 200k 200k+" ) |
| 1365 | PORT_DIPSETTING( 0x04, "100k 250k 250k+" ) |
| 1366 | PORT_DIPSETTING( 0x08, "200k 300k 300k+" ) |
| 1034 | 1367 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) |
| 1035 | 1368 | PORT_DIPSETTING( 0x20, "2" ) |
| 1036 | 1369 | PORT_DIPSETTING( 0x30, "3" ) |
| r3485 | r3486 | |
| 1039 | 1372 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) |
| 1040 | 1373 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 1041 | 1374 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) |
| 1042 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 1043 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 1044 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1375 | PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) |
| 1045 | 1376 | |
| 1046 | 1377 | PORT_START("IN0") |
| 1047 | 1378 | TAITO_JOY_LRUD_2_BUTTONS_START( 1 ) |
| r3485 | r3486 | |
| 1054 | 1385 | COMMON_COIN2(IP_ACTIVE_LOW) |
| 1055 | 1386 | INPUT_PORTS_END |
| 1056 | 1387 | |
| 1057 | | static INPUT_PORTS_START( tnzsb ) |
| 1058 | | PORT_INCLUDE( tnzs ) |
| 1388 | static INPUT_PORTS_START( tnzso ) |
| 1389 | PORT_INCLUDE( tnzsjo ) |
| 1059 | 1390 | |
| 1060 | 1391 | PORT_MODIFY("DSWA") |
| 1392 | PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW ) /* value read at 0x356b but not tested nor stored elsewhere */ |
| 1061 | 1393 | TAITO_COINAGE_WORLD |
| 1062 | 1394 | |
| 1063 | | PORT_MODIFY("IN1") |
| 1064 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL |
| 1065 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL |
| 1066 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_COCKTAIL |
| 1067 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL |
| 1068 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 1069 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL |
| 1070 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1071 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2) |
| 1072 | | |
| 1073 | | PORT_MODIFY("IN2") |
| 1074 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 1075 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1076 | | |
| 1077 | | PORT_MODIFY("COIN1") /* not present in the bootleg */ |
| 1078 | | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1079 | | |
| 1080 | | PORT_MODIFY("COIN2") /* not present in the bootleg */ |
| 1081 | | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1395 | PORT_MODIFY("DSWB") |
| 1396 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) /* table at 0x09afb */ |
| 1397 | PORT_DIPSETTING( 0x00, "10k 100k 100k+" ) |
| 1398 | PORT_DIPSETTING( 0x0c, "10k 150k 150k+" ) |
| 1399 | PORT_DIPSETTING( 0x04, "10k 200k 200k+" ) |
| 1400 | PORT_DIPSETTING( 0x08, "10k 300k 300k+" ) |
| 1082 | 1401 | INPUT_PORTS_END |
| 1083 | 1402 | |
| 1084 | | static INPUT_PORTS_START( tnzs2 ) |
| 1085 | | PORT_INCLUDE( tnzs ) |
| 1086 | 1403 | |
| 1087 | | PORT_MODIFY("DSWA") |
| 1088 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) |
| 1089 | | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1090 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1091 | | TAITO_COINAGE_WORLD |
| 1092 | | |
| 1093 | | PORT_MODIFY("DSWB") |
| 1094 | | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) |
| 1095 | | PORT_DIPSETTING( 0x00, "10000 100000" ) |
| 1096 | | PORT_DIPSETTING( 0x0c, "10000 150000" ) |
| 1097 | | PORT_DIPSETTING( 0x08, "10000 200000" ) |
| 1098 | | PORT_DIPSETTING( 0x04, "10000 300000" ) |
| 1099 | | INPUT_PORTS_END |
| 1100 | | |
| 1101 | 1404 | static INPUT_PORTS_START( kabukiz ) |
| 1405 | /* 0xb002 (CPU1) */ |
| 1102 | 1406 | PORT_START("DSWA") |
| 1103 | | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 1104 | | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 1105 | | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| 1106 | | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) |
| 1107 | | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 1108 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1109 | | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) |
| 1110 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) |
| 1111 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1112 | | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 1113 | | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
| 1114 | | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 1115 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1116 | | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) |
| 1117 | | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 1118 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1119 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 1120 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1121 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1407 | TAITO_MACHINE_COCKTAIL |
| 1408 | PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW ) |
| 1409 | PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW ) |
| 1410 | PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) |
| 1122 | 1411 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Allow_Continue ) ) |
| 1123 | 1412 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 1124 | 1413 | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) |
| 1125 | 1414 | |
| 1415 | /* 0xb003 (CPU1) */ |
| 1126 | 1416 | PORT_START("DSWB") |
| 1127 | | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) ) |
| 1128 | | PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) |
| 1129 | | PORT_DIPSETTING( 0x02, DEF_STR( Normal ) ) |
| 1130 | | PORT_DIPSETTING( 0x01, DEF_STR( Medium ) ) |
| 1131 | | PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) |
| 1132 | | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) |
| 1133 | | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 1134 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1135 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) |
| 1136 | | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1137 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1138 | | TAITO_COINAGE_JAPAN_OLD |
| 1417 | TAITO_DIFFICULTY |
| 1418 | PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW ) |
| 1419 | PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW ) |
| 1420 | TAITO_COINAGE_WORLD |
| 1139 | 1421 | |
| 1140 | 1422 | PORT_START("IN0") |
| 1141 | 1423 | TAITO_JOY_LRUD_2_BUTTONS_START( 1 ) |
| 1142 | 1424 | |
| 1143 | 1425 | PORT_START("IN1") |
| 1144 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL |
| 1145 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL |
| 1146 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_COCKTAIL |
| 1147 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL |
| 1148 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 1149 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL |
| 1150 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1151 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2) |
| 1426 | TAITO_JOY_LRUD_2_BUTTONS_START( 2 ) |
| 1152 | 1427 | |
| 1153 | 1428 | PORT_START("IN2") |
| 1154 | 1429 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| r3485 | r3486 | |
| 1159 | 1434 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1160 | 1435 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1161 | 1436 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1437 | INPUT_PORTS_END |
| 1162 | 1438 | |
| 1439 | static INPUT_PORTS_START( kabukizj ) |
| 1440 | PORT_INCLUDE( kabukiz ) |
| 1441 | |
| 1442 | PORT_MODIFY("DSWB") |
| 1443 | TAITO_COINAGE_JAPAN_OLD |
| 1163 | 1444 | INPUT_PORTS_END |
| 1164 | 1445 | |
| 1446 | |
| 1165 | 1447 | static INPUT_PORTS_START( insectx ) |
| 1448 | /* 0xb001 (CPU1) port 0 -> 0xec06 (shared RAM) */ |
| 1166 | 1449 | PORT_START("DSWA") |
| 1167 | | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 1168 | | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 1169 | | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| 1170 | | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) |
| 1171 | | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 1172 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1173 | | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) |
| 1174 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) |
| 1175 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1176 | | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 1450 | TAITO_MACHINE_COCKTAIL |
| 1177 | 1451 | TAITO_COINAGE_WORLD |
| 1178 | 1452 | |
| 1453 | /* 0xb001 (CPU1) port 1 -> 0xec07 (shared RAM) */ |
| 1179 | 1454 | PORT_START("DSWB") |
| 1180 | | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) |
| 1181 | | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| 1455 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) /* see notes */ |
| 1456 | PORT_DIPSETTING( 0x01, DEF_STR( Easy ) ) |
| 1182 | 1457 | PORT_DIPSETTING( 0x03, DEF_STR( Medium ) ) |
| 1183 | | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 1458 | PORT_DIPSETTING( 0x02, DEF_STR( Hard ) ) |
| 1184 | 1459 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 1185 | | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) |
| 1186 | | PORT_DIPSETTING( 0x08, "100k 200k 300k 440k" ) |
| 1187 | | PORT_DIPSETTING( 0x0c, "100k 400k" ) |
| 1188 | | PORT_DIPSETTING( 0x04, "100k 500k" ) |
| 1189 | | PORT_DIPSETTING( 0x00, "150000 Only" ) |
| 1460 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) /* code at 0xaacc - bank = 0x02 */ |
| 1461 | PORT_DIPSETTING( 0x08, "40k 240k 200k+" ) |
| 1462 | PORT_DIPSETTING( 0x0c, "60k 360k 300k+" ) |
| 1463 | PORT_DIPSETTING( 0x04, "100k 500k 400k+" ) |
| 1464 | PORT_DIPSETTING( 0x00, "150k 650k 500k+" ) |
| 1190 | 1465 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) |
| 1191 | 1466 | PORT_DIPSETTING( 0x00, "1" ) |
| 1192 | 1467 | PORT_DIPSETTING( 0x10, "2" ) |
| 1193 | 1468 | PORT_DIPSETTING( 0x30, "3" ) |
| 1194 | 1469 | PORT_DIPSETTING( 0x20, "4" ) |
| 1195 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 1196 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1197 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1198 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 1199 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 1200 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1470 | PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) |
| 1471 | PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) |
| 1201 | 1472 | |
| 1202 | 1473 | PORT_START("IN0") |
| 1203 | 1474 | TAITO_JOY_LRUD_2_BUTTONS_START( 1 ) |
| r3485 | r3486 | |
| 1216 | 1487 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1217 | 1488 | INPUT_PORTS_END |
| 1218 | 1489 | |
| 1219 | | static INPUT_PORTS_START( kageki ) |
| 1220 | | PORT_START("DSWA") |
| 1221 | | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 1222 | | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 1223 | | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| 1224 | | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) |
| 1225 | | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 1490 | |
| 1491 | static INPUT_PORTS_START( jpopnics ) |
| 1492 | /* 0xc600 (CPU1) -> 0xef0e (shared RAM) */ |
| 1493 | PORT_START("DSWA") |
| 1494 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) /* code at 0x6e99 - is it ever called ? */ |
| 1495 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 1226 | 1496 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1227 | | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) |
| 1228 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) |
| 1229 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1230 | | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) |
| 1231 | | TAITO_COINAGE_JAPAN_OLD |
| 1497 | TAITO_DSWA_BITS_1_TO_3 |
| 1498 | PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW ) /* see notes */ |
| 1499 | PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW ) /* see notes */ |
| 1500 | PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) /* see notes */ |
| 1501 | PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) /* see notes */ |
| 1232 | 1502 | |
| 1233 | | PORT_START("DSWB") |
| 1234 | | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) |
| 1235 | | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| 1236 | | PORT_DIPSETTING( 0x03, DEF_STR( Medium ) ) |
| 1237 | | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 1238 | | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 1239 | | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) |
| 1240 | | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 1241 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1242 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) |
| 1243 | | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 1244 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1245 | | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
| 1246 | | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 1247 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1248 | | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) |
| 1249 | | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 1250 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1251 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 1503 | /* 0xc601 (CPU1) -> 0xef0f (shared RAM) */ |
| 1504 | PORT_START("DSWB") |
| 1505 | TAITO_DIFFICULTY |
| 1506 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) /* table at 0x2b86 */ |
| 1507 | PORT_DIPSETTING( 0x08, "50k 200k 150k+" ) |
| 1508 | PORT_DIPSETTING( 0x0c, "50k 250k 200k+" ) |
| 1509 | PORT_DIPSETTING( 0x04, "100k 300k 200k+" ) |
| 1510 | PORT_DIPSETTING( 0x00, "100k 400k 300k+" ) |
| 1511 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) |
| 1512 | PORT_DIPSETTING( 0x20, "2" ) |
| 1513 | PORT_DIPSETTING( 0x30, "3" ) |
| 1514 | PORT_DIPSETTING( 0x10, "4" ) |
| 1515 | PORT_DIPSETTING( 0x00, "5" ) |
| 1516 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) /* code at 0x3dcc */ |
| 1252 | 1517 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1253 | 1518 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1254 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Allow_Continue ) ) |
| 1255 | | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 1256 | | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) |
| 1519 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Allow_Continue ) ) |
| 1520 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 1521 | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) |
| 1257 | 1522 | |
| 1258 | 1523 | PORT_START("IN0") |
| 1259 | | TAITO_JOY_LRUD_2_BUTTONS_START( 1 ) |
| 1524 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1260 | 1525 | |
| 1261 | 1526 | PORT_START("IN1") |
| 1262 | | TAITO_JOY_LRUD_2_BUTTONS_START( 2 ) |
| 1527 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1528 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 1529 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Button 2 (Cheat)") |
| 1530 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 1531 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) |
| 1263 | 1532 | |
| 1264 | 1533 | PORT_START("IN2") |
| 1265 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 1266 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT ) |
| 1267 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1268 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1269 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 1270 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1271 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1272 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 1534 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1535 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 1536 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Button 2 (Cheat)") /* not working ? */ |
| 1537 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1538 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) |
| 1539 | |
| 1540 | PORT_START("COIN1") |
| 1541 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1542 | |
| 1543 | PORT_START("COIN2") |
| 1544 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 1545 | |
| 1546 | PORT_START("AN1") /* spinner 1 - read at f000/1 */ |
| 1547 | PORT_BIT( 0xffff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15) PORT_PLAYER(1) |
| 1548 | |
| 1549 | PORT_START("AN2") /* spinner 2 - read at f002/3 */ |
| 1550 | PORT_BIT( 0xffff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15) PORT_PLAYER(2) |
| 1273 | 1551 | INPUT_PORTS_END |
| 1274 | 1552 | |
| 1553 | |
| 1275 | 1554 | static const gfx_layout tnzs_charlayout = |
| 1276 | 1555 | { |
| 1277 | 1556 | 16,16, |
| r3485 | r3486 | |
| 1998 | 2277 | supported because it appears to be a different code revision to the other supported sets |
| 1999 | 2278 | */ |
| 2000 | 2279 | |
| 2001 | | ROM_START( kagekia ) |
| 2280 | ROM_START( kagekih ) |
| 2002 | 2281 | ROM_REGION( 0x30000, "main", 0 ) |
| 2003 | | ROM_LOAD( "b35_16.11c", 0x00000, 0x08000, CRC(1cf67603) SHA1(0627285ac69e44312d7694c64b96a81489d8663c) ) /* World? (hacked) ver */ |
| 2282 | ROM_LOAD( "b35_16.11c", 0x00000, 0x08000, CRC(1cf67603) SHA1(0627285ac69e44312d7694c64b96a81489d8663c) ) /* hacked ver */ |
| 2004 | 2283 | ROM_CONTINUE( 0x18000, 0x08000 ) |
| 2005 | 2284 | ROM_LOAD( "b35-10.9c", 0x20000, 0x10000, CRC(b150457d) SHA1(a58e46e7dfdc93c2cc7c04d623d7754f85ba693b) ) |
| 2006 | 2285 | |
| r3485 | r3486 | |
| 2232 | 2511 | ROM_LOAD( "b53-21.1", 0xe0000, 0x20000, CRC(9800c54d) SHA1(761647177d621ac2cdd8b009876eed35809f3c92) ) |
| 2233 | 2512 | ROM_END |
| 2234 | 2513 | |
| 2235 | | ROM_START( tnzsjn ) |
| 2514 | ROM_START( tnzsj ) |
| 2236 | 2515 | ROM_REGION( 0x30000, "main", 0 ) /* 64k + bankswitch areas for the first CPU */ |
| 2237 | 2516 | ROM_LOAD( "b53-24.1", 0x00000, 0x08000, CRC(d66824c6) SHA1(fd381ac0dc52ce670c3fde320ea60a209e288a52) ) |
| 2238 | 2517 | ROM_CONTINUE( 0x18000, 0x18000 ) /* banked at 8000-bfff */ |
| r3485 | r3486 | |
| 2257 | 2536 | |
| 2258 | 2537 | /* tnzs - old style PCB sets */ |
| 2259 | 2538 | |
| 2260 | | ROM_START( tnzsj ) |
| 2539 | ROM_START( tnzsjo ) |
| 2261 | 2540 | ROM_REGION( 0x30000, "main", 0 ) /* 64k + bankswitch areas for the first CPU */ |
| 2262 | 2541 | ROM_LOAD( "b53-10.32", 0x00000, 0x08000, CRC(a73745c6) SHA1(73eb38e75e08312d752332f988dc655084b4a86d) ) |
| 2263 | 2542 | ROM_CONTINUE( 0x18000, 0x18000 ) /* banked at 8000-bfff */ |
| r3485 | r3486 | |
| 2308 | 2587 | Kabuki Z |
| 2309 | 2588 | Taito, 1988 |
| 2310 | 2589 | |
| 2311 | | This PCB runs on Taito/Seta hardware and the exact same PCB as The New Zealand Story. |
| 2590 | This PCB runs on Taito/Seta hardware and the exact same newer PCB as The New Zealand Story. |
| 2312 | 2591 | As such, everything here also applies to The New Zealand Story. |
| 2313 | 2592 | |
| 2314 | 2593 | PCB Layout |
| r3485 | r3486 | |
| 2415 | 2694 | GAME( 1987, drtopplu, drtoppel, drtoppel, drtopplu, drtoppel, ROT90, "Taito America Corporation", "Dr. Toppel's Adventure (US)", 0 ) /* Possible region hack */ |
| 2416 | 2695 | GAME( 1987, drtopplj, drtoppel, drtoppel, drtopplu, drtoppel, ROT90, "Taito Corporation", "Dr. Toppel's Tankentai (Japan)", 0 ) |
| 2417 | 2696 | GAME( 1988, kageki, 0, kageki, kageki, kageki, ROT90, "Taito America Corporation (Romstar license)", "Kageki (US)", 0 ) |
| 2418 | | GAME( 1988, kagekij, kageki, kageki, kageki, kageki, ROT90, "Taito Corporation", "Kageki (Japan)", 0 ) |
| 2419 | | GAME( 1992, kagekia, kageki, kageki, kageki, kageki, ROT90, "Taito Corporation", "Kageki (World?, hack)", 0 ) // date is hacked at least, might also be a Japan set hacked to show english |
| 2697 | GAME( 1988, kagekij, kageki, kageki, kagekij, kageki, ROT90, "Taito Corporation", "Kageki (Japan)", 0 ) |
| 2698 | GAME( 1992, kagekih, kageki, kageki, kageki, kageki, ROT90, "Taito Corporation", "Kageki (hack)", 0 ) // date is hacked at least, might also be a Japan set hacked to show english |
| 2420 | 2699 | GAME( 1988, chukatai, 0, tnzs, chukatai, chukatai, ROT0, "Taito Corporation Japan", "Chuka Taisen (World)", 0 ) /* Possible region hack */ |
| 2421 | 2700 | GAME( 1988, chukatau, chukatai, tnzs, chukatau, chukatai, ROT0, "Taito America Corporation", "Chuka Taisen (US)", 0 ) /* Possible region hack */ |
| 2422 | 2701 | GAME( 1988, chukataj, chukatai, tnzs, chukatau, chukatai, ROT0, "Taito Corporation", "Chuka Taisen (Japan)", 0 ) |
| 2423 | | GAME( 1988, tnzs, 0, tnzsb, tnzsb, tnzsb, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, newer) (newer PCB)", 0 ) |
| 2424 | | GAME( 1988, tnzsjn, tnzs, tnzsb, tnzsb, tnzsb, ROT0, "Taito Corporation", "The NewZealand Story (Japan) (newer PCB)", 0 ) |
| 2425 | | GAME( 1988, tnzsj, tnzs, tnzs, tnzs, tnzs, ROT0, "Taito Corporation", "The NewZealand Story (Japan) (older PCB)", 0 ) |
| 2426 | | GAME( 1988, tnzso, tnzs, tnzs, tnzs2, tnzs, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, older) (older PCB)", 0 ) |
| 2702 | GAME( 1988, tnzs, 0, tnzsb, tnzs, tnzsb, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, new version) (newer PCB)", 0 ) |
| 2703 | GAME( 1988, tnzsj, tnzs, tnzsb, tnzsj, tnzsb, ROT0, "Taito Corporation", "The NewZealand Story (Japan, new version) (newer PCB)", 0 ) |
| 2704 | GAME( 1988, tnzsjo, tnzs, tnzs, tnzsjo, tnzs, ROT0, "Taito Corporation", "The NewZealand Story (Japan, old version) (older PCB)", 0 ) |
| 2705 | GAME( 1988, tnzso, tnzs, tnzs, tnzso, tnzs, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, prototype?) (older PCB)", 0 ) |
| 2427 | 2706 | GAME( 1988, kabukiz, 0, kabukiz, kabukiz, kabukiz, ROT0, "Taito Corporation Japan", "Kabuki-Z (World)", 0 ) |
| 2428 | | GAME( 1988, kabukizj, kabukiz, kabukiz, kabukiz, kabukiz, ROT0, "Taito Corporation", "Kabuki-Z (Japan)", 0 ) |
| 2707 | GAME( 1988, kabukizj, kabukiz, kabukiz, kabukizj, kabukiz, ROT0, "Taito Corporation", "Kabuki-Z (Japan)", 0 ) |
| 2429 | 2708 | GAME( 1989, insectx, 0, insectx, insectx, insectx, ROT0, "Taito Corporation Japan", "Insector X (World)", 0 ) |
| 2430 | 2709 | GAME( 1992, jpopnics, 0, jpopnics, jpopnics, 0, ROT0, "Nics", "Jumping Pop (Nics, Korean bootleg of Plump Pop)", GAME_IMPERFECT_GRAPHICS ) |
| 2431 | | |
src/mame/drivers/stv.c
| r3485 | r3486 | |
| 972 | 972 | return 0xffffffff; |
| 973 | 973 | } |
| 974 | 974 | break; |
| 975 | case 5: |
| 976 | switch(port_sel) |
| 977 | { |
| 978 | case 0x77: |
| 979 | { |
| 980 | //popmessage("(PC=%06x) offs 5 %04x %02x",activecpu_get_pc(),port_sel,((ioga[5] & 0xff0000) >> 16)); |
| 981 | logerror("(PC=%06x) offs 5 %04x %02x\n",activecpu_get_pc(),port_sel,((ioga[5] & 0xff0000) >> 16)); |
| 982 | |
| 983 | //stv_workram_h[0x8e830/4] = ((ioga[5] & 0xff0000) >> 16) ^ 0x3; |
| 984 | //stv_workram_h[0x8e834/4] = ((ioga[5] & 0xff0000) >> 16) ^ 0x3; |
| 985 | return (ioga[5] & 0xff0000) >> 16;//stv_workram_h[0x8e830/4];//sound board data |
| 986 | } |
| 987 | default: return 0xffffffff; |
| 988 | } |
| 989 | break; |
| 975 | 990 | case 6: |
| 976 | 991 | switch(port_sel) |
| 977 | 992 | { |
| 978 | 993 | case 0x60: return ioga[5]; |
| 994 | case 0x77: |
| 995 | { |
| 996 | //popmessage("(PC=%06x) offs 6 %04x %02x",activecpu_get_pc(),port_sel,((ioga[5] & 0xff0000) >> 16)); |
| 997 | logerror("(PC=%06x) offs 6 %04x %02x\n",activecpu_get_pc(),port_sel,((ioga[5] & 0xff0000) >> 16)); |
| 998 | return 0;//sound board status,non-zero = processing |
| 999 | } |
| 979 | 1000 | default: |
| 980 | 1001 | //popmessage("offs: 6 %02x",port_sel); |
| 981 | 1002 | return 0xffffffff; |
| r3485 | r3486 | |
| 2499 | 2520 | |
| 2500 | 2521 | GFXDECODE_END |
| 2501 | 2522 | |
| 2502 | | static const sh2_cpu_core sh2_conf_master = { 0 }; |
| 2503 | | static const sh2_cpu_core sh2_conf_slave = { 1 }; |
| 2523 | static const sh2_cpu_core sh2_conf_master = { 0, NULL }; |
| 2524 | static const sh2_cpu_core sh2_conf_slave = { 1, NULL }; |
| 2504 | 2525 | |
| 2505 | 2526 | static int scsp_last_line = 0; |
| 2506 | 2527 | |
| r3485 | r3486 | |
| 2702 | 2723 | |
| 2703 | 2724 | ( add 0x2000000 for real memory map location ) |
| 2704 | 2725 | |
| 2705 | | 0x0000000 - 0x01fffff IC13 Header can be read from here .. |
| 2706 | | 0x0200000 - 0x03fffff IC7 .. or here (some games have both ic7 and ic13 but the header is in ic13 in these cases) |
| 2726 | 0x0000000 - 0x01fffff IC13 Header can be read from here .. IC13 roms are loaded on ODD bytes only |
| 2727 | 0x0200000 - 0x03fffff IC7 Header can also be read from here. If No IC7 is present it seems to mirror IC13, but loaded normally (mausuke) |
| 2707 | 2728 | 0x0400000 - 0x07fffff IC2 |
| 2708 | 2729 | 0x0800000 - 0x0bfffff IC3 |
| 2709 | 2730 | 0x0c00000 - 0x0ffffff IC4 |
| r3485 | r3486 | |
| 2726 | 2747 | STV_BIOS |
| 2727 | 2748 | |
| 2728 | 2749 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 2729 | | ROM_LOAD( "epr20825.13", 0x0000000, 0x0100000, CRC(94a9ad8f) SHA1(861311c14cfa9f560752aa5b023c147a539cf135) ) |
| 2730 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 2731 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 2732 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 2750 | |
| 2751 | ROM_LOAD16_BYTE( "epr20825.13", 0x0000001, 0x0100000, CRC(94a9ad8f) SHA1(861311c14cfa9f560752aa5b023c147a539cf135) ) |
| 2752 | |
| 2733 | 2753 | ROM_LOAD16_WORD_SWAP( "mpr20827.2", 0x0400000, 0x0400000, CRC(65cabbb3) SHA1(5e7cb090101dc42207a4084465e419f4311b6baf) ) // good (was .12) |
| 2734 | 2754 | ROM_LOAD16_WORD_SWAP( "mpr20828.3", 0x0800000, 0x0400000, CRC(3934d44a) SHA1(969406b8bfac43b30f4d732702ca8cffeeefffb9) ) // good (was .13) |
| 2735 | 2755 | ROM_LOAD16_WORD_SWAP( "mpr20829.4", 0x0c00000, 0x0400000, CRC(814308c3) SHA1(45c3f551690224c95acd156ae8f8397667927a04) ) // good (was .14) |
| r3485 | r3486 | |
| 2749 | 2769 | STV_BIOS |
| 2750 | 2770 | |
| 2751 | 2771 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 2752 | | ROM_LOAD( "fpr17969.13", 0x0000000, 0x0100000, CRC(bee327e5) SHA1(1d226db72d6ef68fd294f60659df7f882b25def6) ) |
| 2753 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 2754 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 2755 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 2772 | |
| 2773 | ROM_LOAD16_BYTE( "fpr17969.13", 0x0000001, 0x0100000, CRC(bee327e5) SHA1(1d226db72d6ef68fd294f60659df7f882b25def6) ) |
| 2774 | |
| 2756 | 2775 | ROM_LOAD16_WORD_SWAP( "mpr17970.2", 0x0400000, 0x0400000, CRC(bc4d6f91) SHA1(dcc241dcabea59325decfba3fd5e113c07958422) ) // good |
| 2757 | 2776 | ROM_LOAD16_WORD_SWAP( "mpr17971.3", 0x0800000, 0x0400000, CRC(c780a3b3) SHA1(99587eea528a6413cacc3e4d3d1dbfff57b03dca) ) // good |
| 2758 | 2777 | ROM_LOAD16_WORD_SWAP( "mpr17972.4", 0x0c00000, 0x0400000, CRC(8f29815a) SHA1(e86acd8096f2aee5f5e3ddfd3abb4f5c2b11df66) ) // good |
| r3485 | r3486 | |
| 2763 | 2782 | STV_BIOS |
| 2764 | 2783 | |
| 2765 | 2784 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 2766 | | /* it tests .13 at 0x000000 - 0x1fffff but reports as bad even if we put the rom there */ |
| 2767 | | ROM_LOAD( "fpr19553.13", 0x000000, 0x100000, CRC(d4fb6a5e) SHA1(bd3cfb4f451b6c9612e42af5ddcbffa14f057329) ) |
| 2768 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 2769 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 2770 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 2785 | |
| 2786 | ROM_LOAD16_BYTE( "fpr19553.13", 0x000001, 0x100000, CRC(d4fb6a5e) SHA1(bd3cfb4f451b6c9612e42af5ddcbffa14f057329) ) |
| 2787 | |
| 2771 | 2788 | ROM_LOAD16_WORD_SWAP( "mpr19554.2", 0x400000, 0x400000, CRC(5a3ebcac) SHA1(46e3d1cf515a7ff8a8f97e5050b29dbbeb5060c0) ) // good |
| 2772 | 2789 | ROM_LOAD16_WORD_SWAP( "mpr19555.3", 0x800000, 0x400000, CRC(74f6e6b8) SHA1(8080860550eb770e04447e344fb337748a249761) ) // good |
| 2773 | 2790 | ROM_END |
| r3485 | r3486 | |
| 2805 | 2822 | STV_BIOS |
| 2806 | 2823 | |
| 2807 | 2824 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 2808 | | ROM_LOAD( "epr18967.a", 0x0000000, 0x0100000, CRC(ac59c186) SHA1(7d4924d1e4c1b9257b58a690de988b3f6486e86f) ) |
| 2809 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 2810 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 2811 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 2825 | |
| 2826 | ROM_LOAD16_BYTE( "epr18967a.13", 0x0000001, 0x0100000, CRC(ac59c186) SHA1(7d4924d1e4c1b9257b58a690de988b3f6486e86f) ) |
| 2827 | |
| 2812 | 2828 | ROM_LOAD16_WORD_SWAP( "mpr18968.2", 0x0400000, 0x0400000, CRC(11a891de) SHA1(1a4fa8d7e07e1d8fdc8122ef8a5b93723c007cda) ) // good (was .1) |
| 2813 | 2829 | ROM_LOAD16_WORD_SWAP( "mpr18969.3", 0x0800000, 0x0400000, CRC(199cc47d) SHA1(d78f7c6be7e9b43e208244c5c8722245f4c653e1) ) // good (was .2) |
| 2814 | 2830 | ROM_LOAD16_WORD_SWAP( "mpr18970.4", 0x0c00000, 0x0400000, CRC(8b7a509e) SHA1(8f4d36a858231764ed09b26a1141d1f055eee092) ) // good (was .3) |
| r3485 | r3486 | |
| 2820 | 2836 | STV_BIOS |
| 2821 | 2837 | |
| 2822 | 2838 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 2823 | | ROM_LOAD( "epr18967.13", 0x0000000, 0x0100000, CRC(c0446674) SHA1(4917089d95613c9d2a936ed9fe3ebd22f461aa4f) ) |
| 2824 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 2825 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 2826 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 2839 | |
| 2840 | ROM_LOAD16_BYTE( "epr18967.13", 0x0000001, 0x0100000, CRC(c0446674) SHA1(4917089d95613c9d2a936ed9fe3ebd22f461aa4f) ) |
| 2841 | |
| 2827 | 2842 | ROM_LOAD16_WORD_SWAP( "mpr18968.2", 0x0400000, 0x0400000, CRC(11a891de) SHA1(1a4fa8d7e07e1d8fdc8122ef8a5b93723c007cda) ) // good (was .1) |
| 2828 | 2843 | ROM_LOAD16_WORD_SWAP( "mpr18969.3", 0x0800000, 0x0400000, CRC(199cc47d) SHA1(d78f7c6be7e9b43e208244c5c8722245f4c653e1) ) // good (was .2) |
| 2829 | 2844 | ROM_LOAD16_WORD_SWAP( "mpr18970.4", 0x0c00000, 0x0400000, CRC(8b7a509e) SHA1(8f4d36a858231764ed09b26a1141d1f055eee092) ) // good (was .3) |
| r3485 | r3486 | |
| 2835 | 2850 | STV_BIOS |
| 2836 | 2851 | |
| 2837 | 2852 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 2838 | | ROM_LOAD( "fpr19119.13", 0x0000000, 0x0100000, CRC(de5c4f7c) SHA1(35f670a15e9c86edbe2fe718470f5a75b5b096ac) ) |
| 2839 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 2840 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 2841 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 2853 | |
| 2854 | ROM_LOAD16_BYTE( "fpr19119.13", 0x0000001, 0x0100000, CRC(de5c4f7c) SHA1(35f670a15e9c86edbe2fe718470f5a75b5b096ac) ) |
| 2855 | |
| 2842 | 2856 | ROM_LOAD16_WORD_SWAP( "mpr19115.2", 0x0400000, 0x0400000, CRC(6fe06a30) SHA1(dedb90f800bae8fd9df1023eb5bec7fb6c9d0179) ) // good |
| 2843 | 2857 | ROM_LOAD16_WORD_SWAP( "mpr19116.3", 0x0800000, 0x0400000, CRC(af9e627b) SHA1(a53921c3185a93ec95299bf1c29e744e2fa3b8c0) ) // good |
| 2844 | 2858 | ROM_LOAD16_WORD_SWAP( "mpr19117.4", 0x0c00000, 0x0400000, CRC(74520ff1) SHA1(16c1acf878664b3bd866c9b94f3695ae892ac12f) ) // good |
| r3485 | r3486 | |
| 2849 | 2863 | STV_BIOS |
| 2850 | 2864 | |
| 2851 | 2865 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 2852 | | ROM_LOAD( "fpr19114.13", 0x0000000, 0x0100000, CRC(1fd22a5f) SHA1(c3d9653b12354a73a3e15f23a2ab7992ffb83e46) ) |
| 2853 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 2854 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 2855 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 2866 | |
| 2867 | ROM_LOAD16_BYTE( "fpr19114.13", 0x0000001, 0x0100000, CRC(1fd22a5f) SHA1(c3d9653b12354a73a3e15f23a2ab7992ffb83e46) ) |
| 2868 | |
| 2856 | 2869 | ROM_LOAD16_WORD_SWAP( "mpr19115.2", 0x0400000, 0x0400000, CRC(6fe06a30) SHA1(dedb90f800bae8fd9df1023eb5bec7fb6c9d0179) ) // good |
| 2857 | 2870 | ROM_LOAD16_WORD_SWAP( "mpr19116.3", 0x0800000, 0x0400000, CRC(af9e627b) SHA1(a53921c3185a93ec95299bf1c29e744e2fa3b8c0) ) // good |
| 2858 | 2871 | ROM_LOAD16_WORD_SWAP( "mpr19117.4", 0x0c00000, 0x0400000, CRC(74520ff1) SHA1(16c1acf878664b3bd866c9b94f3695ae892ac12f) ) // good |
| r3485 | r3486 | |
| 2863 | 2876 | STV_BIOS |
| 2864 | 2877 | |
| 2865 | 2878 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 2866 | | ROM_LOAD( "epr18137.13", 0x0000000, 0x0080000, CRC(151aa9bc) SHA1(0959c60f31634816825acb57413838dcddb17d31) ) |
| 2867 | | ROM_RELOAD ( 0x0080000, 0x0080000 ) |
| 2868 | | ROM_RELOAD ( 0x0100000, 0x0080000 ) |
| 2869 | | ROM_RELOAD ( 0x0180000, 0x0080000 ) |
| 2870 | | ROM_RELOAD ( 0x0200000, 0x0080000 ) |
| 2871 | | ROM_RELOAD ( 0x0280000, 0x0080000 ) |
| 2872 | | ROM_RELOAD ( 0x0300000, 0x0080000 ) |
| 2873 | | ROM_RELOAD ( 0x0380000, 0x0080000 ) |
| 2879 | ROM_LOAD16_BYTE( "epr18137.13", 0x0000001, 0x0080000, CRC(151aa9bc) SHA1(0959c60f31634816825acb57413838dcddb17d31) ) |
| 2880 | ROM_RELOAD( 0x100001, 0x0080000 ) |
| 2881 | |
| 2874 | 2882 | ROM_LOAD16_WORD_SWAP( "mpr18138.2", 0x0400000, 0x0400000, CRC(f5567049) SHA1(6eb35e4b5fbda39cf7e8c42b6a568bd53a364d6d) ) // good |
| 2875 | 2883 | ROM_LOAD16_WORD_SWAP( "mpr18139.3", 0x0800000, 0x0400000, CRC(f36b4878) SHA1(e3f63c0046bd37b7ab02fb3865b8ebcf4cf68e75) ) // good |
| 2876 | 2884 | ROM_LOAD16_WORD_SWAP( "mpr18140.4", 0x0c00000, 0x0400000, CRC(228850a0) SHA1(d83f7fa7df08407fa45a13661393679b88800805) ) // good |
| r3485 | r3486 | |
| 2912 | 2920 | STV_BIOS |
| 2913 | 2921 | |
| 2914 | 2922 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 2915 | | ROM_LOAD( "fr18541a.13", 0x0000000, 0x0100000, CRC(8c61a17c) SHA1(a8aef27b53482923a506f7daa4b7a38653b4d8a4) ) //(header is read from here, not ic7 even if both are populated on this board) |
| 2916 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 2917 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 2918 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 2923 | ROM_LOAD16_BYTE( "fr18541a.13", 0x0000001, 0x0100000, CRC(8c61a17c) SHA1(a8aef27b53482923a506f7daa4b7a38653b4d8a4) ) //(header is read from here, not ic7 even if both are populated on this board) |
| 2919 | 2924 | |
| 2920 | 2925 | ROM_LOAD16_WORD_SWAP( "mpr18538.7", 0x0200000, 0x0200000, CRC(7b5230c5) SHA1(70cebc3281580b43adf42c37318e12159c28a13d) ) // good |
| 2921 | 2926 | ROM_LOAD16_WORD_SWAP( "mpr18533.2", 0x0400000, 0x0400000, CRC(7181fe51) SHA1(646f95e1a5b64d721e961352cee6fd5adfd031ec) ) // good |
| r3485 | r3486 | |
| 2933 | 2938 | STV_BIOS |
| 2934 | 2939 | |
| 2935 | 2940 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 2936 | | ROM_LOAD( "epr20424.13", 0x0000000, 0x0100000, CRC(4e61fa46) SHA1(e34624d98cbdf2dd04d997167d3c4decd2f208f7) ) //(header is read from here, not ic7 even if both are populated on this board) |
| 2937 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 2941 | ROM_LOAD16_BYTE( "epr20424.13", 0x0000001, 0x0100000, CRC(4e61fa46) SHA1(e34624d98cbdf2dd04d997167d3c4decd2f208f7) ) //(header is read from here, not ic7 even if both are populated on this board) |
| 2938 | 2942 | |
| 2939 | 2943 | ROM_LOAD16_WORD_SWAP( "mpr20431.7", 0x0200000, 0x0200000, CRC(ea656ced) SHA1(b2d6286081bd46a89d1284a2757b87d0bca1bbde) ) // good |
| 2940 | 2944 | ROM_LOAD16_WORD_SWAP( "mpr20426.2", 0x0400000, 0x0400000, CRC(897d1747) SHA1(f3fb2c4ef8bc2c1658907e822f2ee2b88582afdd) ) // good |
| r3485 | r3486 | |
| 2954 | 2958 | STV_BIOS |
| 2955 | 2959 | |
| 2956 | 2960 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 2957 | | ROM_LOAD( "finlarch.13", 0x0000000, 0x0100000, CRC(4505fa9e) SHA1(96c6399146cf9c8f1d27a8fb6a265f937258004a) ) |
| 2958 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 2959 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 2960 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 2961 | ROM_LOAD16_BYTE( "finlarch.13", 0x0000001, 0x0100000, CRC(4505fa9e) SHA1(96c6399146cf9c8f1d27a8fb6a265f937258004a) ) |
| 2962 | |
| 2961 | 2963 | ROM_LOAD16_WORD_SWAP( "mpr18257.2", 0x0400000, 0x0400000, CRC(137fdf55) SHA1(07a02fe531b3707e063498f5bc9749bd1b4cadb3) ) // good |
| 2962 | 2964 | ROM_RELOAD( 0x1400000, 0x0400000 ) |
| 2963 | 2965 | ROM_LOAD16_WORD_SWAP( "mpr18258.3", 0x0800000, 0x0400000, CRC(f519c505) SHA1(5cad39314e46b98c24a71f1c2c10c682ef3bdcf3) ) // good |
| r3485 | r3486 | |
| 2973 | 2975 | STV_BIOS |
| 2974 | 2976 | |
| 2975 | 2977 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 2976 | | ROM_LOAD( "epr17766.13", 0x0000000, 0x0080000, CRC(a83fcd62) SHA1(4ce77ebaa0e93c6553ad8f7fb87cbdc32433402b) ) |
| 2977 | | ROM_RELOAD ( 0x0080000, 0x0080000 ) |
| 2978 | | ROM_RELOAD ( 0x0100000, 0x0080000 ) |
| 2979 | | ROM_RELOAD ( 0x0180000, 0x0080000 ) |
| 2980 | | ROM_RELOAD ( 0x0200000, 0x0080000 ) |
| 2981 | | ROM_RELOAD ( 0x0280000, 0x0080000 ) |
| 2982 | | ROM_RELOAD ( 0x0300000, 0x0080000 ) |
| 2983 | | ROM_RELOAD ( 0x0380000, 0x0080000 ) |
| 2978 | ROM_LOAD16_BYTE( "epr17766.13", 0x0000001, 0x0080000, CRC(a83fcd62) SHA1(4ce77ebaa0e93c6553ad8f7fb87cbdc32433402b) ) |
| 2979 | ROM_RELOAD( 0x0100001, 0x0080000 ) |
| 2980 | |
| 2984 | 2981 | ROM_LOAD16_WORD_SWAP( "mpr17768.2", 0x0400000, 0x0400000, CRC(d6808a7d) SHA1(83a97bbe1160cb45b3bdcbde8adc0d9bae5ded60) ) // good |
| 2985 | 2982 | ROM_LOAD16_WORD_SWAP( "mpr17769.3", 0x0800000, 0x0400000, CRC(3471dd35) SHA1(24febddfe70984cebc0e6948ad718e0e6957fa82) ) // good |
| 2986 | 2983 | ROM_LOAD16_WORD_SWAP( "mpr17770.4", 0x0c00000, 0x0400000, CRC(06978a00) SHA1(a8d1333a9f4322e28b23724937f595805315b136) ) // good |
| r3485 | r3486 | |
| 3041 | 3038 | STV_BIOS |
| 3042 | 3039 | |
| 3043 | 3040 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3044 | | ROM_LOAD( "epr18937.13", 0x0000000, 0x0080000, CRC(1f40d766) SHA1(35d9751c1b23cfbf448f2a9e9cf3b121929368ae) ) |
| 3045 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3046 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3047 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3041 | ROM_LOAD16_BYTE( "epr18937.13", 0x0000001, 0x0080000, CRC(1f40d766) SHA1(35d9751c1b23cfbf448f2a9e9cf3b121929368ae) ) |
| 3042 | ROM_RELOAD( 0x0100001, 0x0080000) |
| 3043 | |
| 3048 | 3044 | ROM_LOAD16_WORD_SWAP( "mpr18944.7", 0x0200000, 0x0100000, CRC(f7f75ce5) SHA1(0787ece9f89cc1847889adbf08ba5d3ccbc405de) ) // good |
| 3049 | 3045 | ROM_LOAD16_WORD_SWAP( "mpr18939.2", 0x0400000, 0x0400000, CRC(ef95a6e6) SHA1(3026c52ad542997d5b0e621b389c0e01240cb486) ) // good |
| 3050 | 3046 | ROM_LOAD16_WORD_SWAP( "mpr18940.3", 0x0800000, 0x0400000, CRC(cabab4cd) SHA1(b251609573c4b0ccc933188f32226855b25fd9da) ) // good |
| r3485 | r3486 | |
| 3059 | 3055 | STV_BIOS |
| 3060 | 3056 | |
| 3061 | 3057 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3062 | | ROM_LOAD( "epr18737.13", 0x0000000, 0x0080000, CRC(cfad6c49) SHA1(fc69980a351ed13307706db506c79c774eabeb66) ) // bad |
| 3063 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3064 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3065 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3058 | ROM_LOAD16_BYTE( "epr18737.13", 0x0000001, 0x0080000, CRC(cfad6c49) SHA1(fc69980a351ed13307706db506c79c774eabeb66) ) // bad |
| 3059 | ROM_RELOAD( 0x0100001, 0x0080000) |
| 3060 | |
| 3066 | 3061 | ROM_LOAD16_WORD_SWAP( "mpr18738.2", 0x0400000, 0x0400000, CRC(4b3c175a) SHA1(b6d2438ae1d3d51950a7ed1eaadf2dae45c4e7b1) ) // good |
| 3067 | 3062 | ROM_LOAD16_WORD_SWAP( "mpr18739.3", 0x0800000, 0x0400000, CRC(eb41fa67) SHA1(d12acebb1df9eafd17aff1841087f5017225e7e7) ) // good |
| 3068 | 3063 | ROM_LOAD16_WORD_SWAP( "mpr18740.4", 0x0c00000, 0x0200000, CRC(9ca7962f) SHA1(a09e0db2246b34ca7efa3165afbc5ba292a95398) ) // good |
| r3485 | r3486 | |
| 3072 | 3067 | STV_BIOS |
| 3073 | 3068 | |
| 3074 | 3069 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3075 | | ROM_LOAD( "epr20416.13", 0x0000000, 0x0100000, CRC(8bf0176d) SHA1(5bd468e2ffed042ee84e2ceb8712ff5883a1d824) ) // bad |
| 3076 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3077 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3078 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3070 | ROM_LOAD16_BYTE( "epr20416.13", 0x0000001, 0x0100000, CRC(8bf0176d) SHA1(5bd468e2ffed042ee84e2ceb8712ff5883a1d824) ) // bad |
| 3071 | |
| 3079 | 3072 | ROM_LOAD16_WORD_SWAP( "mpr20417.2", 0x0400000, 0x0400000, CRC(636c2a08) SHA1(47986b71d68f6a1852e4e2b03ca7b6e48e83718b) ) // good |
| 3080 | 3073 | ROM_LOAD16_WORD_SWAP( "mpr20418.3", 0x0800000, 0x0400000, CRC(3f0d9e34) SHA1(2ec81e40ebf689d17b6421820bfb0a1280a8ef25) ) // good |
| 3081 | 3074 | ROM_LOAD16_WORD_SWAP( "mpr20419.4", 0x0c00000, 0x0400000, CRC(ec969815) SHA1(b59782174051f5717b06f43e57dd8a2a6910d95f) ) // good |
| r3485 | r3486 | |
| 3118 | 3111 | STV_BIOS |
| 3119 | 3112 | |
| 3120 | 3113 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3121 | | ROM_LOAD( "epr18852.13", 0x0000000, 0x0080000, CRC(d12414ec) SHA1(0f42ec9e41983781b6892622b00398a102072aa7) ) // bad |
| 3122 | | ROM_RELOAD ( 0x0080000, 0x0080000 ) |
| 3123 | | ROM_RELOAD ( 0x0100000, 0x0080000 ) |
| 3124 | | ROM_RELOAD ( 0x0180000, 0x0080000 ) |
| 3125 | | ROM_RELOAD ( 0x0200000, 0x0080000 ) |
| 3126 | | ROM_RELOAD ( 0x0280000, 0x0080000 ) |
| 3127 | | ROM_RELOAD ( 0x0300000, 0x0080000 ) |
| 3128 | | ROM_RELOAD ( 0x0380000, 0x0080000 ) |
| 3114 | ROM_LOAD16_BYTE( "epr18852.13", 0x0000001, 0x0080000, CRC(d12414ec) SHA1(0f42ec9e41983781b6892622b00398a102072aa7) ) // bad |
| 3115 | ROM_RELOAD ( 0x0100001, 0x0080000 ) |
| 3116 | |
| 3129 | 3117 | ROM_LOAD16_WORD_SWAP( "mpr18853.2", 0x0400000, 0x0400000, CRC(b9268c97) SHA1(8734e3f0e6b2849d173e3acc9d0308084a4e84fd) ) // good |
| 3130 | 3118 | ROM_LOAD16_WORD_SWAP( "mpr18854.3", 0x0800000, 0x0400000, CRC(3113c8bc) SHA1(4e4600646ddd1978988d27430ffdf0d1d405b804) ) // good |
| 3131 | 3119 | ROM_LOAD16_WORD_SWAP( "mpr18855.4", 0x0c00000, 0x0400000, CRC(daf6ad0c) SHA1(2a14a6a42e4eb68abb7a427e43062dfde2d13c5c) ) // good |
| r3485 | r3486 | |
| 3148 | 3136 | STV_BIOS |
| 3149 | 3137 | |
| 3150 | 3138 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3151 | | ROM_LOAD( "epr19531.13", 0x0000000, 0x0080000, CRC(ac81024f) SHA1(b22c7c1798fade7ae992ff83b138dd23e6292d3f) ) // bad |
| 3152 | | ROM_RELOAD ( 0x0080000, 0x0080000 ) |
| 3153 | | ROM_RELOAD ( 0x0100000, 0x0080000 ) |
| 3154 | | ROM_RELOAD ( 0x0180000, 0x0080000 ) |
| 3155 | | ROM_RELOAD ( 0x0200000, 0x0080000 ) |
| 3156 | | ROM_RELOAD ( 0x0280000, 0x0080000 ) |
| 3157 | | ROM_RELOAD ( 0x0300000, 0x0080000 ) |
| 3158 | | ROM_RELOAD ( 0x0380000, 0x0080000 ) |
| 3139 | ROM_LOAD16_BYTE( "epr19531.13", 0x0000001, 0x0080000, CRC(ac81024f) SHA1(b22c7c1798fade7ae992ff83b138dd23e6292d3f) ) // bad |
| 3140 | ROM_RELOAD ( 0x0100001, 0x0080000 ) |
| 3141 | |
| 3159 | 3142 | ROM_LOAD16_WORD_SWAP( "mpr19533.2", 0x0400000, 0x0400000, CRC(17ec54ba) SHA1(d4cdc86926519291cc78980ec513e1cfc677e76e) ) // good |
| 3160 | 3143 | ROM_LOAD16_WORD_SWAP( "mpr19534.3", 0x0800000, 0x0400000, CRC(820e4781) SHA1(7ea5626ad4e1929a5ec28a99ec12bc364df8f70d) ) // good |
| 3161 | 3144 | ROM_LOAD16_WORD_SWAP( "mpr19535.4", 0x0c00000, 0x0400000, CRC(94fadfa4) SHA1(a7d0727cf601e00f1ea31e6bf3e591349c3f6030) ) // good |
| r3485 | r3486 | |
| 3184 | 3167 | STV_BIOS |
| 3185 | 3168 | |
| 3186 | 3169 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3187 | | ROM_LOAD( "sando-r.13", 0x0000000, 0x0100000, CRC(fe63a239) SHA1(01502d4494f968443581cd2c74f25967d41f775e) ) |
| 3188 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3189 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3190 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3170 | ROM_LOAD16_BYTE( "sando-r.13", 0x0000001, 0x0100000, CRC(fe63a239) SHA1(01502d4494f968443581cd2c74f25967d41f775e) ) |
| 3171 | |
| 3191 | 3172 | ROM_LOAD16_WORD_SWAP( "mpr18635.8", 0x1c00000, 0x0400000, CRC(441e1368) SHA1(acb2a7e8d44c2203b8d3c7a7b70e20ffb120bebf) ) // good |
| 3192 | 3173 | ROM_RELOAD( 0x0400000, 0x0400000 ) |
| 3193 | 3174 | ROM_LOAD16_WORD_SWAP( "mpr18636.9", 0x2000000, 0x0400000, CRC(fff1dd80) SHA1(36b8e1526a4370ae33fd4671850faf51c448bca4) ) // good |
| r3485 | r3486 | |
| 3251 | 3232 | STV_BIOS |
| 3252 | 3233 | |
| 3253 | 3234 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3254 | | ROM_LOAD( "ic11", 0x0000000, 0x0200000, CRC(9abae8d4) SHA1(ddbe4c8fff8fa59d63e278e95f245145d2da8aeb) ) |
| 3255 | | ROM_RELOAD ( 0x0100000, 0x0200000 ) |
| 3256 | | ROM_RELOAD ( 0x0200000, 0x0200000 ) |
| 3257 | | ROM_RELOAD ( 0x0300000, 0x0200000 ) |
| 3235 | ROM_LOAD16_BYTE( "ic11", 0x0000001, 0x0200000, CRC(9abae8d4) SHA1(ddbe4c8fff8fa59d63e278e95f245145d2da8aeb) ) |
| 3258 | 3236 | |
| 3259 | 3237 | ROM_LOAD( "ic13", 0x0400000, 0x0200000, CRC(f72c1d13) SHA1(a2b168d187034024b83fbbe2f5eec78816285da9) ) // ic2 good |
| 3260 | 3238 | ROM_LOAD( "ic14", 0x0600000, 0x0200000, CRC(bcd72105) SHA1(fb88a1f2589fef5d9845027646259ec8e781771b) ) // ic2 good |
| r3485 | r3486 | |
| 3274 | 3252 | STV_BIOS |
| 3275 | 3253 | |
| 3276 | 3254 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3277 | | ROM_LOAD( "epr20542.13", 0x0000000, 0x0100000, CRC(0e632db5) SHA1(9bc52794892eec22d381387d13a0388042e30714) ) |
| 3278 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3279 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3280 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3255 | ROM_LOAD16_BYTE( "epr20542.13", 0x0000001, 0x0100000, CRC(0e632db5) SHA1(9bc52794892eec22d381387d13a0388042e30714) ) |
| 3256 | |
| 3281 | 3257 | ROM_LOAD16_WORD_SWAP( "mpr20544.2", 0x0400000, 0x0400000, CRC(661fff5e) SHA1(41f4ddda7adf004b52cc9a076606a60f31947d19) ) // good |
| 3282 | 3258 | ROM_LOAD16_WORD_SWAP( "mpr20545.3", 0x0800000, 0x0400000, CRC(8e3a37be) SHA1(a3227cdc4f03bb088e7f9aed225b238da3283e01) ) // good |
| 3283 | 3259 | ROM_LOAD16_WORD_SWAP( "mpr20546.4", 0x0c00000, 0x0400000, CRC(72020886) SHA1(e80bdeb11b726eb23f2283950d65d55e31a5672e) ) // good |
| r3485 | r3486 | |
| 3291 | 3267 | STV_BIOS |
| 3292 | 3268 | |
| 3293 | 3269 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3294 | | ROM_LOAD( "seabassf.13", 0x0000000, 0x0100000, CRC(6d7c39cc) SHA1(d9d1663134420b75c65ee07d7d547254785f2f83) ) |
| 3295 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3296 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3297 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3270 | ROM_LOAD16_BYTE( "seabassf.13", 0x0000001, 0x0100000, CRC(6d7c39cc) SHA1(d9d1663134420b75c65ee07d7d547254785f2f83) ) |
| 3271 | |
| 3298 | 3272 | ROM_LOAD16_WORD_SWAP( "mpr20551.2", 0x0400000, 0x0400000, CRC(9a0c6dd8) SHA1(26600372cc673ce3678945f4b5dc4e3ab31643a4) ) // good |
| 3299 | 3273 | ROM_LOAD16_WORD_SWAP( "mpr20552.3", 0x0800000, 0x0400000, CRC(5f46b0aa) SHA1(1aa576b15971c0ffb4e08d4802246841b31b6f35) ) // good |
| 3300 | 3274 | ROM_LOAD16_WORD_SWAP( "mpr20553.4", 0x0c00000, 0x0400000, CRC(c0f8a6b6) SHA1(2038b9231a950450267be0db24b31d8035db79ad) ) // good |
| r3485 | r3486 | |
| 3328 | 3302 | STV_BIOS |
| 3329 | 3303 | |
| 3330 | 3304 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3331 | | ROM_LOAD( "epr18777.13", 0x0000000, 0x0080000, CRC(8d180866) SHA1(d47ebabab6e06400312d39f68cd818852e496b96) ) |
| 3332 | | ROM_RELOAD ( 0x0080000, 0x0080000 ) |
| 3333 | | ROM_RELOAD ( 0x0100000, 0x0080000 ) |
| 3334 | | ROM_RELOAD ( 0x0180000, 0x0080000 ) |
| 3335 | | ROM_RELOAD ( 0x0200000, 0x0080000 ) |
| 3336 | | ROM_RELOAD ( 0x0280000, 0x0080000 ) |
| 3337 | | ROM_RELOAD ( 0x0300000, 0x0080000 ) |
| 3338 | | ROM_RELOAD ( 0x0380000, 0x0080000 ) |
| 3305 | ROM_LOAD16_BYTE( "epr18777.13", 0x0000001, 0x0080000, CRC(8d180866) SHA1(d47ebabab6e06400312d39f68cd818852e496b96) ) |
| 3306 | ROM_RELOAD ( 0x0100001, 0x0080000 ) |
| 3307 | |
| 3339 | 3308 | ROM_LOAD16_WORD_SWAP( "mpr18778.8", 0x1c00000, 0x0400000, CRC(25e1300e) SHA1(64f3843f62cee34a47244ad5ee78fb2aa35289e3) ) // good |
| 3340 | 3309 | ROM_LOAD16_WORD_SWAP( "mpr18779.9", 0x2000000, 0x0400000, CRC(51e2fabd) SHA1(3aa361149af516f16d7d422596ee82014a183c2b) ) // good |
| 3341 | 3310 | ROM_LOAD16_WORD_SWAP( "mpr18780.10", 0x2400000, 0x0400000, CRC(8cd4dd74) SHA1(9ffec1280b3965d52f643894bdfecdd792028191) ) // good |
| r3485 | r3486 | |
| 3347 | 3316 | STV_BIOS |
| 3348 | 3317 | |
| 3349 | 3318 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3350 | | ROM_LOAD( "fpr19188.13", 0x0000000, 0x0100000, CRC(45a27e32) SHA1(96e1bab8bdadf7071afac2a0a6dd8fd8989f12a6) ) |
| 3351 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3352 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3353 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3319 | ROM_LOAD16_BYTE( "fpr19188.13", 0x0000001, 0x0100000, CRC(45a27e32) SHA1(96e1bab8bdadf7071afac2a0a6dd8fd8989f12a6) ) |
| 3320 | |
| 3354 | 3321 | ROM_LOAD16_WORD_SWAP( "mpr19189.2", 0x0400000, 0x0400000, CRC(0b202a3e) SHA1(6691b5af2cacd6092ec03886b78c2565953fa297) ) // good |
| 3355 | 3322 | ROM_LOAD16_WORD_SWAP( "mpr19190.3", 0x0800000, 0x0400000, CRC(1777ded8) SHA1(dd332ac79f0a6d82b6bde35b795b2845003dd1a5) ) // good |
| 3356 | 3323 | ROM_LOAD16_WORD_SWAP( "mpr19191.4", 0x0c00000, 0x0400000, CRC(ec6eb07b) SHA1(01fe4832ece8638ea6f4060099d9105fe8092c88) ) // good |
| r3485 | r3486 | |
| 3362 | 3329 | STV_BIOS |
| 3363 | 3330 | |
| 3364 | 3331 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3365 | | ROM_LOAD( "epr21488.13", 0x0000000, 0x0080000, CRC(71c9def1) SHA1(a544a0b4046307172d2c1bf426ed24845f87d894) ) |
| 3366 | | ROM_RELOAD ( 0x0080000, 0x0080000 ) |
| 3367 | | ROM_RELOAD ( 0x0100000, 0x0080000 ) |
| 3368 | | ROM_RELOAD ( 0x0180000, 0x0080000 ) |
| 3369 | | ROM_RELOAD ( 0x0200000, 0x0080000 ) |
| 3370 | | ROM_RELOAD ( 0x0280000, 0x0080000 ) |
| 3371 | | ROM_RELOAD ( 0x0300000, 0x0080000 ) |
| 3372 | | ROM_RELOAD ( 0x0380000, 0x0080000 ) |
| 3332 | ROM_LOAD16_BYTE( "epr21488.13", 0x0000001, 0x0080000, CRC(71c9def1) SHA1(a544a0b4046307172d2c1bf426ed24845f87d894) ) |
| 3333 | ROM_RELOAD ( 0x0100001, 0x0080000 ) |
| 3334 | |
| 3373 | 3335 | ROM_LOAD16_WORD_SWAP( "mpr21489.2", 0x0400000, 0x0400000, CRC(4c85152b) SHA1(78f2f1c31718d5bf631d8813daf9a11ea2a0e451) ) // ic2 good (was .12) |
| 3374 | 3336 | ROM_LOAD16_WORD_SWAP( "mpr21490.3", 0x0800000, 0x0400000, CRC(03da67f8) SHA1(02f9ba7549ca552291dc0ff1b631103015838bba) ) // ic3 good (was .13) |
| 3375 | 3337 | ROM_LOAD16_WORD_SWAP( "mpr21491.4", 0x0c00000, 0x0400000, CRC(cf7ee784) SHA1(af823df2d60d8ef3d17628b95a04136b807ca095) ) // ic4 good (was .14) |
| r3485 | r3486 | |
| 3381 | 3343 | STV_BIOS |
| 3382 | 3344 | |
| 3383 | 3345 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3384 | | ROM_LOAD( "fpr17834.13", 0x0000000, 0x0100000, CRC(746ef686) SHA1(e31c317991a687662a8a2a45aed411001e5f1941) ) |
| 3385 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3386 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3387 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3346 | ROM_LOAD16_BYTE( "fpr17834.13", 0x0000001, 0x0100000, CRC(746ef686) SHA1(e31c317991a687662a8a2a45aed411001e5f1941) ) |
| 3347 | |
| 3388 | 3348 | ROM_LOAD16_WORD_SWAP( "mpr17836.2", 0x0400000, 0x0400000, CRC(55e9642d) SHA1(5198291cd1dce0398eb47760db2c19eae99273b0) ) // good |
| 3389 | 3349 | ROM_LOAD16_WORD_SWAP( "mpr17837.3", 0x0800000, 0x0400000, CRC(13d1e667) SHA1(cd513ceb33cc20032090113b61227638cf3b3998) ) // good |
| 3390 | 3350 | ROM_LOAD16_WORD_SWAP( "mpr17838.4", 0x0c00000, 0x0400000, CRC(f9e70032) SHA1(8efdbcce01bdf77acfdb293545c59bf224a9c7d2) ) // good |
| r3485 | r3486 | |
| 3399 | 3359 | STV_BIOS |
| 3400 | 3360 | |
| 3401 | 3361 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3402 | | ROM_LOAD( "epr20819.13", 0x0000000, 0x0100000, CRC(d930dfc8) SHA1(f66cc955181720661a0334fe67fa5750ddf9758b) ) |
| 3403 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3404 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3405 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3362 | ROM_LOAD16_BYTE( "epr20819.13", 0x0000001, 0x0100000, CRC(d930dfc8) SHA1(f66cc955181720661a0334fe67fa5750ddf9758b) ) |
| 3363 | |
| 3406 | 3364 | ROM_LOAD16_WORD_SWAP( "mpr20821.2", 0x0400000, 0x0400000, CRC(2d930d23) SHA1(5fcaf4257f3639cb3aa407d2936f616499a09d97) ) // ic2 good (was .12) |
| 3407 | 3365 | ROM_LOAD16_WORD_SWAP( "mpr20822.3", 0x0800000, 0x0400000, CRC(8b33a5e2) SHA1(d5689ac8aad63509febe9aa4077351be09b2d8d4) ) // ic3 good (was .13) |
| 3408 | 3366 | ROM_LOAD16_WORD_SWAP( "mpr20823.4", 0x0c00000, 0x0400000, CRC(6e6d4e95) SHA1(c387d03ba27580c62ac0bf780915fdf41552df6f) ) // ic4 good (was .14) |
| r3485 | r3486 | |
| 3413 | 3371 | STV_BIOS |
| 3414 | 3372 | |
| 3415 | 3373 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3416 | | ROM_LOAD( "fpr18914.13", 0x0000000, 0x0100000, CRC(cd35730a) SHA1(645b52b449766beb740ab8f99957f8f431351ceb) ) |
| 3417 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3418 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3419 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3374 | ROM_LOAD16_BYTE( "fpr18914.13", 0x0000001, 0x0100000, CRC(cd35730a) SHA1(645b52b449766beb740ab8f99957f8f431351ceb) ) |
| 3375 | |
| 3420 | 3376 | ROM_LOAD16_WORD_SWAP( "mpr18916.4", 0x0c00000, 0x0400000, CRC(4aae3ddb) SHA1(b75479e73f1bce3f0c27fbd90820fa51eb1914a6) ) // good |
| 3421 | 3377 | ROM_LOAD16_WORD_SWAP( "mpr18917.5", 0x1000000, 0x0400000, CRC(edf6edc3) SHA1(478e958f4f10a8126a00c83feca4a55ad6c25503) ) // good |
| 3422 | 3378 | ROM_LOAD16_WORD_SWAP( "mpr18918.6", 0x1400000, 0x0400000, CRC(d3a95036) SHA1(e300bbbb71fb06027dc539c9bbb12946770ffc95) ) // good |
| r3485 | r3486 | |
| 3432 | 3388 | STV_BIOS |
| 3433 | 3389 | |
| 3434 | 3390 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3435 | | ROM_LOAD( "epr17944.13", 0x0000000, 0x0100000, CRC(a5bdc560) SHA1(d3830480a611b7d88760c672ce46a2ea74076487) ) |
| 3436 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3437 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3438 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3391 | ROM_LOAD16_BYTE( "epr17944.13", 0x0000001, 0x0100000, CRC(a5bdc560) SHA1(d3830480a611b7d88760c672ce46a2ea74076487) ) |
| 3392 | |
| 3439 | 3393 | ROM_LOAD16_WORD_SWAP( "mpr17946.2", 0x0400000, 0x0400000, CRC(4cb245f7) SHA1(363d9936b27043b5858c956a45736ac05aefc54e) ) // good |
| 3440 | 3394 | ROM_LOAD16_WORD_SWAP( "mpr17947.3", 0x0800000, 0x0400000, CRC(fef4a9fb) SHA1(1b4bd095962db769da17d3644df10f62d041e914) ) // good |
| 3441 | 3395 | ROM_LOAD16_WORD_SWAP( "mpr17948.4", 0x0c00000, 0x0400000, CRC(3e2b251a) SHA1(be6191c18727d7cbc6399fd4c1aaae59304af30c) ) // good |
| r3485 | r3486 | |
| 3464 | 3418 | STV_BIOS |
| 3465 | 3419 | |
| 3466 | 3420 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3467 | | ROM_LOAD( "fpr20108.13", 0x0000000, 0x0100000, CRC(1ef9ced0) SHA1(abc90ce341cd17bb77349d611d6879389611f0bf) ) // bad |
| 3468 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3469 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3470 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3421 | ROM_LOAD16_BYTE( "fpr20108.13", 0x0000001, 0x0100000, CRC(1ef9ced0) SHA1(abc90ce341cd17bb77349d611d6879389611f0bf) ) // bad |
| 3422 | |
| 3471 | 3423 | ROM_LOAD16_WORD_SWAP( "mpr20110.2", 0x0400000, 0x0400000, CRC(238ef832) SHA1(20fade5730ff8e249a1450c41bfdff6e133f4768) ) // good |
| 3472 | 3424 | ROM_LOAD16_WORD_SWAP( "mpr20111.3", 0x0800000, 0x0400000, CRC(b0a86f69) SHA1(e66427f70413ad43fccc38423962c5eeda01094f) ) // good |
| 3473 | 3425 | ROM_LOAD16_WORD_SWAP( "mpr20112.4", 0x0c00000, 0x0400000, CRC(3ba2b49b) SHA1(5ad154a8b774075479d791e29cbaf221d47557fc) ) // good |
| r3485 | r3486 | |
| 3481 | 3433 | STV_BIOS |
| 3482 | 3434 | |
| 3483 | 3435 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3484 | | ROM_LOAD( "epr20398.13", 0x0000000, 0x0100000, CRC(3fb56a0b) SHA1(13c2fa2d94b106d39e46f71d15fbce3607a5965a) ) // bad |
| 3485 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3486 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3487 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3436 | ROM_LOAD16_BYTE( "epr20398.13", 0x0000001, 0x0100000, CRC(3fb56a0b) SHA1(13c2fa2d94b106d39e46f71d15fbce3607a5965a) ) // bad |
| 3437 | |
| 3488 | 3438 | ROM_LOAD16_WORD_SWAP( "mpr20400.2", 0x0400000, 0x0400000, CRC(1edfbe05) SHA1(b0edd3f3d57408101ae6eb0aec742afbb4d289ca) ) // good |
| 3489 | 3439 | ROM_LOAD16_WORD_SWAP( "mpr20401.3", 0x0800000, 0x0400000, CRC(99e98937) SHA1(e1b4d12a0b4d0fe97a62fcc085e19cce77657c99) ) // good |
| 3490 | 3440 | ROM_LOAD16_WORD_SWAP( "mpr20402.4", 0x0c00000, 0x0400000, CRC(4572aa60) SHA1(8b2d76ea8c6e2f472c6ee7c9b6ad6e80e6a1a85a) ) // good |
| r3485 | r3486 | |
| 3512 | 3462 | STV_BIOS |
| 3513 | 3463 | |
| 3514 | 3464 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3515 | | ROM_LOAD( "ic13.bin", 0x0000000, 0x0100000, CRC(b456f4cd) SHA1(91cbe703ec7c1dd45eb3b05bdfeb06e3570599d1) ) |
| 3516 | | /* mirroring is essential on this one */ |
| 3517 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3518 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3519 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3465 | ROM_LOAD16_BYTE( "ic13.bin", 0x0000001, 0x0100000, CRC(b456f4cd) SHA1(91cbe703ec7c1dd45eb3b05bdfeb06e3570599d1) ) |
| 3466 | ROM_RELOAD_PLAIN ( 0x0200000, 0x0100000 ) // needs the rom mapped here to appear 'normal' |
| 3467 | ROM_RELOAD_PLAIN ( 0x0300000, 0x0100000 ) |
| 3520 | 3468 | |
| 3521 | 3469 | ROM_LOAD16_WORD_SWAP( "mcj-00.2", 0x0400000, 0x0200000, CRC(4eeacd6f) SHA1(104ca230f22cd11cc536b34abd482e54791b4d0f) )// good |
| 3522 | 3470 | ROM_LOAD16_WORD_SWAP( "mcj-01.3", 0x0800000, 0x0200000, CRC(365a494b) SHA1(29713dfc83a9ade63ebcc7994d14cd785c4500b9) )// good |
| r3485 | r3486 | |
| 3576 | 3524 | STV_BIOS |
| 3577 | 3525 | |
| 3578 | 3526 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3579 | | ROM_LOAD( "epr-18821.ic13", 0x0000000, 0x0080000, CRC(9a6658e2) SHA1(16dbae3d9ab584713afcb403f89fe71049609245) ) |
| 3580 | | ROM_RELOAD ( 0x0080000, 0x0080000 ) |
| 3581 | | ROM_RELOAD ( 0x0100000, 0x0080000 ) |
| 3582 | | ROM_RELOAD ( 0x0180000, 0x0080000 ) |
| 3583 | | ROM_RELOAD ( 0x0200000, 0x0080000 ) |
| 3584 | | ROM_RELOAD ( 0x0280000, 0x0080000 ) |
| 3585 | | ROM_RELOAD ( 0x0300000, 0x0080000 ) |
| 3586 | | ROM_RELOAD ( 0x0380000, 0x0080000 ) |
| 3527 | ROM_LOAD16_BYTE( "epr-18821.ic13", 0x0000001, 0x0080000, CRC(9a6658e2) SHA1(16dbae3d9ab584713afcb403f89fe71049609245) ) |
| 3528 | ROM_RELOAD ( 0x0100001, 0x0080000 ) |
| 3529 | |
| 3587 | 3530 | // ROM_LOAD16_WORD_SWAP( "mpr17946.2", 0x0400000, 0x0400000, CRC(4cb245f7) SHA1(363d9936b27043b5858c956a45736ac05aefc54e) ) // good |
| 3588 | 3531 | // ROM_LOAD16_WORD_SWAP( "mpr17947.3", 0x0800000, 0x0400000, CRC(fef4a9fb) SHA1(1b4bd095962db769da17d3644df10f62d041e914) ) // good |
| 3589 | 3532 | // ROM_LOAD16_WORD_SWAP( "mpr17948.4", 0x0c00000, 0x0400000, CRC(3e2b251a) SHA1(be6191c18727d7cbc6399fd4c1aaae59304af30c) ) // good |
| r3485 | r3486 | |
| 3621 | 3564 | ROM_COPY( "main",0,0,0x080000) |
| 3622 | 3565 | |
| 3623 | 3566 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3624 | | ROM_LOAD( "epr18344.a", 0x0000000, 0x0100000, CRC(5a7de018) SHA1(88e0c2a9a9d4ebf699878c0aa9737af85f95ccf8) ) |
| 3625 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3626 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3627 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3567 | ROM_LOAD16_BYTE( "epr18344.a", 0x0000001, 0x0100000, CRC(5a7de018) SHA1(88e0c2a9a9d4ebf699878c0aa9737af85f95ccf8) ) |
| 3568 | |
| 3628 | 3569 | ROM_LOAD16_WORD_SWAP( "mpr18273.ic2", 0x0400000, 0x0200000, NO_DUMP ) |
| 3629 | 3570 | ROM_LOAD16_WORD_SWAP( "mpr18274.ic3", 0x0800000, 0x0200000, NO_DUMP ) |
| 3630 | 3571 | |
| r3485 | r3486 | |
| 3637 | 3578 | STV_BIOS |
| 3638 | 3579 | |
| 3639 | 3580 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3640 | | ROM_LOAD( "flash.ic13", 0x0000000, 0x0100000, CRC(e6f0aca0) SHA1(251d4d9c5a332d13af3a144c5eb9d8e7836bdd1b) ) // good |
| 3641 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3642 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3643 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3581 | ROM_LOAD16_BYTE( "flash.ic13", 0x0000001, 0x0100000, CRC(e6f0aca0) SHA1(251d4d9c5a332d13af3a144c5eb9d8e7836bdd1b) ) // good |
| 3644 | 3582 | |
| 3645 | 3583 | ROM_LOAD16_WORD_SWAP( "mpr-19354.ic2", 0x0400000, 0x0400000, CRC(a23822e7) SHA1(10ca5d39dcaaf35b80168a08d8a18d77fba1d2ce) ) // good |
| 3646 | 3584 | ROM_LOAD16_WORD_SWAP( "mpr-19355.ic3", 0x0800000, 0x0400000, CRC(d70e5ebc) SHA1(2d560f6b6e693b2b91cf5ff5c4f0890cc2176f91) ) // good |
| r3485 | r3486 | |
| 3655 | 3593 | STV_BIOS |
| 3656 | 3594 | |
| 3657 | 3595 | ROM_REGION32_BE( 0x3000000, "user1", 0 ) /* SH2 code */ |
| 3658 | | ROM_LOAD( "epr-21300a.ic13", 0x0000000, 0x0100000, CRC(899d829e) SHA1(b6c6da92dc108353998b29c0659d288645541519) ) // good |
| 3659 | | ROM_RELOAD ( 0x0100000, 0x0100000 ) |
| 3660 | | ROM_RELOAD ( 0x0200000, 0x0100000 ) |
| 3661 | | ROM_RELOAD ( 0x0300000, 0x0100000 ) |
| 3596 | ROM_LOAD16_BYTE( "epr-21300a.ic13", 0x0000001, 0x0100000, CRC(899d829e) SHA1(b6c6da92dc108353998b29c0659d288645541519) ) // good |
| 3597 | |
| 3662 | 3598 | ROM_LOAD16_WORD_SWAP( "mpr-21290.ic2", 0x0400000, 0x0400000, CRC(a49d29f3) SHA1(8f6c26fd9e94a9e03dd0029026d205cf481fe151) ) // good |
| 3663 | 3599 | ROM_LOAD16_WORD_SWAP( "mpr-21291.ic3", 0x0800000, 0x0400000, CRC(9452ba20) SHA1(8a9ff546901715f99bb911616c74ae30ebd7c6d7) ) // good |
| 3664 | 3600 | ROM_LOAD16_WORD_SWAP( "mpr-21292.ic4", 0x0c00000, 0x0400000, CRC(f60268e2) SHA1(5c2febb94553a941a68e9611617750a89c82e783) ) // good |
| r3485 | r3486 | |
| 3735 | 3671 | |
| 3736 | 3672 | //GAME YEAR, NAME, PARENT, MACH, INP, INIT, MONITOR |
| 3737 | 3673 | /* Playable */ |
| 3738 | | GAME( 1998, astrass, stvbios, stv, stv, astrass, ROT0, "Sunsoft", "Astra SuperStars (J 980514 V1.002)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3739 | | GAME( 1995, bakubaku, stvbios, stv, stv, bakubaku, ROT0, "Sega", "Baku Baku Animal (J 950407 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3740 | | GAME( 1996, batmanfr, stvbios, stv, batmanfr,batmanfr, ROT0, "Acclaim", "Batman Forever (JUE 960507 V1.000)", GAME_NO_SOUND ) |
| 3741 | | GAME( 1996, colmns97, stvbios, stv, stv, colmns97, ROT0, "Sega", "Columns '97 (JET 961209 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3742 | | GAME( 1997, cotton2, stvbios, stv, stv, cotton2, ROT0, "Success", "Cotton 2 (JUET 970902 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3743 | | GAME( 1998, cottonbm, stvbios, stv, stv, cottonbm, ROT0, "Success", "Cotton Boomerang (JUET 980709 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3744 | | GAME( 1995, critcrsh, stvbios, stv, critcrsh, ic13, ROT0, "Sega", "Critter Crusher (EA 951204 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3745 | | GAME( 1999, danchih, stvbios, stv, stvmp,danchih, ROT0, "Altron (Tecmo license)", "Danchi de Hanafuda (J 990607 V1.400)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3746 | | GAME( 1996, diehard, stvbios, stv, stv, diehard, ROT0, "Sega", "Die Hard Arcade (UET 960515 V1.000)", GAME_IMPERFECT_SOUND ) |
| 3747 | | GAME( 1996, dnmtdeka, diehard, stv, stv, dnmtdeka, ROT0, "Sega", "Dynamite Deka (J 960515 V1.000)", GAME_IMPERFECT_SOUND ) |
| 3748 | | GAME( 1995, ejihon, stvbios, stv, stv, ic13, ROT0, "Sega", "Ejihon Tantei Jimusyo (J 950613 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3749 | | GAME( 1995, fhboxers, stvbios, stv, stv, fhboxers, ROT0, "Sega", "Funky Head Boxers (JUETBKAL 951218 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3750 | | GAME( 1994, gaxeduel, stvbios, stv, stv, gaxeduel, ROT0, "Sega", "Golden Axe - The Duel (JUETL 950117 V1.000)", GAME_IMPERFECT_SOUND ) |
| 3751 | | GAME( 1998, grdforce, stvbios, stv, stv, grdforce, ROT0, "Success", "Guardian Force (JUET 980318 V0.105)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3752 | | GAME( 1998, groovef, stvbios, stv, stv, groovef, ROT0, "Atlus", "Power Instinct 3 - Groove On Fight (J 970416 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3753 | | GAME( 1997, hanagumi, stvbios, stv, stv, hanagumi, ROT0, "Sega", "Hanagumi Taisen Columns - Sakura Wars (J 971007 V1.010)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3754 | | GAME( 1996, introdon, stvbios, stv, stv, ic13, ROT0, "Sunsoft / Success", "Karaoke Quiz Intro Don Don! (J 960213 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3755 | | GAME( 1995, kiwames, stvbios, stv, stvmp,ic13, ROT0, "Athena", "Pro Mahjong Kiwame S (J 951020 V1.208)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3756 | | GAME( 1997, maruchan, stvbios, stv, stv, maruchan, ROT0, "Sega / Toyosuisan", "Maru-Chan de Goo! (J 971216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3757 | | GAME( 1996, mausuke, stvbios, stv, stv, mausuke, ROT0, "Data East", "Mausuke no Ojama the World (J 960314 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3758 | | GAME( 1998, othellos, stvbios, stv, stv, othellos, ROT0, "Success", "Othello Shiyouyo (J 980423 V1.002)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3759 | | GAME( 1995, pblbeach, stvbios, stv, stv, pblbeach, ROT0, "T&E Soft", "Pebble Beach - The Great Shot (JUE 950913 V0.990)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3760 | | GAME( 1996, prikura, stvbios, stv, stv, prikura, ROT0, "Atlus", "Princess Clara Daisakusen (J 960910 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3761 | | GAME( 1996, puyosun, stvbios, stv, stv, puyosun, ROT0, "Compile", "Puyo Puyo Sun (J 961115 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3762 | | GAME( 1998, rsgun, stvbios, stv, stv, rsgun, ROT0, "Treasure", "Radiant Silvergun (JUET 980523 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3763 | | GAME( 1998, sasissu, stvbios, stv, stv, sasissu, ROT0, "Sega", "Taisen Tanto-R Sashissu!! (J 980216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3764 | | GAME( 1999, sanjeon, sasissu, stv, stv, sanjeon, ROT0, "Sega / Deniam", "DaeJeon! SanJeon SuJeon (Korea)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3765 | | GAME( 1997, seabass, stvbios, stv, stv, seabass, ROT0, "A wave inc. (Able license)","Sea Bass Fishing (JUET 971110 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3766 | | GAME( 1995, shanhigw, stvbios, stv, stv, shanhigw, ROT0, "Sunsoft / Activision", "Shanghai - The Great Wall / Shanghai Triple Threat (JUE 950623 V1.005)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3767 | | GAME( 1997, shienryu, stvbios, stv, stv, shienryu, ROT270, "Warashi", "Shienryu (JUET 961226 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3768 | | GAME( 1995, smleague, stvbios, stv, stv, smleague, ROT0, "Sega", "Super Major League (U 960108 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3769 | | GAME( 1995, finlarch, smleague,stv, stv, finlarch, ROT0, "Sega", "Final Arch (J 950714 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3770 | | GAME( 1998, sss, stvbios, stv, stv, sss, ROT0, "Capcom / Cave / Victor", "Steep Slope Sliders (JUET 981110 V1.000)", GAME_IMPERFECT_SOUND ) |
| 3771 | | GAME( 1995, sandor, stvbios, stv, stv, sandor, ROT0, "Sega", "Puzzle & Action: Sando-R (J 951114 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3772 | | GAME( 1997, thunt, sandor, stv, stv, thunt, ROT0, "Sega", "Puzzle & Action: Treasure Hunt (JUET 970901 V2.00E)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3773 | | GAME( 1997, thuntk, sandor, stv, stv, sandor, ROT0, "Sega / Deniam", "Puzzle & Action: BoMulEul Chajara (Korea)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3774 | | GAME( 1996, sokyugrt, stvbios, stv, stv, sokyugrt, ROT0, "Raizing / 8ing", "Soukyugurentai / Terra Diver (JUET 960821 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3775 | | GAME( 1995, suikoenb, stvbios, stv, stv, suikoenb, ROT0, "Data East", "Suikoenbu / Outlaws of the Lost Dynasty (JUETL 950314 V2.001)", GAME_IMPERFECT_SOUND ) |
| 3776 | | GAME( 1996, vfkids, stvbios, stv, stv, ic13, ROT0, "Sega", "Virtua Fighter Kids (JUET 960319 V0.000)", GAME_IMPERFECT_SOUND ) |
| 3777 | | GAME( 1997, winterht, stvbios, stv, stv, winterht, ROT0, "Sega", "Winter Heat (JUET 971012 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3778 | | GAME( 1997, znpwfv, stvbios, stv, stv, znpwfv, ROT0, "Sega", "Zen Nippon Pro-Wrestling Featuring Virtua (J 971123 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3779 | | GAME( 1997, nclubv3, stvbios, stv, stv, nameclv3, ROT0, "Sega", "Name Club Ver.3 (J 970723 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) // seems to work, although it could do with speedups, and the printer isn't emulated.. |
| 3674 | GAME( 1998, astrass, stvbios, stv, stv, astrass, ROT0, "Sunsoft", "Astra SuperStars (J 980514 V1.002)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3675 | GAME( 1995, bakubaku, stvbios, stv, stv, stv, ROT0, "Sega", "Baku Baku Animal (J 950407 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3676 | GAME( 1996, batmanfr, stvbios, stv, batmanfr, batmanfr, ROT0, "Acclaim", "Batman Forever (JUE 960507 V1.000)", GAME_NO_SOUND ) |
| 3677 | GAME( 1996, colmns97, stvbios, stv, stv, colmns97, ROT0, "Sega", "Columns '97 (JET 961209 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3678 | GAME( 1997, cotton2, stvbios, stv, stv, cotton2, ROT0, "Success", "Cotton 2 (JUET 970902 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3679 | GAME( 1998, cottonbm, stvbios, stv, stv, cottonbm, ROT0, "Success", "Cotton Boomerang (JUET 980709 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3680 | GAME( 1995, critcrsh, stvbios, stv, critcrsh, stv, ROT0, "Sega", "Critter Crusher (EA 951204 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3681 | GAME( 1999, danchih, stvbios, stv, stvmp, danchih, ROT0, "Altron (Tecmo license)", "Danchi de Hanafuda (J 990607 V1.400)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3682 | GAME( 1996, diehard, stvbios, stv, stv, diehard, ROT0, "Sega", "Die Hard Arcade (UET 960515 V1.000)", GAME_IMPERFECT_SOUND ) |
| 3683 | GAME( 1996, dnmtdeka, diehard, stv, stv, dnmtdeka, ROT0, "Sega", "Dynamite Deka (J 960515 V1.000)", GAME_IMPERFECT_SOUND ) |
| 3684 | GAME( 1995, ejihon, stvbios, stv, stv, stv, ROT0, "Sega", "Ejihon Tantei Jimusyo (J 950613 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3685 | GAME( 1995, fhboxers, stvbios, stv, stv, fhboxers, ROT0, "Sega", "Funky Head Boxers (JUETBKAL 951218 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3686 | GAME( 1994, gaxeduel, stvbios, stv, stv, gaxeduel, ROT0, "Sega", "Golden Axe - The Duel (JUETL 950117 V1.000)", GAME_IMPERFECT_SOUND ) |
| 3687 | GAME( 1998, grdforce, stvbios, stv, stv, grdforce, ROT0, "Success", "Guardian Force (JUET 980318 V0.105)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3688 | GAME( 1998, groovef, stvbios, stv, stv, groovef, ROT0, "Atlus", "Power Instinct 3 - Groove On Fight (J 970416 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3689 | GAME( 1997, hanagumi, stvbios, stv, stv, hanagumi, ROT0, "Sega", "Hanagumi Taisen Columns - Sakura Wars (J 971007 V1.010)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3690 | GAME( 1996, introdon, stvbios, stv, stv, stv, ROT0, "Sunsoft / Success", "Karaoke Quiz Intro Don Don! (J 960213 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3691 | GAME( 1995, kiwames, stvbios, stv, stvmp, stv, ROT0, "Athena", "Pro Mahjong Kiwame S (J 951020 V1.208)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3692 | GAME( 1997, maruchan, stvbios, stv, stv, maruchan, ROT0, "Sega / Toyosuisan", "Maru-Chan de Goo! (J 971216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3693 | GAME( 1996, mausuke, stvbios, stv, stv, mausuke, ROT0, "Data East", "Mausuke no Ojama the World (J 960314 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3694 | GAME( 1998, othellos, stvbios, stv, stv, othellos, ROT0, "Success", "Othello Shiyouyo (J 980423 V1.002)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3695 | GAME( 1995, pblbeach, stvbios, stv, stv, pblbeach, ROT0, "T&E Soft", "Pebble Beach - The Great Shot (JUE 950913 V0.990)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3696 | GAME( 1996, prikura, stvbios, stv, stv, prikura, ROT0, "Atlus", "Princess Clara Daisakusen (J 960910 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3697 | GAME( 1996, puyosun, stvbios, stv, stv, puyosun, ROT0, "Compile", "Puyo Puyo Sun (J 961115 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3698 | GAME( 1998, rsgun, stvbios, stv, stv, rsgun, ROT0, "Treasure", "Radiant Silvergun (JUET 980523 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3699 | GAME( 1998, sasissu, stvbios, stv, stv, sasissu, ROT0, "Sega", "Taisen Tanto-R Sashissu!! (J 980216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3700 | GAME( 1999, sanjeon, sasissu, stv, stv, sanjeon, ROT0, "Sega / Deniam", "DaeJeon! SanJeon SuJeon (AJTUE 990412 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3701 | GAME( 1997, seabass, stvbios, stv, stv, seabass, ROT0, "A wave inc. (Able license)", "Sea Bass Fishing (JUET 971110 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3702 | GAME( 1995, shanhigw, stvbios, stv, stv, shanhigw, ROT0, "Sunsoft / Activision", "Shanghai - The Great Wall / Shanghai Triple Threat (JUE 950623 V1.005)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3703 | GAME( 1997, shienryu, stvbios, stv, stv, shienryu, ROT270, "Warashi", "Shienryu (JUET 961226 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3704 | GAME( 1995, smleague, stvbios, stv, stv, smleague, ROT0, "Sega", "Super Major League (U 960108 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3705 | GAME( 1995, finlarch, smleague,stv, stv, finlarch, ROT0, "Sega", "Final Arch (J 950714 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3706 | GAME( 1998, sss, stvbios, stv, stv, sss, ROT0, "Capcom / Cave / Victor", "Steep Slope Sliders (JUET 981110 V1.000)", GAME_IMPERFECT_SOUND ) |
| 3707 | GAME( 1995, sandor, stvbios, stv, stv, sandor, ROT0, "Sega", "Puzzle & Action: Sando-R (J 951114 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3708 | GAME( 1997, thunt, sandor, stv, stv, thunt, ROT0, "Sega", "Puzzle & Action: Treasure Hunt (JUET 970901 V2.00E)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3709 | GAME( 1997, thuntk, sandor, stv, stv, sandor, ROT0, "Sega / Deniam", "Puzzle & Action: BoMulEul Chajara (JUET 970125 V2.00K)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3710 | GAME( 1996, sokyugrt, stvbios, stv, stv, sokyugrt, ROT0, "Raizing / 8ing", "Soukyugurentai / Terra Diver (JUET 960821 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3711 | GAME( 1995, suikoenb, stvbios, stv, stv, suikoenb, ROT0, "Data East", "Suikoenbu / Outlaws of the Lost Dynasty (JUETL 950314 V2.001)", GAME_IMPERFECT_SOUND ) |
| 3712 | GAME( 1996, vfkids, stvbios, stv, stv, stv, ROT0, "Sega", "Virtua Fighter Kids (JUET 960319 V0.000)", GAME_IMPERFECT_SOUND ) |
| 3713 | GAME( 1997, winterht, stvbios, stv, stv, winterht, ROT0, "Sega", "Winter Heat (JUET 971012 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3714 | GAME( 1997, znpwfv, stvbios, stv, stv, znpwfv, ROT0, "Sega", "Zen Nippon Pro-Wrestling Featuring Virtua (J 971123 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3715 | GAME( 1997, nclubv3, stvbios, stv, stv, nameclv3, ROT0, "Sega", "Name Club Ver.3 (J 970723 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) // seems to work, although it could do with speedups, and the printer isn't emulated.. |
| 3780 | 3716 | |
| 3781 | 3717 | /* Almost */ |
| 3782 | | GAME( 1997, vmahjong, stvbios, stv, stvmp,stv, ROT0, "Micronet", "Virtual Mahjong (J 961214 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3783 | | GAME( 1998, myfairld, stvbios, stv, stvmp,stv, ROT0, "Micronet", "Virtual Mahjong 2 - My Fair Lady (J 980608 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING ) |
| 3784 | | GAME( 1998, twcup98, stvbios, stv, stv, twcup98, ROT0, "Tecmo", "Tecmo World Cup '98 (JUET 980410 V1.000)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS|GAME_NOT_WORKING ) // player movement |
| 3785 | | GAME( 1997, stress, stvbios, stv, stv, ic13, ROT0, "Sega", "Stress Busters", GAME_NOT_WORKING ) // needs printer |
| 3718 | GAME( 1997, vmahjong, stvbios, stv, stvmp, stv, ROT0, "Micronet", "Virtual Mahjong (J 961214 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3719 | GAME( 1998, myfairld, stvbios, stv, stvmp, stv, ROT0, "Micronet", "Virtual Mahjong 2 - My Fair Lady (J 980608 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING ) |
| 3720 | GAME( 1998, twcup98, stvbios, stv, stv, twcup98, ROT0, "Tecmo", "Tecmo World Cup '98 (JUET 980410 V1.000)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS|GAME_NOT_WORKING ) // player movement |
| 3721 | GAME( 1998, stress, stvbios, stv, stv, stv, ROT0, "Sega", "Stress Busters (J 981020 V1.000)", GAME_NOT_WORKING ) // needs printer |
| 3786 | 3722 | |
| 3787 | 3723 | /* Doing Something.. but not enough yet */ |
| 3788 | | GAME( 1998, elandore, stvbios, stv, stv, elandore, ROT0, "Sai-Mate", "Elan Doree - Legend of Dragon (JUET 980922 V1.006)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )//japanese name? |
| 3789 | | GAME( 1995, vfremix, stvbios, stv, stv, vfremix, ROT0, "Sega", "Virtua Fighter Remix (JUETBKAL 950428 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 3790 | | GAME( 1997, findlove, stvbios, stv, stv, ic13, ROT0, "Daiki / FCF", "Find Love (J 971212 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 3791 | | GAME( 1996, decathlt, stvbios, stv, stv, decathlt, ROT0, "Sega", "Decathlete (JUET 960709 V1.001)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3792 | | GAME( 1996, decathlo, decathlt, stv, stv, decathlt, ROT0, "Sega", "Decathlete (JUET 960424 V1.000)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3724 | GAME( 1998, elandore, stvbios, stv, stv, elandore, ROT0, "Sai-Mate", "Touryuu Densetsu Elan-Doree / Elan Doree - Legend of Dragoon (JUET 980922 V1.006)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 3725 | GAME( 1995, vfremix, stvbios, stv, stv, vfremix, ROT0, "Sega", "Virtua Fighter Remix (JUETBKAL 950428 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 3726 | GAME( 1997, findlove, stvbios, stv, stv, stv, ROT0, "Daiki / FCF", "Find Love (J 971212 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 3727 | GAME( 1996, decathlt, stvbios, stv, stv, decathlt, ROT0, "Sega", "Decathlete (JUET 960709 V1.001)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3728 | GAME( 1996, decathlo, decathlt,stv, stv, decathlt, ROT0, "Sega", "Decathlete (JUET 960424 V1.000)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3793 | 3729 | |
| 3794 | 3730 | |
| 3795 | 3731 | /* not working,black screen */ |
| 3796 | | GAME( 1999, ffreveng, stvbios, stv, stv, ffreveng, ROT0, "Capcom", "Final Fight Revenge (JUET 990714 V1.000)", GAME_UNEMULATED_PROTECTION | GAME_NO_SOUND | GAME_NOT_WORKING ) |
| 3732 | GAME( 1999, ffreveng, stvbios, stv, stv, ffreveng, ROT0, "Capcom", "Final Fight Revenge (JUET 990714 V1.000)", GAME_UNEMULATED_PROTECTION | GAME_NO_SOUND | GAME_NOT_WORKING ) |
| 3733 | GAME( 1996, magzun, stvbios, stv, stv, stv, ROT0, "Sega", "Magical Zunou Power (J 961031 V1.000)", GAME_NOT_WORKING ) |
| 3797 | 3734 | /* CD games */ |
| 3798 | | GAME( 1995, sfish2, 0, stv, stv, ic13, ROT0, "Sega", "Sport Fishing 2 (UET 951106 V1.10e)", GAME_NO_SOUND | GAME_NOT_WORKING ) |
| 3799 | | GAME( 1995, sfish2j, sfish2, stv, stv, ic13, ROT0, "Sega", "Sport Fishing 2 (J 951201 V1.100)", GAME_NO_SOUND | GAME_NOT_WORKING ) |
| 3800 | | GAME( 1997, magzun, stvbios, stv, stv, ic13, ROT0, "Sega", "Magical Zunou Power", GAME_NOT_WORKING ) |
| 3735 | GAME( 1995, sfish2, 0, stv, stv, stv, ROT0, "Sega", "Sport Fishing 2 (UET 951106 V1.10e)", GAME_NO_SOUND | GAME_NOT_WORKING ) |
| 3736 | GAME( 1995, sfish2j, sfish2, stv, stv, stv, ROT0, "Sega", "Sport Fishing 2 (J 951201 V1.100)", GAME_NO_SOUND | GAME_NOT_WORKING ) |
| 3801 | 3737 | |
| 3802 | 3738 | /* |
| 3803 | 3739 | This is the known list of undumped ST-V games: |
| r3485 | r3486 | |
| 3806 | 3742 | Sport Fishing |
| 3807 | 3743 | Aroma Club |
| 3808 | 3744 | Movie Club |
| 3809 | | Name Club |
| 3745 | Name Club (other versions) |
| 3746 | Print Club 2 |
| 3747 | Youen Denshi Mahjong Yuugi Gal Jan |
| 3748 | Danchi de Quiz: Okusan 4taku Desu yo! |
| 3810 | 3749 | NBA Action (?) |
| 3811 | 3750 | Quiz Omaeni Pipon Cho! (?) |
| 3812 | | |
| 3813 | 3751 | Others may exist as well... |
| 3814 | 3752 | */ |
| 3815 | 3753 | |
src/emu/cpu/dsp56k/dsp56ops.c
| r3485 | r3486 | |
| 15 | 15 | // |
| 16 | 16 | // |
| 17 | 17 | |
| 18 | | // Helper functions and macros |
| 19 | | #define BITS(CUR,MASK) (Dsp56kOpMask(CUR,MASK)) |
| 20 | | static UINT16 Dsp56kOpMask(UINT16 op, UINT16 mask) ; |
| 18 | /************************/ |
| 19 | /* Datatypes and macros */ |
| 20 | /************************/ |
| 21 | enum dataType { DT_BYTE, |
| 22 | DT_WORD, |
| 23 | DT_DOUBLE_WORD, |
| 24 | DT_LONG_WORD }; |
| 21 | 25 | |
| 22 | | enum dataType { DT_BYTE, DT_WORD, DT_DOUBLE_WORD, DT_LONG_WORD } ; |
| 26 | struct _typed_pointer |
| 27 | { |
| 28 | void* addr; |
| 29 | char data_type; |
| 30 | }; |
| 31 | typedef struct _typed_pointer typed_pointer; |
| 23 | 32 | |
| 24 | | // This function's areguments are written source->destination to fall in line with the processor's paradigm... |
| 25 | | static void SetDestinationValue(void *sourcePointer, unsigned char sourceType, |
| 26 | | void *destinationPointer, unsigned char destinationType) ; |
| 27 | 33 | |
| 28 | | static void SetDataMemoryValue (void *sourcePointer, unsigned char sourceType, UINT32 destinationAddr) ; |
| 29 | | static void SetProgramMemoryValue(void *sourcePointer, unsigned char sourceType, UINT32 destinationAddr) ; |
| 34 | #define WORD(X) (X<<1) |
| 35 | #define BITS(CUR,MASK) (Dsp56kOpMask(CUR,MASK)) |
| 30 | 36 | |
| 31 | 37 | |
| 32 | | // Main opcode categories |
| 33 | | static unsigned ExecuteDataALUOpcode(int parallelType) ; |
| 34 | | static unsigned ExecuteDXMDROpcode(void) ; |
| 35 | | static unsigned ExecuteNPMOpcode(void) ; |
| 36 | | static unsigned ExecuteMisfitOpcode(void) ; |
| 37 | | static unsigned ExecuteSpecialOpcode(void) ; |
| 38 | 38 | |
| 39 | /*********************/ |
| 40 | /* Opcode prototypes */ |
| 41 | /*********************/ |
| 42 | static size_t dsp56k_op_add_2 (const UINT16 op_byte, UINT8* cycles); |
| 43 | static size_t dsp56k_op_mac_1 (const UINT16 op_byte, UINT8* cycles); |
| 44 | static size_t dsp56k_op_macr_1 (const UINT16 op_byte, UINT8* cycles); |
| 45 | static size_t dsp56k_op_move_1 (const UINT16 op_byte, UINT8* cycles); |
| 46 | static size_t dsp56k_op_mpy_1 (const UINT16 op_byte, UINT8* cycles); |
| 47 | static size_t dsp56k_op_mpyr_1 (const UINT16 op_byte, UINT8* cycles); |
| 48 | static size_t dsp56k_op_sub_1 (const UINT16 op_byte, UINT8* cycles); |
| 49 | static size_t dsp56k_op_tfr_2 (const UINT16 op_byte, UINT8* cycles); |
| 50 | static size_t dsp56k_op_mpy_2 (const UINT16 op_byte, UINT8* cycles); |
| 51 | static size_t dsp56k_op_mac_2 (const UINT16 op_byte, UINT8* cycles); |
| 52 | static size_t dsp56k_op_clr (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 53 | static size_t dsp56k_op_add (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 54 | static size_t dsp56k_op_move (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 55 | static size_t dsp56k_op_tfr (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 56 | static size_t dsp56k_op_rnd (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 57 | static size_t dsp56k_op_tst (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 58 | static size_t dsp56k_op_inc (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 59 | static size_t dsp56k_op_inc24 (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 60 | static size_t dsp56k_op_or (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 61 | static size_t dsp56k_op_asr (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 62 | static size_t dsp56k_op_asl (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 63 | static size_t dsp56k_op_lsr (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 64 | static size_t dsp56k_op_lsl (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 65 | static size_t dsp56k_op_eor (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 66 | static size_t dsp56k_op_subl (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 67 | static size_t dsp56k_op_sub (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 68 | static size_t dsp56k_op_clr24 (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 69 | static size_t dsp56k_op_sbc (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 70 | static size_t dsp56k_op_cmp (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 71 | static size_t dsp56k_op_neg (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 72 | static size_t dsp56k_op_not (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 73 | static size_t dsp56k_op_dec (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 74 | static size_t dsp56k_op_dec24 (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 75 | static size_t dsp56k_op_and (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 76 | static size_t dsp56k_op_abs (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 77 | static size_t dsp56k_op_ror (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 78 | static size_t dsp56k_op_rol (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 79 | static size_t dsp56k_op_cmpm (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 80 | static size_t dsp56k_op_mpy (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 81 | static size_t dsp56k_op_mpyr (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 82 | static size_t dsp56k_op_mac (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 83 | static size_t dsp56k_op_macr (const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles); |
| 84 | static size_t dsp56k_op_adc (const UINT16 op, UINT8* cycles); |
| 85 | static size_t dsp56k_op_andi (const UINT16 op, UINT8* cycles); |
| 86 | static size_t dsp56k_op_asl4 (const UINT16 op, UINT8* cycles); |
| 87 | static size_t dsp56k_op_asr4 (const UINT16 op, UINT8* cycles); |
| 88 | static size_t dsp56k_op_asr16 (const UINT16 op, UINT8* cycles); |
| 89 | static size_t dsp56k_op_bfop (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 90 | static size_t dsp56k_op_bfop_1 (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 91 | static size_t dsp56k_op_bfop_2 (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 92 | static size_t dsp56k_op_bcc (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 93 | static size_t dsp56k_op_bcc_1 (const UINT16 op, UINT8* cycles); |
| 94 | static size_t dsp56k_op_bcc_2 (const UINT16 op, UINT8* cycles); |
| 95 | static size_t dsp56k_op_bra (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 96 | static size_t dsp56k_op_bra_1 (const UINT16 op, UINT8* cycles); |
| 97 | static size_t dsp56k_op_bra_2 (const UINT16 op, UINT8* cycles); |
| 98 | static size_t dsp56k_op_brkc (const UINT16 op, UINT8* cycles); |
| 99 | static size_t dsp56k_op_bscc (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 100 | static size_t dsp56k_op_bscc_1 (const UINT16 op, UINT8* cycles); |
| 101 | static size_t dsp56k_op_bsr (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 102 | static size_t dsp56k_op_bsr_1 (const UINT16 op, UINT8* cycles); |
| 103 | static size_t dsp56k_op_chkaau (const UINT16 op, UINT8* cycles); |
| 104 | static size_t dsp56k_op_debug (const UINT16 op, UINT8* cycles); |
| 105 | static size_t dsp56k_op_debugcc (const UINT16 op, UINT8* cycles); |
| 106 | static size_t dsp56k_op_div (const UINT16 op, UINT8* cycles); |
| 107 | static size_t dsp56k_op_dmac (const UINT16 op, UINT8* cycles); |
| 108 | static size_t dsp56k_op_do (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 109 | static size_t dsp56k_op_do_1 (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 110 | static size_t dsp56k_op_do_2 (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 111 | static size_t dsp56k_op_doforever(const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 112 | static size_t dsp56k_op_enddo (const UINT16 op, UINT8* cycles); |
| 113 | static size_t dsp56k_op_ext (const UINT16 op, UINT8* cycles); |
| 114 | static size_t dsp56k_op_illegal (const UINT16 op, UINT8* cycles); |
| 115 | static size_t dsp56k_op_imac (const UINT16 op, UINT8* cycles); |
| 116 | static size_t dsp56k_op_impy (const UINT16 op, UINT8* cycles); |
| 117 | static size_t dsp56k_op_jcc (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 118 | static size_t dsp56k_op_jcc_1 (const UINT16 op, UINT8* cycles); |
| 119 | static size_t dsp56k_op_jmp (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 120 | static size_t dsp56k_op_jmp_1 (const UINT16 op, UINT8* cycles); |
| 121 | static size_t dsp56k_op_jscc (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 122 | static size_t dsp56k_op_jscc_1 (const UINT16 op, UINT8* cycles); |
| 123 | static size_t dsp56k_op_jsr (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 124 | static size_t dsp56k_op_jsr_1 (const UINT16 op, UINT8* cycles); |
| 125 | static size_t dsp56k_op_jsr_2 (const UINT16 op, UINT8* cycles); |
| 126 | static size_t dsp56k_op_lea (const UINT16 op, UINT8* cycles); |
| 127 | static size_t dsp56k_op_lea_1 (const UINT16 op, UINT8* cycles); |
| 128 | static size_t dsp56k_op_macsuuu (const UINT16 op, UINT8* cycles); |
| 129 | static size_t dsp56k_op_move_2 (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 130 | static size_t dsp56k_op_movec (const UINT16 op, UINT8* cycles); |
| 131 | static size_t dsp56k_op_movec_1 (const UINT16 op, UINT8* cycles); |
| 132 | static size_t dsp56k_op_movec_2 (const UINT16 op, UINT8* cycles); |
| 133 | static size_t dsp56k_op_movec_3 (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 134 | static size_t dsp56k_op_movec_4 (const UINT16 op, UINT8* cycles); |
| 135 | static size_t dsp56k_op_movec_5 (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 136 | static size_t dsp56k_op_movei (const UINT16 op, UINT8* cycles); |
| 137 | static size_t dsp56k_op_movem (const UINT16 op, UINT8* cycles); |
| 138 | static size_t dsp56k_op_movem_1 (const UINT16 op, UINT8* cycles); |
| 139 | static size_t dsp56k_op_movem_2 (const UINT16 op, const UINT16 op2, UINT8* cycles); |
| 140 | static size_t dsp56k_op_movep (const UINT16 op, UINT8* cycles); |
| 141 | static size_t dsp56k_op_movep_1 (const UINT16 op, UINT8* cycles); |
| 142 | static size_t dsp56k_op_moves (const UINT16 op, UINT8* cycles); |
| 143 | static size_t dsp56k_op_mpysuuu (const UINT16 op, UINT8* cycles); |
| 144 | static size_t dsp56k_op_negc (const UINT16 op, UINT8* cycles); |
| 145 | static size_t dsp56k_op_nop (const UINT16 op, UINT8* cycles); |
| 146 | static size_t dsp56k_op_norm (const UINT16 op, UINT8* cycles); |
| 147 | static size_t dsp56k_op_ori (const UINT16 op, UINT8* cycles); |
| 148 | static size_t dsp56k_op_rep (const UINT16 op, UINT8* cycles); |
| 149 | static size_t dsp56k_op_rep_1 (const UINT16 op, UINT8* cycles); |
| 150 | static size_t dsp56k_op_rep_2 (const UINT16 op, UINT8* cycles); |
| 151 | static size_t dsp56k_op_repcc (const UINT16 op, UINT8* cycles); |
| 152 | static size_t dsp56k_op_reset (const UINT16 op, UINT8* cycles); |
| 153 | static size_t dsp56k_op_rti (const UINT16 op, UINT8* cycles); |
| 154 | static size_t dsp56k_op_rts (const UINT16 op, UINT8* cycles); |
| 155 | static size_t dsp56k_op_stop (const UINT16 op, UINT8* cycles); |
| 156 | static size_t dsp56k_op_swap (const UINT16 op, UINT8* cycles); |
| 157 | static size_t dsp56k_op_swi (const UINT16 op, UINT8* cycles); |
| 158 | static size_t dsp56k_op_tcc (const UINT16 op, UINT8* cycles); |
| 159 | static size_t dsp56k_op_tfr2 (const UINT16 op, UINT8* cycles); |
| 160 | static size_t dsp56k_op_tfr3 (const UINT16 op, UINT8* cycles); |
| 161 | static size_t dsp56k_op_tst2 (const UINT16 op, UINT8* cycles); |
| 162 | static size_t dsp56k_op_wait (const UINT16 op, UINT8* cycles); |
| 163 | static size_t dsp56k_op_zero (const UINT16 op, UINT8* cycles); |
| 39 | 164 | |
| 40 | | // Actual opcode implementations |
| 41 | 165 | |
| 42 | | // Data ALU Ops |
| 43 | | static int ClrOperation(void **wd, UINT64 *pa) ; |
| 44 | | static int AddOperation(void **wd, UINT64 *pa) ; |
| 45 | | static int NotOperation(void **wd, UINT64 *pa) ; |
| 46 | | static int LsrOperation(void **wd, UINT64 *pa) ; |
| 47 | | static int AsrOperation(void **wd, UINT64 *pa) ; |
| 48 | | static int TfrDataALUOperation(void **wd, UINT64 *pa) ; |
| 49 | | static int EorOperation(void **wd, UINT64 *pa) ; |
| 50 | | static int CmpOperation(void **wd, UINT64 *pa) ; |
| 51 | | static int Dec24Operation(void **wd, UINT64 *pa) ; |
| 52 | | static int AndOperation(void **wd, UINT64 *pa) ; |
| 53 | | static int OrOperation(void **wd, UINT64 *pa) ; |
| 54 | | static int TstOperation(void **wd, UINT64 *pa) ; |
| 166 | static void execute_register_to_register_data_move(const UINT16 op, typed_pointer* d_register, UINT64* prev_accum_value); |
| 167 | static void execute_x_memory_data_move (const UINT16 op, typed_pointer* d_register, UINT64* prev_accum_value); |
| 168 | static void execute_x_memory_data_move2(const UINT16 op, typed_pointer* d_register); |
| 55 | 169 | |
| 56 | | static int MoveCOperation(void) ; |
| 57 | | static int MoveMOperation(void) ; |
| 58 | | static int MoveIOperation(void) ; |
| 59 | | static int MovePOperation(void) ; |
| 60 | 170 | |
| 61 | | static int AndiOperation(void) ; |
| 62 | | //static int OriOperation(void) ; |
| 171 | static UINT16 decode_BBB_bitmask(UINT16 BBB, UINT16 *iVal); |
| 172 | static int decode_cccc_table(UINT16 cccc); |
| 173 | static void decode_DDDDD_table(UINT16 DDDDD, typed_pointer* ret); |
| 174 | static void decode_DD_table(UINT16 DD, typed_pointer* ret); |
| 175 | static void decode_F_table(UINT16 F, typed_pointer* ret); |
| 176 | static void decode_h0hF_table(UINT16 h0h, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret); |
| 177 | static void decode_HH_table(UINT16 HH, typed_pointer* ret); |
| 178 | static void decode_HHH_table(UINT16 HHH, typed_pointer* ret); |
| 179 | static void decode_IIII_table(UINT16 IIII, typed_pointer* src_ret, typed_pointer* dst_ret, void *working); |
| 180 | static void decode_JJJF_table(UINT16 JJJ, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret); |
| 181 | static void decode_JJF_table(UINT16 JJ, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret); |
| 182 | static void decode_QQF_special_table(UINT16 QQ, UINT16 F, void **S1, void **S2, void **D); |
| 183 | static void decode_RR_table(UINT16 RR, typed_pointer* ret); |
| 184 | static void decode_Z_table(UINT16 Z, typed_pointer* ret); |
| 185 | static void execute_m_table(int x, UINT16 m); |
| 186 | static void execute_MM_table(UINT16 rnum, UINT16 MM); |
| 187 | static UINT16 execute_q_table(int x, UINT16 q); |
| 188 | #ifdef UNUSED_FUNCTION |
| 189 | static void execute_z_table(int x, UINT16 z); |
| 190 | #endif |
| 191 | static UINT16 assemble_address_from_Pppppp_table(UINT16 P, UINT16 ppppp); |
| 192 | static UINT16 assemble_address_from_IO_short_address(UINT16 pp); |
| 193 | static UINT16 assemble_address_from_6bit_signed_relative_short_address(UINT16 srs); |
| 63 | 194 | |
| 64 | | static int BitfieldOperation(void) ; |
| 65 | | static int JmpOperation(void) ; |
| 66 | | static int BsrOperation(void) ; |
| 67 | | static int JsrOperation(void) ; |
| 68 | | static int DoOperation(void) ; |
| 69 | | static int TccOperation(void) ; |
| 70 | | static int BraOperation(void) ; |
| 71 | | static int BsccOperation(void) ; |
| 72 | | static int BccOperation(void) ; |
| 73 | | static int Tst2Operation(void) ; |
| 74 | | static int MACsuuuOperation(void) ; |
| 75 | | static int RepOperation(void) ; |
| 195 | static void dsp56k_process_loop(void); |
| 196 | static void dsp56k_process_rep(size_t repSize); |
| 76 | 197 | |
| 77 | | static void EndOfLoopProcessing(void) ; |
| 78 | | static void EndOfRepProcessing(void) ; |
| 79 | 198 | |
| 80 | | // Parallel memory data moves |
| 81 | | static void XMDMOperation(UINT16 parameters, void *working, UINT64 *pa) ; |
| 82 | | static void XMDMSpecialOperation(UINT16 parameters, void *working) ; |
| 83 | | static void ARUOperation(UINT16 parameters) ; |
| 84 | | static void RRDMOperation(UINT16 parameters, void *working, UINT64 *pa) ; |
| 85 | 199 | |
| 86 | | // For decoding the different types of tables... |
| 87 | | static void *DecodeDDDDDTable(UINT16 DDDDD, unsigned char *dt) ; |
| 88 | | static void *DecodeRRTable(UINT16 RR, unsigned char *dt) ; |
| 89 | | static void *DecodeDDTable(UINT16 DD, unsigned char *dt) ; |
| 90 | | static void *DecodeHHHTable(UINT16 HHH, unsigned char *dt) ; |
| 91 | | static void *DecodeHHTable(UINT16 HH, unsigned char *dt) ; |
| 92 | | static void *DecodeZTable(UINT16 Z, unsigned char *dt) ; |
| 93 | | static UINT16 DecodeBBBBitMask(UINT16 BBB, UINT16 *iVal) ; |
| 94 | | static int DecodeccccTable(UINT16 cccc) ; |
| 95 | | static void Decodeh0hFTable(UINT16 h0h, UINT16 F, void **source, unsigned char *st, void **dest, unsigned char *dt) ; |
| 96 | | static void *DecodeFTable(UINT16 F, unsigned char *dt) ; |
| 97 | | static void DecodeJJJFTable(UINT16 JJJ, UINT16 F, void **source, unsigned char *st, void **dest, unsigned char *dt) ; |
| 98 | | static void DecodeJJFTable(UINT16 JJ, UINT16 F, void **source, unsigned char *st, void **dest, unsigned char *dt) ; |
| 99 | | static void DecodeQQFTableSp(UINT16 QQ, UINT16 F, void **S1, void **S2, void **D) ; |
| 100 | | static void DecodeIIIITable(UINT16 IIII, void **source, unsigned char *st, void **dest, unsigned char *dt, void *working) ; |
| 200 | /********************/ |
| 201 | /* Helper Functions */ |
| 202 | /********************/ |
| 203 | static UINT16 Dsp56kOpMask(UINT16 op, UINT16 mask); |
| 101 | 204 | |
| 102 | | static void ExecuteMMTable(int x, UINT16 MM) ; |
| 103 | | static void ExecutemTable(int x, UINT16 m) ; |
| 104 | | static void ExecutezTable(int x, UINT16 z) ; |
| 105 | | static UINT16 ExecuteqTable(int x, UINT16 q) ; |
| 205 | /* These arguments are written source->destination to fall in line with the processor's paradigm. */ |
| 206 | static void SetDestinationValue(typed_pointer source, typed_pointer dest); |
| 106 | 207 | |
| 107 | | static UINT16 AssembleDFromPTable(UINT16 P, UINT16 ppppp) ; |
| 208 | static void SetDataMemoryValue(typed_pointer source, UINT32 destinationAddr); |
| 209 | static void SetProgramMemoryValue(typed_pointer source, UINT32 destinationAddr); |
| 108 | 210 | |
| 109 | | static UINT16 AssembleAddressFromIOShortAddress(UINT16 pp) ; |
| 110 | | static UINT16 AssembleAddressFrom6BitSignedRelativeShortAddress(UINT16 srs) ; |
| 111 | 211 | |
| 112 | 212 | |
| 113 | 213 | /*************************************************************************** |
| 114 | 214 | IMPLEMENTATION |
| 115 | 215 | ***************************************************************************/ |
| 116 | 216 | |
| 117 | | #ifdef UNUSED_FUNCTION |
| 118 | | static void unimplemented(void) |
| 119 | | { |
| 120 | | fatalerror("Unimplemented OP @ %04X: %04X", PC-2, OP) ; |
| 121 | | } |
| 122 | | #endif |
| 123 | | |
| 124 | | |
| 125 | 217 | static void execute_one(void) |
| 126 | 218 | { |
| 127 | | unsigned size = 666 ; |
| 219 | UINT16 op; |
| 220 | UINT16 op2; |
| 221 | size_t size = 0x1337; |
| 222 | UINT8 cycle_count = 0; |
| 128 | 223 | |
| 224 | /* For MAME */ |
| 129 | 225 | debugger_instruction_hook(Machine, PC); |
| 130 | | OP = ROPCODE(PC<<1); |
| 226 | OP = ROPCODE(WORD(PC)); |
| 131 | 227 | |
| 132 | | if (BITS(OP,0x8000)) // First, the parallel data move instructions |
| 228 | /* The words we're going to be working with */ |
| 229 | op = ROPCODE(WORD(PC)); |
| 230 | op2 = ROPCODE(WORD(PC) + WORD(1)); |
| 231 | |
| 232 | |
| 233 | /* DECODE */ |
| 234 | /* Dual X Memory Data Read : 011m mKKK -rr- ---- : A-142*/ |
| 235 | if ((op & 0xe000) == 0x6000) |
| 133 | 236 | { |
| 134 | | size = ExecuteDataALUOpcode(PARALLEL_TYPE_XMDM) ; |
| 237 | /* Quote: (MOVE, MAC(R), MPY(R), ADD, SUB, TFR) */ |
| 238 | UINT16 op_byte = op & 0x00ff; |
| 239 | |
| 240 | /* ADD : 011m mKKK 0rru Fuuu : A-22 */ |
| 241 | if ((op & 0xe080) == 0x6000) |
| 242 | { |
| 243 | size = dsp56k_op_add_2(op_byte, &cycle_count); |
| 244 | } |
| 245 | /* MAC : 011m mKKK 1xx0 F1QQ : A-122 */ |
| 246 | else if ((op & 0xe094) == 0x6084) |
| 247 | { |
| 248 | size = dsp56k_op_mac_1(op_byte, &cycle_count); |
| 249 | } |
| 250 | /* MACR: 011m mKKK 1--1 F1QQ : A-124 */ |
| 251 | else if ((op & 0xe094) == 0x6094) |
| 252 | { |
| 253 | size = dsp56k_op_macr_1(op_byte, &cycle_count); |
| 254 | } |
| 255 | /* MOVE : 011m mKKK 0rr1 0000 : A-128 */ |
| 256 | else if ((op & 0xe09f) == 0x6010) |
| 257 | { |
| 258 | size = dsp56k_op_move_1(op_byte, &cycle_count); |
| 259 | } |
| 260 | /* MPY : 011m mKKK 1xx0 F0QQ : A-160 */ |
| 261 | else if ((op & 0xe094) == 0x6080) |
| 262 | { |
| 263 | size = dsp56k_op_mpy_1(op_byte, &cycle_count); |
| 264 | } |
| 265 | /* MPYR : 011m mKKK 1--1 F0QQ : A-162 */ |
| 266 | else if ((op & 0xe094) == 0x6090) |
| 267 | { |
| 268 | size = dsp56k_op_mpyr_1(op_byte, &cycle_count); |
| 269 | } |
| 270 | /* SUB : 011m mKKK 0rru Fuuu : A-202 */ |
| 271 | else if ((op & 0xe080) == 0x6000) |
| 272 | { |
| 273 | size = dsp56k_op_sub_1(op_byte, &cycle_count); |
| 274 | } |
| 275 | /* TFR : 011m mKKK 0rr1 F0DD : A-212 */ |
| 276 | else if ((op & 0xe094) == 0x6010) |
| 277 | { |
| 278 | size = dsp56k_op_tfr_2(op_byte, &cycle_count); |
| 279 | } |
| 280 | |
| 281 | /* Now evaluate the parallel data move */ |
| 282 | // TODO // decode_dual_x_memory_data_read(op, parallel_move_str, parallel_move_str2); |
| 135 | 283 | } |
| 136 | | else if (BITS(OP,0xf000) == 0x5) |
| 284 | /* X Memory Data Write and Register Data Move : 0001 011k RRDD ---- : A-140 */ |
| 285 | else if ((op & 0xfe00) == 0x1600) |
| 137 | 286 | { |
| 138 | | size = ExecuteDataALUOpcode(PARALLEL_TYPE_XMDM_SPECIAL) ; |
| 139 | | } |
| 140 | | else if (BITS(OP,0xff00) == 0x4a) |
| 141 | | { |
| 142 | | size = ExecuteDataALUOpcode(PARALLEL_TYPE_NODM) ; |
| 143 | | } |
| 144 | | else if (BITS(OP,0xf000) == 0x04) |
| 145 | | { |
| 146 | | size = ExecuteDataALUOpcode(PARALLEL_TYPE_RRDM) ; |
| 147 | | } |
| 148 | | else if (BITS(OP,0xf800) == 0x06) |
| 149 | | { |
| 150 | | size = ExecuteDataALUOpcode(PARALLEL_TYPE_ARU) ; |
| 151 | | } |
| 287 | /* Quote: (MPY or MAC) */ |
| 288 | UINT16 op_byte = op & 0x00ff; |
| 152 | 289 | |
| 290 | /* MPY : 0001 0110 RRDD FQQQ : A-160 */ |
| 291 | if ((op & 0xff00) == 0x1600) |
| 292 | { |
| 293 | size = dsp56k_op_mpy_2(op_byte, &cycle_count); |
| 294 | } |
| 295 | /* MAC : 0001 0111 RRDD FQQQ : A-122 */ |
| 296 | else if ((op & 0xff00) == 0x1700) |
| 297 | { |
| 298 | size = dsp56k_op_mac_2(op_byte, &cycle_count); |
| 299 | } |
| 153 | 300 | |
| 154 | | else if (BITS(OP,0x4000)) |
| 155 | | { |
| 156 | | size = ExecuteDXMDROpcode() ; |
| 301 | /* Now evaluate the parallel data move */ |
| 302 | // TODO // decode_x_memory_data_write_and_register_data_move(op, parallel_move_str, parallel_move_str2); |
| 157 | 303 | } |
| 158 | | else if (BITS(OP,0xf000) == 0x1) |
| 159 | | { |
| 160 | | size = ExecuteNPMOpcode() ; |
| 161 | | } |
| 162 | | else if (BITS(OP,0x2000)) |
| 163 | | { |
| 164 | | size = ExecuteMisfitOpcode() ; |
| 165 | | } |
| 166 | | else if (BITS(OP,0xf000) == 0x0) |
| 167 | | { |
| 168 | | size = ExecuteSpecialOpcode(); |
| 169 | | } |
| 170 | 304 | |
| 171 | | if (size == 666) |
| 305 | /* Handle Other parallel types */ |
| 306 | else |
| 172 | 307 | { |
| 173 | | mame_printf_debug("unimplemented at %04x\n", PC) ; |
| 174 | | size = 1 ; // Just to get the debugger past the bad opcode |
| 175 | | } |
| 308 | /***************************************/ |
| 309 | /* 32 General parallel move operations */ |
| 310 | /***************************************/ |
| 176 | 311 | |
| 312 | enum pType { kNoParallelDataMove, |
| 313 | kRegisterToRegister, |
| 314 | kAddressRegister, |
| 315 | kXMemoryDataMove, |
| 316 | kXMemoryDataMove2, |
| 317 | kXMemoryDataMoveWithDisp }; |
| 177 | 318 | |
| 178 | | PC += size ; |
| 179 | | change_pc(PC) ; |
| 319 | int parallelType = -1; |
| 320 | UINT16 op_byte = 0x0000; |
| 321 | typed_pointer d_register = {NULL, DT_BYTE}; |
| 322 | UINT64 prev_accum_value = U64(0x0000000000000000); |
| 180 | 323 | |
| 181 | | // Loop processing |
| 182 | | if (LF_bit()) |
| 183 | | { |
| 184 | | if (PC == LA) |
| 324 | /* Note: it's important that NPDM comes before RtRDM here */ |
| 325 | /* No Parallel Data Move : 0100 1010 ---- ---- : A-131 */ |
| 326 | if ((op & 0xff00) == 0x4a00) |
| 185 | 327 | { |
| 186 | | // You're on the last instruction of the loop... |
| 187 | | if (LC != 1) // Strange, the == 1 thing... |
| 328 | op_byte = op & 0x00ff; |
| 329 | parallelType = kNoParallelDataMove; |
| 330 | } |
| 331 | /* Register to Register Data Move : 0100 IIII ---- ---- : A-133 */ |
| 332 | else if ((op & 0xf000) == 0x4000) |
| 333 | { |
| 334 | op_byte = op & 0x00ff; |
| 335 | parallelType = kRegisterToRegister; |
| 336 | } |
| 337 | /* Address Register Update : 0011 0zRR ---- ---- : A-135 */ |
| 338 | else if ((op & 0xf800) == 0x3000) |
| 339 | { |
| 340 | op_byte = op & 0x00ff; |
| 341 | parallelType = kAddressRegister; |
| 342 | } |
| 343 | /* X Memory Data Move : 1mRR HHHW ---- ---- : A-137 */ |
| 344 | else if ((op & 0x8000) == 0x8000) |
| 345 | { |
| 346 | op_byte = op & 0x00ff; |
| 347 | parallelType = kXMemoryDataMove; |
| 348 | } |
| 349 | /* X Memory Data Move : 0101 HHHW ---- ---- : A-137 */ |
| 350 | else if ((op & 0xf000) == 0x5000) |
| 351 | { |
| 352 | op_byte = op & 0x00ff; |
| 353 | parallelType = kXMemoryDataMove2; |
| 354 | } |
| 355 | /* X Memory Data Move with short displacement : 0000 0101 BBBB BBBB ---- HHHW ---- ---- : A-139 */ |
| 356 | else if ((op & 0xff00) == 0x0500) |
| 357 | { |
| 358 | /* See notes at top of file! */ |
| 359 | /* op_byte = op2 & 0x00ff; */ |
| 360 | /* parallelType = kXMemoryDataMoveWithDisp; */ |
| 361 | /* DO NOTHING FOR NOW */ |
| 362 | } |
| 363 | |
| 364 | |
| 365 | if (parallelType != -1) |
| 366 | { |
| 367 | /* Note: There is much overlap between opcodes down here */ |
| 368 | /* To this end, certain ops must come before others in the list */ |
| 369 | |
| 370 | /* CLR : .... .... 0000 F001 : A-60 */ |
| 371 | if ((op_byte & 0x00f7) == 0x0001) |
| 188 | 372 | { |
| 189 | | LC-- ; |
| 190 | | PC = SSH ; |
| 191 | | change_pc(PC) ; |
| 373 | size = dsp56k_op_clr(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 192 | 374 | } |
| 193 | | else |
| 375 | /* ADD : .... .... 0000 FJJJ : A-22 */ |
| 376 | else if ((op_byte & 0x00f0) == 0x0000) |
| 194 | 377 | { |
| 195 | | EndOfLoopProcessing() ; |
| 378 | size = dsp56k_op_add(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 196 | 379 | } |
| 197 | | } |
| 198 | | } |
| 199 | 380 | |
| 200 | | // Rep processing |
| 201 | | if (core.repFlag) |
| 202 | | { |
| 203 | | if (PC == core.repAddr) |
| 204 | | { |
| 205 | | if (LC != 1) |
| 381 | |
| 382 | /* MOVE : .... .... 0001 0001 : A-128 */ |
| 383 | else if ((op_byte & 0x00ff) == 0x0011) |
| 206 | 384 | { |
| 207 | | LC-- ; |
| 208 | | PC -= size ; // Eh, seems reasonable :) |
| 209 | | change_pc(PC) ; |
| 385 | size = dsp56k_op_move(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 210 | 386 | } |
| 211 | | else |
| 387 | /* TFR : .... .... 0001 FJJJ : A-212 */ |
| 388 | else if ((op_byte & 0x00f0) == 0x0010) |
| 212 | 389 | { |
| 213 | | EndOfRepProcessing() ; |
| 390 | size = dsp56k_op_tfr(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 214 | 391 | } |
| 215 | | } |
| 216 | | } |
| 217 | 392 | |
| 218 | | dsp56k_icount -= 4; /* Temporarily hard-coded at 4 clocks per opcode */ |
| 219 | | } |
| 220 | 393 | |
| 394 | /* RND : .... .... 0010 F000 : A-188 */ |
| 395 | else if ((op_byte & 0x00f7) == 0x0020) |
| 396 | { |
| 397 | size = dsp56k_op_rnd(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 398 | } |
| 399 | /* TST : .... .... 0010 F001 : A-218 */ |
| 400 | else if ((op_byte & 0x00f7) == 0x0021) |
| 401 | { |
| 402 | size = dsp56k_op_tst(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 403 | } |
| 404 | /* INC : .... .... 0010 F010 : A-104 */ |
| 405 | else if ((op_byte & 0x00f7) == 0x0022) |
| 406 | { |
| 407 | size = dsp56k_op_inc(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 408 | } |
| 409 | /* INC24 : .... .... 0010 F011 : A-106 */ |
| 410 | else if ((op_byte & 0x00f7) == 0x0023) |
| 411 | { |
| 412 | size = dsp56k_op_inc24(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 413 | } |
| 414 | /* OR : .... .... 0010 F1JJ : A-176 */ |
| 415 | else if ((op_byte & 0x00f4) == 0x0024) |
| 416 | { |
| 417 | size = dsp56k_op_or(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 418 | } |
| 221 | 419 | |
| 222 | | static unsigned ExecuteDataALUOpcode(int parallelType) |
| 223 | | { |
| 224 | | unsigned retSize = 666 ; |
| 225 | 420 | |
| 226 | | void *workingDest = 0x00 ; |
| 227 | | |
| 228 | | // Whenever an instruction uses an accumulator as both a destination operand for a Data ALU operation and |
| 229 | | // as a source for a parallel move operation, the parallel move operation will use the value in the accumulator |
| 230 | | // prior to execution of any Data ALU operation. |
| 231 | | UINT64 previousAccum = 0 ; |
| 232 | | |
| 233 | | switch(BITS(OP,0x0070)) |
| 234 | | { |
| 235 | | |
| 236 | | case 0x0: |
| 237 | | if (BITS(OP,0x0007) == 0x1) |
| 421 | /* ASR : .... .... 0011 F000 : A-32 */ |
| 422 | else if ((op_byte & 0x00f7) == 0x0030) |
| 238 | 423 | { |
| 239 | | // CLR - 1mRR HHHW 0000 F001 |
| 240 | | retSize = ClrOperation(&workingDest, &previousAccum) ; |
| 424 | size = dsp56k_op_asr(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 241 | 425 | } |
| 242 | | else |
| 426 | /* ASL : .... .... 0011 F001 : A-28 */ |
| 427 | else if ((op_byte & 0x00f7) == 0x0031) |
| 243 | 428 | { |
| 244 | | // ADD - 1mRR HHHW 0000 FJJJ |
| 245 | | retSize = AddOperation(&workingDest, &previousAccum) ; |
| 429 | size = dsp56k_op_asl(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 246 | 430 | } |
| 247 | | break ; |
| 248 | | |
| 249 | | case 0x1: |
| 250 | | if (BITS(OP,0x000f) == 0x1) |
| 431 | /* LSR : .... .... 0011 F010 : A-120 */ |
| 432 | else if ((op_byte & 0x00f7) == 0x0032) |
| 251 | 433 | { |
| 252 | | // MOVE - 1mRR HHHW 0001 0001 |
| 253 | | retSize = 1 ; |
| 434 | size = dsp56k_op_lsr(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 254 | 435 | } |
| 255 | | else |
| 436 | /* LSL : .... .... 0011 F011 : A-118 */ |
| 437 | else if ((op_byte & 0x00f7) == 0x0033) |
| 256 | 438 | { |
| 257 | | // TFR - 1mRR HHHW 0001 FJJJ |
| 258 | | retSize = TfrDataALUOperation(&workingDest, &previousAccum) ; |
| 439 | size = dsp56k_op_lsl(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 259 | 440 | } |
| 260 | | break ; |
| 441 | /* EOR : .... .... 0011 F1JJ : A-94 */ |
| 442 | else if ((op_byte & 0x00f4) == 0x0034) |
| 443 | { |
| 444 | size = dsp56k_op_eor(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 445 | } |
| 261 | 446 | |
| 262 | | case 0x2: |
| 263 | | if (BITS(OP,0x0007) == 0x0) |
| 447 | |
| 448 | /* SUBL : .... .... 0100 F001 : A-204 */ |
| 449 | else if ((op_byte & 0x00f7) == 0x0041) |
| 264 | 450 | { |
| 265 | | // RND - 1mRR HHHW 0010 F000 |
| 451 | size = dsp56k_op_subl(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 266 | 452 | } |
| 267 | | else if (BITS(OP,0x0007) == 0x1) |
| 453 | /* SUB : .... .... 0100 FJJJ : A-202 */ |
| 454 | else if ((op_byte & 0x00f0) == 0x0040) |
| 268 | 455 | { |
| 269 | | // TST - 1mRR HHHW 0010 F001 |
| 270 | | retSize = TstOperation(&workingDest, &previousAccum); |
| 456 | size = dsp56k_op_sub(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 271 | 457 | } |
| 272 | | else if (BITS(OP,0x0007) == 0x2) |
| 458 | |
| 459 | |
| 460 | /* CLR24 : .... .... 0101 F001 : A-62 */ |
| 461 | else if ((op_byte & 0x00f7) == 0x0051) |
| 273 | 462 | { |
| 274 | | // INC - 1mRR HHHW 0010 F010 |
| 463 | size = dsp56k_op_clr24(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 275 | 464 | } |
| 276 | | else if (BITS(OP,0x0007) == 0x3) |
| 465 | /* SBC : .... .... 0101 F01J : A-198 */ |
| 466 | else if ((op_byte & 0x00f6) == 0x0052) |
| 277 | 467 | { |
| 278 | | // INC24 - 1mRR HHHW 0010 F011 |
| 468 | size = dsp56k_op_sbc(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 279 | 469 | } |
| 280 | | else |
| 470 | /* CMP : .... .... 0101 FJJJ : A-64 */ |
| 471 | else if ((op_byte & 0x00f0) == 0x0050) |
| 281 | 472 | { |
| 282 | | // OR - 1mRR HHHW 0010 F1JJ |
| 283 | | retSize = OrOperation(&workingDest, &previousAccum) ; |
| 473 | size = dsp56k_op_cmp(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 284 | 474 | } |
| 285 | | break ; |
| 286 | 475 | |
| 287 | | case 0x3: |
| 288 | | if (BITS(OP,0x0007) == 0x0) |
| 476 | |
| 477 | /* NEG : .... .... 0110 F000 : A-166 */ |
| 478 | else if ((op_byte & 0x00f7) == 0x0060) |
| 289 | 479 | { |
| 290 | | // ASR - 1mRR HHHW 0011 F000 |
| 291 | | retSize = AsrOperation(&workingDest, &previousAccum) ; |
| 480 | size = dsp56k_op_neg(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 292 | 481 | } |
| 293 | | else if (BITS(OP,0x0007) == 0x1) |
| 482 | /* NOT : .... .... 0110 F001 : A-174 */ |
| 483 | else if ((op_byte & 0x00f7) == 0x0061) |
| 294 | 484 | { |
| 295 | | // ASL - 1mRR HHHW 0011 F001 |
| 485 | size = dsp56k_op_not(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 296 | 486 | } |
| 297 | | else if (BITS(OP,0x0007) == 0x2) |
| 487 | /* DEC : .... .... 0110 F010 : A-72 */ |
| 488 | else if ((op_byte & 0x00f7) == 0x0062) |
| 298 | 489 | { |
| 299 | | // LSR - 1mRR HHHW 0011 F010 |
| 300 | | retSize = LsrOperation(&workingDest, &previousAccum) ; |
| 490 | size = dsp56k_op_dec(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 301 | 491 | } |
| 302 | | else if (BITS(OP,0x0007) == 0x3) |
| 492 | /* DEC24 : .... .... 0110 F011 : A-74 */ |
| 493 | else if ((op_byte & 0x00f7) == 0x0063) |
| 303 | 494 | { |
| 304 | | // LSL - 1mRR HHHW 0011 F011 |
| 495 | size = dsp56k_op_dec24(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 305 | 496 | } |
| 306 | | else |
| 497 | /* AND : .... .... 0110 F1JJ : A-24 */ |
| 498 | else if ((op_byte & 0x00f4) == 0x0064) |
| 307 | 499 | { |
| 308 | | // EOR - 1mRR HHHW 0011 F1JJ |
| 309 | | retSize = EorOperation(&workingDest, &previousAccum) ; |
| 500 | size = dsp56k_op_and(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 310 | 501 | } |
| 311 | | break ; |
| 312 | | /* |
| 313 | | case 0x4: |
| 314 | | if (BITS(op,0x0007) == 0x1) |
| 315 | | { |
| 316 | | // SUBL - 1mRR HHHW 0100 F001 |
| 317 | | } |
| 318 | | else |
| 319 | | { |
| 320 | | // SUB - 1mRR HHHW 0100 FJJJ |
| 321 | | } |
| 322 | | break ; |
| 323 | | */ |
| 324 | | case 0x5: |
| 325 | | if (BITS(OP,0x0007) == 0x1) |
| 502 | |
| 503 | |
| 504 | /* ABS : .... .... 0111 F001 : A-18 */ |
| 505 | if ((op_byte & 0x00f7) == 0x0071) |
| 326 | 506 | { |
| 327 | | // CLR24 - 1mRR HHHW 0101 F001 |
| 507 | size = dsp56k_op_abs(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 328 | 508 | } |
| 329 | | else if (BITS(OP,0x0006) == 0x1) |
| 509 | /* ROR : .... .... 0111 F010 : A-192 */ |
| 510 | else if ((op_byte & 0x00f7) == 0x0072) |
| 330 | 511 | { |
| 331 | | // SBC - 1mRR HHHW 0101 F01J |
| 512 | size = dsp56k_op_ror(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 332 | 513 | } |
| 333 | | else |
| 514 | /* ROL : .... .... 0111 F011 : A-190 */ |
| 515 | else if ((op_byte & 0x00f7) == 0x0073) |
| 334 | 516 | { |
| 335 | | // CMP - 1mRR HHHW 0101 FJJJ |
| 336 | | retSize = CmpOperation(&workingDest, &previousAccum) ; |
| 517 | size = dsp56k_op_rol(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 337 | 518 | } |
| 338 | | break ; |
| 519 | /* CMPM : .... .... 0111 FJJJ : A-66 */ |
| 520 | else if ((op_byte & 0x00f0) == 0x0070) |
| 521 | { |
| 522 | size = dsp56k_op_cmpm(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 523 | } |
| 339 | 524 | |
| 340 | | case 0x6: |
| 341 | | if (BITS(OP,0x0007) == 0x0) |
| 525 | |
| 526 | /* MPY : .... .... 1k00 FQQQ : A-160 -- CONFIRMED TYPO IN DOCS (HHHH vs HHHW) */ |
| 527 | else if ((op_byte & 0x00b0) == 0x0080) |
| 342 | 528 | { |
| 343 | | // NEG - 1mRR HHHW 0110 F000 |
| 529 | size = dsp56k_op_mpy(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 344 | 530 | } |
| 345 | | else if (BITS(OP,0x0007) == 0x1) |
| 531 | /* MPYR : .... .... 1k01 FQQQ : A-162 */ |
| 532 | else if ((op_byte & 0x00b0) == 0x0090) |
| 346 | 533 | { |
| 347 | | // NOT - 1mRR HHHW 0110 F001 |
| 348 | | retSize = NotOperation(&workingDest, &previousAccum) ; |
| 534 | size = dsp56k_op_mpyr(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 349 | 535 | } |
| 350 | | else if (BITS(OP,0x0007) == 0x2) |
| 536 | /* MAC : .... .... 1k10 FQQQ : A-122 */ |
| 537 | else if ((op_byte & 0x00b0) == 0x00a0) |
| 351 | 538 | { |
| 352 | | // DEC - 1mRR HHHW 0110 F010 |
| 539 | size = dsp56k_op_mac(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 353 | 540 | } |
| 354 | | else if (BITS(OP,0x0007) == 0x3) |
| 541 | /* MACR : .... .... 1k11 FQQQ : A-124 -- DRAMA - rr vs xx (805) */ |
| 542 | else if ((op_byte & 0x00b0) == 0x00b0) |
| 355 | 543 | { |
| 356 | | // DEC24 - 1mRR HHHW 0110 F011 |
| 357 | | retSize = Dec24Operation(&workingDest, &previousAccum) ; |
| 544 | size = dsp56k_op_macr(op_byte, &d_register, &prev_accum_value, &cycle_count); |
| 358 | 545 | } |
| 359 | | else |
| 546 | |
| 547 | |
| 548 | /* Now evaluate the parallel data move */ |
| 549 | switch (parallelType) |
| 360 | 550 | { |
| 361 | | // AND - 1mRR HHHW 0110 F1JJ |
| 362 | | retSize = AndOperation(&workingDest, &previousAccum) ; |
| 551 | case kNoParallelDataMove: |
| 552 | /* DO NOTHING */ |
| 553 | break; |
| 554 | case kRegisterToRegister: |
| 555 | execute_register_to_register_data_move(op, &d_register, &prev_accum_value); |
| 556 | break; |
| 557 | case kAddressRegister: |
| 558 | // TODO // decode_address_register_update(op, parallel_move_str); |
| 559 | break; |
| 560 | case kXMemoryDataMove: |
| 561 | execute_x_memory_data_move(op, &d_register, &prev_accum_value); |
| 562 | break; |
| 563 | case kXMemoryDataMove2: |
| 564 | execute_x_memory_data_move2(op, &d_register); |
| 565 | break; |
| 566 | case kXMemoryDataMoveWithDisp: |
| 567 | // TODO // decode_x_memory_data_move_with_short_displacement(op, op2, parallel_move_str); |
| 568 | break; |
| 363 | 569 | } |
| 364 | | break ; |
| 365 | | /* |
| 366 | | case 0x7: |
| 367 | | if (BITS(op,0x0007) == 0x1) |
| 368 | | { |
| 369 | | // ABS - 1mRR HHHW 0111 F001 |
| 370 | | } |
| 371 | | if (BITS(op,0x0007) == 0x2) |
| 372 | | { |
| 373 | | // ROR - 1mRR HHHW 0111 F010 |
| 374 | | } |
| 375 | | if (BITS(op,0x0007) == 0x3) |
| 376 | | { |
| 377 | | // ROL - 1mRR HHHW 0111 F011 |
| 378 | | } |
| 379 | | else |
| 380 | | { |
| 381 | | // CMPM - 1mRR HHHW 0111 FJJJ |
| 382 | | } |
| 383 | | |
| 384 | | break ; |
| 385 | | */ |
| 570 | } |
| 386 | 571 | } |
| 387 | 572 | |
| 388 | | /* |
| 389 | | // Otherwise you're looking at a MPY/MAC operation... |
| 390 | | if (BITS(op,0x0080)) // Maybe i should un-consolidate here? |
| 391 | | { |
| 392 | | DecodeQQQFTable(BITS(op,0x0007), BITS(op,0x0008), S1, S2, D) ; |
| 393 | | DecodekSignTable(BITS(op,0x0040), sign) ; |
| 394 | | |
| 395 | | switch(BITS(op,0x00b0)) |
| 396 | | { |
| 397 | | // MPY - 1mRR HHHH 1k00 FQQQ |
| 398 | | case 0x4: sprintf(buffer, "mpy (%s)%s,%s,%s", sign, S2, S1, D) ; break ; |
| 399 | | |
| 400 | | // MPYR - 1mRR HHHH 1k01 FQQQ |
| 401 | | case 0x5: sprintf(buffer, "mpyr (%s)%s,%s,%s", sign, S2, S1, D) ; break ; |
| 402 | | |
| 403 | | // MAC - 1mRR HHHH 1k10 FQQQ |
| 404 | | case 0x6: sprintf(buffer, "mac (%s)%s,%s,%s", sign, S2, S1, D) ; break ; |
| 405 | | |
| 406 | | // MACR - 1mRR HHHH 1k11 FQQQ |
| 407 | | case 0x7: sprintf(buffer, "macr (%s)%s,%s,%s", sign, S1, S2, D) ; break ; |
| 408 | | // !! It's a little odd that macr is S1,S2 while everyone else is S2,S1 !! |
| 409 | | } |
| 410 | | |
| 411 | | retSize = 1 ; |
| 412 | | } |
| 413 | | */ |
| 414 | | |
| 415 | | // Do the parallel move parallel'y :) |
| 416 | | // Someday we may have to check against the special cases to throw exceptions !! |
| 417 | | switch (parallelType) |
| 573 | /* Drop out if you've already completed your work. */ |
| 574 | if (size != 0x1337) |
| 418 | 575 | { |
| 419 | | case PARALLEL_TYPE_XMDM: |
| 420 | | XMDMOperation(BITS(OP,0xff00), workingDest, &previousAccum) ; |
| 421 | | break ; |
| 576 | PC += size; |
| 577 | change_pc(PC); |
| 422 | 578 | |
| 423 | | case PARALLEL_TYPE_RRDM: |
| 424 | | RRDMOperation(BITS(OP,0xff00), workingDest, &previousAccum) ; |
| 425 | | break ; |
| 579 | dsp56k_process_loop(); |
| 580 | dsp56k_process_rep(size); |
| 426 | 581 | |
| 427 | | case PARALLEL_TYPE_XMDM_SPECIAL: |
| 428 | | // pa is not needed because the XMDM dest is always the .opposite. of the regular dest. |
| 429 | | XMDMSpecialOperation(BITS(OP,0xff00), workingDest) ; |
| 430 | | break ; |
| 431 | | |
| 432 | | case PARALLEL_TYPE_NODM: |
| 433 | | // do nothing |
| 434 | | break ; |
| 435 | | |
| 436 | | case PARALLEL_TYPE_ARU: |
| 437 | | ARUOperation(BITS(OP,0xff00)) ; |
| 438 | | break ; |
| 582 | dsp56k_icount -= 4; /* Temporarily hard-coded at 4 clocks per opcode */ /* cycle_count */ |
| 583 | return; |
| 439 | 584 | } |
| 440 | 585 | |
| 441 | | return retSize ; |
| 442 | | } |
| 443 | 586 | |
| 444 | | static unsigned ExecuteDXMDROpcode(void) |
| 445 | | { |
| 446 | | unsigned retSize = 666 ; |
| 587 | /******************************/ |
| 588 | /* Remaining non-parallel ops */ |
| 589 | /******************************/ |
| 447 | 590 | |
| 448 | | return retSize ; |
| 449 | | } |
| 450 | | |
| 451 | | static unsigned ExecuteNPMOpcode(void) |
| 452 | | { |
| 453 | | unsigned retSize = 666 ; |
| 454 | | |
| 455 | | if (BITS(OP,0x0f00) == 0x4) |
| 591 | /* ADC : 0001 0101 0000 F01J : A-20 */ |
| 592 | if ((op & 0xfff6) == 0x1502) |
| 456 | 593 | { |
| 457 | | retSize = BitfieldOperation() ; |
| 594 | size = dsp56k_op_adc(op, &cycle_count); |
| 458 | 595 | } |
| 459 | | else if (BITS(OP,0x0f00) == 0x5) |
| 596 | /* ANDI : 0001 1EE0 iiii iiii : A-26 */ |
| 597 | /* (MoveP sneaks in here if you don't check 0x0600) */ |
| 598 | else if (((op & 0xf900) == 0x1800) & ((op & 0x0600) != 0x0000)) |
| 460 | 599 | { |
| 461 | | switch(BITS(OP,0x0074)) |
| 462 | | { |
| 463 | | case 0x0: |
| 464 | | if (BITS(OP,0x0006) == 0x0) |
| 465 | | { |
| 466 | | // TFR(2) - 0001 0101 0000 F00J |
| 467 | | retSize = 1 ; |
| 468 | | } |
| 469 | | else if (BITS(OP,0x0006) == 0x1) |
| 470 | | { |
| 471 | | // ADC - 0001 0101 0000 F01J |
| 472 | | retSize = 1 ; |
| 473 | | } |
| 474 | | break ; |
| 475 | | |
| 476 | | case 0x3: |
| 477 | | // TST(2) - 0001 0101 0001 -1DD |
| 478 | | retSize = Tst2Operation() ; break ; |
| 479 | | |
| 480 | | case 0x4: |
| 481 | | // NORM - 0001 0101 0010 F0RR |
| 482 | | retSize = 1 ; break ; |
| 483 | | |
| 484 | | case 0x6: |
| 485 | | if (BITS(OP,0x0003) == 0x0) |
| 486 | | { |
| 487 | | // ASR4 - 0001 0101 0011 F000 |
| 488 | | retSize = 1 ; |
| 489 | | } |
| 490 | | else if (BITS(OP,0x0003) == 0x1) |
| 491 | | { |
| 492 | | // ASL4 - 0001 0101 0011 F001 |
| 493 | | retSize = 1 ; |
| 494 | | } |
| 495 | | break ; |
| 496 | | |
| 497 | | case 0x1: case 0x5: case 0x9: case 0xd: |
| 498 | | // DIV - 0001 0101 0--0 F1DD |
| 499 | | retSize = 1 ; break ; |
| 500 | | |
| 501 | | case 0xa: |
| 502 | | if (BITS(OP,0x0003) == 0x0) |
| 503 | | { |
| 504 | | // ZERO - 0001 0101 0101 F000 |
| 505 | | retSize = 1 ; |
| 506 | | } |
| 507 | | else if (BITS(OP,0x0003) == 0x2) |
| 508 | | { |
| 509 | | // EXT - 0001 0101 0101 F010 |
| 510 | | retSize = 1 ; |
| 511 | | } |
| 512 | | break ; |
| 513 | | |
| 514 | | case 0xc: |
| 515 | | if (BITS(OP,0x0003) == 0x0) |
| 516 | | { |
| 517 | | // NEGC - 0001 0101 0110 F000 |
| 518 | | retSize = 1 ; |
| 519 | | } |
| 520 | | break ; |
| 521 | | |
| 522 | | case 0xe: |
| 523 | | if (BITS(OP,0x0003) == 0x0) |
| 524 | | { |
| 525 | | // ASR16 - 0001 0101 0111 F000 |
| 526 | | retSize = 1 ; |
| 527 | | } |
| 528 | | else if (BITS(OP,0x0003) == 0x1) |
| 529 | | { |
| 530 | | // SWAP - 0001 0101 0111 F001 |
| 531 | | retSize = 1 ; |
| 532 | | } |
| 533 | | break ; |
| 534 | | } |
| 535 | | |
| 536 | | switch(BITS(OP,0x00f0)) |
| 537 | | { |
| 538 | | case 0x8: |
| 539 | | // IMPY - 0001 0101 1000 FQQQ |
| 540 | | retSize = 1 ; break ; |
| 541 | | case 0xa: |
| 542 | | // IMAC - 0001 0101 1010 FQQQ |
| 543 | | retSize = 1 ; break ; |
| 544 | | case 0x9: case 0xb: |
| 545 | | // DMAC(ss,su,uu) - 0001 0101 10s1 FsQQ |
| 546 | | retSize = 1 ; break ; |
| 547 | | case 0xc: |
| 548 | | // MPY(su,uu) - 0001 0101 1100 FsQQ |
| 549 | | retSize = 1 ; break ; |
| 550 | | case 0xe: |
| 551 | | // MAC(su,uu) - 0001 0101 1110 FsQQ |
| 552 | | retSize = MACsuuuOperation() ; break ; |
| 553 | | } |
| 600 | size = dsp56k_op_andi(op, &cycle_count); |
| 554 | 601 | } |
| 555 | | else if ((BITS(OP,0x0f00) == 0x6)) |
| 602 | /* ASL4 : 0001 0101 0011 F001 : A-30 */ |
| 603 | else if ((op & 0xfff7) == 0x1531) |
| 556 | 604 | { |
| 557 | | retSize = 1 ; |
| 605 | size = dsp56k_op_asl4(op, &cycle_count); |
| 558 | 606 | } |
| 559 | | else if ((BITS(OP,0x0f00) == 0x7)) |
| 607 | /* ASR4 : 0001 0101 0011 F000 : A-34 */ |
| 608 | else if ((op & 0xfff7) == 0x1530) |
| 560 | 609 | { |
| 561 | | retSize = 1 ; |
| 610 | size = dsp56k_op_asr4(op, &cycle_count); |
| 562 | 611 | } |
| 563 | | else if ((BITS(OP,0x0800) == 0x1)) |
| 612 | /* ASR16 : 0001 0101 0111 F000 : A-36 */ |
| 613 | else if ((op & 0xfff7) == 0x1570) |
| 564 | 614 | { |
| 565 | | if (BITS(OP,0x0600)) |
| 566 | | { |
| 567 | | if (!BITS(OP,0x0100)) |
| 568 | | { |
| 569 | | // ANDI - 0001 1EE0 iiii iiii |
| 570 | | retSize = AndiOperation() ; |
| 571 | | } |
| 572 | | else |
| 573 | | { |
| 574 | | // ORI - 0001 1EE1 iiii iiii |
| 575 | | } |
| 576 | | } |
| 577 | | else |
| 578 | | { |
| 579 | | if (!BITS(OP,0x0020)) |
| 580 | | { |
| 581 | | // MOVE(S) - 0001 100W HH0a aaaa |
| 582 | | } |
| 583 | | else |
| 584 | | { |
| 585 | | // MOVE(P) - 0001 100W HH1p pppp |
| 586 | | retSize = MovePOperation() ; |
| 587 | | } |
| 588 | | } |
| 615 | size = dsp56k_op_asr16(op, &cycle_count); |
| 589 | 616 | } |
| 590 | | else if ((BITS(OP,0x0c00) == 0x0)) |
| 617 | /* BFCHG : 0001 0100 11Pp pppp BBB1 0010 iiii iiii : A-38 */ |
| 618 | else if (((op & 0xffc0) == 0x14c0) && ((op2 & 0x1f00) == 0x1200)) |
| 591 | 619 | { |
| 592 | | retSize = TccOperation() ; |
| 620 | size = dsp56k_op_bfop(op, op2, &cycle_count); |
| 593 | 621 | } |
| 594 | | |
| 595 | | return retSize ; |
| 596 | | } |
| 597 | | |
| 598 | | static unsigned ExecuteMisfitOpcode(void) |
| 599 | | { |
| 600 | | unsigned retSize = 666 ; |
| 601 | | |
| 602 | | if (BITS(OP,0x1000)== 0x0) |
| 622 | /* BFCHG : 0001 0100 101- --RR BBB1 0010 iiii iiii : A-38 */ |
| 623 | else if (((op & 0xffe0) == 0x14a0) && ((op2 & 0x1f00) == 0x1200)) |
| 603 | 624 | { |
| 604 | | switch(BITS(OP,0x0c00)) |
| 605 | | { |
| 606 | | // MOVE(I) - 0010 00DD BBBB BBBB |
| 607 | | case 0x0: |
| 608 | | retSize = MoveIOperation() ; |
| 609 | | break ; |
| 610 | | |
| 611 | | /* |
| 612 | | case 0x1: |
| 613 | | // TFR(3) - 0010 01mW RRDD FHHH |
| 614 | | break ; |
| 615 | | */ |
| 616 | | case 0x2: |
| 617 | | // MOVE(C) - 0010 10dd dddD DDDD |
| 618 | | retSize = MoveCOperation() ; |
| 619 | | break ; |
| 620 | | |
| 621 | | case 0x3: |
| 622 | | // B.cc - 0010 11cc ccee eeee |
| 623 | | retSize = BccOperation() ; |
| 624 | | break ; |
| 625 | | } |
| 625 | size = dsp56k_op_bfop_1(op, op2, &cycle_count); |
| 626 | 626 | } |
| 627 | | else |
| 627 | /* BFCHG : 0001 0100 100D DDDD BBB1 0010 iiii iiii : A-38 */ |
| 628 | else if (((op & 0xffe0) == 0x1480) && ((op2 & 0x1f00) == 0x1200)) |
| 628 | 629 | { |
| 629 | | // MOVE(C) - 0011 1WDD DDD0 MMRR |
| 630 | | // MOVE(C) - 0011 1WDD DDD1 q0RR |
| 631 | | // MOVE(C) - 0011 1WDD DDD1 t10- xxxx xxxx xxxx xxxx |
| 632 | | // MOVE(C) - 0011 1WDD DDD1 Z11- |
| 633 | | retSize = MoveCOperation() ; |
| 630 | size = dsp56k_op_bfop_2(op, op2, &cycle_count); |
| 634 | 631 | } |
| 635 | | |
| 636 | | return retSize ; |
| 637 | | } |
| 638 | | |
| 639 | | static unsigned ExecuteSpecialOpcode(void) |
| 640 | | { |
| 641 | | unsigned retSize = 666 ; |
| 642 | | |
| 643 | | if (BITS(OP,0x0ff0) == 0x0) |
| 632 | /* BFCLR : 0001 0100 11Pp pppp BBB0 0100 iiii iiii : A-40 */ |
| 633 | else if (((op & 0xffc0) == 0x14c0) && ((op2 & 0x1f00) == 0x0400)) |
| 644 | 634 | { |
| 645 | | switch (BITS(OP,0x000f)) |
| 646 | | { |
| 647 | | // NOP - 0000 0000 0000 0000 |
| 648 | | case 0x0: |
| 649 | | retSize = 1 ; |
| 650 | | break ; |
| 651 | | |
| 652 | | // DO FOREVER - 0000 0000 0000 0010 xxxx xxxx xxxx xxxx |
| 653 | | case 0x2: |
| 654 | | // !!! IMPLEMENT ME NEXT; |
| 655 | | retSize = 0; |
| 656 | | break; |
| 657 | | |
| 658 | | // RTS - 0000 0000 0000 0110 |
| 659 | | case 0x6: |
| 660 | | PC = SSH ; |
| 661 | | SR = SSL ; |
| 662 | | SP-- ; |
| 663 | | retSize = 0 ; |
| 664 | | change_pc(PC) ; |
| 665 | | break ; |
| 666 | | |
| 667 | | // RTI - 0000 0000 0000 0111 |
| 668 | | case 0x7: |
| 669 | | PC = SSH; |
| 670 | | SR = SSL; |
| 671 | | SP--; |
| 672 | | retSize = 0; |
| 673 | | change_pc(PC); |
| 674 | | break; |
| 675 | | } |
| 635 | size = dsp56k_op_bfop(op, op2, &cycle_count); |
| 676 | 636 | } |
| 677 | | else if (BITS(OP,0x0f00) == 0x0) |
| 637 | /* BFCLR : 0001 0100 101- --RR BBB0 0100 iiii iiii : A-40 */ |
| 638 | else if (((op & 0xffe0) == 0x14a0) && ((op2 & 0x1f00) == 0x0400)) |
| 678 | 639 | { |
| 679 | | retSize = 1 ; |
| 640 | size = dsp56k_op_bfop_1(op, op2, &cycle_count); |
| 680 | 641 | } |
| 681 | | else if (BITS(OP,0x0f00) == 0x1) |
| 642 | /* BFCLR : 0001 0100 100D DDDD BBB0 0100 iiii iiii : A-40 */ |
| 643 | else if (((op & 0xffe0) == 0x1480) && ((op2 & 0x1f00) == 0x0400)) |
| 682 | 644 | { |
| 683 | | if (BITS(OP,0x00f0) == 0x1) |
| 684 | | { |
| 685 | | retSize = 1 ; |
| 686 | | } |
| 687 | | else if (BITS(OP,0x00f0) == 0x2) |
| 688 | | { |
| 689 | | switch(BITS(OP,0x000c)) // Consolidation can happen here |
| 690 | | { |
| 691 | | // JSR - 0000 0001 0010 00RR |
| 692 | | // JMP - 0000 0001 0010 01RR |
| 693 | | case 0x1: retSize = JmpOperation(); break; |
| 694 | | // BSR - 0000 0001 0010 10RR |
| 695 | | // BRA - 0000 0001 0010 11RR |
| 696 | | default: retSize = 1; |
| 697 | | } |
| 698 | | } |
| 699 | | else if (BITS(OP,0x00f0) == 0x3) |
| 700 | | { |
| 701 | | switch(BITS(OP,0x000c)) |
| 702 | | { |
| 703 | | // JSR - 0000 0001 0011 00-- xxxx xxxx xxxx xxxx |
| 704 | | case 0x0: retSize = JsrOperation() ; break ; |
| 705 | | // JMP - 0000 0001 0011 01-- xxxx xxxx xxxx xxxx |
| 706 | | case 0x1: retSize = JmpOperation() ; break ; |
| 707 | | // BSR - 0000 0001 0011 10-- xxxx xxxx xxxx xxxx |
| 708 | | case 0x2: retSize = BsrOperation() ; break ; |
| 709 | | } |
| 710 | | } |
| 711 | | else if (BITS(OP,0x00f0) == 0x5) |
| 712 | | { |
| 713 | | retSize = 1 ; |
| 714 | | } |
| 715 | | else if (BITS(OP,0x0080) == 0x1) |
| 716 | | { |
| 717 | | retSize = 1 ; |
| 718 | | } |
| 645 | size = dsp56k_op_bfop_2(op, op2, &cycle_count); |
| 719 | 646 | } |
| 720 | | else if (BITS(OP,0x0e00) == 0x1) |
| 647 | /* BFSET : 0001 0100 11Pp pppp BBB1 1000 iiii iiii : A-42 */ |
| 648 | else if (((op & 0xffc0) == 0x14c0) && ((op2 & 0x1f00) == 0x1800)) |
| 721 | 649 | { |
| 722 | | if (BITS(OP,0x0020) == 0x0) |
| 723 | | { |
| 724 | | // MOVE(M) - 0000 001W RR0M MHHH |
| 725 | | retSize = MoveMOperation() ; |
| 726 | | } |
| 650 | size = dsp56k_op_bfop(op, op2, &cycle_count); |
| 727 | 651 | } |
| 728 | | else if (BITS(OP,0x0f00) == 0x4) |
| 652 | /* BFSET : 0001 0100 101- --RR BBB1 1000 iiii iiii : A-42 */ |
| 653 | else if (((op & 0xffe0) == 0x14a0) && ((op2 & 0x1f00) == 0x1800)) |
| 729 | 654 | { |
| 730 | | if (BITS(OP,0x0020) == 0x0) |
| 731 | | { |
| 732 | | // DO - 0000 0100 000D DDDD xxxx xxxx xxxx xxxx |
| 733 | | retSize = DoOperation() ; |
| 734 | | } |
| 735 | | else |
| 736 | | { |
| 737 | | // REP - 0000 0100 001D DDDD |
| 738 | | retSize = RepOperation() ; |
| 739 | | } |
| 655 | size = dsp56k_op_bfop_1(op, op2, &cycle_count); |
| 740 | 656 | } |
| 741 | | else if (BITS(OP,0x0f00) == 0x5) |
| 657 | /* BFSET : 0001 0100 100D DDDD BBB1 1000 iiii iiii : A-42 */ |
| 658 | else if (((op & 0xffe0) == 0x1480) && ((op2 & 0x1f00) == 0x1800)) |
| 742 | 659 | { |
| 743 | | UINT16 op2 = ROPCODE((PC<<1)+2) ; |
| 744 | | |
| 745 | | if (BITS(op2,0xfe20) == 0x02) |
| 746 | | { |
| 747 | | // MOVE(M) - 0000 0101 BBBB BBBB | 0000 001W --0- -HHH |
| 748 | | retSize = MoveMOperation() ; |
| 749 | | } |
| 750 | | else if (BITS(op2,0xf810) == 0x0e) |
| 751 | | { |
| 752 | | // MOVE(C) - 0000 0101 BBBB BBBB | 0011 1WDD DDD0 ---- |
| 753 | | } |
| 754 | | else if (BITS(op2,0x00ff) == 0x11) |
| 755 | | { |
| 756 | | // MOVE - 0000 0101 BBBB BBBB | ---- HHHW 0001 0001 |
| 757 | | } |
| 660 | size = dsp56k_op_bfop_2(op, op2, &cycle_count); |
| 758 | 661 | } |
| 759 | | else if (BITS(OP,0x0f00) == 0x6) |
| 662 | /* BFTSTH : 0001 0100 01Pp pppp BBB1 0000 iiii iiii : A-44 */ |
| 663 | else if (((op & 0xffc0) == 0x1440) && ((op2 & 0x1f00) == 0x1000)) |
| 760 | 664 | { |
| 761 | | retSize = 1 ; |
| 665 | size = dsp56k_op_bfop(op, op2, &cycle_count); |
| 762 | 666 | } |
| 763 | | else if (BITS(OP,0x0f00) == 0x7) |
| 667 | /* BFTSTH : 0001 0100 001- --RR BBB1 0000 iiii iiii : A-44 */ |
| 668 | else if (((op & 0xffe0) == 0x1420) && ((op2 & 0x1f00) == 0x1000)) |
| 764 | 669 | { |
| 765 | | switch(BITS(OP,0x0030)) |
| 766 | | { |
| 767 | | // BS.cc - 0000 0111 RR00 cccc |
| 768 | | case 0x0: retSize = 1 ; break ; |
| 769 | | |
| 770 | | // BS.cc - 0000 0111 --01 cccc xxxx xxxx xxxx xxxx |
| 771 | | case 0x1: retSize = BsccOperation() ; break ; |
| 772 | | |
| 773 | | // B.cc - 0000 0111 RR10 cccc |
| 774 | | case 0x2: retSize = 1 ; break ; |
| 775 | | |
| 776 | | // B.cc - 0000 0111 --11 cccc xxxx xxxx xxxx xxxx |
| 777 | | case 0x3: retSize = BccOperation() ; break ; |
| 778 | | } |
| 670 | size = dsp56k_op_bfop_1(op, op2, &cycle_count); |
| 779 | 671 | } |
| 780 | | else if (BITS(OP,0x0800)) |
| 672 | /* BFTSTH : 0001 0100 000D DDDD BBB1 0000 iiii iiii : A-44 */ |
| 673 | else if (((op & 0xffe0) == 0x1400) && ((op2 & 0x1f00) == 0x1000)) |
| 781 | 674 | { |
| 782 | | switch (BITS(OP,0x0700)) |
| 783 | | { |
| 784 | | // BRA - 0000 1011 aaaa aaaa |
| 785 | | case 0x3: retSize = BraOperation() ; break ; |
| 675 | size = dsp56k_op_bfop_2(op, op2, &cycle_count); |
| 676 | } |
| 677 | /* BFTSTL : 0001 0100 01Pp pppp BBB0 0000 iiii iiii : A-46 */ |
| 678 | else if (((op & 0xffc0) == 0x1440) && ((op2 & 0x1f00) == 0x0000)) |
| 679 | { |
| 680 | size = dsp56k_op_bfop(op, op2, &cycle_count); |
| 681 | } |
| 682 | /* BFTSTL : 0001 0100 001- --RR BBB0 0000 iiii iiii : A-46 */ |
| 683 | else if (((op & 0xffe0) == 0x1420) && ((op2 & 0x1f00) == 0x0000)) |
| 684 | { |
| 685 | size = dsp56k_op_bfop_1(op, op2, &cycle_count); |
| 686 | } |
| 687 | /* BFTSTL : 0001 0100 000D DDDD BBB0 0000 iiii iiii : A-46 */ |
| 688 | else if (((op & 0xffe0) == 0x1400) && ((op2 & 0x1f00) == 0x0000)) |
| 689 | { |
| 690 | size = dsp56k_op_bfop_2(op, op2, &cycle_count); |
| 691 | } |
| 692 | /* Bcc : 0000 0111 --11 cccc xxxx xxxx xxxx xxxx : A-48 */ |
| 693 | else if (((op & 0xff30) == 0x0730) && ((op2 & 0x0000) == 0x0000)) |
| 694 | { |
| 695 | size = dsp56k_op_bcc(op, op2, &cycle_count); |
| 696 | } |
| 697 | /* Bcc : 0010 11cc ccee eeee : A-48 */ |
| 698 | else if ((op & 0xfc00) == 0x2c00) |
| 699 | { |
| 700 | size = dsp56k_op_bcc_1(op, &cycle_count); |
| 701 | } |
| 702 | /* Bcc : 0000 0111 RR10 cccc : A-48 */ |
| 703 | else if ((op & 0xff30) == 0x0720) |
| 704 | { |
| 705 | size = dsp56k_op_bcc_2(op, &cycle_count); |
| 706 | } |
| 707 | /* BRA : 0000 0001 0011 11-- xxxx xxxx xxxx xxxx : A-50 */ |
| 708 | else if (((op & 0xfffc) == 0x013c) && ((op2 & 0x0000) == 0x0000)) |
| 709 | { |
| 710 | size = dsp56k_op_bra(op, op2, &cycle_count); |
| 711 | } |
| 712 | /* BRA : 0000 1011 aaaa aaaa : A-50 */ |
| 713 | else if ((op & 0xff00) == 0x0b00) |
| 714 | { |
| 715 | size = dsp56k_op_bra_1(op, &cycle_count); |
| 716 | } |
| 717 | /* BRA : 0000 0001 0010 11RR : A-50 */ |
| 718 | else if ((op & 0xfffc) == 0x012c) |
| 719 | { |
| 720 | size = dsp56k_op_bra_2(op, &cycle_count); |
| 721 | } |
| 722 | /* BRKc : 0000 0001 0001 cccc : A-52 */ |
| 723 | else if ((op & 0xfff0) == 0x0110) |
| 724 | { |
| 725 | size = dsp56k_op_brkc(op, &cycle_count); |
| 726 | } |
| 727 | /* BScc : 0000 0111 --01 cccc xxxx xxxx xxxx xxxx : A-54 */ |
| 728 | else if (((op & 0xff30) == 0x0710) && ((op2 & 0x0000) == 0x0000)) |
| 729 | { |
| 730 | size = dsp56k_op_bscc(op, op2, &cycle_count); |
| 731 | } |
| 732 | /* BScc : 0000 0111 RR00 cccc : A-54 */ |
| 733 | else if ((op & 0xff30) == 0x0700) |
| 734 | { |
| 735 | size = dsp56k_op_bscc_1(op, &cycle_count); |
| 736 | } |
| 737 | /* BSR : 0000 0001 0011 10-- xxxx xxxx xxxx xxxx : A-56 */ |
| 738 | else if (((op & 0xfffc) == 0x0138) && ((op2 & 0x0000) == 0x0000)) |
| 739 | { |
| 740 | size = dsp56k_op_bsr(op, op2, &cycle_count); |
| 741 | } |
| 742 | /* BSR : 0000 0001 0010 10RR : A-56 */ |
| 743 | else if ((op & 0xfffc) == 0x0128) |
| 744 | { |
| 745 | size = dsp56k_op_bsr_1(op, &cycle_count); |
| 746 | } |
| 747 | /* CHKAAU : 0000 0000 0000 0100 : A-58 */ |
| 748 | else if ((op & 0xffff) == 0x0004) |
| 749 | { |
| 750 | size = dsp56k_op_chkaau(op, &cycle_count); |
| 751 | } |
| 752 | /* DEBUG : 0000 0000 0000 0001 : A-68 */ |
| 753 | else if ((op & 0xffff) == 0x0001) |
| 754 | { |
| 755 | size = dsp56k_op_debug(op, &cycle_count); |
| 756 | } |
| 757 | /* DEBUGcc : 0000 0000 0101 cccc : A-70 */ |
| 758 | else if ((op & 0xfff0) == 0x0050) |
| 759 | { |
| 760 | size = dsp56k_op_debugcc(op, &cycle_count); |
| 761 | } |
| 762 | /* DIV : 0001 0101 0--0 F1DD : A-76 */ |
| 763 | /* WARNING : DOCS SAY THERE IS A PARALLEL MOVE HERE !!! */ |
| 764 | else if ((op & 0xff94) == 0x1504) |
| 765 | { |
| 766 | size = dsp56k_op_div(op, &cycle_count); |
| 767 | } |
| 768 | /* DMAC : 0001 0101 10s1 FsQQ : A-80 */ |
| 769 | else if ((op & 0xffd0) == 0x1590) |
| 770 | { |
| 771 | size = dsp56k_op_dmac(op, &cycle_count); |
| 772 | } |
| 773 | /* DO : 0000 0000 110- --RR xxxx xxxx xxxx xxxx : A-82 */ |
| 774 | else if (((op & 0xffe0) == 0x00c0) && ((op2 & 0x0000) == 0x0000)) |
| 775 | { |
| 776 | size = dsp56k_op_do(op, op2, &cycle_count); |
| 777 | } |
| 778 | /* DO : 0000 1110 iiii iiii xxxx xxxx xxxx xxxx : A-82 */ |
| 779 | else if (((op & 0xff00) == 0x0e00) && ((op2 & 0x0000) == 0x0000)) |
| 780 | { |
| 781 | size = dsp56k_op_do_1(op, op2, &cycle_count); |
| 782 | } |
| 783 | /* DO : 0000 0100 000D DDDD xxxx xxxx xxxx xxxx : A-82 */ |
| 784 | else if (((op & 0xffe0) == 0x0400) && ((op2 & 0x0000) == 0x0000)) |
| 785 | { |
| 786 | size = dsp56k_op_do_2(op, op2, &cycle_count); |
| 787 | } |
| 788 | /* DO FOREVER : 0000 0000 0000 0010 xxxx xxxx xxxx xxxx : A-88 */ |
| 789 | else if (((op & 0xffff) == 0x0002) && ((op2 & 0x0000) == 0x0000)) |
| 790 | { |
| 791 | size = dsp56k_op_doforever(op, op2, &cycle_count); |
| 792 | } |
| 793 | /* ENDDO : 0000 0000 0000 1001 : A-92 */ |
| 794 | else if ((op & 0xffff) == 0x0009) |
| 795 | { |
| 796 | size = dsp56k_op_enddo(op, &cycle_count); |
| 797 | } |
| 798 | /* EXT : 0001 0101 0101 F010 : A-96 */ |
| 799 | else if ((op & 0xfff7) == 0x1552) |
| 800 | { |
| 801 | size = dsp56k_op_ext(op, &cycle_count); |
| 802 | } |
| 803 | /* ILLEGAL : 0000 0000 0000 1111 : A-98 */ |
| 804 | else if ((op & 0xffff) == 0x000f) |
| 805 | { |
| 806 | size = dsp56k_op_illegal(op, &cycle_count); |
| 807 | } |
| 808 | /* IMAC : 0001 0101 1010 FQQQ : A-100 */ |
| 809 | else if ((op & 0xfff0) == 0x15a0) |
| 810 | { |
| 811 | size = dsp56k_op_imac(op, &cycle_count); |
| 812 | } |
| 813 | /* IMPY : 0001 0101 1000 FQQQ : A-102 */ |
| 814 | else if ((op & 0xfff0) == 0x1580) |
| 815 | { |
| 816 | size = dsp56k_op_impy(op, &cycle_count); |
| 817 | } |
| 818 | /* Jcc : 0000 0110 --11 cccc xxxx xxxx xxxx xxxx : A-108 */ |
| 819 | else if (((op & 0xff30) == 0x0630) && ((op2 & 0x0000) == 0x0000)) |
| 820 | { |
| 821 | size = dsp56k_op_jcc(op, op2, &cycle_count); |
| 822 | } |
| 823 | /* Jcc : 0000 0110 RR10 cccc : A-108 */ |
| 824 | else if ((op & 0xff30) == 0x0620 ) |
| 825 | { |
| 826 | size = dsp56k_op_jcc_1(op, &cycle_count); |
| 827 | } |
| 828 | /* JMP : 0000 0001 0011 01-- xxxx xxxx xxxx xxxx : A-110 */ |
| 829 | else if (((op & 0xfffc) == 0x0134) && ((op2 & 0x0000) == 0x0000)) |
| 830 | { |
| 831 | size = dsp56k_op_jmp(op, op2, &cycle_count); |
| 832 | } |
| 833 | /* JMP : 0000 0001 0010 01RR : A-110 */ |
| 834 | else if ((op & 0xfffc) == 0x0124) |
| 835 | { |
| 836 | size = dsp56k_op_jmp_1(op, &cycle_count); |
| 837 | } |
| 838 | /* JScc : 0000 0110 --01 cccc xxxx xxxx xxxx xxxx : A-112 */ |
| 839 | else if (((op & 0xff30) == 0x0610) && ((op2 & 0x0000) == 0x0000)) |
| 840 | { |
| 841 | size = dsp56k_op_jscc(op, op2, &cycle_count); |
| 842 | } |
| 843 | /* JScc : 0000 0110 RR00 cccc : A-112 */ |
| 844 | else if ((op & 0xff30) == 0x0600) |
| 845 | { |
| 846 | size = dsp56k_op_jscc_1(op, &cycle_count); |
| 847 | } |
| 848 | /* JSR : 0000 0001 0011 00-- xxxx xxxx xxxx xxxx : A-114 */ |
| 849 | else if (((op & 0xfffc) == 0x0130) && ((op2 & 0x0000) == 0x0000)) |
| 850 | { |
| 851 | size = dsp56k_op_jsr(op, op2, &cycle_count); |
| 852 | } |
| 853 | /* JSR : 0000 1010 AAAA AAAA : A-114 */ |
| 854 | else if ((op & 0xff00) == 0x0a00) |
| 855 | { |
| 856 | size = dsp56k_op_jsr_1(op, &cycle_count); |
| 857 | } |
| 858 | /* JSR : 0000 0001 0010 00RR : A-114 */ |
| 859 | else if ((op & 0xfffc) == 0x0120) |
| 860 | { |
| 861 | size = dsp56k_op_jsr_2(op, &cycle_count); |
| 862 | } |
| 863 | /* LEA : 0000 0001 11TT MMRR : A-116 */ |
| 864 | else if ((op & 0xffc0) == 0x01c0) |
| 865 | { |
| 866 | size = dsp56k_op_lea(op, &cycle_count); |
| 867 | } |
| 868 | /* LEA : 0000 0001 10NN MMRR : A-116 */ |
| 869 | else if ((op & 0xffc0) == 0x0180) |
| 870 | { |
| 871 | size = dsp56k_op_lea_1(op, &cycle_count); |
| 872 | } |
| 873 | /* MAC(su,uu) : 0001 0101 1110 FsQQ : A-126 */ |
| 874 | else if ((op & 0xfff0) == 0x15e0) |
| 875 | { |
| 876 | size = dsp56k_op_macsuuu(op, &cycle_count); |
| 877 | } |
| 878 | /* MOVE : 0000 0101 BBBB BBBB ---- HHHW 0001 0001 : A-128 */ |
| 879 | else if (((op & 0xff00) == 0x0500) && ((op2 & 0x00ff) == 0x0011)) |
| 880 | { |
| 881 | size = dsp56k_op_move_2(op, op2, &cycle_count); |
| 882 | } |
| 883 | /* MOVE(C) : 0011 1WDD DDD0 MMRR : A-144 */ |
| 884 | else if ((op & 0xf810) == 0x3800) |
| 885 | { |
| 886 | size = dsp56k_op_movec(op, &cycle_count); |
| 887 | } |
| 888 | /* MOVE(C) : 0011 1WDD DDD1 q0RR : A-144 */ |
| 889 | else if ((op & 0xf814) == 0x3810) |
| 890 | { |
| 891 | size = dsp56k_op_movec_1(op, &cycle_count); |
| 892 | } |
| 893 | /* MOVE(C) : 0011 1WDD DDD1 Z11- : A-144 */ |
| 894 | else if ((op & 0xf816) == 0x3816) |
| 895 | { |
| 896 | size = dsp56k_op_movec_2(op, &cycle_count); |
| 897 | } |
| 898 | /* MOVE(C) : 0011 1WDD DDD1 t10- xxxx xxxx xxxx xxxx : A-144 */ |
| 899 | else if (((op & 0xf816) == 0x3814) && ((op2 & 0x0000) == 0x0000)) |
| 900 | { |
| 901 | size = dsp56k_op_movec_3(op, op2, &cycle_count); |
| 902 | } |
| 903 | /* MOVE(C) : 0010 10dd dddD DDDD : A-144 */ |
| 904 | else if ((op & 0xfc00) == 0x2800) |
| 905 | { |
| 906 | size = dsp56k_op_movec_4(op, &cycle_count); |
| 907 | } |
| 908 | /* MOVE(C) : 0000 0101 BBBB BBBB 0011 1WDD DDD0 ---- : A-144 */ |
| 909 | else if (((op & 0xff00) == 0x0500) && ((op2 & 0xf810) == 0x3800)) |
| 910 | { |
| 911 | size = dsp56k_op_movec_5(op, op2, &cycle_count); |
| 912 | } |
| 913 | /* MOVE(I) : 0010 00DD BBBB BBBB : A-150 */ |
| 914 | else if ((op & 0xfc00) == 0x2000) |
| 915 | { |
| 916 | size = dsp56k_op_movei(op, &cycle_count); |
| 917 | } |
| 918 | /* MOVE(M) : 0000 001W RR0M MHHH : A-152 */ |
| 919 | else if ((op & 0xfe20) == 0x0200) |
| 920 | { |
| 921 | size = dsp56k_op_movem(op, &cycle_count); |
| 922 | } |
| 923 | /* MOVE(M) : 0000 001W RR11 mmRR : A-152 */ |
| 924 | else if ((op & 0xfe30) == 0x0230) |
| 925 | { |
| 926 | size = dsp56k_op_movem_1(op, &cycle_count); |
| 927 | } |
| 928 | /* MOVE(M) : 0000 0101 BBBB BBBB 0000 001W --0- -HHH : A-152 */ |
| 929 | else if (((op & 0xff00) == 0x0500) && ((op2 & 0xfe20) == 0x0200)) |
| 930 | { |
| 931 | size = dsp56k_op_movem_2(op, op2, &cycle_count); |
| 932 | } |
| 933 | /* MOVE(P) : 0001 100W HH1p pppp : A-156 */ |
| 934 | else if ((op & 0xfe20) == 0x1820) |
| 935 | { |
| 936 | size = dsp56k_op_movep(op, &cycle_count); |
| 937 | } |
| 938 | /* MOVE(P) : 0000 110W RRmp pppp : A-156 */ |
| 939 | else if ((op & 0xfe00) == 0x0c00) |
| 940 | { |
| 941 | size = dsp56k_op_movep_1(op, &cycle_count); |
| 942 | } |
| 943 | /* MOVE(S) : 0001 100W HH0a aaaa : A-158 */ |
| 944 | else if ((op & 0xfe20) == 0x1800) |
| 945 | { |
| 946 | size = dsp56k_op_moves(op, &cycle_count); |
| 947 | } |
| 948 | /* MPY(su,uu) : 0001 0101 1100 FsQQ : A-164 */ |
| 949 | else if ((op & 0xfff0) == 0x15c0) |
| 950 | { |
| 951 | size = dsp56k_op_mpysuuu(op, &cycle_count); |
| 952 | } |
| 953 | /* NEGC : 0001 0101 0110 F000 : A-168 */ |
| 954 | else if ((op & 0xfff7) == 0x1560) |
| 955 | { |
| 956 | size = dsp56k_op_negc(op, &cycle_count); |
| 957 | } |
| 958 | /* NOP : 0000 0000 0000 0000 : A-170 */ |
| 959 | else if ((op & 0xffff) == 0x0000) |
| 960 | { |
| 961 | size = dsp56k_op_nop(op, &cycle_count); |
| 962 | } |
| 963 | /* NORM : 0001 0101 0010 F0RR : A-172 */ |
| 964 | else if ((op & 0xfff4) == 0x1520) |
| 965 | { |
| 966 | size = dsp56k_op_norm(op, &cycle_count); |
| 967 | } |
| 968 | /* ORI : 0001 1EE1 iiii iiii : A-178 */ |
| 969 | else if ((op & 0xf900) == 0x1900) |
| 970 | { |
| 971 | size = dsp56k_op_ori(op, &cycle_count); |
| 972 | } |
| 973 | /* REP : 0000 0000 111- --RR : A-180 */ |
| 974 | else if ((op & 0xffe0) == 0x00e0) |
| 975 | { |
| 976 | size = dsp56k_op_rep(op, &cycle_count); |
| 977 | } |
| 978 | /* REP : 0000 1111 iiii iiii : A-180 */ |
| 979 | else if ((op & 0xff00) == 0x0f00) |
| 980 | { |
| 981 | size = dsp56k_op_rep_1(op, &cycle_count); |
| 982 | } |
| 983 | /* REP : 0000 0100 001D DDDD : A-180 */ |
| 984 | else if ((op & 0xffe0) == 0x0420) |
| 985 | { |
| 986 | size = dsp56k_op_rep_2(op, &cycle_count); |
| 987 | } |
| 988 | /* REPcc : 0000 0001 0101 cccc : A-184 */ |
| 989 | else if ((op & 0xfff0) == 0x0150) |
| 990 | { |
| 991 | size = dsp56k_op_repcc(op, &cycle_count); |
| 992 | } |
| 993 | /* RESET : 0000 0000 0000 1000 : A-186 */ |
| 994 | else if ((op & 0xffff) == 0x0008) |
| 995 | { |
| 996 | size = dsp56k_op_reset(op, &cycle_count); |
| 997 | } |
| 998 | /* RTI : 0000 0000 0000 0111 : A-194 */ |
| 999 | else if ((op & 0xffff) == 0x0007) |
| 1000 | { |
| 1001 | size = dsp56k_op_rti(op, &cycle_count); |
| 1002 | } |
| 1003 | /* RTS : 0000 0000 0000 0110 : A-196 */ |
| 1004 | else if ((op & 0xffff) == 0x0006) |
| 1005 | { |
| 1006 | size = dsp56k_op_rts(op, &cycle_count); |
| 1007 | } |
| 1008 | /* STOP : 0000 0000 0000 1010 : A-200 */ |
| 1009 | else if ((op & 0xffff) == 0x000a) |
| 1010 | { |
| 1011 | size = dsp56k_op_stop(op, &cycle_count); |
| 1012 | } |
| 1013 | /* SWAP : 0001 0101 0111 F001 : A-206 */ |
| 1014 | else if ((op & 0xfff7) == 0x1571) |
| 1015 | { |
| 1016 | size = dsp56k_op_swap(op, &cycle_count); |
| 1017 | } |
| 1018 | /* SWI : 0000 0000 0000 0101 : A-208 */ |
| 1019 | else if ((op & 0xffff) == 0x0005) |
| 1020 | { |
| 1021 | size = dsp56k_op_swi(op, &cycle_count); |
| 1022 | } |
| 1023 | /* Tcc : 0001 00cc ccTT Fh0h : A-210 */ |
| 1024 | else if ((op & 0xfc02) == 0x1000) |
| 1025 | { |
| 1026 | size = dsp56k_op_tcc(op, &cycle_count); |
| 1027 | } |
| 1028 | /* TFR(2) : 0001 0101 0000 F00J : A-214 */ |
| 1029 | else if ((op & 0xfff6) == 0x1500) |
| 1030 | { |
| 1031 | size = dsp56k_op_tfr2(op, &cycle_count); |
| 1032 | } |
| 1033 | /* TFR(3) : 0010 01mW RRDD FHHH : A-216 */ |
| 1034 | else if ((op & 0xfc00) == 0x2400) |
| 1035 | { |
| 1036 | size = dsp56k_op_tfr3(op, &cycle_count); |
| 1037 | } |
| 1038 | /* TST(2) : 0001 0101 0001 -1DD : A-220 */ |
| 1039 | else if ((op & 0xfff4) == 0x1514) |
| 1040 | { |
| 1041 | size = dsp56k_op_tst2(op, &cycle_count); |
| 1042 | } |
| 1043 | /* WAIT : 0000 0000 0000 1011 : A-222 */ |
| 1044 | else if ((op & 0xffff) == 0x000b) |
| 1045 | { |
| 1046 | size = dsp56k_op_wait(op, &cycle_count); |
| 1047 | } |
| 1048 | /* ZERO : 0001 0101 0101 F000 : A-224 */ |
| 1049 | else if ((op & 0xfff7) == 0x1550) |
| 1050 | { |
| 1051 | size = dsp56k_op_zero(op, &cycle_count); |
| 1052 | } |
| 786 | 1053 | |
| 787 | | // MOVE(P) - 0000 110W RRmp pppp |
| 788 | | case 0x4: case 0x5: retSize = MovePOperation() ; break ; |
| 789 | 1054 | |
| 790 | | // DO - 0000 1110 iiii iiii xxxx xxxx xxxx xxxx |
| 791 | | case 0x6: retSize = DoOperation() ; break ; |
| 792 | | |
| 793 | | // REP - 0000 1111 iiii iiii |
| 794 | | case 0x7: retSize = RepOperation() ; break ; |
| 795 | | } |
| 1055 | /* Not recognized? Nudge debugger onto the next word */ |
| 1056 | if (size == 0x1337) |
| 1057 | { |
| 1058 | logerror("DSP56k: Unimplemented opcode at 0x%04x : %04x\n", PC, op); |
| 1059 | size = 1 ; // Just to get the debugger past the bad opcode |
| 796 | 1060 | } |
| 797 | 1061 | |
| 798 | | return retSize ; |
| 799 | | } |
| 1062 | /* Must have been a good opcode */ |
| 1063 | PC += size; |
| 1064 | change_pc(PC); |
| 800 | 1065 | |
| 801 | | /* |
| 802 | | IMPLEMENTATIONS |
| 803 | | */ |
| 1066 | dsp56k_process_loop(); |
| 1067 | dsp56k_process_rep(size); |
| 804 | 1068 | |
| 805 | | static int BitfieldOperation(void) |
| 806 | | { |
| 807 | | int retSize = 0 ; |
| 1069 | dsp56k_icount -= 4; /* Temporarily hard-coded at 4 clocks per opcode */ /* cycle_count */ |
| 1070 | } |
| 808 | 1071 | |
| 809 | | // BITFIELD OPERATIONS |
| 810 | | // ONLY PARTIALLY IMPLEMENTED !!! |
| 811 | 1072 | |
| 812 | | // Get the next part of the opcode... |
| 813 | | UINT16 op2 = ROPCODE((PC<<1)+2) ; |
| 814 | 1073 | |
| 815 | | unsigned char dt = 0x00 ; |
| 816 | | void *destinationReg = 0x00 ; |
| 817 | | void *rReg = 0x00 ; |
| 818 | 1074 | |
| 819 | | UINT16 destAddr = 0x00 ; |
| 1075 | /*************************************************************************** |
| 1076 | Opcode implementations |
| 1077 | ***************************************************************************/ |
| 820 | 1078 | |
| 821 | | UINT16 opVal ; |
| 1079 | /*******************************/ |
| 1080 | /* 32 Parallel move operations */ |
| 1081 | /*******************************/ |
| 822 | 1082 | |
| 823 | | // Get the universal immediate value and its proper mask... |
| 824 | | UINT16 iVal = op2 & 0x00ff ; |
| 825 | | DecodeBBBBitMask(BITS(op2,0xe000), &iVal) ; |
| 1083 | /* ADD : 011m mKKK 0rru Fuuu : A-22 */ |
| 1084 | static size_t dsp56k_op_add_2(const UINT16 op_byte, UINT8* cycles) |
| 1085 | { |
| 1086 | /* S L E U N Z V C */ |
| 1087 | /* * * * * * * * * */ |
| 1088 | return 0; |
| 1089 | } |
| 826 | 1090 | |
| 827 | | // Figure out where data you'll be dealing with comes from... |
| 828 | | switch(BITS(OP,0x00e0)) |
| 829 | | { |
| 830 | | case 0x6: case 0x7: case 0x2: case 0x3: |
| 831 | | destAddr = AssembleDFromPTable(BITS(OP,0x0020), BITS(OP,0x001f)) ; |
| 832 | | break ; |
| 1091 | /* MAC : 011m mKKK 1xx0 F1QQ : A-122 */ |
| 1092 | static size_t dsp56k_op_mac_1(const UINT16 op_byte, UINT8* cycles) |
| 1093 | { |
| 1094 | /* S L E U N Z V C */ |
| 1095 | /* * * * * * * * - */ |
| 1096 | return 0; |
| 1097 | } |
| 833 | 1098 | |
| 834 | | case 0x5: case 0x1: |
| 835 | | rReg = DecodeRRTable(BITS(OP,0x0003), &dt) ; |
| 836 | | destAddr = *((UINT16*)rReg) ; |
| 837 | | break ; |
| 1099 | /* MACR: 011m mKKK 1--1 F1QQ : A-124 */ |
| 1100 | static size_t dsp56k_op_macr_1(const UINT16 op_byte, UINT8* cycles) |
| 1101 | { |
| 1102 | /* S L E U N Z V C */ |
| 1103 | /* * * * * * * * - */ |
| 1104 | return 0; |
| 1105 | } |
| 838 | 1106 | |
| 839 | | case 0x4: case 0x0: |
| 840 | | destinationReg = DecodeDDDDDTable(BITS(OP,0x001f), &dt) ; |
| 841 | | break ; |
| 842 | | } |
| 1107 | /* MOVE : 011m mKKK 0rr1 0000 : A-128 */ |
| 1108 | static size_t dsp56k_op_move_1(const UINT16 op_byte, UINT8* cycles) |
| 1109 | { |
| 1110 | /* S L E U N Z V C */ |
| 1111 | /* * * - - - - - - */ |
| 1112 | return 0; |
| 1113 | } |
| 843 | 1114 | |
| 844 | | // Grab the value to operate on... |
| 845 | | if (destinationReg) |
| 846 | | { |
| 847 | | if (dt == DT_LONG_WORD) |
| 848 | | opVal = (*((PAIR64*)destinationReg)).w.h ; |
| 849 | | else |
| 850 | | opVal = *((UINT16*)destinationReg) ; |
| 851 | | } |
| 852 | | else |
| 853 | | opVal = data_read_word_16le(destAddr<<1) ; |
| 1115 | /* MPY : 011m mKKK 1xx0 F0QQ : A-160 */ |
| 1116 | static size_t dsp56k_op_mpy_1(const UINT16 op_byte, UINT8* cycles) |
| 1117 | { |
| 1118 | /* S L E U N Z V C */ |
| 1119 | /* * * * * * * * - */ |
| 1120 | return 0; |
| 1121 | } |
| 854 | 1122 | |
| 855 | | // Do the necessary bitfield operation... |
| 856 | | switch(BITS(op2,0x1f00)) |
| 857 | | { |
| 858 | | // bfchg |
| 859 | | case 0x12: |
| 860 | | if ((iVal & opVal) == iVal) C_bit_set(1); // test |
| 861 | | else C_bit_set(0) ; |
| 1123 | /* MPYR : 011m mKKK 1--1 F0QQ : A-162 */ |
| 1124 | static size_t dsp56k_op_mpyr_1(const UINT16 op_byte, UINT8* cycles) |
| 1125 | { |
| 1126 | /* S L E U N Z V C */ |
| 1127 | /* * * * * * * * - */ |
| 1128 | return 0; |
| 1129 | } |
| 862 | 1130 | |
| 863 | | opVal ^= iVal ; // and change |
| 864 | | break ; |
| 1131 | /* SUB : 011m mKKK 0rru Fuuu : A-202 */ |
| 1132 | static size_t dsp56k_op_sub_1(const UINT16 op_byte, UINT8* cycles) |
| 1133 | { |
| 1134 | /* S L E U N Z V C */ |
| 1135 | /* * * * * * * * * */ |
| 1136 | return 0; |
| 1137 | } |
| 865 | 1138 | |
| 866 | | // bfclr |
| 867 | | case 0x04: |
| 868 | | opVal &= (~iVal) ; |
| 869 | | break ; |
| 1139 | /* TFR : 011m mKKK 0rr1 F0DD : A-212 */ |
| 1140 | static size_t dsp56k_op_tfr_2(const UINT16 op_byte, UINT8* cycles) |
| 1141 | { |
| 1142 | /* S L E U N Z V C */ |
| 1143 | /* - - - - - - - - */ |
| 1144 | return 0; |
| 1145 | } |
| 870 | 1146 | |
| 871 | | // bfset |
| 872 | | case 0x18: |
| 873 | | opVal |= iVal ; |
| 874 | | break ; |
| 1147 | /* MPY : 0001 0110 RRDD FQQQ : A-160 */ |
| 1148 | static size_t dsp56k_op_mpy_2(const UINT16 op_byte, UINT8* cycles) |
| 1149 | { |
| 1150 | /* S L E U N Z V C */ |
| 1151 | /* * * * * * * * - */ |
| 1152 | return 0; |
| 1153 | } |
| 875 | 1154 | |
| 876 | | // bfsth |
| 877 | | case 0x10: |
| 878 | | mame_printf_debug("BFSTH - not here yet") ; |
| 879 | | break ; |
| 880 | | |
| 881 | | // bftstl |
| 882 | | case 0x00: |
| 883 | | if ((iVal & opVal) == 0) C_bit_set(1); |
| 884 | | else C_bit_set(0); |
| 885 | | retSize = 2; return retSize; /* It's just a test - no need to go on */ |
| 886 | | break ; |
| 887 | | } |
| 888 | | |
| 889 | | // Put the data back where it belongs |
| 890 | | // !!! When setting A and B, I'm pretty sure if it's supposed to pass through the normal 'setDestValue' pipe but not entirely !!! |
| 891 | | // (in other words, does clearing ff.ffff.ffff with 001c really result in ff.ffe3.0000 or ff.ffe3.ffff) ??? |
| 892 | | if (destinationReg) |
| 893 | | SetDestinationValue(&opVal, DT_WORD, destinationReg, dt) ; |
| 894 | | else |
| 895 | | SetDataMemoryValue(&opVal, DT_WORD, destAddr<<1) ; |
| 896 | | |
| 897 | | retSize = 2 ; |
| 898 | | return retSize ; |
| 1155 | /* MAC : 0001 0111 RRDD FQQQ : A-122 */ |
| 1156 | static size_t dsp56k_op_mac_2(const UINT16 op_byte, UINT8* cycles) |
| 1157 | { |
| 1158 | /* S L E U N Z V C */ |
| 1159 | /* * * * * * * * - */ |
| 1160 | return 0; |
| 899 | 1161 | } |
| 900 | 1162 | |
| 901 | | static int MoveCOperation(void) |
| 1163 | /* CLR : .... .... 0000 F001 : A-60 */ |
| 1164 | static size_t dsp56k_op_clr(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 902 | 1165 | { |
| 903 | | int retSize = 0 ; |
| 1166 | typed_pointer D = {NULL, DT_LONG_WORD}; |
| 1167 | typed_pointer clear = {NULL, DT_LONG_WORD}; |
| 1168 | UINT64 clear_val = U64(0x0000000000000000); |
| 904 | 1169 | |
| 905 | | unsigned char W = 0x00 ; |
| 1170 | decode_F_table(BITS(op_byte,0x0008), &D); |
| 906 | 1171 | |
| 907 | | unsigned char sdt = 0x00 ; |
| 908 | | void *SD ; |
| 1172 | *p_accum = *((UINT64*)D.addr); |
| 909 | 1173 | |
| 910 | | // ONLY PARTIALLY IMPLEMENTED !!! |
| 1174 | clear.addr = &clear_val; |
| 1175 | clear.data_type = DT_LONG_WORD; |
| 1176 | SetDestinationValue(clear, D); |
| 911 | 1177 | |
| 912 | | SD = DecodeDDDDDTable(BITS(OP,0x03e0), &sdt) ; |
| 913 | | W = BITS(OP,0x0400) ; |
| 1178 | d_register->addr = D.addr; |
| 1179 | d_register->data_type = D.data_type; |
| 914 | 1180 | |
| 915 | | if (BITS(OP,0x1000)) |
| 916 | | { |
| 917 | | // Single source/destination move(c) |
| 918 | | if (!BITS(OP,0x0010)) |
| 919 | | { |
| 920 | | // MM in move(c) |
| 1181 | /* S L E U N Z V C */ |
| 1182 | /* * * * * * * 0 - */ |
| 1183 | /* TODO - S&L */ |
| 1184 | E_bit_set(0); |
| 1185 | U_bit_set(1); |
| 1186 | N_bit_set(0); |
| 1187 | Z_bit_set(1); |
| 1188 | V_bit_set(0); |
| 921 | 1189 | |
| 922 | | // Get the r register... |
| 923 | | unsigned char rt = 0x00 ; |
| 924 | | void *R ; |
| 1190 | cycles += 2; /* TODO: + mv oscillator clock cycles */ |
| 1191 | return 1; |
| 1192 | } |
| 925 | 1193 | |
| 926 | | R = DecodeRRTable(BITS(OP,0x0003), &rt) ; |
| 1194 | /* ADD : .... .... 0000 FJJJ : A-22 */ |
| 1195 | static size_t dsp56k_op_add(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1196 | { |
| 1197 | UINT64 addVal = 0; |
| 927 | 1198 | |
| 928 | | if (W) |
| 929 | | { |
| 930 | | // !!! does this work ??? |
| 931 | | UINT16 data = data_read_word_16le((*((UINT16*)R))<<1) ; |
| 932 | | SetDestinationValue(&data, DT_WORD, SD, sdt) ; |
| 933 | | } |
| 934 | | else |
| 935 | | { |
| 936 | | SetDataMemoryValue(SD, sdt, (*((UINT16*)R))<<1) ; |
| 937 | | } |
| 1199 | typed_pointer S = {NULL, DT_BYTE}; |
| 1200 | typed_pointer D = {NULL, DT_BYTE}; |
| 1201 | decode_JJJF_table(BITS(op_byte,0x0007),BITS(op_byte,0x0008), &S, &D); |
| 938 | 1202 | |
| 939 | | ExecuteMMTable(BITS(OP,0x0003), BITS(OP,0x000c)) ; |
| 940 | | retSize = 1 ; |
| 941 | | } |
| 942 | | else |
| 943 | | { |
| 944 | | if (!BITS(OP,0x0004)) |
| 945 | | { |
| 946 | | // q in move(c) |
| 1203 | *p_accum = *((UINT64*)D.addr); |
| 947 | 1204 | |
| 948 | | // Figure out the true addr... |
| 949 | | UINT16 addr = ExecuteqTable(BITS(OP,0x0003), BITS(OP,0x0008)); |
| 1205 | switch(S.data_type) |
| 1206 | { |
| 1207 | case DT_WORD: addVal = (UINT64)*((UINT16*)S.addr) << 16; break; |
| 1208 | case DT_DOUBLE_WORD: addVal = (UINT64)*((UINT32*)S.addr); break; |
| 1209 | case DT_LONG_WORD: addVal = (UINT64)*((UINT64*)S.addr); break; |
| 1210 | } |
| 950 | 1211 | |
| 951 | | if (W) |
| 952 | | { |
| 953 | | // !!! does this work ??? |
| 954 | | UINT16 data = data_read_word_16le(addr<<1) ; |
| 955 | | SetDestinationValue(&data, DT_WORD, SD, sdt) ; |
| 956 | | } |
| 957 | | else |
| 958 | | { |
| 959 | | SetDataMemoryValue(SD, sdt, addr<<1); |
| 960 | | } |
| 1212 | /* TODO: Verify : Sign-extend everyone for proper addition op */ |
| 1213 | if (addVal & U64(0x0000000080000000)) |
| 1214 | addVal |= U64(0xffffffff00000000); |
| 961 | 1215 | |
| 962 | | retSize = 1 ; |
| 963 | | } |
| 964 | | else |
| 965 | | { |
| 966 | | if (BITS(OP,0x0002)) |
| 967 | | { |
| 968 | | // Z in move(c) |
| 969 | | unsigned char rt = 0x00; |
| 970 | | void *Z; |
| 1216 | /* Operate*/ |
| 1217 | *((UINT64*)D.addr) += addVal; |
| 971 | 1218 | |
| 972 | | Z = DecodeZTable(BITS(OP,0x0008), &rt); |
| 1219 | d_register->addr = D.addr; |
| 1220 | d_register->data_type = D.data_type; |
| 973 | 1221 | |
| 974 | | if (W) |
| 975 | | { |
| 976 | | // Unimplemented |
| 977 | | retSize = 666 ; |
| 978 | | } |
| 979 | | else |
| 980 | | { |
| 981 | | SetDataMemoryValue(SD, sdt, (*((UINT16*)Z))<<1); |
| 982 | | retSize = 1; |
| 983 | | } |
| 984 | | } |
| 985 | | else |
| 986 | | { |
| 987 | | // 2-word move(c) |
| 988 | | UINT16 nextWord = ROPCODE((PC<<1)+2) ; |
| 1222 | /* S L E U N Z V C */ |
| 1223 | /* * * * * * * * * */ |
| 1224 | /* TODO S, L, E, U, V, C */ |
| 1225 | if (*((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(1); |
| 1226 | if (*((UINT64*)D.addr) == 0) Z_bit_set(1); |
| 989 | 1227 | |
| 990 | | if (BITS(OP,0x0008)) |
| 991 | | { |
| 992 | | // #xxxx - value read directly out of the opcode |
| 993 | | SetDestinationValue(&nextWord, DT_WORD, SD, sdt) ; |
| 994 | | } |
| 995 | | else |
| 996 | | { |
| 997 | | // X:xxxx = value resides in X memory... |
| 998 | | if (W) |
| 999 | | { |
| 1000 | | // Read from X-data memory... |
| 1001 | | // !!! Does this work ??? |
| 1002 | | UINT16 data = data_read_word_16le(nextWord<<1) ; |
| 1003 | | SetDestinationValue(&data, DT_WORD, SD, sdt) ; |
| 1004 | | } |
| 1005 | | else |
| 1006 | | { |
| 1007 | | // Write to X-data memory... |
| 1008 | | SetDataMemoryValue(SD, sdt, nextWord<<1) ; |
| 1009 | | } |
| 1010 | | } |
| 1228 | cycles += 2; /* TODO: + mv oscillator cycles */ |
| 1229 | return 1; |
| 1230 | } |
| 1011 | 1231 | |
| 1012 | | retSize = 2 ; |
| 1013 | | } |
| 1014 | | } |
| 1015 | | } |
| 1016 | | } |
| 1017 | | else if (BITS(OP,0x2000)) |
| 1018 | | { |
| 1019 | | // Source and Destination explicit |
| 1020 | | unsigned char dt = 0x00 ; |
| 1021 | | void *D ; |
| 1232 | /* MOVE : .... .... 0001 0001 : A-128 */ |
| 1233 | static size_t dsp56k_op_move(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1234 | { |
| 1235 | /* S L E U N Z V C */ |
| 1236 | /* * * - - - - - - */ |
| 1237 | return 0; |
| 1238 | } |
| 1022 | 1239 | |
| 1023 | | D = DecodeDDDDDTable(BITS(OP,0x001f), &dt) ; |
| 1024 | | SetDestinationValue(SD, sdt, D, dt) ; |
| 1240 | /* TFR : .... .... 0001 FJJJ : A-212 */ |
| 1241 | static size_t dsp56k_op_tfr(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1242 | { |
| 1243 | /* S L E U N Z V C */ |
| 1244 | /* - - - - - - - - */ |
| 1245 | return 0; |
| 1246 | } |
| 1025 | 1247 | |
| 1026 | | retSize = 1 ; |
| 1027 | | } |
| 1028 | | else |
| 1029 | | { |
| 1030 | | // Double source/destination move(c) |
| 1031 | | |
| 1032 | | retSize = 666 ; |
| 1033 | | } |
| 1034 | | |
| 1035 | | return retSize ; |
| 1248 | /* RND : .... .... 0010 F000 : A-188 */ |
| 1249 | static size_t dsp56k_op_rnd(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1250 | { |
| 1251 | /* S L E U N Z V C */ |
| 1252 | /* * * * * * * * - */ |
| 1253 | return 0; |
| 1036 | 1254 | } |
| 1037 | 1255 | |
| 1038 | | static int MoveMOperation(void) |
| 1256 | /* TST : .... .... 0010 F001 : A-218 */ |
| 1257 | static size_t dsp56k_op_tst(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1039 | 1258 | { |
| 1040 | | int retSize = 0 ; |
| 1259 | typed_pointer D = {NULL, DT_LONG_WORD}; |
| 1041 | 1260 | |
| 1042 | | // ONLY PARTIALLY IMPLEMENTED !!! |
| 1261 | decode_F_table(BITS(op_byte,0x0008), &D); |
| 1043 | 1262 | |
| 1044 | | if (BITS(OP,0x0400)) |
| 1045 | | { |
| 1046 | | // The double word MoveM operation... |
| 1047 | | UINT16 nextWord = ROPCODE((PC<<1)+2) ; |
| 1263 | *p_accum = *((UINT64*)D.addr); |
| 1048 | 1264 | |
| 1049 | | UINT8 increment = BITS(OP,0x00ff) ; |
| 1265 | d_register->addr = D.addr; |
| 1266 | d_register->data_type = D.data_type; |
| 1050 | 1267 | |
| 1051 | | int W = BITS(nextWord, 0x0100) ; |
| 1268 | /* S L E U N Z V C */ |
| 1269 | /* 0 * * * * * 0 0 */ |
| 1270 | /* TODO: S, L, E, U */ |
| 1271 | if ((*((UINT64*)D.addr)) & U64(0x0000008000000000)) N_bit_set(1); else N_bit_set(0); |
| 1272 | if ((*((UINT64*)D.addr)) == 0) Z_bit_set(1); else Z_bit_set(0); |
| 1273 | V_bit_set(0); |
| 1274 | C_bit_set(0); |
| 1052 | 1275 | |
| 1053 | | unsigned char sdt = 0x00 ; |
| 1054 | | void *sdReg = 0x00 ; |
| 1055 | | sdReg = DecodeHHHTable(BITS(nextWord,0x0007), &sdt) ; |
| 1276 | cycles += 2; /* TODO: + mv oscillator clock cycles */ |
| 1277 | return 1; |
| 1278 | } |
| 1056 | 1279 | |
| 1057 | | if (W) |
| 1058 | | { |
| 1059 | | // Read from Program Memory... |
| 1060 | | UINT16 data = program_read_word_16le((R2<<1)+(increment<<1)) ; |
| 1061 | | SetDestinationValue(&data, DT_WORD, sdReg, sdt) ; |
| 1062 | | } |
| 1063 | | else |
| 1064 | | { |
| 1065 | | // Write to Program Memory... |
| 1066 | | // !!! Does this work ??? |
| 1067 | | // SetMemoryValue(sdReg, sdt, ((R2<<1)+(increment<<1))) ; |
| 1068 | | } |
| 1280 | /* INC : .... .... 0010 F010 : A-104 */ |
| 1281 | static size_t dsp56k_op_inc(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1282 | { |
| 1283 | /* S L E U N Z V C */ |
| 1284 | /* * * * * * * * * */ |
| 1285 | return 0; |
| 1286 | } |
| 1069 | 1287 | |
| 1070 | | retSize = 2 ; |
| 1071 | | } |
| 1072 | | else |
| 1073 | | { |
| 1074 | | // The single word MoveM operation... |
| 1288 | /* INC24 : .... .... 0010 F011 : A-106 */ |
| 1289 | static size_t dsp56k_op_inc24(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1290 | { |
| 1291 | /* S L E U N Z V C */ |
| 1292 | /* * * * * * ? * * */ |
| 1293 | /* Z - Set if the 24 most significant bits of the destination result are all zeroes. */ |
| 1294 | return 0; |
| 1295 | } |
| 1075 | 1296 | |
| 1076 | | // Decode which way the data is going... |
| 1077 | | int W = BITS(OP,0x0100) ; |
| 1297 | /* OR : .... .... 0010 F1JJ : A-176 */ |
| 1298 | static size_t dsp56k_op_or(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1299 | { |
| 1300 | typed_pointer S = {NULL, DT_BYTE}; |
| 1301 | typed_pointer D = {NULL, DT_BYTE}; |
| 1078 | 1302 | |
| 1079 | | // Decode which R Register we're working with... |
| 1080 | | unsigned char rt = 0x00 ; |
| 1081 | | void *rReg = 0x00 ; |
| 1082 | | rReg = DecodeRRTable(BITS(OP,0x00c0), &rt) ; |
| 1303 | decode_JJF_table(BITS(op_byte,0x0003), BITS(op_byte,0x0008), &S, &D); |
| 1083 | 1304 | |
| 1084 | | if (BITS(OP,0x0020)) |
| 1085 | | { |
| 1086 | | // R and R operation |
| 1087 | | retSize = 666 ; |
| 1088 | | } |
| 1089 | | else |
| 1090 | | { |
| 1091 | | // R and SD operation |
| 1092 | | // Decode the SD register... |
| 1093 | | unsigned char sdt = 0x00 ; |
| 1094 | | void *sdReg = 0x00 ; |
| 1095 | | sdReg = DecodeHHHTable(BITS(OP,0x0007), &sdt) ; |
| 1305 | /* Save some data for the parallel move */ |
| 1306 | *p_accum = *((UINT64*)D.addr); |
| 1096 | 1307 | |
| 1097 | | if (W) |
| 1098 | | { |
| 1099 | | // Read from Program Memory... |
| 1100 | | UINT16 data = program_read_word_16le( (*((UINT16*)rReg)) << 1 ) ; |
| 1101 | | SetDestinationValue(&data, DT_WORD, sdReg, sdt) ; |
| 1102 | | } |
| 1103 | | else |
| 1104 | | { |
| 1105 | | // Write to Program Memory... |
| 1106 | | SetProgramMemoryValue(sdReg, sdt, (*((UINT16*)rReg)) << 1 ) ; |
| 1107 | | } |
| 1308 | /* OR a word of S with A1|B1 */ |
| 1309 | ((PAIR64*)D.addr)->w.h = *((UINT16*)S.addr) | ((PAIR64*)D.addr)->w.h; |
| 1108 | 1310 | |
| 1109 | | // Execute the increment part of the opcode... |
| 1110 | | ExecuteMMTable(BITS(OP,0x00c0), BITS(OP,0x0018)) ; |
| 1311 | d_register->addr = D.addr; |
| 1312 | d_register->data_type = D.data_type; |
| 1111 | 1313 | |
| 1112 | | retSize = 1 ; |
| 1113 | | } |
| 1114 | | } |
| 1314 | /* S L E U N Z V C */ |
| 1315 | /* * * - - ? ? 0 - */ |
| 1316 | /* TODO: S, L */ |
| 1317 | if ( *((UINT64*)D.addr) & U64(0x0000000080000000)) N_bit_set(1); else N_bit_set(0); |
| 1318 | if ((*((UINT64*)D.addr) & U64(0x00000000ffff0000)) == 0) Z_bit_set(1); else Z_bit_set(0); |
| 1319 | V_bit_set(0); |
| 1115 | 1320 | |
| 1116 | | return retSize ; |
| 1321 | cycles += 2; /* TODO: + mv oscillator cycles */ |
| 1322 | return 1; |
| 1117 | 1323 | } |
| 1118 | 1324 | |
| 1119 | | static int MoveIOperation(void) |
| 1325 | /* ASR : .... .... 0011 F000 : A-32 */ |
| 1326 | static size_t dsp56k_op_asr(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1120 | 1327 | { |
| 1121 | | int retSize = 1 ; |
| 1328 | typed_pointer D = {NULL, DT_BYTE}; |
| 1329 | decode_F_table(BITS(op_byte,0x0008), &D); |
| 1122 | 1330 | |
| 1123 | | // The 8-bit signed immediate operand is stored in the low byte of destination |
| 1124 | | // register D after having been sign extended. |
| 1331 | *p_accum = *((UINT64*)D.addr); |
| 1125 | 1332 | |
| 1126 | | INT8 immediateVal = OP & 0x00ff ; |
| 1127 | | UINT16 immediateWord ; |
| 1333 | *((UINT64*)D.addr) = (*((UINT64*)D.addr)) >> 1; |
| 1128 | 1334 | |
| 1129 | | unsigned char dt = 0x00 ; |
| 1130 | | void *destinationReg = 0x00 ; |
| 1335 | /* Make sure the MSB is maintained */ |
| 1336 | if (*p_accum & U64(0x0000008000000000)) |
| 1337 | *((UINT64*)D.addr) |= U64(0x0000008000000000); |
| 1338 | else |
| 1339 | *((UINT64*)D.addr) &= (~U64(0x0000008000000000)); |
| 1131 | 1340 | |
| 1132 | | destinationReg = DecodeDDTable(BITS(OP,0x0300), &dt) ; |
| 1341 | /* For the parallel move */ |
| 1342 | d_register->addr = D.addr; |
| 1343 | d_register->data_type = D.data_type; |
| 1133 | 1344 | |
| 1134 | | // Sign extend the immediate value... |
| 1135 | | // !!! On Intel architecture this works correctly, does it work everywhere ??? |
| 1136 | | immediateWord = (INT16)immediateVal ; |
| 1345 | /* S L E U N Z V C */ |
| 1346 | /* * * * * * * 0 ? */ |
| 1347 | /* TODO: S, L, E, U */ |
| 1348 | if (*((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(1); |
| 1349 | if (*((UINT64*)D.addr) == 0) Z_bit_set(1); |
| 1350 | V_bit_set(0); |
| 1351 | if (*p_accum & U64(0x0000000000000001)) C_bit_set(1); |
| 1137 | 1352 | |
| 1138 | | SetDestinationValue(&immediateWord, DT_WORD, destinationReg, dt) ; |
| 1353 | cycles += 2; /* TODO: + mv oscillator cycles */ |
| 1354 | return 1; |
| 1355 | } |
| 1139 | 1356 | |
| 1140 | | return retSize ; |
| 1357 | /* ASL : .... .... 0011 F001 : A-28 */ |
| 1358 | static size_t dsp56k_op_asl(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1359 | { |
| 1360 | /* S L E U N Z V C */ |
| 1361 | /* * * * * * * ? ? */ |
| 1362 | /* V - Set if an arithmetic overflow occurs in the 40 bit result. Also set if the most significant |
| 1363 | bit of the destination operand is changed as a result of the left shift. Cleared otherwise. */ |
| 1364 | /* C - Set if bit 39 of source operand is set. Cleared otherwise. */ |
| 1365 | return 0; |
| 1141 | 1366 | } |
| 1142 | 1367 | |
| 1143 | | static int MovePOperation(void) |
| 1368 | /* LSR : .... .... 0011 F010 : A-120 */ |
| 1369 | static size_t dsp56k_op_lsr(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1144 | 1370 | { |
| 1145 | | int retSize = 1 ; |
| 1371 | typed_pointer D = {NULL, DT_BYTE}; |
| 1372 | decode_F_table(BITS(op_byte,0x0008), &D); |
| 1146 | 1373 | |
| 1147 | | if (BITS(OP,0x1000)) |
| 1148 | | { |
| 1149 | | // X:<pp> and SD |
| 1150 | | UINT16 pp ; |
| 1151 | | UINT16 W ; |
| 1374 | *p_accum = *((UINT64*)D.addr); |
| 1152 | 1375 | |
| 1153 | | unsigned char sdt = 0x00 ; |
| 1154 | | void *SD = 0x00 ; |
| 1376 | ((PAIR64*)D.addr)->w.h = (((PAIR64*)D.addr)->w.h) >> 1; |
| 1155 | 1377 | |
| 1156 | | SD = DecodeHHTable(BITS(OP,0x00c0), &sdt) ; |
| 1378 | /* Make sure bit 31 gets a 0 */ |
| 1379 | ((PAIR64*)D.addr)->w.h &= (~0x8000); |
| 1157 | 1380 | |
| 1158 | | pp = BITS(OP,0x001f) ; |
| 1159 | | pp = AssembleAddressFromIOShortAddress(pp) ; |
| 1381 | /* For the parallel move */ |
| 1382 | d_register->addr = D.addr; |
| 1383 | d_register->data_type = D.data_type; |
| 1160 | 1384 | |
| 1161 | | W = BITS(OP,0x0100) ; |
| 1385 | /* S L E U N Z V C */ |
| 1386 | /* * * - - ? ? 0 ? */ |
| 1387 | /* TODO: S, L */ |
| 1388 | N_bit_set(0); |
| 1389 | if (((PAIR64*)D.addr)->w.h == 0) Z_bit_set(1); |
| 1390 | V_bit_set(0); |
| 1391 | if (*p_accum & U64(0x0000000000010000)) C_bit_set(1); |
| 1162 | 1392 | |
| 1163 | | if (W) |
| 1164 | | { |
| 1165 | | UINT16 data = data_read_word_16le(pp<<1) ; |
| 1166 | | SetDestinationValue(&data, DT_WORD, SD, sdt) ; |
| 1167 | | } |
| 1168 | | else |
| 1169 | | { |
| 1170 | | SetDataMemoryValue(SD, sdt, pp<<1) ; |
| 1171 | | } |
| 1172 | | } |
| 1173 | | else |
| 1174 | | { |
| 1175 | | // X:<Rx> and X:<pp> |
| 1176 | | UINT16 pp ; |
| 1177 | | UINT16 W ; |
| 1393 | cycles += 2; /* TODO: + mv oscillator cycles */ |
| 1394 | return 1; |
| 1395 | } |
| 1178 | 1396 | |
| 1179 | | unsigned char sdrt = 0x00 ; |
| 1180 | | void *sdrReg = 0x00 ; |
| 1181 | | sdrReg = DecodeRRTable(BITS(OP,0x00c0), &sdrt) ; |
| 1397 | /* LSL : .... .... 0011 F011 : A-118 */ |
| 1398 | static size_t dsp56k_op_lsl(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1399 | { |
| 1400 | /* S L E U N Z V C */ |
| 1401 | /* * * - - ? ? 0 ? */ |
| 1402 | /* N - Set if bit 31 of the result is set. Cleared otherwise. */ |
| 1403 | /* Z - Set if bits 16-31 of the result are zero. Cleared otherwise. */ |
| 1404 | /* C - Set if bit 31 of the source operand is set. Cleared otherwise. */ |
| 1405 | return 0; |
| 1406 | } |
| 1182 | 1407 | |
| 1183 | | pp = BITS(OP,0x001f) ; |
| 1184 | | pp = AssembleAddressFromIOShortAddress(pp) ; |
| 1408 | /* EOR : .... .... 0011 F1JJ : A-94 */ |
| 1409 | static size_t dsp56k_op_eor(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1410 | { |
| 1411 | /* S L E U N Z V C */ |
| 1412 | /* * * - - ? ? 0 - */ |
| 1413 | /* N - Set if bit 31 of the result is set. Cleared otherwise. */ |
| 1414 | /* Z - Set if bits 16-31 of the result are zero. Cleared otherwise. */ |
| 1415 | return 0; |
| 1416 | } |
| 1185 | 1417 | |
| 1186 | | W = BITS(OP,0x0100) ; |
| 1418 | /* SUBL : .... .... 0100 F001 : A-204 */ |
| 1419 | static size_t dsp56k_op_subl(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1420 | { |
| 1421 | /* S L E U N Z V C */ |
| 1422 | /* * * * * * * ? * */ |
| 1423 | /* V - Set if an arithmetic overflow occurs in the 40 bit result. Also set if the most significant |
| 1424 | bit of the destination operand is changed as a result of the left shift. Cleared otherwise. */ |
| 1425 | return 0; |
| 1426 | } |
| 1187 | 1427 | |
| 1188 | | // A little different than most W if's - opposite read and write thingies... |
| 1189 | | if (W) |
| 1190 | | { |
| 1191 | | UINT16 data = data_read_word_16le( (*((UINT16*)sdrReg))<<1 ) ; // read the word out |
| 1192 | | SetDataMemoryValue(&data, DT_WORD, pp<<1) ; |
| 1193 | | } |
| 1194 | | else |
| 1195 | | { |
| 1196 | | mame_printf_debug("NOTHING HERE (yet)\n") ; |
| 1197 | | } |
| 1428 | /* SUB : .... .... 0100 FJJJ : A-202 */ |
| 1429 | static size_t dsp56k_op_sub(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1430 | { |
| 1431 | /* S L E U N Z V C */ |
| 1432 | /* * * * * * * * * */ |
| 1433 | return 0; |
| 1434 | } |
| 1198 | 1435 | |
| 1199 | | // Postincrement |
| 1200 | | ExecutemTable(BITS(OP,0x00c0), BITS(OP,0x0020)) ; |
| 1201 | | } |
| 1436 | /* CLR24 : .... .... 0101 F001 : A-62 */ |
| 1437 | static size_t dsp56k_op_clr24(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1438 | { |
| 1439 | /* S L E U N Z V C */ |
| 1440 | /* * * * * * ? 0 - */ |
| 1441 | /* Z - Set if the 24 most significant bits of the destination result are all zeroes. */ |
| 1442 | return 0; |
| 1443 | } |
| 1202 | 1444 | |
| 1203 | | return retSize ; |
| 1445 | /* SBC : .... .... 0101 F01J : A-198 */ |
| 1446 | static size_t dsp56k_op_sbc(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1447 | { |
| 1448 | /* S L E U N Z V C */ |
| 1449 | /* * * * * * * * * */ |
| 1450 | return 0; |
| 1204 | 1451 | } |
| 1205 | 1452 | |
| 1206 | | |
| 1207 | | static int JmpOperation(void) |
| 1453 | /* CMP : .... .... 0101 FJJJ : A-64 */ |
| 1454 | static size_t dsp56k_op_cmp(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1208 | 1455 | { |
| 1209 | | int retSize = 0 ; |
| 1456 | UINT64 cmpVal = 0; |
| 1457 | UINT64 result = 0; |
| 1210 | 1458 | |
| 1211 | | core.ppc = PC; |
| 1459 | typed_pointer S = {NULL, DT_BYTE}; |
| 1460 | typed_pointer D = {NULL, DT_BYTE}; |
| 1212 | 1461 | |
| 1213 | | if (BITS(OP,0x0010)) |
| 1462 | decode_JJJF_table(BITS(op_byte,0x0007),BITS(op_byte,0x0008), &S, &D); |
| 1463 | |
| 1464 | *p_accum = *((UINT64*)D.addr); |
| 1465 | |
| 1466 | switch(S.data_type) |
| 1214 | 1467 | { |
| 1215 | | PC = (ROPCODE((PC<<1)+2)) ; // Can this offset by 2 bytes be handled better? Say, for example, by moving "1 word"? |
| 1216 | | change_pc(PC) ; |
| 1468 | case DT_WORD: cmpVal = (UINT64)*((UINT16*)S.addr); break; |
| 1469 | case DT_DOUBLE_WORD: cmpVal = (UINT64)*((UINT32*)S.addr); break; |
| 1470 | case DT_LONG_WORD: cmpVal = (UINT64)*((UINT64*)S.addr); break; |
| 1217 | 1471 | } |
| 1218 | | else |
| 1219 | | { |
| 1220 | | unsigned char rt = 0x00 ; |
| 1221 | | void *R = 0x00 ; |
| 1222 | 1472 | |
| 1223 | | R = DecodeRRTable(BITS(OP,0x0003), &rt); |
| 1473 | result = *((UINT64*)D.addr) - cmpVal; |
| 1224 | 1474 | |
| 1225 | | PC = *((UINT16*)R); |
| 1226 | | change_pc(PC); |
| 1227 | | } |
| 1475 | d_register->addr = D.addr; |
| 1476 | d_register->data_type = D.data_type; |
| 1228 | 1477 | |
| 1229 | | retSize = 0 ; // Jump with no offset. |
| 1478 | /* S L E U N Z V C */ |
| 1479 | /* * * * * * * * * */ |
| 1480 | /* TODO: S, L, E, U, N, V, C */ |
| 1481 | if (result == 0) Z_bit_set(1); /* TODO: Do you clear it if this isn't true? */ |
| 1230 | 1482 | |
| 1231 | | return retSize ; |
| 1483 | |
| 1484 | cycles += 2; /* TODO: + mv oscillator clock cycles */ |
| 1485 | return 1; |
| 1232 | 1486 | } |
| 1233 | 1487 | |
| 1234 | | static int BsrOperation(void) |
| 1488 | /* NEG : .... .... 0110 F000 : A-166 */ |
| 1489 | static size_t dsp56k_op_neg(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1235 | 1490 | { |
| 1236 | | int retSize = 0 ; |
| 1491 | /* S L E U N Z V C */ |
| 1492 | /* * * * * * * * * */ |
| 1493 | return 0; |
| 1494 | } |
| 1237 | 1495 | |
| 1238 | | INT16 branchOffset = (ROPCODE((PC<<1)+2)) ; // Can this offset by 2 bytes be handled better? Say, for example, by moving "1 word"? |
| 1496 | /* NOT : .... .... 0110 F001 : A-174 */ |
| 1497 | static size_t dsp56k_op_not(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1498 | { |
| 1499 | typed_pointer D = {NULL, DT_BYTE}; |
| 1500 | decode_F_table(BITS(op_byte,0x0008), &D); |
| 1239 | 1501 | |
| 1240 | | // "The PC Contains the address of the next instruction" |
| 1241 | | PC += 2 ; |
| 1242 | | core.ppc = PC ; |
| 1502 | *p_accum = *((UINT64*)D.addr); |
| 1243 | 1503 | |
| 1244 | | // Push the PC to the stack... |
| 1245 | | SP++ ; // !!! I'm not so sure about this 'pre-increment' |
| 1246 | | // The reason it might be there is that SSH and SSL are supposed to point to the top of the |
| 1247 | | // stack (and the docs seem to imply this behaviour). But it wastes the first stack entry ??? |
| 1248 | | // !!! I think i've read somewhere that PC == 1 when the stack is empty ??? |
| 1249 | | // !!! I also .know. there are only 15 stack entries - could this be why ??? |
| 1250 | | SSH = PC ; |
| 1251 | | SSL = SR ; |
| 1504 | /* Invert bits [16:31] of D */ |
| 1505 | ((PAIR64*)D.addr)->w.h = ~(((PAIR64*)D.addr)->w.h); |
| 1252 | 1506 | |
| 1253 | | PC += branchOffset ; |
| 1507 | d_register->addr = D.addr; |
| 1508 | d_register->data_type = D.data_type; |
| 1254 | 1509 | |
| 1255 | | retSize = 0 ; // Branch and then no offset. |
| 1510 | /* S L E U N Z V C */ |
| 1511 | /* * * - - ? ? 0 - */ |
| 1512 | /* TODO: S?, L */ |
| 1513 | if ( *((UINT64*)D.addr) & U64(0x0000000080000000)) N_bit_set(1); |
| 1514 | if ((*((UINT64*)D.addr) & U64(0x00000000ffff0000)) == 0) Z_bit_set(1); |
| 1515 | V_bit_set(0); |
| 1256 | 1516 | |
| 1257 | | change_pc(PC) ; |
| 1258 | | |
| 1259 | | return retSize ; |
| 1517 | cycles += 2; /* TODO: + mv oscillator cycles */ |
| 1518 | return 1; |
| 1260 | 1519 | } |
| 1261 | 1520 | |
| 1262 | | static int JsrOperation(void) |
| 1521 | /* DEC : .... .... 0110 F010 : A-72 */ |
| 1522 | static size_t dsp56k_op_dec(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1263 | 1523 | { |
| 1264 | | int retSize = 0; |
| 1265 | | |
| 1266 | | // Handle other JSR types! |
| 1267 | | INT16 branchOffset = (ROPCODE((PC<<1)+2)) ; // Can this offset by 2 bytes be handled better? Say, for example, by moving "1 word"? |
| 1268 | | |
| 1269 | | // The docs say nothing of this, but I swear it *must* be true |
| 1270 | | PC += 2 ; |
| 1271 | | core.ppc = PC ; |
| 1272 | | |
| 1273 | | // See bsr operation |
| 1274 | | SP++; |
| 1275 | | SSH = PC; |
| 1276 | | SSL = SR; |
| 1277 | | |
| 1278 | | PC = branchOffset; |
| 1279 | | |
| 1280 | | return retSize; |
| 1524 | /* S L E U N Z V C */ |
| 1525 | /* * * * * * * * * */ |
| 1526 | return 0; |
| 1281 | 1527 | } |
| 1282 | 1528 | |
| 1283 | | static int BraOperation(void) |
| 1529 | /* DEC24 : .... .... 0110 F011 : A-74 */ |
| 1530 | static size_t dsp56k_op_dec24(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1284 | 1531 | { |
| 1285 | | int retSize = 0 ; |
| 1532 | UINT32 workBits24; |
| 1286 | 1533 | |
| 1287 | | // Branch to the location in program memory at location PC+displacement. |
| 1288 | | INT16 branchOffset = 0x00; |
| 1534 | typed_pointer D = {NULL, DT_BYTE}; |
| 1535 | decode_F_table(BITS(op_byte,0x0008), &D); |
| 1289 | 1536 | |
| 1290 | | if (BITS(OP,0x0800)) |
| 1291 | | { |
| 1292 | | // 8 bit immediate (relative) offset |
| 1293 | | branchOffset = (INT8)BITS(OP,0x00ff) ; |
| 1537 | /* Save some data for the parallel move */ |
| 1538 | *p_accum = *((UINT64*)D.addr); |
| 1294 | 1539 | |
| 1295 | | // "The PC Contains the address of the next instruction" |
| 1296 | | PC += 1 ; |
| 1297 | | } |
| 1298 | | else if (BITS(OP,0x0010)) |
| 1299 | | { |
| 1300 | | // 16 bit immediate (relative) offset |
| 1301 | | retSize = 666 ; |
| 1302 | | } |
| 1303 | | else if (!BITS(OP,0x0010)) |
| 1304 | | { |
| 1305 | | // 16 bit Rx offset |
| 1306 | | retSize = 666 ; |
| 1307 | | } |
| 1540 | /* TODO: I wonder if workBits24 should be signed? */ |
| 1541 | workBits24 = ((*((UINT64*)D.addr)) & U64(0x000000ffffff0000)) >> 16; |
| 1542 | workBits24--; |
| 1543 | workBits24 &= 0x00ffffff; /* Solves -x issues */ |
| 1308 | 1544 | |
| 1309 | | core.ppc = PC ; |
| 1310 | | PC += branchOffset ; |
| 1545 | /* Set the D bits with the dec result */ |
| 1546 | *((UINT64*)D.addr) &= U64(0x000000000000ffff); |
| 1547 | *((UINT64*)D.addr) |= (((UINT64)(workBits24)) << 16); |
| 1311 | 1548 | |
| 1312 | | change_pc(PC) ; |
| 1549 | d_register->addr = D.addr; |
| 1550 | d_register->data_type = D.data_type; |
| 1313 | 1551 | |
| 1314 | | return retSize ; |
| 1552 | /* S L E U N Z V C */ |
| 1553 | /* * * * * * ? * * */ |
| 1554 | /* TODO: S, L, E, U, V, C */ |
| 1555 | if ( *((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(1); |
| 1556 | if ((*((UINT64*)D.addr) & U64(0x000000ffffff0000)) == 0) Z_bit_set(1); |
| 1557 | |
| 1558 | cycles += 2; /* TODO: + mv oscillator clock cycles */ |
| 1559 | return 1; |
| 1315 | 1560 | } |
| 1316 | 1561 | |
| 1317 | | |
| 1318 | | static int DoOperation(void) |
| 1562 | /* AND : .... .... 0110 F1JJ : A-24 */ |
| 1563 | static size_t dsp56k_op_and(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1319 | 1564 | { |
| 1320 | | int retSize = 0 ; |
| 1565 | typed_pointer S = {NULL, DT_BYTE}; |
| 1566 | typed_pointer D = {NULL, DT_BYTE}; |
| 1321 | 1567 | |
| 1322 | | UINT16 offset ; |
| 1568 | decode_JJF_table(BITS(op_byte,0x0003), BITS(op_byte,0x0008), &S, &D); |
| 1323 | 1569 | |
| 1324 | | // First instruction cycle |
| 1325 | | SP++ ; |
| 1326 | | SSH = LA ; |
| 1327 | | SSL = LC ; |
| 1570 | /* Save some data for the parallel move */ |
| 1571 | *p_accum = *((UINT64*)D.addr); |
| 1328 | 1572 | |
| 1329 | | if (BITS(OP,0x0800)) |
| 1330 | | { |
| 1331 | | // #xx,expr |
| 1332 | | LC = BITS(OP,0x00ff) ; |
| 1333 | | retSize = 2 ; |
| 1334 | | } |
| 1335 | | else if (BITS(OP,0x0400)) |
| 1336 | | { |
| 1337 | | // S,expr |
| 1338 | | unsigned char sdt = 0x00 ; |
| 1339 | | void *SD ; |
| 1573 | /* AND a word of S with A1|B1 */ |
| 1574 | ((PAIR64*)D.addr)->w.h = *((UINT16*)S.addr) & ((PAIR64*)D.addr)->w.h; |
| 1340 | 1575 | |
| 1341 | | // !!! Watch out for the special cases (FamilyManual page 276) !!! |
| 1342 | | SD = DecodeDDDDDTable(BITS(OP,0x001f), &sdt) ; |
| 1343 | | SetDestinationValue(SD, sdt, &LC, DT_WORD) ; |
| 1344 | | retSize = 2 ; |
| 1345 | | } |
| 1346 | | else |
| 1347 | | { |
| 1348 | | // X:(Rn),expr |
| 1349 | | retSize = 666 ; |
| 1350 | | } |
| 1576 | d_register->addr = D.addr; |
| 1577 | d_register->data_type = D.data_type; |
| 1351 | 1578 | |
| 1579 | /* S L E U N Z V C */ |
| 1580 | /* * * - - ? ? 0 - */ |
| 1581 | /* TODO: S, L */ |
| 1582 | if ( *((UINT64*)D.addr) & U64(0x0000000080000000)) N_bit_set(1); |
| 1583 | if ((*((UINT64*)D.addr) & U64(0x00000000ffff0000)) == 0) Z_bit_set(1); |
| 1584 | V_bit_set(0); |
| 1352 | 1585 | |
| 1353 | | // Second instruction cycle |
| 1354 | | SP++ ; |
| 1355 | | SSH = PC+2 ; // The value in the Program Counter (PC) register pushed onto the system stack is the address of the first instruction following the DO instruction |
| 1356 | | SSL = SR ; |
| 1586 | cycles += 2; /* TODO: + mv oscillator cycles */ |
| 1587 | return 1; |
| 1588 | } |
| 1357 | 1589 | |
| 1358 | | offset = 0x00 ; // The offset is the same for all DO instructions... |
| 1359 | | offset = (ROPCODE((PC<<1)+2)) ; |
| 1360 | | offset += PC+2 ; |
| 1361 | | LA = offset ; |
| 1590 | /* ABS : .... .... 0111 F001 : A-18 */ |
| 1591 | static size_t dsp56k_op_abs(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1592 | { |
| 1593 | /* S L E U N Z V C */ |
| 1594 | /* * * * * * * * - */ |
| 1595 | return 0; |
| 1596 | } |
| 1362 | 1597 | |
| 1598 | /* ROR : .... .... 0111 F010 : A-192 */ |
| 1599 | static size_t dsp56k_op_ror(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1600 | { |
| 1601 | /* S L E U N Z V C */ |
| 1602 | /* * * - - ? ? 0 ? */ |
| 1603 | /* N - Set if bit 31 of the result is set. Cleared otherwise. */ |
| 1604 | /* Z - Set if bits 16-31 of the result are zero. Cleared otherwise. */ |
| 1605 | /* C - Set if bit 16 of the source operand is set. Cleared otherwise. */ |
| 1606 | return 0; |
| 1607 | } |
| 1363 | 1608 | |
| 1364 | | // Third instruction cycle |
| 1365 | | LF_bit_set(1); |
| 1609 | /* ROL : .... .... 0111 F011 : A-190 */ |
| 1610 | static size_t dsp56k_op_rol(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1611 | { |
| 1612 | /* S L E U N Z V C */ |
| 1613 | /* * * - - ? ? 0 ? */ |
| 1614 | /* N - Set if bit 31 of the result is set. Cleared otherwise. */ |
| 1615 | /* Z - Set if bits 16-31 of the result are zero. Cleared otherwise. */ |
| 1616 | /* C - Set if bit 31 of the source operand is set. Cleared otherwise. */ |
| 1617 | return 0; |
| 1618 | } |
| 1366 | 1619 | |
| 1367 | | return retSize ; |
| 1620 | /* CMPM : .... .... 0111 FJJJ : A-66 */ |
| 1621 | static size_t dsp56k_op_cmpm(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1622 | { |
| 1623 | /* S L E U N Z V C */ |
| 1624 | /* * * * * * * * * */ |
| 1625 | return 0; |
| 1368 | 1626 | } |
| 1369 | 1627 | |
| 1370 | | static void EndOfLoopProcessing(void) |
| 1628 | /* MPY : .... .... 1k00 FQQQ : A-160 -- CONFIRMED TYPO IN DOCS (HHHH vs HHHW) */ |
| 1629 | static size_t dsp56k_op_mpy(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1371 | 1630 | { |
| 1372 | | SR = SSL ; |
| 1373 | | SP-- ; |
| 1374 | | LA = SSH ; |
| 1375 | | LC = SSL ; |
| 1376 | | SP-- ; |
| 1631 | /* S L E U N Z V C */ |
| 1632 | /* * * * * * * * - */ |
| 1633 | return 0; |
| 1377 | 1634 | } |
| 1378 | 1635 | |
| 1379 | | static int Dec24Operation(void **wd, UINT64 *pa) |
| 1636 | /* MPYR : .... .... 1k01 FQQQ : A-162 */ |
| 1637 | static size_t dsp56k_op_mpyr(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1380 | 1638 | { |
| 1381 | | int retSize = 1 ; |
| 1639 | /* S L E U N Z V C */ |
| 1640 | /* * * * * * * * - */ |
| 1641 | return 0; |
| 1642 | } |
| 1382 | 1643 | |
| 1383 | | UINT64 decMe ; |
| 1644 | /* MAC : .... .... 1k10 FQQQ : A-122 */ |
| 1645 | static size_t dsp56k_op_mac(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1646 | { |
| 1647 | /* S L E U N Z V C */ |
| 1648 | /* * * * * * * * - */ |
| 1649 | return 0; |
| 1650 | } |
| 1384 | 1651 | |
| 1385 | | unsigned char drt = 0x00 ; |
| 1386 | | void *D = 0x00 ; |
| 1387 | | D = DecodeFTable(BITS(OP,0x0008), &drt) ; |
| 1652 | /* MACR : .... .... 1k11 FQQQ : A-124 -- DRAMA - rr vs xx (805) */ |
| 1653 | static size_t dsp56k_op_macr(const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles) |
| 1654 | { |
| 1655 | /* S L E U N Z V C */ |
| 1656 | /* * * * * * * * - */ |
| 1657 | return 0; |
| 1658 | } |
| 1388 | 1659 | |
| 1389 | | *pa = *((UINT64*)D) ; // backup the previous value |
| 1390 | 1660 | |
| 1391 | | // !! I wonder if this should be a signed int instead !! |
| 1392 | | decMe = (*((UINT64*)D) & (UINT64)U64(0xffffff0000)) >> 16 ; |
| 1393 | | decMe-- ; |
| 1394 | | decMe &= (UINT64)U64(0x0000000000ffffff) ; // For wraparound - Make sure no bits get set improperly in A/B |
| 1661 | /******************************/ |
| 1662 | /* Remaining non-parallel ops */ |
| 1663 | /******************************/ |
| 1395 | 1664 | |
| 1396 | | // UINT8 carryBit = (*((UINT64*)D) & 0x0000008000000000) >> 39 ; // For determinating carry status... |
| 1665 | /* ADC : 0001 0101 0000 F01J : A-20 */ |
| 1666 | static size_t dsp56k_op_adc(const UINT16 op, UINT8* cycles) |
| 1667 | { |
| 1668 | /* S L E U N Z V C */ |
| 1669 | /* - * * * * * * * */ |
| 1670 | return 0; |
| 1671 | } |
| 1397 | 1672 | |
| 1398 | | *((UINT64*)D) &= (UINT64)U64(0x000000000000ffff) ; // Prepare the destination to be set... |
| 1399 | | *((UINT64*)D) |= (decMe << 16) ; // Set the top 24 bits accordingly... |
| 1673 | /* ANDI : 0001 1EE0 iiii iiii : A-26 */ |
| 1674 | static size_t dsp56k_op_andi(const UINT16 op, UINT8* cycles) |
| 1675 | { |
| 1676 | UINT16 immediate = BITS(op,0x00ff); |
| 1400 | 1677 | |
| 1401 | | // Carry flag (C) - HACK |
| 1402 | | // if (decMe == 0x0000000000ff7fff) |
| 1403 | | // SET_cBIT() ; |
| 1404 | | // else |
| 1405 | | // CLEAR_cBIT() ; |
| 1678 | /* There is not currently a good way to refer to CCR or MR. Explicitly decode here. */ |
| 1679 | switch(BITS(op,0x0600)) |
| 1680 | { |
| 1681 | case 0x01: /* MR */ |
| 1682 | SR &= ((immediate << 8) | 0x00ff); |
| 1683 | break; |
| 1406 | 1684 | |
| 1407 | | // Carry flag (C) |
| 1408 | | // UINT8 postCarryBit = (*((UINT64*)D) & 0x0000008000000000) >> 39 ; |
| 1409 | | // if (postCarryBit != carryBit) SET_cBIT() ; |
| 1410 | | // else CLEAR_cBIT() ; |
| 1685 | case 0x02: /* CCR */ |
| 1686 | SR &= (immediate | 0xff00); |
| 1687 | break; |
| 1411 | 1688 | |
| 1412 | | *wd = D ; |
| 1689 | case 0x03: /* OMR */ |
| 1690 | OMR &= (UINT8)(immediate); |
| 1691 | break; |
| 1413 | 1692 | |
| 1414 | | /* |
| 1415 | | UINT32 decMe = ((*((PAIR64*)D)).b.h4 << 16) | (*((PAIR64*)D)).w.h ; |
| 1693 | default: |
| 1694 | fatalerror("DSP56k - BAD EE value in andi operation") ; |
| 1695 | } |
| 1416 | 1696 | |
| 1417 | | int fflag = 0 ; |
| 1418 | | if (decMe == 0x00007fff) fflag = 1 ; |
| 1697 | /* S L E U N Z V C */ |
| 1698 | /* - ? ? ? ? ? ? ? */ |
| 1699 | /* All ? bits - Cleared if the corresponding bit in the immediate data is cleared and if the operand |
| 1700 | is the CCR. Not affected otherwise. */ |
| 1701 | cycles += 2; |
| 1702 | return 1; |
| 1703 | } |
| 1419 | 1704 | |
| 1420 | | if (fflag) mame_printf_debug("%08x\n", decMe) ; |
| 1705 | /* ASL4 : 0001 0101 0011 F001 : A-30 */ |
| 1706 | static size_t dsp56k_op_asl4(const UINT16 op, UINT8* cycles) |
| 1707 | { |
| 1708 | /* S L E U N Z V C */ |
| 1709 | /* - ? * * * * ? ? */ |
| 1710 | /* V - Set if an arithmetic overflow occurs in the 40 bit result. Also set if bit 5 through 39 are |
| 1711 | not the same. */ |
| 1712 | /* C - Set if bit 36 of source operand is set. Cleared otherwise. */ |
| 1713 | return 0; |
| 1714 | } |
| 1421 | 1715 | |
| 1422 | | decMe-- ; |
| 1716 | /* ASR4 : 0001 0101 0011 F000 : A-34 */ |
| 1717 | static size_t dsp56k_op_asr4(const UINT16 op, UINT8* cycles) |
| 1718 | { |
| 1719 | /* S L E U N Z V C */ |
| 1720 | /* - * * * * * 0 ? */ |
| 1721 | /* C - Set if bit 3 of source operand is set. Cleared otherwise. */ |
| 1722 | return 0; |
| 1723 | } |
| 1423 | 1724 | |
| 1424 | | if (fflag) mame_printf_debug("%08x\n", decMe) ; |
| 1725 | /* ASR16 : 0001 0101 0111 F000 : A-36 */ |
| 1726 | static size_t dsp56k_op_asr16(const UINT16 op, UINT8* cycles) |
| 1727 | { |
| 1728 | /* S L E U N Z V C */ |
| 1729 | /* - * * * * * 0 ? */ |
| 1730 | /* C - Set if bit 15 of source operand is set. Cleared otherwise. */ |
| 1731 | return 0; |
| 1732 | } |
| 1425 | 1733 | |
| 1426 | | decMe &= 0x00ffffff ; |
| 1734 | /* BFCHG : 0001 0100 11Pp pppp BBB1 0010 iiii iiii : A-38 */ |
| 1735 | /* BFCLR : 0001 0100 11Pp pppp BBB0 0100 iiii iiii : A-40 */ |
| 1736 | /* BFSET : 0001 0100 11Pp pppp BBB1 1000 iiii iiii : A-42 */ |
| 1737 | /* BFTSTH : 0001 0100 01Pp pppp BBB1 0000 iiii iiii : A-44 */ |
| 1738 | /* BFTSTL : 0001 0100 01Pp pppp BBB0 0000 iiii iiii : A-46 */ |
| 1739 | static size_t dsp56k_op_bfop(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 1740 | { |
| 1741 | UINT16 workAddr = 0x0000; |
| 1742 | UINT16 workingWord = 0x0000; |
| 1743 | UINT16 previousValue = 0x0000; |
| 1744 | typed_pointer tempTP = { NULL, DT_BYTE }; |
| 1427 | 1745 | |
| 1428 | | if (fflag) mame_printf_debug("%08x\n", decMe) ; |
| 1746 | UINT16 iVal = op2 & 0x00ff; |
| 1747 | decode_BBB_bitmask(BITS(op2,0xe000), &iVal); |
| 1429 | 1748 | |
| 1430 | | UINT8 carryBit = ((*((PAIR64*)D)).b.h4 & 0x80) >> 7 ; |
| 1749 | workAddr = assemble_address_from_Pppppp_table(BITS(OP,0x0020), BITS(OP,0x001f)); |
| 1750 | previousValue = data_read_word_16le(WORD(workAddr)); |
| 1751 | workingWord = previousValue; |
| 1431 | 1752 | |
| 1432 | | (*((PAIR64*)D)).b.h4 = (decMe & 0x00ff0000) >> 16 ; |
| 1433 | | (*((PAIR64*)D)).w.h = (decMe & 0x0000ffff) ; |
| 1753 | switch(BITS(op2, 0x1f00)) |
| 1754 | { |
| 1755 | case 0x12: /* BFCHG */ |
| 1756 | workingWord ^= iVal; |
| 1757 | break; |
| 1758 | case 0x04: /* BFCLR */ |
| 1759 | workingWord = workingWord & (~iVal); |
| 1760 | break; |
| 1761 | case 0x18: /* BFSET */ |
| 1762 | workingWord = workingWord | iVal; |
| 1763 | break; |
| 1764 | case 0x10: /* BFTSTH */ |
| 1765 | /* Just the test below */ |
| 1766 | break; |
| 1767 | case 0x00: /* BFTSTL */ |
| 1768 | /* Just the test below */ |
| 1769 | break; |
| 1770 | } |
| 1434 | 1771 | |
| 1435 | | if (fflag) mame_printf_debug("%2x\n", (*((PAIR64*)D)).b.h4) ; |
| 1436 | | if (fflag) mame_printf_debug("%4x\n", (*((PAIR64*)D)).w.h) ; |
| 1772 | tempTP.addr = &workingWord; |
| 1773 | tempTP.data_type = DT_WORD; |
| 1774 | SetDataMemoryValue(tempTP, WORD(workAddr)); |
| 1437 | 1775 | |
| 1438 | | // Carry flag (C) |
| 1439 | | UINT8 postCarryBit = ((*((PAIR64*)D)).b.h4 & 0x80) >> 7 ; |
| 1440 | | if (postCarryBit != carryBit) SET_cBIT() ; |
| 1441 | | else CLEAR_cBIT() ; |
| 1776 | /* S L E U N Z V C */ |
| 1777 | /* - * - - - - - ? */ |
| 1778 | /* TODO: L */ |
| 1779 | switch(BITS(op2, 0x1f00)) |
| 1780 | { |
| 1781 | case 0x12: /* BFCHG */ |
| 1782 | if ((iVal & previousValue) == iVal) C_bit_set(1); else C_bit_set(0); break; |
| 1783 | case 0x04: /* BFCLR */ |
| 1784 | if ((iVal & previousValue) == iVal) C_bit_set(1); else C_bit_set(0); break; |
| 1785 | case 0x18: /* BFSET */ |
| 1786 | if ((iVal & previousValue) == iVal) C_bit_set(1); else C_bit_set(0); break; |
| 1787 | case 0x10: /* BFTSTH */ |
| 1788 | if ((iVal & previousValue) == iVal) C_bit_set(1); else C_bit_set(0); break; |
| 1789 | case 0x00: /* BFTSTL */ |
| 1790 | if ((iVal & previousValue) == 0x0000) C_bit_set(1); else C_bit_set(0); break; |
| 1791 | } |
| 1442 | 1792 | |
| 1443 | | *wd = D ; |
| 1444 | | */ |
| 1445 | | return retSize ; |
| 1793 | cycles += 4; /* TODO: + mvb oscillator clock cycles */ |
| 1794 | return 2; |
| 1446 | 1795 | } |
| 1447 | 1796 | |
| 1448 | | static int AddOperation(void **wd, UINT64 *pa) |
| 1797 | /* BFCHG : 0001 0100 101- --RR BBB1 0010 iiii iiii : A-38 */ |
| 1798 | /* BFCLR : 0001 0100 101- --RR BBB0 0100 iiii iiii : A-40 */ |
| 1799 | /* BFSET : 0001 0100 101- --RR BBB1 1000 iiii iiii : A-42 */ |
| 1800 | /* BFTSTH : 0001 0100 001- --RR BBB1 0000 iiii iiii : A-44 */ |
| 1801 | /* BFTSTL : 0001 0100 001- --RR BBB0 0000 iiii iiii : A-46 */ |
| 1802 | static size_t dsp56k_op_bfop_1(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 1449 | 1803 | { |
| 1450 | | UINT64 addVal = 0x00; |
| 1804 | UINT16 workAddr = 0x0000; |
| 1805 | UINT16 workingWord = 0x0000; |
| 1806 | UINT16 previousValue = 0x0000; |
| 1807 | typed_pointer R = { NULL, DT_BYTE }; |
| 1808 | typed_pointer tempTP = { NULL, DT_BYTE }; |
| 1451 | 1809 | |
| 1452 | | unsigned char st = 0x00, dt = 0x00 ; |
| 1453 | | void *S = 0x00, *D = 0x00; |
| 1810 | UINT16 iVal = op2 & 0x00ff; |
| 1811 | decode_BBB_bitmask(BITS(op2,0xe000), &iVal); |
| 1454 | 1812 | |
| 1455 | | DecodeJJJFTable(BITS(OP,0x0007),BITS(OP,0x0008), &S, &st, &D, &dt) ; |
| 1813 | decode_RR_table(BITS(op,0x0003), &R); |
| 1456 | 1814 | |
| 1457 | | *pa = *((UINT64*)D) ; // backup the previous value |
| 1815 | workAddr = *((UINT16*)R.addr); |
| 1816 | previousValue = data_read_word_16le(WORD(workAddr)); |
| 1817 | workingWord = previousValue; |
| 1458 | 1818 | |
| 1459 | | switch(st) |
| 1819 | switch(BITS(op2, 0x1f00)) |
| 1460 | 1820 | { |
| 1461 | | case DT_WORD: addVal = (UINT64)*((UINT16*)S) << 16 ; break ; |
| 1462 | | case DT_DOUBLE_WORD: addVal = (UINT64)*((UINT32*)S) ; break ; |
| 1463 | | case DT_LONG_WORD: addVal = (UINT64)*((UINT64*)S) ; break ; |
| 1821 | case 0x12: /* BFCHG */ |
| 1822 | workingWord ^= iVal; |
| 1823 | break; |
| 1824 | case 0x04: /* BFCLR */ |
| 1825 | workingWord = workingWord & (~iVal); |
| 1826 | break; |
| 1827 | case 0x18: /* BFSET */ |
| 1828 | workingWord = workingWord | iVal; |
| 1829 | break; |
| 1830 | case 0x10: /* BFTSTH */ |
| 1831 | /* Just the test below */ |
| 1832 | break; |
| 1833 | case 0x00: /* BFTSTL */ |
| 1834 | /* Just the test below */ |
| 1835 | break; |
| 1464 | 1836 | } |
| 1465 | 1837 | |
| 1466 | | *((UINT64*)D) += addVal ; |
| 1838 | tempTP.addr = &workingWord; |
| 1839 | tempTP.data_type = DT_WORD; |
| 1840 | SetDataMemoryValue(tempTP, WORD(workAddr)); |
| 1467 | 1841 | |
| 1468 | | *wd = D ; |
| 1842 | /* S L E U N Z V C */ |
| 1843 | /* - * - - - - - ? */ |
| 1844 | /* TODO: L */ |
| 1845 | switch(BITS(op2, 0x1f00)) |
| 1846 | { |
| 1847 | case 0x12: /* BFCHG */ |
| 1848 | if ((iVal & previousValue) == iVal) C_bit_set(1); else C_bit_set(0); break; |
| 1849 | case 0x04: /* BFCLR */ |
| 1850 | if ((iVal & previousValue) == iVal) C_bit_set(1); else C_bit_set(0); break; |
| 1851 | case 0x18: /* BFSET */ |
| 1852 | if ((iVal & previousValue) == iVal) C_bit_set(1); else C_bit_set(0); break; |
| 1853 | case 0x10: /* BFTSTH */ |
| 1854 | if ((iVal & previousValue) == iVal) C_bit_set(1); else C_bit_set(0); break; |
| 1855 | case 0x00: /* BFTSTL */ |
| 1856 | if ((iVal & previousValue) == 0x0000) C_bit_set(1); else C_bit_set(0); break; |
| 1857 | } |
| 1469 | 1858 | |
| 1470 | | return 1 ; |
| 1859 | cycles += 4; /* TODO: + mvb oscillator clock cycles */ |
| 1860 | return 2; |
| 1471 | 1861 | } |
| 1472 | 1862 | |
| 1473 | | static int LsrOperation(void **wd, UINT64 *pa) |
| 1863 | /* BFCHG : 0001 0100 100D DDDD BBB1 0010 iiii iiii : A-38 */ |
| 1864 | /* BFCLR : 0001 0100 100D DDDD BBB0 0100 iiii iiii : A-40 */ |
| 1865 | /* BFSET : 0001 0100 100D DDDD BBB1 1000 iiii iiii : A-42 */ |
| 1866 | /* BFTSTH : 0001 0100 000D DDDD BBB1 0000 iiii iiii : A-44 */ |
| 1867 | /* BFTSTL : 0001 0100 000D DDDD BBB0 0000 iiii iiii : A-46 */ |
| 1868 | static size_t dsp56k_op_bfop_2(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 1474 | 1869 | { |
| 1475 | | int retSize = 1 ; |
| 1870 | UINT16 workingWord = 0x0000; |
| 1871 | UINT16 previousValue = 0x0000; |
| 1476 | 1872 | |
| 1477 | | UINT16 result ; |
| 1873 | UINT16 iVal = op2 & 0x00ff; |
| 1874 | typed_pointer S = { NULL, DT_BYTE }; |
| 1478 | 1875 | |
| 1479 | | unsigned char dt = 0x00 ; |
| 1480 | | void *D = 0x00 ; |
| 1876 | decode_BBB_bitmask(BITS(op2,0xe000), &iVal); |
| 1877 | decode_DDDDD_table(BITS(op,0x001f), &S); |
| 1481 | 1878 | |
| 1482 | | D = DecodeFTable(BITS(OP,0x0008), &dt) ; |
| 1879 | /* A & B are special */ |
| 1880 | if (S.data_type == DT_LONG_WORD) |
| 1881 | previousValue = ((PAIR64*)S.addr)->w.h; |
| 1882 | else |
| 1883 | previousValue = *((UINT16*)S.addr); |
| 1483 | 1884 | |
| 1484 | | *pa = *((UINT64*)D) ; // backup the previous value |
| 1885 | workingWord = previousValue; |
| 1485 | 1886 | |
| 1486 | | // !!! Make sure to hold the MS bit and shift the LS bit properly !!! |
| 1887 | switch(BITS(op2, 0x1f00)) |
| 1888 | { |
| 1889 | case 0x12: /* BFCHG */ |
| 1890 | workingWord ^= iVal; |
| 1891 | break; |
| 1892 | case 0x04: /* BFCLR */ |
| 1893 | workingWord = workingWord & (~iVal); |
| 1894 | break; |
| 1895 | case 0x18: /* BFSET */ |
| 1896 | workingWord = workingWord | iVal; |
| 1897 | break; |
| 1898 | case 0x10: /* BFTSTH */ |
| 1899 | /* Just the test below */ |
| 1900 | break; |
| 1901 | case 0x00: /* BFTSTL */ |
| 1902 | /* Just the test below */ |
| 1903 | break; |
| 1904 | } |
| 1487 | 1905 | |
| 1488 | | result = (*((PAIR64*)D)).w.h >> 1 ; |
| 1489 | | (*((PAIR64*)D)).w.h = result ; |
| 1906 | /* Put the data back where it belongs (A & B are special) */ |
| 1907 | if (S.data_type == DT_LONG_WORD) |
| 1908 | ((PAIR64*)S.addr)->w.h = workingWord; |
| 1909 | else |
| 1910 | *((UINT16*)S.addr) = workingWord; |
| 1490 | 1911 | |
| 1491 | | *wd = D ; |
| 1492 | | return retSize ; |
| 1912 | /* S L E U N Z V C */ |
| 1913 | /* - * - - - - - ? */ |
| 1914 | /* TODO: L */ |
| 1915 | switch(BITS(op2, 0x1f00)) |
| 1916 | { |
| 1917 | case 0x12: /* BFCHG */ |
| 1918 | if ((iVal & previousValue) == iVal) C_bit_set(1); else C_bit_set(0); break; |
| 1919 | case 0x04: /* BFCLR */ |
| 1920 | if ((iVal & previousValue) == iVal) C_bit_set(1); else C_bit_set(0); break; |
| 1921 | case 0x18: /* BFSET */ |
| 1922 | if ((iVal & previousValue) == iVal) C_bit_set(1); else C_bit_set(0); break; |
| 1923 | case 0x10: /* BFTSTH */ |
| 1924 | if ((iVal & previousValue) == iVal) C_bit_set(1); else C_bit_set(0); break; |
| 1925 | case 0x00: /* BFTSTL */ |
| 1926 | if ((iVal & previousValue) == 0x0000) C_bit_set(1); else C_bit_set(0); break; |
| 1927 | } |
| 1928 | |
| 1929 | cycles += 4; /* TODO: + mvb oscillator clock cycles */ |
| 1930 | return 2; |
| 1493 | 1931 | } |
| 1494 | 1932 | |
| 1495 | | static int AsrOperation(void **wd, UINT64 *pa) |
| 1933 | /* Bcc : 0000 0111 --11 cccc xxxx xxxx xxxx xxxx : A-48 */ |
| 1934 | static size_t dsp56k_op_bcc(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 1496 | 1935 | { |
| 1497 | | int retSize = 1 ; |
| 1936 | /* S L E U N Z V C */ |
| 1937 | /* - - - - - - - - */ |
| 1938 | return 0; |
| 1939 | } |
| 1498 | 1940 | |
| 1499 | | unsigned char dt = 0x00 ; |
| 1500 | | void *D = 0x00 ; |
| 1941 | /* Bcc : 0010 11cc ccee eeee : A-48 */ |
| 1942 | static size_t dsp56k_op_bcc_1(const UINT16 op, UINT8* cycles) |
| 1943 | { |
| 1944 | int shouldBranch = decode_cccc_table(BITS(op,0x03c0)); |
| 1501 | 1945 | |
| 1502 | | D = DecodeFTable(BITS(OP,0x0008), &dt) ; |
| 1946 | if (shouldBranch) |
| 1947 | { |
| 1948 | INT16 offset = (INT16)assemble_address_from_6bit_signed_relative_short_address(BITS(op,0x003f)); |
| 1503 | 1949 | |
| 1504 | | *pa = *((UINT64*)D) ; // backup the previous value |
| 1950 | PC += 1; |
| 1505 | 1951 | |
| 1506 | | // !!! Make sure to hold the MS bit and shift the LS bit properly !!! |
| 1952 | core.ppc = PC; |
| 1953 | PC += offset; |
| 1954 | change_pc(PC) ; |
| 1507 | 1955 | |
| 1508 | | *((UINT64*)D) = (*((UINT64*)D)) >> 1 ; |
| 1956 | cycles += 4; |
| 1957 | return 0; |
| 1958 | } |
| 1959 | else |
| 1960 | { |
| 1961 | cycles += 4; |
| 1962 | return 1; |
| 1963 | } |
| 1509 | 1964 | |
| 1510 | | *wd = D ; |
| 1511 | | return retSize ; |
| 1965 | /* S L E U N Z V C */ |
| 1966 | /* - - - - - - - - */ |
| 1967 | return 0; |
| 1512 | 1968 | } |
| 1513 | 1969 | |
| 1514 | | static int NotOperation(void **wd, UINT64 *pa) |
| 1970 | /* Bcc : 0000 0111 RR10 cccc : A-48 */ |
| 1971 | static size_t dsp56k_op_bcc_2(const UINT16 op, UINT8* cycles) |
| 1515 | 1972 | { |
| 1516 | | int retSize = 1 ; |
| 1973 | /* S L E U N Z V C */ |
| 1974 | /* - - - - - - - - */ |
| 1975 | return 0; |
| 1976 | } |
| 1517 | 1977 | |
| 1518 | | unsigned char dt = 0x00 ; |
| 1519 | | void *D = 0x00 ; |
| 1978 | /* BRA : 0000 0001 0011 11-- xxxx xxxx xxxx xxxx : A-50 */ |
| 1979 | static size_t dsp56k_op_bra(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 1980 | { |
| 1981 | /* S L E U N Z V C */ |
| 1982 | /* - - - - - - - - */ |
| 1983 | return 0; |
| 1984 | } |
| 1520 | 1985 | |
| 1521 | | D = DecodeFTable(BITS(OP,0x0008), &dt) ; |
| 1986 | /* BRA : 0000 1011 aaaa aaaa : A-50 */ |
| 1987 | static size_t dsp56k_op_bra_1(const UINT16 op, UINT8* cycles) |
| 1988 | { |
| 1989 | /* 8 bit immediate, relative offset */ |
| 1990 | INT8 branchOffset = (INT8)BITS(op,0x00ff); |
| 1522 | 1991 | |
| 1523 | | *pa = *((UINT64*)D) ; // backup the previous value |
| 1992 | /* "The PC Contains the address of the next instruction" */ |
| 1993 | PC += 1; |
| 1524 | 1994 | |
| 1525 | | (*((PAIR64*)D)).w.h ^= 0xffff ; |
| 1995 | /* Jump */ |
| 1996 | core.ppc = PC; |
| 1997 | PC += branchOffset; |
| 1998 | change_pc(PC); |
| 1526 | 1999 | |
| 1527 | | *wd = D ; |
| 1528 | | return retSize ; |
| 2000 | /* S L E U N Z V C */ |
| 2001 | /* - - - - - - - - */ |
| 2002 | cycles += 4; /* TODO: + jx oscillator clock cycles */ |
| 2003 | return 0; |
| 1529 | 2004 | } |
| 1530 | 2005 | |
| 2006 | /* BRA : 0000 0001 0010 11RR : A-50 */ |
| 2007 | static size_t dsp56k_op_bra_2(const UINT16 op, UINT8* cycles) |
| 2008 | { |
| 2009 | /* S L E U N Z V C */ |
| 2010 | /* - - - - - - - - */ |
| 2011 | return 0; |
| 2012 | } |
| 1531 | 2013 | |
| 1532 | | static int EorOperation(void **wd, UINT64 *pa) |
| 2014 | /* BRKc : 0000 0001 0001 cccc : A-52 */ |
| 2015 | static size_t dsp56k_op_brkc(const UINT16 op, UINT8* cycles) |
| 1533 | 2016 | { |
| 1534 | | int retSize = 1 ; |
| 2017 | /* S L E U N Z V C */ |
| 2018 | /* - - - - - - - - */ |
| 2019 | return 0; |
| 2020 | } |
| 1535 | 2021 | |
| 1536 | | UINT16 result ; |
| 2022 | /* BScc : 0000 0111 --01 cccc xxxx xxxx xxxx xxxx : A-54 */ |
| 2023 | static size_t dsp56k_op_bscc(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 2024 | { |
| 2025 | int shouldBranch = decode_cccc_table(BITS(op,0x000f)); |
| 1537 | 2026 | |
| 1538 | | unsigned char st = 0x00, dt = 0x00 ; |
| 1539 | | void *S = 0x00, *D = 0x00; |
| 2027 | if (shouldBranch) |
| 2028 | { |
| 2029 | /* The PC Contains the address of the next instruction */ |
| 2030 | PC += 2; |
| 1540 | 2031 | |
| 1541 | | DecodeJJFTable(BITS(OP,0x0003),BITS(OP,0x0008), &S, &st, &D, &dt) ; |
| 2032 | /* Push */ |
| 2033 | SP++; |
| 2034 | SSH = PC; |
| 2035 | SSL = SR; |
| 1542 | 2036 | |
| 1543 | | *pa = *((UINT64*)D) ; // backup the previous value |
| 2037 | /* Change */ |
| 2038 | core.ppc = PC; |
| 2039 | PC = PC + (INT16)op2; |
| 2040 | change_pc(PC); |
| 2041 | } |
| 1544 | 2042 | |
| 1545 | | // This operation does an XOR of a word of S with A1/B1... |
| 1546 | | result = *((UINT16*)S) ^ (*((PAIR64*)D)).w.h ; |
| 1547 | | (*((PAIR64*)D)).w.h = result ; |
| 2043 | /* S L E U N Z V C */ |
| 2044 | /* - - - - - - - - */ |
| 2045 | cycles += 4; /* TODO: + jx oscillator clock cycles */ |
| 2046 | return 2; |
| 2047 | } |
| 1548 | 2048 | |
| 1549 | | *wd = D ; |
| 1550 | | return retSize ; |
| 2049 | /* BScc : 0000 0111 RR00 cccc : A-54 */ |
| 2050 | static size_t dsp56k_op_bscc_1(const UINT16 op, UINT8* cycles) |
| 2051 | { |
| 2052 | /* S L E U N Z V C */ |
| 2053 | /* - - - - - - - - */ |
| 2054 | return 0; |
| 1551 | 2055 | } |
| 1552 | 2056 | |
| 1553 | | static int TfrDataALUOperation(void **wd, UINT64 *pa) |
| 2057 | /* BSR : 0000 0001 0011 10-- xxxx xxxx xxxx xxxx : A-56 */ |
| 2058 | static size_t dsp56k_op_bsr(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 1554 | 2059 | { |
| 1555 | | int retSize = 1 ; |
| 2060 | /* The PC Contains the address of the next instruction */ |
| 2061 | PC += 2; |
| 1556 | 2062 | |
| 1557 | | unsigned char st = 0x00, dt = 0x00 ; |
| 1558 | | void *S = 0x00, *D = 0x00; |
| 2063 | /* Push */ |
| 2064 | SP++; |
| 2065 | SSH = PC; |
| 2066 | SSL = SR; |
| 1559 | 2067 | |
| 1560 | | DecodeJJJFTable(BITS(OP,0x0007),BITS(OP,0x0008), &S, &st, &D, &dt) ; |
| 2068 | /* Change */ |
| 2069 | core.ppc = PC; |
| 2070 | PC = PC + (INT16)op2; |
| 2071 | change_pc(PC); |
| 1561 | 2072 | |
| 1562 | | *pa = *((UINT64*)D) ; // backup the previous value |
| 2073 | /* S L E U N Z V C */ |
| 2074 | /* - - - - - - - - */ |
| 2075 | cycles += 4; /* TODO: + jx oscillator clock cycles */ |
| 2076 | return 0; |
| 2077 | } |
| 1563 | 2078 | |
| 1564 | | SetDestinationValue(S, st, D, dt) ; |
| 2079 | /* BSR : 0000 0001 0010 10RR : A-56 */ |
| 2080 | static size_t dsp56k_op_bsr_1(const UINT16 op, UINT8* cycles) |
| 2081 | { |
| 2082 | /* S L E U N Z V C */ |
| 2083 | /* - - - - - - - - */ |
| 2084 | return 0; |
| 2085 | } |
| 1565 | 2086 | |
| 1566 | | *wd = D ; |
| 1567 | | return retSize ; |
| 2087 | /* CHKAAU : 0000 0000 0000 0100 : A-58 */ |
| 2088 | static size_t dsp56k_op_chkaau(const UINT16 op, UINT8* cycles) |
| 2089 | { |
| 2090 | /* S L E U N Z V C */ |
| 2091 | /* - - - - ? ? ? - */ |
| 2092 | /* V - Set if the result of the last address ALU update performed a modulo wrap. Cleared if |
| 2093 | result of the last address ALU did not perform a modulo wrap.*/ |
| 2094 | /* Z - Set if the result of the last address ALU update is 0. Cleared if the result of the last |
| 2095 | address ALU is positive. */ |
| 2096 | /* N - Set if the result of the last address ALU update is negative. Cleared if the result of the |
| 2097 | last address ALU is positive. */ |
| 2098 | return 0; |
| 1568 | 2099 | } |
| 1569 | 2100 | |
| 1570 | | static int AndOperation(void **wd, UINT64 *pa) |
| 2101 | /* DEBUG : 0000 0000 0000 0001 : A-68 */ |
| 2102 | static size_t dsp56k_op_debug(const UINT16 op, UINT8* cycles) |
| 1571 | 2103 | { |
| 1572 | | int retSize = 1 ; |
| 2104 | /* S L E U N Z V C */ |
| 2105 | /* - - - - - - - - */ |
| 2106 | return 0; |
| 2107 | } |
| 1573 | 2108 | |
| 1574 | | UINT16 result ; |
| 2109 | /* DEBUGcc : 0000 0000 0101 cccc : A-70 */ |
| 2110 | static size_t dsp56k_op_debugcc(const UINT16 op, UINT8* cycles) |
| 2111 | { |
| 2112 | /* S L E U N Z V C */ |
| 2113 | /* - - - - - - - - */ |
| 2114 | return 0; |
| 2115 | } |
| 1575 | 2116 | |
| 1576 | | unsigned char st = 0x00, dt = 0x00 ; |
| 1577 | | void *S = 0x00, *D = 0x00; |
| 2117 | /* DIV : 0001 0101 0--0 F1DD : A-76 */ |
| 2118 | /* WARNING : DOCS SAY THERE IS A PARALLEL MOVE HERE !!! */ |
| 2119 | static size_t dsp56k_op_div(const UINT16 op, UINT8* cycles) |
| 2120 | { |
| 2121 | /* S L E U N Z V C */ |
| 2122 | /* - * - - - - ? ? */ |
| 2123 | /* V - Set if an arithmetic overflow occurs in the 40 bit result. Also set if the most significantst |
| 2124 | bit of the destination operand is changed as a result of the left shift. Cleared otherwise. */ |
| 2125 | /* C - Set if bit 39 of the result is cleared. Cleared otherwise. */ |
| 2126 | return 0; |
| 2127 | } |
| 1578 | 2128 | |
| 1579 | | DecodeJJFTable(BITS(OP,0x0003),BITS(OP,0x0008), &S, &st, &D, &dt) ; |
| 2129 | /* DMAC : 0001 0101 10s1 FsQQ : A-80 */ |
| 2130 | static size_t dsp56k_op_dmac(const UINT16 op, UINT8* cycles) |
| 2131 | { |
| 2132 | /* S L E U N Z V C */ |
| 2133 | /* - * * * * * * - */ |
| 2134 | return 0; |
| 2135 | } |
| 1580 | 2136 | |
| 1581 | | *pa = *((UINT64*)D) ; // backup the previous value |
| 1582 | | |
| 1583 | | // This operation does an AND of a word of S with A1/B1... |
| 1584 | | result = *((UINT16*)S) & (*((PAIR64*)D)).w.h ; |
| 1585 | | (*((PAIR64*)D)).w.h = result ; |
| 1586 | | |
| 1587 | | *wd = D ; |
| 1588 | | return retSize ; |
| 2137 | /* DO : 0000 0000 110- --RR xxxx xxxx xxxx xxxx : A-82 */ |
| 2138 | static size_t dsp56k_op_do(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 2139 | { |
| 2140 | /* S L E U N Z V C */ |
| 2141 | /* - * - - - - - - */ |
| 2142 | return 0; |
| 1589 | 2143 | } |
| 1590 | 2144 | |
| 1591 | | static int OrOperation(void **wd, UINT64 *pa) |
| 2145 | /* DO : 0000 1110 iiii iiii xxxx xxxx xxxx xxxx : A-82 */ |
| 2146 | static size_t dsp56k_op_do_1(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 1592 | 2147 | { |
| 1593 | | int retSize = 1 ; |
| 2148 | UINT8 iValue = BITS(op,0x00ff); |
| 1594 | 2149 | |
| 1595 | | UINT16 result ; |
| 2150 | /* Don't execute if the loop counter == 0 */ |
| 2151 | if (iValue != 0x00) |
| 2152 | { |
| 2153 | /* First instruction cycle */ |
| 2154 | SP++; /* TODO: Should i really inc here first? */ |
| 2155 | SSH = LA; |
| 2156 | SSL = LC; |
| 2157 | LC = (UINT16)iValue; |
| 1596 | 2158 | |
| 1597 | | unsigned char st = 0x00, dt = 0x00 ; |
| 1598 | | void *S = 0x00, *D = 0x00; |
| 1599 | 2159 | |
| 1600 | | DecodeJJFTable(BITS(OP,0x0003),BITS(OP,0x0008), &S, &st, &D, &dt) ; |
| 2160 | /* Second instruction cycle */ |
| 2161 | SP++; /* TODO: See above */ |
| 2162 | SSH = PC + 2; /* Keep these stack entries in 'word-based-index' space */ |
| 2163 | SSL = SR; |
| 2164 | LA = PC + 2 + op2; /* TODO: The docs subtract 1 from here? */ |
| 1601 | 2165 | |
| 1602 | | *pa = *((UINT64*)D) ; // backup the previous value |
| 1603 | 2166 | |
| 1604 | | // This operation does an OR of a word of S with A1/B1... |
| 1605 | | result = *((UINT16*)S) | (*((PAIR64*)D)).w.h ; |
| 1606 | | (*((PAIR64*)D)).w.h = result ; |
| 2167 | /* Third instruction cycle */ |
| 2168 | LF_bit_set(1); |
| 1607 | 2169 | |
| 1608 | | *wd = D ; |
| 1609 | | return retSize ; |
| 2170 | |
| 2171 | /* S L E U N Z V C */ |
| 2172 | /* - * - - - - - - */ |
| 2173 | /* TODO : L */ |
| 2174 | |
| 2175 | cycles += 6; /* TODO: + mv oscillator cycles */ |
| 2176 | } |
| 2177 | else |
| 2178 | { |
| 2179 | cycles += 10; /* TODO: + mv oscillator cycles */ |
| 2180 | } |
| 2181 | |
| 2182 | return 2; |
| 1610 | 2183 | } |
| 1611 | 2184 | |
| 1612 | | |
| 1613 | | static int TccOperation(void) |
| 2185 | /* DO : 0000 0100 000D DDDD xxxx xxxx xxxx xxxx : A-82 */ |
| 2186 | static size_t dsp56k_op_do_2(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 1614 | 2187 | { |
| 1615 | | int retSize = 1 ; |
| 2188 | UINT16 lValue = 0x0000; |
| 2189 | typed_pointer S = {NULL, DT_BYTE}; |
| 2190 | decode_DDDDD_table(BITS(op,0x001f), &S); |
| 1616 | 2191 | |
| 1617 | | int transfer = DecodeccccTable(BITS(OP,0x03c0)) ; |
| 2192 | /* TODO: Does not work for sources A&B - Fix per the docs */ |
| 2193 | lValue = *((UINT16*)S.addr); |
| 1618 | 2194 | |
| 1619 | | // !!! WARNING === TESTING !!! |
| 1620 | | // transfer = 1 ; |
| 2195 | /* TODO: Fix for special cased SP S */ |
| 2196 | if (S.addr == &SP) |
| 2197 | logerror("DSP56k: do with SP as the source not properly implemented yet.\n"); |
| 1621 | 2198 | |
| 1622 | | if (transfer) |
| 2199 | /* TODO: Fix for special cased SSSL S */ |
| 2200 | if (S.addr == &SSL) |
| 2201 | logerror("DSP56k: do with SP as the source not properly implemented yet.\n"); |
| 2202 | |
| 2203 | /* Don't execute if the loop counter == 0 */ |
| 2204 | if (lValue != 0x00) |
| 1623 | 2205 | { |
| 1624 | | unsigned char st = 0x00, dt = 0x00 ; |
| 1625 | | void *S = 0x00, *D = 0x00; |
| 2206 | /* First instruction cycle */ |
| 2207 | SP++; /* TODO: Should i really inc here first? */ |
| 2208 | SSH = LA; |
| 2209 | SSL = LC; |
| 2210 | LC = (UINT16)lValue; |
| 1626 | 2211 | |
| 1627 | | unsigned char drt = 0x00 ; |
| 1628 | | void *destinationReg = 0x00 ; |
| 1629 | 2212 | |
| 1630 | | Decodeh0hFTable(BITS(OP,0x0007),BITS(OP,0x0008), &S, &st, &D, &dt) ; |
| 2213 | /* Second instruction cycle */ |
| 2214 | SP++; /* TODO: See above */ |
| 2215 | SSH = PC + 2; /* Keep these stack entries in 'word-based-index' space */ |
| 2216 | SSL = SR; |
| 2217 | LA = PC + 2 + op2; /* TODO: The docs subtract 1 from here? */ |
| 1631 | 2218 | |
| 1632 | | SetDestinationValue(S, st, D, dt) ; |
| 1633 | 2219 | |
| 1634 | | // !!! What's up with that A,A* thing in the docs? Does that mean "do not transfer R0 to Rn ??? |
| 1635 | | destinationReg = DecodeRRTable(BITS(OP,0x0030), &drt) ; // Actually a TT table, but it's the same |
| 2220 | /* Third instruction cycle */ |
| 2221 | LF_bit_set(1); |
| 1636 | 2222 | |
| 1637 | | SetDestinationValue(&R0, DT_WORD, destinationReg, drt) ; |
| 2223 | |
| 2224 | /* S L E U N Z V C */ |
| 2225 | /* - * - - - - - - */ |
| 2226 | /* TODO : L */ |
| 2227 | |
| 2228 | cycles += 6; /* TODO: + mv oscillator cycles */ |
| 1638 | 2229 | } |
| 2230 | else |
| 2231 | { |
| 2232 | cycles += 10; /* TODO: + mv oscillator cycles */ |
| 2233 | } |
| 1639 | 2234 | |
| 1640 | | // Otherwise it's a NOP |
| 2235 | return 2; |
| 2236 | } |
| 1641 | 2237 | |
| 1642 | | return retSize ; |
| 2238 | /* DO FOREVER : 0000 0000 0000 0010 xxxx xxxx xxxx xxxx : A-88 */ |
| 2239 | static size_t dsp56k_op_doforever(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 2240 | { |
| 2241 | /* S L E U N Z V C */ |
| 2242 | /* - - - - - - - - */ |
| 2243 | return 0; |
| 1643 | 2244 | } |
| 1644 | 2245 | |
| 1645 | | static int ClrOperation(void **wd, UINT64 *pa) |
| 2246 | /* ENDDO : 0000 0000 0000 1001 : A-92 */ |
| 2247 | static size_t dsp56k_op_enddo(const UINT16 op, UINT8* cycles) |
| 1646 | 2248 | { |
| 1647 | | int retSize = 1 ; |
| 2249 | /* S L E U N Z V C */ |
| 2250 | /* - - - - - - - - */ |
| 2251 | return 0; |
| 2252 | } |
| 1648 | 2253 | |
| 1649 | | UINT64 clearValue = 0 ; |
| 2254 | /* EXT : 0001 0101 0101 F010 : A-96 */ |
| 2255 | static size_t dsp56k_op_ext(const UINT16 op, UINT8* cycles) |
| 2256 | { |
| 2257 | /* S L E U N Z V C */ |
| 2258 | /* - * * * * * * - */ |
| 2259 | return 0; |
| 2260 | } |
| 1650 | 2261 | |
| 1651 | | unsigned char drt = 0x00 ; |
| 1652 | | void *destinationReg = 0x00 ; |
| 2262 | /* ILLEGAL : 0000 0000 0000 1111 : A-98 */ |
| 2263 | static size_t dsp56k_op_illegal(const UINT16 op, UINT8* cycles) |
| 2264 | { |
| 2265 | /* S L E U N Z V C */ |
| 2266 | /* - - - - - - - - */ |
| 2267 | return 0; |
| 2268 | } |
| 1653 | 2269 | |
| 1654 | | destinationReg = DecodeFTable(BITS(OP,0x0008), &drt) ; |
| 2270 | /* IMAC : 0001 0101 1010 FQQQ : A-100 */ |
| 2271 | static size_t dsp56k_op_imac(const UINT16 op, UINT8* cycles) |
| 2272 | { |
| 2273 | /* S L E U N Z V C */ |
| 2274 | /* - * ? ? * ? ? - */ |
| 2275 | /* Z - Set if the 24 most significant bits of the destination result are all zeroes. */ |
| 2276 | /* U,E - Will not be set correctly by this instruction*/ |
| 2277 | /* V - Set to zero regardless of the overflow */ |
| 2278 | return 0; |
| 2279 | } |
| 1655 | 2280 | |
| 1656 | | *pa = *((UINT64*)destinationReg) ; // backup the previous value |
| 2281 | /* IMPY : 0001 0101 1000 FQQQ : A-102 */ |
| 2282 | static size_t dsp56k_op_impy(const UINT16 op, UINT8* cycles) |
| 2283 | { |
| 2284 | /* S L E U N Z V C */ |
| 2285 | /* - * ? ? * ? ? - */ |
| 2286 | /* Z - Set if the 24 most significant bits of the destination result are all zeroes. */ |
| 2287 | /* U,E - Will not be set correctly by this instruction*/ |
| 2288 | /* V - Set to zero regardless of the overflow */ |
| 2289 | return 0; |
| 2290 | } |
| 1657 | 2291 | |
| 1658 | | SetDestinationValue(&clearValue, DT_LONG_WORD, destinationReg, drt) ; |
| 2292 | /* Jcc : 0000 0110 --11 cccc xxxx xxxx xxxx xxxx : A-108 */ |
| 2293 | static size_t dsp56k_op_jcc(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 2294 | { |
| 2295 | /* S L E U N Z V C */ |
| 2296 | /* - - - - - - - - */ |
| 2297 | return 0; |
| 2298 | } |
| 1659 | 2299 | |
| 1660 | | *wd = destinationReg ; |
| 1661 | | return retSize ; |
| 2300 | /* Jcc : 0000 0110 RR10 cccc : A-108 */ |
| 2301 | static size_t dsp56k_op_jcc_1(const UINT16 op, UINT8* cycles) |
| 2302 | { |
| 2303 | /* S L E U N Z V C */ |
| 2304 | /* - - - - - - - - */ |
| 2305 | return 0; |
| 1662 | 2306 | } |
| 1663 | 2307 | |
| 1664 | | static int TstOperation(void **wd, UINT64 *pa) |
| 2308 | /* JMP : 0000 0001 0011 01-- xxxx xxxx xxxx xxxx : A-110 */ |
| 2309 | static size_t dsp56k_op_jmp(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 1665 | 2310 | { |
| 1666 | | int retSize = 1 ; |
| 2311 | core.ppc = PC; |
| 2312 | PC = op2; |
| 2313 | change_pc(PC); |
| 1667 | 2314 | |
| 1668 | | unsigned char drt = 0x00 ; |
| 1669 | | void *destinationReg = 0x00 ; |
| 1670 | | destinationReg = DecodeFTable(BITS(OP,0x0008), &drt) ; |
| 2315 | /* S L E U N Z V C */ |
| 2316 | /* - - - - - - - - */ |
| 1671 | 2317 | |
| 1672 | | // S - "computed according to the standard definition (section A.4)" |
| 1673 | | // L - can't be done until after data move |
| 1674 | | // E - set if signed integer portion is in use |
| 1675 | | // U - set according to the standard definition of the U bit |
| 1676 | | // N - set if bit 39 is set |
| 1677 | | if (*((UINT64*)destinationReg) & (UINT64)U64(0x8000000000)) N_bit_set(1); |
| 1678 | | else N_bit_set(0); |
| 2318 | cycles += 4; /* TODO: + jx */ |
| 2319 | return 0; |
| 2320 | } |
| 1679 | 2321 | |
| 1680 | | // Z - set if == 0 |
| 1681 | | if (*((UINT64*)destinationReg) == 0) Z_bit_set(1); |
| 1682 | | else Z_bit_set(0); |
| 2322 | /* JMP : 0000 0001 0010 01RR : A-110 */ |
| 2323 | static size_t dsp56k_op_jmp_1(const UINT16 op, UINT8* cycles) |
| 2324 | { |
| 2325 | typed_pointer R = { NULL, DT_BYTE }; |
| 2326 | decode_RR_table(BITS(op,0x0003), &R); |
| 1683 | 2327 | |
| 1684 | | // V&C - always cleared |
| 1685 | | V_bit_set(0); |
| 1686 | | C_bit_set(0); |
| 2328 | core.ppc = PC; |
| 2329 | PC = *((UINT16*)R.addr); |
| 2330 | change_pc(PC); |
| 1687 | 2331 | |
| 1688 | | *pa = *((UINT64*)destinationReg) ; // backup the previous value (no change here) |
| 1689 | | *wd = destinationReg; |
| 2332 | /* S L E U N Z V C */ |
| 2333 | /* - - - - - - - - */ |
| 1690 | 2334 | |
| 1691 | | return retSize ; |
| 2335 | cycles += 4; /* TODO: + jx */ |
| 2336 | return 0; |
| 1692 | 2337 | } |
| 1693 | 2338 | |
| 1694 | | static int AndiOperation(void) |
| 2339 | /* JScc : 0000 0110 --01 cccc xxxx xxxx xxxx xxxx : A-112 */ |
| 2340 | static size_t dsp56k_op_jscc(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 1695 | 2341 | { |
| 1696 | | int retSize = 1 ; |
| 2342 | /* S L E U N Z V C */ |
| 2343 | /* - - - - - - - - */ |
| 2344 | return 0; |
| 2345 | } |
| 1697 | 2346 | |
| 1698 | | UINT16 andMe = BITS(OP,0x00ff) ; |
| 2347 | /* JScc : 0000 0110 RR00 cccc : A-112 */ |
| 2348 | static size_t dsp56k_op_jscc_1(const UINT16 op, UINT8* cycles) |
| 2349 | { |
| 2350 | /* S L E U N Z V C */ |
| 2351 | /* - - - - - - - - */ |
| 2352 | return 0; |
| 2353 | } |
| 1699 | 2354 | |
| 1700 | | // Because I don't have a good way to access MR and CCR right now, i'm going to |
| 1701 | | // hard-code decoding EE here and in the OriOperation as well... |
| 1702 | | switch(BITS(OP,0x0600)) |
| 1703 | | { |
| 1704 | | // MR |
| 1705 | | case 0x01: |
| 1706 | | SR &= ((andMe << 8) | 0x00ff) ; |
| 1707 | | break ; |
| 2355 | /* JSR : 0000 0001 0011 00-- xxxx xxxx xxxx xxxx : A-114 */ |
| 2356 | static size_t dsp56k_op_jsr(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 2357 | { |
| 2358 | /* TODO: It says "signed" absolute offset. Weird. */ |
| 2359 | UINT16 branchOffset = op2; |
| 1708 | 2360 | |
| 1709 | | // CCR |
| 1710 | | case 0x03: |
| 1711 | | SR &= ((andMe) | 0xff00) ; |
| 1712 | | break ; |
| 2361 | /* TODO: Verify, since it's not in the docs, but it must be true */ |
| 2362 | PC += 2; |
| 1713 | 2363 | |
| 1714 | | // OMR |
| 1715 | | case 0x02: |
| 1716 | | OMR &= (UINT8)(andMe) ; |
| 1717 | | break ; |
| 2364 | SP++; |
| 2365 | SSH = PC; |
| 2366 | SSL = SR; |
| 1718 | 2367 | |
| 1719 | | default: |
| 1720 | | fatalerror("DSP56k - BAD EE value in andi operation") ; |
| 1721 | | } |
| 2368 | core.ppc = PC; |
| 2369 | PC = branchOffset; |
| 2370 | change_pc(PC); |
| 1722 | 2371 | |
| 2372 | /* S L E U N Z V C */ |
| 2373 | /* - - - - - - - - */ |
| 2374 | cycles += 4; /* TODO: + jx oscillator cycles */ |
| 2375 | return 0; |
| 2376 | } |
| 1723 | 2377 | |
| 1724 | | return retSize ; |
| 2378 | /* JSR : 0000 1010 AAAA AAAA : A-114 */ |
| 2379 | static size_t dsp56k_op_jsr_1(const UINT16 op, UINT8* cycles) |
| 2380 | { |
| 2381 | /* S L E U N Z V C */ |
| 2382 | /* - - - - - - - - */ |
| 2383 | return 0; |
| 1725 | 2384 | } |
| 1726 | 2385 | |
| 1727 | | #ifdef UNUSED_FUNCTION |
| 1728 | | // !!! NOT IMPLEMENTED YET - JUST PUT HERE TO BE NEXT TO ANDI SOMEDAY !!! |
| 1729 | | static int OriOperation(void) |
| 2386 | /* JSR : 0000 0001 0010 00RR : A-114 */ |
| 2387 | static size_t dsp56k_op_jsr_2(const UINT16 op, UINT8* cycles) |
| 1730 | 2388 | { |
| 1731 | | int retSize = 1 ; |
| 2389 | /* S L E U N Z V C */ |
| 2390 | /* - - - - - - - - */ |
| 2391 | return 0; |
| 2392 | } |
| 1732 | 2393 | |
| 1733 | | return retSize ; |
| 2394 | /* LEA : 0000 0001 11TT MMRR : A-116 */ |
| 2395 | static size_t dsp56k_op_lea(const UINT16 op, UINT8* cycles) |
| 2396 | { |
| 2397 | /* S L E U N Z V C */ |
| 2398 | /* - - - - - - - - */ |
| 2399 | return 0; |
| 1734 | 2400 | } |
| 1735 | | #endif |
| 1736 | 2401 | |
| 1737 | | static int CmpOperation(void **wd, UINT64 *pa) |
| 2402 | /* LEA : 0000 0001 10NN MMRR : A-116 */ |
| 2403 | static size_t dsp56k_op_lea_1(const UINT16 op, UINT8* cycles) |
| 1738 | 2404 | { |
| 1739 | | int retSize = 1 ; |
| 2405 | /* S L E U N Z V C */ |
| 2406 | /* - - - - - - - - */ |
| 2407 | return 0; |
| 2408 | } |
| 1740 | 2409 | |
| 1741 | | UINT64 cmpVal ; |
| 1742 | | UINT64 result ; |
| 2410 | /* MAC(su,uu) : 0001 0101 1110 FsQQ : A-126 */ |
| 2411 | static size_t dsp56k_op_macsuuu(const UINT16 op, UINT8* cycles) |
| 2412 | { |
| 2413 | UINT8 s = 0; |
| 2414 | INT64 result = 0; |
| 1743 | 2415 | |
| 1744 | | unsigned char st = 0x00, dt = 0x00 ; |
| 1745 | | void *S = 0x00, *D = 0x00; |
| 2416 | void* D = NULL; |
| 2417 | void* S1 = NULL; |
| 2418 | void* S2 = NULL; |
| 1746 | 2419 | |
| 1747 | | DecodeJJJFTable(BITS(OP,0x0007),BITS(OP,0x0008), &S, &st, &D, &dt) ; |
| 2420 | decode_QQF_special_table(BITS(op,0x0003), BITS(op,0x0008), &S1, &S2, &D); |
| 1748 | 2421 | |
| 1749 | | *pa = *((UINT64*)D) ; // backup the previous value - not necessary for cmp :) |
| 2422 | s = BITS(op,0x0004); |
| 1750 | 2423 | |
| 1751 | | switch(st) |
| 2424 | /* Fixed-point 2's complement multiplication requires a shift */ |
| 2425 | if (s) |
| 1752 | 2426 | { |
| 1753 | | default: |
| 1754 | | case DT_WORD: cmpVal = (UINT64)*((UINT16*)S) ; break ; |
| 1755 | | case DT_DOUBLE_WORD: cmpVal = (UINT64)*((UINT32*)S) ; break ; |
| 1756 | | case DT_LONG_WORD: cmpVal = (UINT64)*((UINT64*)S) ; break ; |
| 2427 | /* Unsigned * Unsigned */ |
| 2428 | UINT32 s1 = (UINT32)(*((UINT16*)S1)); |
| 2429 | UINT32 s2 = (UINT32)(*((UINT16*)S2)); |
| 2430 | result = ( s1 * s2 ) << 1; |
| 1757 | 2431 | } |
| 2432 | else |
| 2433 | { |
| 2434 | /* Signed * Unsigned */ |
| 2435 | UINT32 s1 = (UINT32)((INT32)(*((UINT16*)S1))); |
| 2436 | UINT32 s2 = (UINT32)(*((UINT16*)S2)); |
| 2437 | result = ( s1 * s2 ) << 1; |
| 2438 | } |
| 1758 | 2439 | |
| 1759 | | result = *((UINT64*)D) - cmpVal ; |
| 2440 | (*((UINT64*)D)) += result; |
| 1760 | 2441 | |
| 1761 | | if (result == 0) |
| 1762 | | Z_bit_set(1) ; |
| 1763 | | else |
| 1764 | | Z_bit_set(0) ; |
| 2442 | /* S L E U N Z V C */ |
| 2443 | /* - * * * * * * - */ |
| 2444 | /* TODO: L, E, U, V */ |
| 2445 | if ( *((UINT64*)D) & U64(0x0000008000000000)) N_bit_set(1); |
| 2446 | if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(1); |
| 1765 | 2447 | |
| 1766 | | *wd = D ; |
| 1767 | | return retSize ; |
| 2448 | cycles += 2; |
| 2449 | return 1; |
| 1768 | 2450 | } |
| 1769 | 2451 | |
| 1770 | | static int BsccOperation(void) |
| 2452 | /* MOVE : 0000 0101 BBBB BBBB ---- HHHW 0001 0001 : A-128 */ |
| 2453 | static size_t dsp56k_op_move_2(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 1771 | 2454 | { |
| 1772 | | int retSize = 0 ; |
| 2455 | /* S L E U N Z V C */ |
| 2456 | /* * * - - - - - - */ |
| 2457 | return 0; |
| 2458 | } |
| 1773 | 2459 | |
| 1774 | | // Decode the condition |
| 1775 | | int transfer = DecodeccccTable(BITS(OP,0x000f)) ; |
| 2460 | /* MOVE(C) : 0011 1WDD DDD0 MMRR : A-144 */ |
| 2461 | static size_t dsp56k_op_movec(const UINT16 op, UINT8* cycles) |
| 2462 | { |
| 2463 | UINT8 W; |
| 2464 | typed_pointer R = { NULL, DT_BYTE }; |
| 2465 | typed_pointer SD = { NULL, DT_BYTE }; |
| 1776 | 2466 | |
| 1777 | | // TESTING !!! |
| 1778 | | // transfer = 0 ; |
| 2467 | W = BITS(op,0x0400); |
| 2468 | decode_DDDDD_table(BITS(op,0x03e0), &SD); |
| 2469 | decode_RR_table(BITS(op,0x0003), &R); |
| 1779 | 2470 | |
| 1780 | | // 1 or 2 word operation... |
| 1781 | | if (transfer) |
| 2471 | if (W) |
| 1782 | 2472 | { |
| 1783 | | if (BITS(OP,0x0010)) |
| 1784 | | { |
| 1785 | | // 2 word immediate offset... |
| 1786 | | INT16 branchOffset = (INT16)ROPCODE((PC<<1)+2) ; |
| 2473 | /* Write D */ |
| 2474 | UINT16 value = data_read_word_16le(WORD(*((UINT16*)R.addr))) ; |
| 2475 | typed_pointer temp_src = { &value, DT_WORD }; |
| 2476 | SetDestinationValue(temp_src, SD); |
| 2477 | } |
| 2478 | else |
| 2479 | { |
| 2480 | /* Read S */ |
| 2481 | UINT16 dataMemOffset = *((UINT16*)R.addr); |
| 2482 | SetDataMemoryValue(SD, WORD(dataMemOffset)); |
| 2483 | } |
| 1787 | 2484 | |
| 1788 | | // "The PC Contains the address of the next instruction" |
| 1789 | | PC += 2 ; |
| 1790 | | core.ppc = PC ; |
| 2485 | execute_MM_table(BITS(op,0x0003), BITS(op,0x000c)); |
| 1791 | 2486 | |
| 1792 | | SP++ ; |
| 1793 | | SSH = PC ; |
| 1794 | | SSL = SR ; |
| 2487 | /* S L E U N Z V C */ |
| 2488 | /* * ? ? ? ? ? ? ? */ |
| 2489 | /* All ? bits - If SR is specified as a destination operand, set according to the corresponding |
| 2490 | bit of the source operand. If SR is not specified as a destination operand, L is set if data |
| 2491 | limiting occurred. All ? bits are not affected otherwise.*/ |
| 2492 | if (W && (SD.addr != &SR)) |
| 2493 | { |
| 2494 | /* If you're writing to something other than the SR */ |
| 2495 | /* TODO */ |
| 2496 | } |
| 1795 | 2497 | |
| 1796 | | PC += branchOffset ; |
| 2498 | cycles += 2; /* TODO: + mvc */ |
| 2499 | return 1; |
| 2500 | } |
| 1797 | 2501 | |
| 1798 | | change_pc(PC) ; |
| 1799 | | } |
| 1800 | | else |
| 1801 | | { |
| 1802 | | // 1 word Rx offset... |
| 1803 | | } |
| 2502 | /* MOVE(C) : 0011 1WDD DDD1 q0RR : A-144 */ |
| 2503 | static size_t dsp56k_op_movec_1(const UINT16 op, UINT8* cycles) |
| 2504 | { |
| 2505 | UINT8 W; |
| 2506 | UINT16 memOffset; |
| 2507 | typed_pointer SD = {NULL, DT_BYTE}; |
| 1804 | 2508 | |
| 1805 | | retSize = 0 ; |
| 2509 | W = BITS(op,0x0400); |
| 2510 | decode_DDDDD_table(BITS(op,0x03e0), &SD); |
| 2511 | memOffset = execute_q_table(BITS(op,0x0003), BITS(op,0x0008)); |
| 2512 | |
| 2513 | if (W) |
| 2514 | { |
| 2515 | /* Write D */ |
| 2516 | UINT16 tempData = data_read_word_16le(WORD(memOffset)); |
| 2517 | typed_pointer temp_src = { (void*)&tempData, DT_WORD }; |
| 2518 | SetDestinationValue(temp_src, SD); |
| 1806 | 2519 | } |
| 1807 | 2520 | else |
| 1808 | 2521 | { |
| 1809 | | if (BITS(OP,0x0010)) |
| 1810 | | retSize = 2 ; |
| 1811 | | else |
| 1812 | | retSize = 1 ; |
| 2522 | /* Read S */ |
| 2523 | UINT16 tempData = *((UINT16*)SD.addr); |
| 2524 | typed_pointer temp_src = { (void*)&tempData, DT_WORD }; |
| 2525 | SetDataMemoryValue(temp_src, WORD(memOffset)); |
| 1813 | 2526 | } |
| 1814 | 2527 | |
| 1815 | | return retSize ; |
| 2528 | /* S L E U N Z V C */ |
| 2529 | /* * ? ? ? ? ? ? ? */ |
| 2530 | /* All ? bits - If SR is specified as a destination operand, set according to the corresponding |
| 2531 | bit of the source operand. If SR is not specified as a destination operand, L is set if data |
| 2532 | limiting occurred. All ? bits are not affected otherwise.*/ |
| 2533 | if (W && (SD.addr != &SR)) |
| 2534 | { |
| 2535 | /* If you're writing to something other than the SR */ |
| 2536 | /* TODO */ |
| 2537 | } |
| 2538 | |
| 2539 | cycles += 2; /* + mvc oscillator clock cycles */ |
| 2540 | return 1; |
| 1816 | 2541 | } |
| 1817 | 2542 | |
| 1818 | | static int BccOperation(void) |
| 2543 | /* MOVE(C) : 0011 1WDD DDD1 Z11- : A-144 */ |
| 2544 | static size_t dsp56k_op_movec_2(const UINT16 op, UINT8* cycles) |
| 1819 | 2545 | { |
| 1820 | | int retSize = 0 ; |
| 2546 | UINT8 W; |
| 2547 | UINT16 memOffset; |
| 2548 | typed_pointer SD = {NULL, DT_BYTE}; |
| 2549 | typed_pointer XMemOffset = {NULL, DT_BYTE}; |
| 1821 | 2550 | |
| 1822 | | if (!BITS(OP,0x2000)) |
| 2551 | W = BITS(op,0x0400); |
| 2552 | decode_Z_table(BITS(op,0x0008), &XMemOffset); |
| 2553 | decode_DDDDD_table(BITS(op,0x03e0), &SD); |
| 2554 | |
| 2555 | memOffset = *((UINT16*)XMemOffset.addr); |
| 2556 | |
| 2557 | if (W) |
| 1823 | 2558 | { |
| 1824 | | int branch = DecodeccccTable(BITS(OP,0x000f)) ; |
| 2559 | /* Write D */ |
| 2560 | UINT16 tempData = data_read_word_16le(WORD(memOffset)); |
| 2561 | typed_pointer temp_src = { (void*)&tempData, DT_WORD }; |
| 2562 | SetDestinationValue(temp_src, SD); |
| 2563 | } |
| 2564 | else |
| 2565 | { |
| 2566 | /* Read S */ |
| 2567 | UINT16 tempData = *((UINT16*)SD.addr); |
| 2568 | typed_pointer temp_src = { (void*)&tempData, DT_WORD }; |
| 2569 | SetDataMemoryValue(temp_src, WORD(memOffset)); |
| 2570 | } |
| 1825 | 2571 | |
| 1826 | | if (branch) |
| 1827 | | { |
| 1828 | | if (BITS(OP,0x0010)) |
| 1829 | | { |
| 1830 | | // B.cc xxxx |
| 1831 | | INT16 op2 = ROPCODE((PC<<1)+2) ; |
| 1832 | 2572 | |
| 1833 | | // The PC contains the address of the next instruction |
| 1834 | | PC += 2 ; |
| 1835 | | core.ppc = PC ; |
| 1836 | | PC += op2 ; |
| 2573 | /* S L E U N Z V C */ |
| 2574 | /* * ? ? ? ? ? ? ? */ |
| 2575 | /* All ? bits - If SR is specified as a destination operand, set according to the corresponding |
| 2576 | bit of the source operand. If SR is not specified as a destination operand, L is set if data |
| 2577 | limiting occurred. All ? bits are not affected otherwise.*/ |
| 2578 | if (W && (SD.addr != &SR)) |
| 2579 | { |
| 2580 | /* If you're writing to something other than the SR */ |
| 2581 | /* TODO */ |
| 2582 | } |
| 1837 | 2583 | |
| 1838 | | change_pc(PC) ; |
| 1839 | | } |
| 1840 | | else |
| 1841 | | { |
| 1842 | | // B.cc Rn |
| 1843 | | } |
| 2584 | cycles += 2; /* + mvc oscillator clock cycles */ |
| 2585 | return 1; |
| 2586 | } |
| 2587 | |
| 2588 | /* MOVE(C) : 0011 1WDD DDD1 t10- xxxx xxxx xxxx xxxx : A-144 */ |
| 2589 | static size_t dsp56k_op_movec_3(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 2590 | { |
| 2591 | UINT8 W; |
| 2592 | UINT8 t; |
| 2593 | typed_pointer SD = { NULL, DT_BYTE }; |
| 2594 | |
| 2595 | W = BITS(op,0x0400); |
| 2596 | t = BITS(op,0x0008); |
| 2597 | decode_DDDDD_table(BITS(op,0x03e0), &SD); |
| 2598 | |
| 2599 | if (W) |
| 2600 | { |
| 2601 | /* Write D */ |
| 2602 | if (t) |
| 2603 | { |
| 2604 | /* 16-bit long data */ |
| 2605 | typed_pointer temp_src = { (void*)&op2, DT_WORD }; |
| 2606 | SetDestinationValue(temp_src, SD); |
| 1844 | 2607 | } |
| 1845 | 2608 | else |
| 1846 | 2609 | { |
| 1847 | | if (BITS(OP,0x0010)) |
| 1848 | | retSize = 2 ; |
| 1849 | | else |
| 1850 | | retSize = 1 ; |
| 2610 | /* 16-bit long address */ |
| 2611 | UINT16 tempD = data_read_word_16le(WORD(op2)); |
| 2612 | typed_pointer tempTP = {&tempD, DT_WORD}; |
| 2613 | SetDestinationValue(tempTP, SD); |
| 1851 | 2614 | } |
| 1852 | 2615 | } |
| 1853 | 2616 | else |
| 1854 | 2617 | { |
| 1855 | | // B.cc aa |
| 1856 | | int branch = DecodeccccTable(BITS(OP,0x03c0)) ; |
| 1857 | | |
| 1858 | | if (branch) |
| 2618 | /* Read S */ |
| 2619 | if (t) |
| 1859 | 2620 | { |
| 1860 | | INT16 offset = (INT16)AssembleAddressFrom6BitSignedRelativeShortAddress(BITS(OP,0x003f)) ; |
| 1861 | | |
| 1862 | | PC += 1 ; |
| 1863 | | core.ppc = PC ; |
| 1864 | | PC += offset ; |
| 1865 | | |
| 1866 | | change_pc(PC) ; |
| 2621 | /* 16-bit long data */ |
| 2622 | logerror("DSP56k: Movec - I don't think this exists?"); |
| 1867 | 2623 | } |
| 1868 | 2624 | else |
| 1869 | 2625 | { |
| 1870 | | retSize = 1 ; |
| 2626 | /* 16-bit long address */ |
| 2627 | SetDataMemoryValue(SD, WORD(op2)); |
| 1871 | 2628 | } |
| 1872 | 2629 | } |
| 1873 | 2630 | |
| 1874 | | return retSize ; |
| 2631 | /* S L E U N Z V C */ |
| 2632 | /* * ? ? ? ? ? ? ? */ |
| 2633 | /* All ? bits - If SR is specified as a destination operand, set according to the corresponding |
| 2634 | bit of the source operand. If SR is not specified as a destination operand, L is set if data |
| 2635 | limiting occurred. All ? bits are not affected otherwise.*/ |
| 2636 | if (W && (SD.addr != &SR)) |
| 2637 | { |
| 2638 | /* If you're writing to something other than the SR */ |
| 2639 | /* TODO */ |
| 2640 | } |
| 2641 | |
| 2642 | cycles += 2; /* TODO: + mvc */ |
| 2643 | return 2; |
| 1875 | 2644 | } |
| 1876 | 2645 | |
| 1877 | | static int Tst2Operation(void) |
| 2646 | /* MOVE(C) : 0010 10dd dddD DDDD : A-144 */ |
| 2647 | static size_t dsp56k_op_movec_4(const UINT16 op, UINT8* cycles) |
| 1878 | 2648 | { |
| 1879 | | int retSize = 1 ; |
| 2649 | typed_pointer S = {NULL, DT_BYTE}; |
| 2650 | typed_pointer D = {NULL, DT_BYTE}; |
| 1880 | 2651 | |
| 1881 | | unsigned char dt = 0x00 ; |
| 1882 | | void *destinationReg = 0x00 ; |
| 2652 | decode_DDDDD_table(BITS(op,0x03e0), &S); |
| 2653 | decode_DDDDD_table(BITS(op,0x001f), &D); |
| 1883 | 2654 | |
| 1884 | | destinationReg = DecodeDDTable(BITS(OP,0x0003), &dt) ; |
| 2655 | SetDestinationValue(S, D); |
| 1885 | 2656 | |
| 1886 | | // unnormalized |
| 2657 | /* S L E U N Z V C */ |
| 2658 | /* * ? ? ? ? ? ? ? */ |
| 2659 | /* All ? bits - If SR is specified as a destination operand, set according to the corresponding |
| 2660 | bit of the source operand. If SR is not specified as a destination operand, L is set if data |
| 2661 | limiting occurred. All ? bits are not affected otherwise.*/ |
| 2662 | if (D.addr != &SR) |
| 2663 | { |
| 2664 | /* If you're writing to something other than the SR */ |
| 2665 | /* TODO */ |
| 2666 | } |
| 1887 | 2667 | |
| 1888 | | // negative |
| 1889 | | // bit 31 of A or B ??? |
| 2668 | cycles += 2; |
| 2669 | return 1; |
| 2670 | } |
| 1890 | 2671 | |
| 1891 | | // zero |
| 1892 | | if ( (*((UINT16*)destinationReg)) == 0) |
| 1893 | | Z_bit_set(1); |
| 2672 | /* MOVE(C) : 0000 0101 BBBB BBBB 0011 1WDD DDD0 ---- : A-144 */ |
| 2673 | static size_t dsp56k_op_movec_5(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 2674 | { |
| 2675 | /* S L E U N Z V C */ |
| 2676 | /* * ? ? ? ? ? ? ? */ |
| 2677 | /* All ? bits - If SR is specified as a destination operand, set according to the corresponding |
| 2678 | bit of the source operand. If SR is not specified as a destination operand, L is set if data |
| 2679 | limiting occurred. All ? bits are not affected otherwise.*/ |
| 2680 | return 0; |
| 2681 | } |
| 2682 | |
| 2683 | /* MOVE(I) : 0010 00DD BBBB BBBB : A-150 */ |
| 2684 | static size_t dsp56k_op_movei(const UINT16 op, UINT8* cycles) |
| 2685 | { |
| 2686 | typed_pointer D = {NULL, DT_BYTE}; |
| 2687 | typed_pointer immTP = {NULL, DT_BYTE}; |
| 2688 | |
| 2689 | /* Typecasting to INT16 sign-extends the BBBBBBBB operand */ |
| 2690 | UINT16 immediateSignExtended = (INT16)(op & 0x00ff); |
| 2691 | immTP.addr = &immediateSignExtended; |
| 2692 | immTP.data_type = DT_WORD; |
| 2693 | |
| 2694 | decode_DD_table(BITS(op,0x0300), &D); |
| 2695 | |
| 2696 | SetDestinationValue(immTP, D); |
| 2697 | |
| 2698 | /* S L E U N Z V C */ |
| 2699 | /* - - - - - - - - */ |
| 2700 | cycles += 2; |
| 2701 | return 1; |
| 2702 | } |
| 2703 | |
| 2704 | /* MOVE(M) : 0000 001W RR0M MHHH : A-152 */ |
| 2705 | static size_t dsp56k_op_movem(const UINT16 op, UINT8* cycles) |
| 2706 | { |
| 2707 | UINT8 W; |
| 2708 | typed_pointer R = { NULL, DT_BYTE }; |
| 2709 | typed_pointer SD = { NULL, DT_BYTE }; |
| 2710 | |
| 2711 | W = BITS(op,0x0100); |
| 2712 | decode_RR_table(BITS(op,0x00c0), &R); |
| 2713 | decode_HHH_table(BITS(op,0x0007), &SD); |
| 2714 | |
| 2715 | if (W) |
| 2716 | { |
| 2717 | /* Read from Program Memory */ |
| 2718 | typed_pointer data; |
| 2719 | UINT16 ldata = program_read_word_16le(WORD(*((UINT16*)R.addr))); |
| 2720 | |
| 2721 | data.addr = &ldata; |
| 2722 | data.data_type = DT_WORD; |
| 2723 | SetDestinationValue(data, SD) ; |
| 2724 | } |
| 1894 | 2725 | else |
| 1895 | | Z_bit_set(0); |
| 2726 | { |
| 2727 | /* Write to Program Memory */ |
| 2728 | SetProgramMemoryValue(SD, WORD(*((UINT16*)R.addr))) ; |
| 2729 | } |
| 1896 | 2730 | |
| 1897 | | // always clear C flag |
| 1898 | | C_bit_set(0) ; |
| 2731 | execute_MM_table(BITS(op,0x00c0), BITS(op,0x0018)); |
| 1899 | 2732 | |
| 1900 | | return retSize ; |
| 2733 | /* S L E U N Z V C */ |
| 2734 | /* * * - - - - - - */ |
| 2735 | /* TODO: S, L */ |
| 2736 | cycles += 2; /* TODO: + mvm oscillator clock cycles */ |
| 2737 | return 1; |
| 1901 | 2738 | } |
| 1902 | 2739 | |
| 1903 | | static int MACsuuuOperation(void) |
| 2740 | /* MOVE(M) : 0000 001W RR11 mmRR : A-152 */ |
| 2741 | static size_t dsp56k_op_movem_1(const UINT16 op, UINT8* cycles) |
| 1904 | 2742 | { |
| 1905 | | int retSize = 1 ; |
| 2743 | /* S L E U N Z V C */ |
| 2744 | /* * * - - - - - - */ |
| 2745 | return 0; |
| 2746 | } |
| 1906 | 2747 | |
| 1907 | | INT64 result = 0 ; |
| 2748 | /* MOVE(M) : 0000 0101 BBBB BBBB 0000 001W --0- -HHH : A-152 */ |
| 2749 | static size_t dsp56k_op_movem_2(const UINT16 op, const UINT16 op2, UINT8* cycles) |
| 2750 | { |
| 2751 | /* S L E U N Z V C */ |
| 2752 | /* * * - - - - - - */ |
| 2753 | return 0; |
| 2754 | } |
| 1908 | 2755 | |
| 1909 | | int s ; |
| 1910 | | void *S1 = 0x00, *S2 = 0x00, *D = 0x00 ; |
| 2756 | /* MOVE(P) : 0001 100W HH1p pppp : A-156 */ |
| 2757 | static size_t dsp56k_op_movep(const UINT16 op, UINT8* cycles) |
| 2758 | { |
| 2759 | UINT16 W; |
| 2760 | UINT16 pp; |
| 2761 | typed_pointer SD = {NULL, DT_BYTE}; |
| 1911 | 2762 | |
| 1912 | | DecodeQQFTableSp(BITS(OP,0x0003), BITS(OP,0x0008), &S1, &S2, &D) ; |
| 2763 | decode_HH_table(BITS(op,0x00c0), &SD); |
| 2764 | /* TODO: Special cases for A & B */ |
| 1913 | 2765 | |
| 1914 | | s = BITS(OP,0x0004) ; |
| 2766 | pp = op & 0x001f; |
| 2767 | pp = assemble_address_from_IO_short_address(pp); |
| 1915 | 2768 | |
| 1916 | | // !!! There is no way this is right - wtf is EXT:MSP:LSP format ??? |
| 1917 | | if (!s) |
| 2769 | W = BITS(op,0x0100); |
| 2770 | |
| 2771 | if (W) |
| 1918 | 2772 | { |
| 1919 | | // su |
| 1920 | | result = ( (INT32)(*((UINT16*)S1)) * (UINT32)(*((UINT16*)S2)) ) << 1 ; |
| 2773 | UINT16 data = data_read_word_16le(WORD(pp)); |
| 2774 | |
| 2775 | typed_pointer tempTP; |
| 2776 | tempTP.addr = &data; |
| 2777 | tempTP.data_type = DT_WORD; |
| 2778 | |
| 2779 | SetDestinationValue(tempTP, SD); |
| 1921 | 2780 | } |
| 1922 | 2781 | else |
| 1923 | 2782 | { |
| 1924 | | // uu |
| 1925 | | result = ( (UINT32)(*((UINT16*)S1)) * (UINT32)(*((UINT16*)S2)) ) << 1 ; |
| 2783 | SetDataMemoryValue(SD, WORD(pp)); |
| 1926 | 2784 | } |
| 1927 | 2785 | |
| 1928 | | (*((UINT64*)D)) += result ; |
| 2786 | /* S L E U N Z V C */ |
| 2787 | /* * * - - - - - - */ |
| 2788 | /* TODO: S, L */ |
| 1929 | 2789 | |
| 1930 | | return retSize ; |
| 2790 | cycles += 4; /* TODO: + mvp oscillator cycles */ |
| 2791 | return 1; |
| 1931 | 2792 | } |
| 1932 | 2793 | |
| 1933 | | static int RepOperation(void) |
| 2794 | /* MOVE(P) : 0000 110W RRmp pppp : A-156 */ |
| 2795 | static size_t dsp56k_op_movep_1(const UINT16 op, UINT8* cycles) |
| 1934 | 2796 | { |
| 1935 | | int retSize = 1 ; |
| 2797 | // X:<Rx> and X:<pp> |
| 2798 | UINT16 W; |
| 2799 | UINT16 pp; |
| 1936 | 2800 | |
| 1937 | | UINT16 count = 0x0000 ; |
| 2801 | typed_pointer SD = {NULL, DT_BYTE}; |
| 2802 | decode_RR_table(BITS(op,0x00c0), &SD); |
| 1938 | 2803 | |
| 1939 | | if (BITS(OP,0x0f00) == 0xf) |
| 2804 | pp = op & 0x001f; |
| 2805 | pp = assemble_address_from_IO_short_address(pp); |
| 2806 | |
| 2807 | W = BITS(OP,0x0100); |
| 2808 | |
| 2809 | /* A little different than most W if's - opposite read and write */ |
| 2810 | if (W) |
| 1940 | 2811 | { |
| 1941 | | // immediate |
| 1942 | | count = BITS(OP,0x00ff) ; |
| 2812 | UINT16 data = data_read_word_16le(WORD(*((UINT16*)SD.addr))); |
| 2813 | |
| 2814 | typed_pointer tempTP; |
| 2815 | tempTP.addr = &data; |
| 2816 | tempTP.data_type = DT_WORD; |
| 2817 | |
| 2818 | SetDataMemoryValue(tempTP, WORD(pp)); |
| 1943 | 2819 | } |
| 1944 | | else if (BITS(OP,0x0f00) == 0x4) |
| 2820 | else |
| 1945 | 2821 | { |
| 1946 | | // SD |
| 1947 | | unsigned char st = 0x00 ; |
| 1948 | | void *S ; |
| 2822 | /* TODO */ |
| 2823 | fatalerror("dsp56k : move(p) NOTHING HERE (yet)\n") ; |
| 2824 | } |
| 1949 | 2825 | |
| 1950 | | S = DecodeDDDDDTable(BITS(OP,0x001f), &st) ; |
| 1951 | | SetDestinationValue(S, st, &count, DT_WORD); |
| 2826 | // Postincrement |
| 2827 | execute_m_table(BITS(OP,0x00c0), BITS(OP,0x0020)); |
| 2828 | |
| 2829 | /* S L E U N Z V C */ |
| 2830 | /* * * - - - - - - */ |
| 2831 | /* TODO: S, L */ |
| 2832 | cycles += 4; /* TODO: + mvp oscillator cycles */ |
| 2833 | return 1; |
| 2834 | } |
| 2835 | |
| 2836 | /* MOVE(S) : 0001 100W HH0a aaaa : A-158 */ |
| 2837 | static size_t dsp56k_op_moves(const UINT16 op, UINT8* cycles) |
| 2838 | { |
| 2839 | /* S L E U N Z V C */ |
| 2840 | /* * * - - - - - - */ |
| 2841 | return 0; |
| 2842 | } |
| 2843 | |
| 2844 | /* MPY(su,uu) : 0001 0101 1100 FsQQ : A-164 */ |
| 2845 | static size_t dsp56k_op_mpysuuu(const UINT16 op, UINT8* cycles) |
| 2846 | { |
| 2847 | /* S L E U N Z V C */ |
| 2848 | /* - * * * * * * - */ |
| 2849 | return 0; |
| 2850 | } |
| 2851 | |
| 2852 | /* NEGC : 0001 0101 0110 F000 : A-168 */ |
| 2853 | static size_t dsp56k_op_negc(const UINT16 op, UINT8* cycles) |
| 2854 | { |
| 2855 | /* S L E U N Z V C */ |
| 2856 | /* - * * * * * * * */ |
| 2857 | return 0; |
| 2858 | } |
| 2859 | |
| 2860 | /* NOP : 0000 0000 0000 0000 : A-170 */ |
| 2861 | static size_t dsp56k_op_nop(const UINT16 op, UINT8* cycles) |
| 2862 | { |
| 2863 | /* S L E U N Z V C */ |
| 2864 | /* - - - - - - - - */ |
| 2865 | return 1; |
| 2866 | } |
| 2867 | |
| 2868 | /* NORM : 0001 0101 0010 F0RR : A-172 */ |
| 2869 | static size_t dsp56k_op_norm(const UINT16 op, UINT8* cycles) |
| 2870 | { |
| 2871 | /* S L E U N Z V C */ |
| 2872 | /* - * * * * * ? - */ |
| 2873 | /* V - Set if an arithmetic overflow occurs in the 40 bit result. Also set if the most significantst |
| 2874 | bit of the destination operand is changed as a result of the left shift. Cleared otherwise. */ |
| 2875 | return 0; |
| 2876 | } |
| 2877 | |
| 2878 | /* ORI : 0001 1EE1 iiii iiii : A-178 */ |
| 2879 | static size_t dsp56k_op_ori(const UINT16 op, UINT8* cycles) |
| 2880 | { |
| 2881 | /* S L E U N Z V C */ |
| 2882 | /* - ? ? ? ? ? ? ? */ |
| 2883 | /* All ? bits - Set if the corresponding bit in the immediate data is set and if the operand is the |
| 2884 | CCR. Not affected otherwise. */ |
| 2885 | return 0; |
| 2886 | } |
| 2887 | |
| 2888 | /* REP : 0000 0000 111- --RR : A-180 */ |
| 2889 | static size_t dsp56k_op_rep(const UINT16 op, UINT8* cycles) |
| 2890 | { |
| 2891 | /* S L E U N Z V C */ |
| 2892 | /* - * - - - - - - */ |
| 2893 | return 0; |
| 2894 | } |
| 2895 | |
| 2896 | /* REP : 0000 1111 iiii iiii : A-180 */ |
| 2897 | static size_t dsp56k_op_rep_1(const UINT16 op, UINT8* cycles) |
| 2898 | { |
| 2899 | /* TODO: This is non-interruptable, probably have to turn off interrupts here */ |
| 2900 | UINT16 iVal = op & 0x00ff; |
| 2901 | |
| 2902 | if (iVal != 0) |
| 2903 | { |
| 2904 | TEMP = LC; |
| 2905 | LC = iVal; |
| 2906 | |
| 2907 | core.repFlag = 1; |
| 2908 | core.repAddr = PC + WORD(1); |
| 2909 | |
| 2910 | cycles += 4; /* TODO: + mv oscillator clock cycles */ |
| 1952 | 2911 | } |
| 1953 | 2912 | else |
| 1954 | 2913 | { |
| 1955 | | // X:(Rn) |
| 2914 | cycles += 6; /* TODO: + mv oscillator clock cycles */ |
| 1956 | 2915 | } |
| 1957 | 2916 | |
| 1958 | | TEMP = LC ; |
| 1959 | | LC = count ; |
| 1960 | 2917 | |
| 1961 | | core.repFlag = 1 ; |
| 1962 | | core.repAddr = PC + (retSize<<1) ; |
| 2918 | /* S L E U N Z V C */ |
| 2919 | /* - * - - - - - - */ |
| 2920 | /* TODO: L */ |
| 2921 | return 1; |
| 2922 | } |
| 1963 | 2923 | |
| 1964 | | return retSize ; |
| 2924 | /* REP : 0000 0100 001D DDDD : A-180 */ |
| 2925 | static size_t dsp56k_op_rep_2(const UINT16 op, UINT8* cycles) |
| 2926 | { |
| 2927 | /* TODO: This is non-interruptable, probably have to turn off interrupts here */ |
| 2928 | UINT16 repValue; |
| 2929 | typed_pointer D = {NULL, DT_BYTE}; |
| 2930 | decode_DDDDD_table(BITS(op,0x001f), &D); |
| 2931 | |
| 2932 | /* TODO: handle special A&B source cases */ |
| 2933 | if (D.addr == &A || D.addr == &B) |
| 2934 | logerror("DSP56k ERROR : Rep with A or B instruction not implemented yet!\n"); |
| 2935 | |
| 2936 | repValue = *((UINT16*)D.addr); |
| 2937 | |
| 2938 | if (repValue != 0) |
| 2939 | { |
| 2940 | TEMP = LC; |
| 2941 | LC = repValue; |
| 2942 | |
| 2943 | core.repFlag = 1; |
| 2944 | core.repAddr = PC + WORD(1); |
| 2945 | |
| 2946 | cycles += 4; /* TODO: + mv oscillator clock cycles */ |
| 2947 | } |
| 2948 | else |
| 2949 | { |
| 2950 | cycles += 6; /* TODO: + mv oscillator clock cycles */ |
| 2951 | } |
| 2952 | |
| 2953 | /* S L E U N Z V C */ |
| 2954 | /* - * - - - - - - */ |
| 2955 | /* TODO: L */ |
| 2956 | return 1; |
| 1965 | 2957 | } |
| 1966 | 2958 | |
| 1967 | | static void EndOfRepProcessing(void) |
| 2959 | /* REPcc : 0000 0001 0101 cccc : A-184 */ |
| 2960 | static size_t dsp56k_op_repcc(const UINT16 op, UINT8* cycles) |
| 1968 | 2961 | { |
| 1969 | | LC = TEMP ; |
| 2962 | /* S L E U N Z V C */ |
| 2963 | /* - - - - - - - - */ |
| 2964 | return 0; |
| 2965 | } |
| 1970 | 2966 | |
| 1971 | | core.repFlag = 0 ; |
| 1972 | | core.repAddr = 0x0000 ; |
| 2967 | /* RESET : 0000 0000 0000 1000 : A-186 */ |
| 2968 | static size_t dsp56k_op_reset(const UINT16 op, UINT8* cycles) |
| 2969 | { |
| 2970 | /* S L E U N Z V C */ |
| 2971 | /* - - - - - - - - */ |
| 2972 | return 0; |
| 1973 | 2973 | } |
| 1974 | 2974 | |
| 2975 | /* RTI : 0000 0000 0000 0111 : A-194 */ |
| 2976 | static size_t dsp56k_op_rti(const UINT16 op, UINT8* cycles) |
| 2977 | { |
| 2978 | core.ppc = PC; |
| 2979 | PC = SSH; |
| 2980 | change_pc(PC); |
| 1975 | 2981 | |
| 1976 | | /* |
| 1977 | | DECODERS |
| 1978 | | */ |
| 1979 | | static void *DecodeDDDDDTable(UINT16 DDDDD, unsigned char *dt) |
| 2982 | SR = SSL; |
| 2983 | SP = SP - 1; |
| 2984 | |
| 2985 | /* S L E U N Z V C */ |
| 2986 | /* ? ? ? ? ? ? ? ? */ |
| 2987 | /* All ? bits - Set according to value pulled from the stack. */ |
| 2988 | cycles += 4; /* TODO: + rx oscillator clock cycles */ |
| 2989 | return 0; |
| 2990 | } |
| 2991 | |
| 2992 | /* RTS : 0000 0000 0000 0110 : A-196 */ |
| 2993 | static size_t dsp56k_op_rts(const UINT16 op, UINT8* cycles) |
| 1980 | 2994 | { |
| 1981 | | void *retAddress = 0x00 ; |
| 2995 | /* Pop */ |
| 2996 | core.ppc = PC; |
| 2997 | PC = SSH; |
| 2998 | change_pc(PC); |
| 1982 | 2999 | |
| 1983 | | switch(DDDDD) |
| 3000 | /* SR = SSL; The status register is not affected. */ |
| 3001 | |
| 3002 | SP--; |
| 3003 | |
| 3004 | /* S L E U N Z V C */ |
| 3005 | /* - - - - - - - - */ |
| 3006 | cycles += 4; /* TODO: + rx oscillator clock cycles */ |
| 3007 | return 0; |
| 3008 | } |
| 3009 | |
| 3010 | /* STOP : 0000 0000 0000 1010 : A-200 */ |
| 3011 | static size_t dsp56k_op_stop(const UINT16 op, UINT8* cycles) |
| 3012 | { |
| 3013 | /* S L E U N Z V C */ |
| 3014 | /* - - - - - - - - */ |
| 3015 | return 0; |
| 3016 | } |
| 3017 | |
| 3018 | /* SWAP : 0001 0101 0111 F001 : A-206 */ |
| 3019 | static size_t dsp56k_op_swap(const UINT16 op, UINT8* cycles) |
| 3020 | { |
| 3021 | /* S L E U N Z V C */ |
| 3022 | /* - - - - - - - - */ |
| 3023 | return 0; |
| 3024 | } |
| 3025 | |
| 3026 | /* SWI : 0000 0000 0000 0101 : A-208 */ |
| 3027 | static size_t dsp56k_op_swi(const UINT16 op, UINT8* cycles) |
| 3028 | { |
| 3029 | /* S L E U N Z V C */ |
| 3030 | /* - - - - - - - - */ |
| 3031 | return 0; |
| 3032 | } |
| 3033 | |
| 3034 | /* Tcc : 0001 00cc ccTT Fh0h : A-210 */ |
| 3035 | static size_t dsp56k_op_tcc(const UINT16 op, UINT8* cycles) |
| 3036 | { |
| 3037 | int shouldTransfer = decode_cccc_table(BITS(op,0x03c0)); |
| 3038 | |
| 3039 | if (shouldTransfer) |
| 1984 | 3040 | { |
| 1985 | | case 0x00: retAddress = &X0 ; *dt = DT_WORD ; break ; |
| 1986 | | case 0x01: retAddress = &Y0 ; *dt = DT_WORD ; break ; |
| 1987 | | case 0x02: retAddress = &X1 ; *dt = DT_WORD ; break ; |
| 1988 | | case 0x03: retAddress = &Y1 ; *dt = DT_WORD ; break ; |
| 1989 | | case 0x04: retAddress = &A ; *dt = DT_LONG_WORD ; break ; |
| 1990 | | case 0x05: retAddress = &B ; *dt = DT_LONG_WORD ; break ; |
| 1991 | | case 0x06: retAddress = &A0 ; *dt = DT_WORD ; break ; |
| 1992 | | case 0x07: retAddress = &B0 ; *dt = DT_WORD ; break ; |
| 1993 | | case 0x08: retAddress = &LC ; *dt = DT_WORD ; break ; |
| 1994 | | case 0x09: retAddress = &SR ; *dt = DT_WORD ; break ; |
| 1995 | | case 0x0a: retAddress = &OMR ; *dt = DT_BYTE ; break ; |
| 1996 | | case 0x0b: retAddress = &SP ; *dt = DT_BYTE ; break ; |
| 1997 | | case 0x0c: retAddress = &A1 ; *dt = DT_WORD ; break ; |
| 1998 | | case 0x0d: retAddress = &B1 ; *dt = DT_WORD ; break ; |
| 1999 | | case 0x0e: retAddress = &A2 ; *dt = DT_BYTE ; break ; |
| 2000 | | case 0x0f: retAddress = &B2 ; *dt = DT_BYTE ; break ; |
| 3041 | typed_pointer S = {NULL, DT_BYTE}; |
| 3042 | typed_pointer D = {NULL, DT_BYTE}; |
| 3043 | typed_pointer S2 = {&R0, DT_WORD}; |
| 3044 | typed_pointer D2 = {NULL, DT_BYTE}; |
| 2001 | 3045 | |
| 2002 | | case 0x10: retAddress = &R0 ; *dt = DT_WORD ; break ; |
| 2003 | | case 0x11: retAddress = &R1 ; *dt = DT_WORD ; break ; |
| 2004 | | case 0x12: retAddress = &R2 ; *dt = DT_WORD ; break ; |
| 2005 | | case 0x13: retAddress = &R3 ; *dt = DT_WORD ; break ; |
| 2006 | | case 0x14: retAddress = &M0 ; *dt = DT_WORD ; break ; |
| 2007 | | case 0x15: retAddress = &M1 ; *dt = DT_WORD ; break ; |
| 2008 | | case 0x16: retAddress = &M2 ; *dt = DT_WORD ; break ; |
| 2009 | | case 0x17: retAddress = &M3 ; *dt = DT_WORD ; break ; |
| 2010 | | case 0x18: retAddress = &SSH ; *dt = DT_WORD ; break ; |
| 2011 | | case 0x19: retAddress = &SSL ; *dt = DT_WORD ; break ; |
| 2012 | | case 0x1a: retAddress = &LA ; *dt = DT_WORD ; break ; |
| 2013 | | //no 0x1b |
| 2014 | | case 0x1c: retAddress = &N0 ; *dt = DT_WORD ; break ; |
| 2015 | | case 0x1d: retAddress = &N1 ; *dt = DT_WORD ; break ; |
| 2016 | | case 0x1e: retAddress = &N2 ; *dt = DT_WORD ; break ; |
| 2017 | | case 0x1f: retAddress = &N3 ; *dt = DT_WORD ; break ; |
| 3046 | decode_h0hF_table(BITS(op,0x0007),BITS(op,0x0008), &S, &D); |
| 3047 | SetDestinationValue(S, D); |
| 3048 | |
| 3049 | /* TODO: What's up with that A,A* thing in the docs? Can you only ignore the R0->RX transfer if you do an A,A? */ |
| 3050 | decode_RR_table(BITS(op,0x0030), &D2); /* TT is the same as RR */ |
| 3051 | SetDestinationValue(S2, D2); |
| 2018 | 3052 | } |
| 2019 | 3053 | |
| 2020 | | return retAddress ; |
| 3054 | /* S L E U N Z V C */ |
| 3055 | /* - - - - - - - - */ |
| 3056 | cycles += 2; |
| 3057 | return 1; |
| 2021 | 3058 | } |
| 2022 | 3059 | |
| 2023 | | static void *DecodeRRTable(UINT16 RR, unsigned char *dt) |
| 3060 | /* TFR(2) : 0001 0101 0000 F00J : A-214 */ |
| 3061 | static size_t dsp56k_op_tfr2(const UINT16 op, UINT8* cycles) |
| 2024 | 3062 | { |
| 2025 | | void *retAddress = 0x00 ; |
| 3063 | /* S L E U N Z V C */ |
| 3064 | /* - * - - - - - - */ |
| 3065 | return 0; |
| 3066 | } |
| 2026 | 3067 | |
| 2027 | | switch(RR) |
| 3068 | /* TFR(3) : 0010 01mW RRDD FHHH : A-216 */ |
| 3069 | static size_t dsp56k_op_tfr3(const UINT16 op, UINT8* cycles) |
| 3070 | { |
| 3071 | /* S L E U N Z V C */ |
| 3072 | /* * * - - - - - - */ |
| 3073 | return 0; |
| 3074 | } |
| 3075 | |
| 3076 | /* TST(2) : 0001 0101 0001 -1DD : A-220 */ |
| 3077 | static size_t dsp56k_op_tst2(const UINT16 op, UINT8* cycles) |
| 3078 | { |
| 3079 | typed_pointer D = {NULL, DT_BYTE}; |
| 3080 | decode_DD_table(BITS(op,0x0003), &D); |
| 3081 | |
| 3082 | /* S L E U N Z V C */ |
| 3083 | /* - * * * * * 0 0 */ |
| 3084 | /* (L,E,U should be set to 0) */ |
| 3085 | L_bit_set(0); |
| 3086 | E_bit_set(0); |
| 3087 | // U_bit_set(0); /* TODO: Conflicting opinions? "Set if unnormalized." Documentation is weird (A&B?) */ |
| 3088 | if ((*((UINT16*)D.addr)) & 0x8000) N_bit_set(1); else N_bit_set(0); |
| 3089 | if ((*((UINT16*)D.addr)) == 0x0000) Z_bit_set(1); else Z_bit_set(0); |
| 3090 | // V_bit_set(0); /* TODO: Verify as well! */ |
| 3091 | C_bit_set(0); |
| 3092 | |
| 3093 | cycles += 2; |
| 3094 | return 1; |
| 3095 | } |
| 3096 | |
| 3097 | /* WAIT : 0000 0000 0000 1011 : A-222 */ |
| 3098 | static size_t dsp56k_op_wait(const UINT16 op, UINT8* cycles) |
| 3099 | { |
| 3100 | /* S L E U N Z V C */ |
| 3101 | /* - - - - - - - - */ |
| 3102 | return 0; |
| 3103 | } |
| 3104 | |
| 3105 | /* ZERO : 0001 0101 0101 F000 : A-224 */ |
| 3106 | static size_t dsp56k_op_zero(const UINT16 op, UINT8* cycles) |
| 3107 | { |
| 3108 | /* S L E U N Z V C */ |
| 3109 | /* - * * * * * * - */ |
| 3110 | return 0; |
| 3111 | } |
| 3112 | |
| 3113 | |
| 3114 | |
| 3115 | /*************************************************************************** |
| 3116 | Table decoding |
| 3117 | ***************************************************************************/ |
| 3118 | static UINT16 decode_BBB_bitmask(UINT16 BBB, UINT16 *iVal) |
| 3119 | { |
| 3120 | UINT16 retVal = 0x0000; |
| 3121 | |
| 3122 | switch(BBB) |
| 2028 | 3123 | { |
| 2029 | | case 0x00: retAddress = &R0 ; *dt = DT_WORD ; break ; |
| 2030 | | case 0x01: retAddress = &R1 ; *dt = DT_WORD ; break ; |
| 2031 | | case 0x02: retAddress = &R2 ; *dt = DT_WORD ; break ; |
| 2032 | | case 0x03: retAddress = &R3 ; *dt = DT_WORD ; break ; |
| 3124 | case 0x4: retVal = 0xff00; *iVal <<= 8; break; |
| 3125 | case 0x2: retVal = 0x0ff0; *iVal <<= 4; break; |
| 3126 | case 0x1: retVal = 0x00ff; *iVal <<= 0; break; |
| 2033 | 3127 | } |
| 2034 | 3128 | |
| 2035 | | return retAddress ; |
| 3129 | return retVal; |
| 2036 | 3130 | } |
| 2037 | 3131 | |
| 2038 | | static void *DecodeDDTable(UINT16 DD, unsigned char *dt) |
| 3132 | static int decode_cccc_table(UINT16 cccc) |
| 2039 | 3133 | { |
| 2040 | | void *retAddress = 0x00 ; |
| 3134 | int retVal = 0; |
| 2041 | 3135 | |
| 2042 | | switch(DD) |
| 3136 | /* Not fully tested */ |
| 3137 | switch (cccc) |
| 2043 | 3138 | { |
| 2044 | | case 0x00: retAddress = &X0 ; *dt = DT_WORD ; break ; |
| 2045 | | case 0x01: retAddress = &Y0 ; *dt = DT_WORD ; break ; |
| 2046 | | case 0x02: retAddress = &X1 ; *dt = DT_WORD ; break ; |
| 2047 | | case 0x03: retAddress = &Y1 ; *dt = DT_WORD ; break ; |
| 3139 | /* Arranged according to mnemonic table - not decoding table */ |
| 3140 | case 0x0: if( C_bit() == 0) retVal = 1; break; // cc(hs) |
| 3141 | case 0x8: if( C_bit() == 1) retVal = 1; break; // cs(lo) |
| 3142 | case 0x5: if( E_bit() == 0) retVal = 1; break; // ec |
| 3143 | case 0xa: if( Z_bit() == 1) retVal = 1; break; // eq |
| 3144 | case 0xd: if( E_bit() == 1) retVal = 1; break; // es |
| 3145 | case 0x1: if((N_bit() ^ V_bit()) == 0) retVal = 1; break; // ge |
| 3146 | case 0x7: if((Z_bit() | (N_bit() ^ V_bit())) == 0) retVal = 1; break; // gt |
| 3147 | case 0x6: if( L_bit() == 0) retVal = 1; break; // lc |
| 3148 | case 0xf: if((Z_bit() | (N_bit() ^ V_bit())) == 1) retVal = 1; break; // le |
| 3149 | case 0xe: if( L_bit() == 1) retVal = 1; break; // ls |
| 3150 | case 0x9: if((N_bit() ^ V_bit()) == 1) retVal = 1; break; // lt |
| 3151 | case 0xb: if( N_bit() == 1) retVal = 1; break; // mi |
| 3152 | case 0x2: if( Z_bit() == 0) retVal = 1; break; // ne |
| 3153 | case 0xc: if((Z_bit() | ((!U_bit()) & (!E_bit()))) == 1) retVal = 1; break; // nr |
| 3154 | case 0x3: if( N_bit() == 0) retVal = 1; break; // pl |
| 3155 | case 0x4: if((Z_bit() | ((!U_bit()) & (!E_bit()))) == 0) retVal = 1; break; // nn |
| 2048 | 3156 | } |
| 2049 | 3157 | |
| 2050 | | return retAddress ; |
| 3158 | return retVal; |
| 2051 | 3159 | } |
| 2052 | 3160 | |
| 2053 | | static void *DecodeHHHTable(UINT16 HHH, unsigned char *dt) |
| 3161 | static void decode_DDDDD_table(UINT16 DDDDD, typed_pointer* ret) |
| 2054 | 3162 | { |
| 2055 | | void *retAddress = 0x00 ; |
| 3163 | switch(DDDDD) |
| 3164 | { |
| 3165 | case 0x00: ret->addr = &X0; ret->data_type = DT_WORD; break; |
| 3166 | case 0x01: ret->addr = &Y0; ret->data_type = DT_WORD; break; |
| 3167 | case 0x02: ret->addr = &X1; ret->data_type = DT_WORD; break; |
| 3168 | case 0x03: ret->addr = &Y1; ret->data_type = DT_WORD; break; |
| 3169 | case 0x04: ret->addr = &A ; ret->data_type = DT_LONG_WORD; break; |
| 3170 | case 0x05: ret->addr = &B ; ret->data_type = DT_LONG_WORD; break; |
| 3171 | case 0x06: ret->addr = &A0; ret->data_type = DT_WORD; break; |
| 3172 | case 0x07: ret->addr = &B0; ret->data_type = DT_WORD; break; |
| 3173 | case 0x08: ret->addr = &LC; ret->data_type = DT_WORD; break; |
| 3174 | case 0x09: ret->addr = &SR; ret->data_type = DT_WORD; break; |
| 3175 | case 0x0a: ret->addr = &OMR; ret->data_type = DT_BYTE; break; |
| 3176 | case 0x0b: ret->addr = &SP; ret->data_type = DT_BYTE; break; |
| 3177 | case 0x0c: ret->addr = &A1; ret->data_type = DT_WORD; break; |
| 3178 | case 0x0d: ret->addr = &B1; ret->data_type = DT_WORD; break; |
| 3179 | case 0x0e: ret->addr = &A2; ret->data_type = DT_BYTE; break; |
| 3180 | case 0x0f: ret->addr = &B2; ret->data_type = DT_BYTE; break; |
| 2056 | 3181 | |
| 2057 | | switch(HHH) |
| 3182 | case 0x10: ret->addr = &R0; ret->data_type = DT_WORD; break; |
| 3183 | case 0x11: ret->addr = &R1; ret->data_type = DT_WORD; break; |
| 3184 | case 0x12: ret->addr = &R2; ret->data_type = DT_WORD; break; |
| 3185 | case 0x13: ret->addr = &R3; ret->data_type = DT_WORD; break; |
| 3186 | case 0x14: ret->addr = &M0; ret->data_type = DT_WORD; break; |
| 3187 | case 0x15: ret->addr = &M1; ret->data_type = DT_WORD; break; |
| 3188 | case 0x16: ret->addr = &M2; ret->data_type = DT_WORD; break; |
| 3189 | case 0x17: ret->addr = &M3; ret->data_type = DT_WORD; break; |
| 3190 | case 0x18: ret->addr = &SSH; ret->data_type = DT_WORD; break; |
| 3191 | case 0x19: ret->addr = &SSL; ret->data_type = DT_WORD; break; |
| 3192 | case 0x1a: ret->addr = &LA; ret->data_type = DT_WORD; break; |
| 3193 | //no 0x1b |
| 3194 | case 0x1c: ret->addr = &N0; ret->data_type = DT_WORD; break; |
| 3195 | case 0x1d: ret->addr = &N1; ret->data_type = DT_WORD; break; |
| 3196 | case 0x1e: ret->addr = &N2; ret->data_type = DT_WORD; break; |
| 3197 | case 0x1f: ret->addr = &N3; ret->data_type = DT_WORD; break; |
| 3198 | } |
| 3199 | } |
| 3200 | |
| 3201 | static void decode_DD_table(UINT16 DD, typed_pointer* ret) |
| 3202 | { |
| 3203 | switch(DD) |
| 2058 | 3204 | { |
| 2059 | | case 0x0: retAddress = &X0 ; *dt = DT_WORD ; break ; |
| 2060 | | case 0x1: retAddress = &Y0 ; *dt = DT_WORD ; break ; |
| 2061 | | case 0x2: retAddress = &X1 ; *dt = DT_WORD ; break ; |
| 2062 | | case 0x3: retAddress = &Y1 ; *dt = DT_WORD ; break ; |
| 2063 | | case 0x4: retAddress = &A ; *dt = DT_LONG_WORD ; break ; |
| 2064 | | case 0x5: retAddress = &B ; *dt = DT_LONG_WORD ; break ; |
| 2065 | | case 0x6: retAddress = &A0 ; *dt = DT_WORD ; break ; |
| 2066 | | case 0x7: retAddress = &B0 ; *dt = DT_WORD ; break ; |
| 3205 | case 0x00: ret->addr = &X0; ret->data_type = DT_WORD; break; |
| 3206 | case 0x01: ret->addr = &Y0; ret->data_type = DT_WORD; break; |
| 3207 | case 0x02: ret->addr = &X1; ret->data_type = DT_WORD; break; |
| 3208 | case 0x03: ret->addr = &Y1; ret->data_type = DT_WORD; break; |
| 2067 | 3209 | } |
| 3210 | } |
| 2068 | 3211 | |
| 2069 | | return retAddress ; |
| 3212 | static void decode_F_table(UINT16 F, typed_pointer* ret) |
| 3213 | { |
| 3214 | switch(F) |
| 3215 | { |
| 3216 | case 0x0: ret->addr = &A; ret->data_type = DT_LONG_WORD; break; |
| 3217 | case 0x1: ret->addr = &B; ret->data_type = DT_LONG_WORD; break; |
| 3218 | } |
| 2070 | 3219 | } |
| 2071 | 3220 | |
| 2072 | | static void *DecodeHHTable(UINT16 HH, unsigned char *dt) |
| 3221 | static void decode_h0hF_table(UINT16 h0h, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret) |
| 2073 | 3222 | { |
| 2074 | | void *retAddress = 0x00 ; |
| 3223 | UINT16 switchVal = (h0h << 1) | F ; |
| 2075 | 3224 | |
| 3225 | switch (switchVal) |
| 3226 | { |
| 3227 | case 0x8: src_ret->addr = &X0; src_ret->data_type = DT_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3228 | case 0x9: src_ret->addr = &X0; src_ret->data_type = DT_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3229 | case 0xa: src_ret->addr = &Y0; src_ret->data_type = DT_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3230 | case 0xb: src_ret->addr = &Y0; src_ret->data_type = DT_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3231 | case 0x2: src_ret->addr = &A; src_ret->data_type = DT_LONG_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3232 | case 0x1: src_ret->addr = &A; src_ret->data_type = DT_LONG_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3233 | case 0x0: src_ret->addr = &B; src_ret->data_type = DT_LONG_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3234 | case 0x3: src_ret->addr = &B; src_ret->data_type = DT_LONG_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3235 | } |
| 3236 | } |
| 3237 | |
| 3238 | static void decode_HH_table(UINT16 HH, typed_pointer* ret) |
| 3239 | { |
| 2076 | 3240 | switch(HH) |
| 2077 | 3241 | { |
| 2078 | | case 0x0: retAddress = &X0 ; *dt = DT_WORD ; break ; |
| 2079 | | case 0x1: retAddress = &Y0 ; *dt = DT_WORD ; break ; |
| 2080 | | case 0x2: retAddress = &A ; *dt = DT_LONG_WORD ; break ; |
| 2081 | | case 0x3: retAddress = &B ; *dt = DT_LONG_WORD ; break ; |
| 3242 | case 0x0: ret->addr = &X0; ret->data_type = DT_WORD; break; |
| 3243 | case 0x1: ret->addr = &Y0; ret->data_type = DT_WORD; break; |
| 3244 | case 0x2: ret->addr = &A; ret->data_type = DT_LONG_WORD; break; |
| 3245 | case 0x3: ret->addr = &B; ret->data_type = DT_LONG_WORD; break; |
| 2082 | 3246 | } |
| 3247 | } |
| 2083 | 3248 | |
| 2084 | | return retAddress ; |
| 3249 | static void decode_HHH_table(UINT16 HHH, typed_pointer* ret) |
| 3250 | { |
| 3251 | switch(HHH) |
| 3252 | { |
| 3253 | case 0x0: ret->addr = &X0; ret->data_type = DT_WORD; break; |
| 3254 | case 0x1: ret->addr = &Y0; ret->data_type = DT_WORD; break; |
| 3255 | case 0x2: ret->addr = &X1; ret->data_type = DT_WORD; break; |
| 3256 | case 0x3: ret->addr = &Y1; ret->data_type = DT_WORD; break; |
| 3257 | case 0x4: ret->addr = &A; ret->data_type = DT_LONG_WORD; break; |
| 3258 | case 0x5: ret->addr = &B; ret->data_type = DT_LONG_WORD; break; |
| 3259 | case 0x6: ret->addr = &A0; ret->data_type = DT_WORD; break; |
| 3260 | case 0x7: ret->addr = &B0; ret->data_type = DT_WORD; break; |
| 3261 | } |
| 2085 | 3262 | } |
| 2086 | 3263 | |
| 2087 | | static void *DecodeZTable(UINT16 Z, unsigned char *dt) |
| 3264 | static void decode_IIII_table(UINT16 IIII, typed_pointer* src_ret, typed_pointer* dst_ret, void *working) |
| 2088 | 3265 | { |
| 2089 | | void *retAddress = 0x00 ; |
| 3266 | void *opposite = 0x00 ; |
| 2090 | 3267 | |
| 2091 | | switch(Z) |
| 3268 | if (working == &A) opposite = &B ; |
| 3269 | else opposite = &A ; |
| 3270 | |
| 3271 | switch(IIII) |
| 2092 | 3272 | { |
| 2093 | | // Fixed as per the Family Manual addendum |
| 2094 | | case 0x01: retAddress = &A1 ; *dt = DT_WORD ; break ; |
| 2095 | | case 0x00: retAddress = &B1 ; *dt = DT_WORD ; break ; |
| 3273 | case 0x0: src_ret->addr = &X0; src_ret->data_type = DT_WORD; dst_ret->addr = opposite; dst_ret->data_type = DT_LONG_WORD; break; |
| 3274 | case 0x1: src_ret->addr = &Y0; src_ret->data_type = DT_WORD; dst_ret->addr = opposite; dst_ret->data_type = DT_LONG_WORD; break; |
| 3275 | case 0x2: src_ret->addr = &X1; src_ret->data_type = DT_WORD; dst_ret->addr = opposite; dst_ret->data_type = DT_LONG_WORD; break; |
| 3276 | case 0x3: src_ret->addr = &Y1; src_ret->data_type = DT_WORD; dst_ret->addr = opposite; dst_ret->data_type = DT_LONG_WORD; break; |
| 3277 | case 0x4: src_ret->addr = &A; src_ret->data_type = DT_LONG_WORD; dst_ret->addr = &X0; dst_ret->data_type = DT_WORD; break; |
| 3278 | case 0x5: src_ret->addr = &B; src_ret->data_type = DT_LONG_WORD; dst_ret->addr = &Y0; dst_ret->data_type = DT_WORD; break; |
| 3279 | case 0x6: src_ret->addr = &A0; src_ret->data_type = DT_WORD; dst_ret->addr = &X0; dst_ret->data_type = DT_WORD; break; |
| 3280 | case 0x7: src_ret->addr = &B0; src_ret->data_type = DT_WORD; dst_ret->addr = &Y0; dst_ret->data_type = DT_WORD; break; |
| 3281 | case 0x8: src_ret->addr = working; src_ret->data_type = DT_LONG_WORD; dst_ret->addr = opposite; dst_ret->data_type = DT_LONG_WORD; break; |
| 3282 | case 0x9: src_ret->addr = working; src_ret->data_type = DT_LONG_WORD; dst_ret->addr = opposite; dst_ret->data_type = DT_LONG_WORD; break; |
| 3283 | case 0xc: src_ret->addr = &A; src_ret->data_type = DT_LONG_WORD; dst_ret->addr = &X1; dst_ret->data_type = DT_WORD; break; |
| 3284 | case 0xd: src_ret->addr = &B; src_ret->data_type = DT_LONG_WORD; dst_ret->addr = &Y1; dst_ret->data_type = DT_WORD; break; |
| 3285 | case 0xe: src_ret->addr = &A0; src_ret->data_type = DT_WORD; dst_ret->addr = &X1; dst_ret->data_type = DT_WORD; break; |
| 3286 | case 0xf: src_ret->addr = &B0; src_ret->data_type = DT_WORD; dst_ret->addr = &Y1; dst_ret->data_type = DT_WORD; break; |
| 2096 | 3287 | } |
| 3288 | } |
| 2097 | 3289 | |
| 2098 | | return retAddress ; |
| 3290 | static void decode_JJJF_table(UINT16 JJJ, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret) |
| 3291 | { |
| 3292 | UINT16 switchVal = (JJJ << 1) | F ; |
| 3293 | |
| 3294 | switch(switchVal) |
| 3295 | { |
| 3296 | case 0x0: src_ret->addr = &B; src_ret->data_type = DT_LONG_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3297 | case 0x1: src_ret->addr = &A; src_ret->data_type = DT_LONG_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3298 | case 0x4: src_ret->addr = &X; src_ret->data_type = DT_DOUBLE_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3299 | case 0x5: src_ret->addr = &X; src_ret->data_type = DT_DOUBLE_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3300 | case 0x6: src_ret->addr = &Y; src_ret->data_type = DT_DOUBLE_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3301 | case 0x7: src_ret->addr = &Y; src_ret->data_type = DT_DOUBLE_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3302 | case 0x8: src_ret->addr = &X0; src_ret->data_type = DT_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3303 | case 0x9: src_ret->addr = &X0; src_ret->data_type = DT_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3304 | case 0xa: src_ret->addr = &Y0; src_ret->data_type = DT_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3305 | case 0xb: src_ret->addr = &Y0; src_ret->data_type = DT_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3306 | case 0xc: src_ret->addr = &X1; src_ret->data_type = DT_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3307 | case 0xd: src_ret->addr = &X1; src_ret->data_type = DT_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3308 | case 0xe: src_ret->addr = &Y1; src_ret->data_type = DT_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3309 | case 0xf: src_ret->addr = &Y1; src_ret->data_type = DT_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3310 | } |
| 2099 | 3311 | } |
| 2100 | 3312 | |
| 3313 | static void decode_JJF_table(UINT16 JJ, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret) |
| 3314 | { |
| 3315 | UINT16 switchVal = (JJ << 1) | F ; |
| 2101 | 3316 | |
| 2102 | | static UINT16 DecodeBBBBitMask(UINT16 BBB, UINT16 *iVal) |
| 3317 | switch (switchVal) |
| 3318 | { |
| 3319 | case 0x0: src_ret->addr = &X0; src_ret->data_type = DT_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3320 | case 0x1: src_ret->addr = &X0; src_ret->data_type = DT_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3321 | case 0x2: src_ret->addr = &Y0; src_ret->data_type = DT_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3322 | case 0x3: src_ret->addr = &Y0; src_ret->data_type = DT_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3323 | case 0x4: src_ret->addr = &X1; src_ret->data_type = DT_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3324 | case 0x5: src_ret->addr = &X1; src_ret->data_type = DT_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3325 | case 0x6: src_ret->addr = &Y1; src_ret->data_type = DT_WORD; dst_ret->addr = &A; dst_ret->data_type = DT_LONG_WORD; break; |
| 3326 | case 0x7: src_ret->addr = &Y1; src_ret->data_type = DT_WORD; dst_ret->addr = &B; dst_ret->data_type = DT_LONG_WORD; break; |
| 3327 | } |
| 3328 | } |
| 3329 | |
| 3330 | static void decode_QQF_special_table(UINT16 QQ, UINT16 F, void **S1, void **S2, void **D) |
| 2103 | 3331 | { |
| 2104 | | UINT16 retVal = 0x00 ; |
| 3332 | UINT16 switchVal = (QQ << 1) | F ; |
| 2105 | 3333 | |
| 2106 | | switch(BBB) |
| 3334 | switch(switchVal) |
| 2107 | 3335 | { |
| 2108 | | case 0x4: retVal = 0xff00 ; *iVal <<= 8 ; break ; |
| 2109 | | case 0x2: retVal = 0x0ff0 ; *iVal <<= 4 ; break ; |
| 2110 | | case 0x1: retVal = 0x00ff ; *iVal <<= 0 ; break ; |
| 3336 | case 0x0: *S1 = &Y0; *S2 = &X0; *D = &A; break; |
| 3337 | case 0x1: *S1 = &Y0; *S2 = &X0; *D = &B; break; |
| 3338 | case 0x2: *S1 = &Y1; *S2 = &X0; *D = &A; break; |
| 3339 | case 0x3: *S1 = &Y1; *S2 = &X0; *D = &B; break; |
| 3340 | case 0x4: *S1 = &X1; *S2 = &Y0; *D = &A; break; |
| 3341 | case 0x5: *S1 = &X1; *S2 = &Y0; *D = &B; break; |
| 3342 | case 0x6: *S1 = &X1; *S2 = &Y1; *D = &A; break; |
| 3343 | case 0x7: *S1 = &X1; *S2 = &Y1; *D = &B; break; |
| 2111 | 3344 | } |
| 3345 | } |
| 2112 | 3346 | |
| 2113 | | return retVal ; |
| 3347 | static void decode_RR_table(UINT16 RR, typed_pointer* ret) |
| 3348 | { |
| 3349 | switch(RR) |
| 3350 | { |
| 3351 | case 0x00: ret->addr = &R0; ret->data_type = DT_WORD; break; |
| 3352 | case 0x01: ret->addr = &R1; ret->data_type = DT_WORD; break; |
| 3353 | case 0x02: ret->addr = &R2; ret->data_type = DT_WORD; break; |
| 3354 | case 0x03: ret->addr = &R3; ret->data_type = DT_WORD; break; |
| 3355 | } |
| 2114 | 3356 | } |
| 2115 | 3357 | |
| 2116 | | static void ExecuteMMTable(int x, UINT16 MM) |
| 3358 | static void decode_Z_table(UINT16 Z, typed_pointer* ret) |
| 2117 | 3359 | { |
| 3360 | switch(Z) |
| 3361 | { |
| 3362 | /* Fixed as per the Family Manual addendum */ |
| 3363 | case 0x01: ret->addr = &A1; ret->data_type = DT_WORD; break; |
| 3364 | case 0x00: ret->addr = &B1; ret->data_type = DT_WORD; break; |
| 3365 | } |
| 3366 | } |
| 3367 | |
| 3368 | static void execute_m_table(int x, UINT16 m) |
| 3369 | { |
| 2118 | 3370 | UINT16 *rX = 0x00 ; |
| 2119 | 3371 | UINT16 *nX = 0x00 ; |
| 2120 | 3372 | |
| 2121 | 3373 | switch(x) |
| 2122 | 3374 | { |
| 2123 | | case 0x0: rX = &R0 ; nX = &N0 ; break ; |
| 2124 | | case 0x1: rX = &R1 ; nX = &N1 ; break ; |
| 2125 | | case 0x2: rX = &R2 ; nX = &N2 ; break ; |
| 2126 | | case 0x3: rX = &R3 ; nX = &N3 ; break ; |
| 3375 | case 0x0: rX = &R0; nX = &N0; break; |
| 3376 | case 0x1: rX = &R1; nX = &N1; break; |
| 3377 | case 0x2: rX = &R2; nX = &N2; break; |
| 3378 | case 0x3: rX = &R3; nX = &N3; break; |
| 2127 | 3379 | } |
| 2128 | 3380 | |
| 2129 | | switch(MM) |
| 3381 | switch(m) |
| 2130 | 3382 | { |
| 2131 | | case 0x0: /* do nothing */ break ; |
| 2132 | | case 0x1: (*rX)++ ; break ; |
| 2133 | | case 0x2: (*rX)-- ; break ; |
| 2134 | | case 0x3: (*rX) = (*rX)+(*nX) ; break ; |
| 3383 | case 0x0: (*rX)++; break; |
| 3384 | case 0x1: (*rX) = (*rX)+(*nX); break; |
| 2135 | 3385 | } |
| 2136 | 3386 | } |
| 2137 | 3387 | |
| 2138 | | static void ExecutemTable(int x, UINT16 m) |
| 3388 | static void execute_MM_table(UINT16 rnum, UINT16 MM) |
| 2139 | 3389 | { |
| 2140 | 3390 | UINT16 *rX = 0x00 ; |
| 2141 | 3391 | UINT16 *nX = 0x00 ; |
| 2142 | 3392 | |
| 2143 | | switch(x) |
| 3393 | switch(rnum) |
| 2144 | 3394 | { |
| 2145 | | case 0x0: rX = &R0 ; nX = &N0 ; break ; |
| 2146 | | case 0x1: rX = &R1 ; nX = &N1 ; break ; |
| 2147 | | case 0x2: rX = &R2 ; nX = &N2 ; break ; |
| 2148 | | case 0x3: rX = &R3 ; nX = &N3 ; break ; |
| 3395 | case 0x0: rX = &R0; nX = &N0; break; |
| 3396 | case 0x1: rX = &R1; nX = &N1; break; |
| 3397 | case 0x2: rX = &R2; nX = &N2; break; |
| 3398 | case 0x3: rX = &R3; nX = &N3; break; |
| 2149 | 3399 | } |
| 2150 | 3400 | |
| 2151 | | switch(m) |
| 3401 | switch(MM) |
| 2152 | 3402 | { |
| 2153 | | case 0x0: (*rX)++ ; break ; |
| 2154 | | case 0x1: (*rX) = (*rX)+(*nX) ; break ; |
| 3403 | case 0x0: /* do nothing */ break; |
| 3404 | case 0x1: (*rX)++ ; break; |
| 3405 | case 0x2: (*rX)-- ; break; |
| 3406 | case 0x3: (*rX) = (*rX)+(*nX) ; break; |
| 2155 | 3407 | } |
| 2156 | 3408 | } |
| 2157 | 3409 | |
| 2158 | | static void ExecutezTable(int x, UINT16 z) |
| 3410 | /* Returns R value */ |
| 3411 | static UINT16 execute_q_table(int x, UINT16 q) |
| 2159 | 3412 | { |
| 2160 | | UINT16 *rX = 0x00 ; |
| 2161 | | UINT16 *nX = 0x00 ; |
| 3413 | UINT16 *rX = 0x0000; |
| 3414 | UINT16 *nX = 0x0000; |
| 2162 | 3415 | |
| 2163 | 3416 | switch(x) |
| 2164 | 3417 | { |
| 2165 | | case 0x0: rX = &R0 ; nX = &N0 ; break ; |
| 2166 | | case 0x1: rX = &R1 ; nX = &N1 ; break ; |
| 2167 | | case 0x2: rX = &R2 ; nX = &N2 ; break ; |
| 2168 | | case 0x3: rX = &R3 ; nX = &N3 ; break ; |
| 3418 | case 0x0: rX = &R0; nX = &N0; break; |
| 3419 | case 0x1: rX = &R1; nX = &N1; break; |
| 3420 | case 0x2: rX = &R2; nX = &N2; break; |
| 3421 | case 0x3: rX = &R3; nX = &N3; break; |
| 2169 | 3422 | } |
| 2170 | 3423 | |
| 2171 | | if (!z) |
| 3424 | switch(q) |
| 2172 | 3425 | { |
| 2173 | | (*rX)-- ; |
| 3426 | case 0x0: /* No permanent changes */ ; return (*rX)+(*nX); break; |
| 3427 | case 0x1: (*rX)--; return (*rX); break; // This one is special - it's a *PRE-decrement*! |
| 2174 | 3428 | } |
| 2175 | | else |
| 2176 | | { |
| 2177 | | (*rX) = (*rX)+(*nX) ; |
| 2178 | | } |
| 3429 | |
| 3430 | /* Should not get here */ |
| 3431 | exit(1); |
| 3432 | return 0x00; |
| 2179 | 3433 | } |
| 2180 | 3434 | |
| 2181 | | // Returns R address |
| 2182 | | static UINT16 ExecuteqTable(int x, UINT16 q) |
| 3435 | #ifdef UNUSED_FUNCTION |
| 3436 | static void execute_z_table(int x, UINT16 z) |
| 2183 | 3437 | { |
| 2184 | 3438 | UINT16 *rX = 0x00 ; |
| 2185 | 3439 | UINT16 *nX = 0x00 ; |
| r3485 | r3486 | |
| 2192 | 3446 | case 0x3: rX = &R3 ; nX = &N3 ; break ; |
| 2193 | 3447 | } |
| 2194 | 3448 | |
| 2195 | | switch(q) |
| 3449 | if (!z) |
| 2196 | 3450 | { |
| 2197 | | case 0x0: /* No permanent changes */ ; return (*rX)+(*nX); break; |
| 2198 | | case 0x1: (*rX)--; return (*rX); break; // This one is special - it's a *PRE-decrement*! |
| 3451 | (*rX)-- ; |
| 2199 | 3452 | } |
| 2200 | | |
| 2201 | | exit(1); |
| 2202 | | return 0x00; |
| 3453 | else |
| 3454 | { |
| 3455 | (*rX) = (*rX)+(*nX) ; |
| 3456 | } |
| 2203 | 3457 | } |
| 2204 | | |
| 2205 | | static UINT16 AssembleDFromPTable(UINT16 P, UINT16 ppppp) |
| 3458 | #endif |
| 3459 | static UINT16 assemble_address_from_Pppppp_table(UINT16 P, UINT16 ppppp) |
| 2206 | 3460 | { |
| 2207 | 3461 | UINT16 destAddr = 0x00 ; |
| 2208 | 3462 | |
| 2209 | 3463 | switch (P) |
| 2210 | 3464 | { |
| 2211 | | case 0x0: destAddr = ppppp ; break ; |
| 2212 | | case 0x1: destAddr = AssembleAddressFromIOShortAddress(ppppp) ; break ; |
| 3465 | case 0x0: destAddr = ppppp; break; /* TODO: Does this really only address up to 0x32? */ |
| 3466 | case 0x1: destAddr = assemble_address_from_IO_short_address(ppppp); break; |
| 2213 | 3467 | } |
| 2214 | 3468 | |
| 2215 | 3469 | return destAddr ; |
| 2216 | 3470 | } |
| 2217 | 3471 | |
| 2218 | | |
| 2219 | | static UINT16 AssembleAddressFromIOShortAddress(UINT16 pp) |
| 3472 | static UINT16 assemble_address_from_IO_short_address(UINT16 pp) |
| 2220 | 3473 | { |
| 2221 | | UINT16 fullAddy = 0xffe0 ; |
| 2222 | | fullAddy |= pp ; |
| 2223 | | return fullAddy ; |
| 3474 | UINT16 fullAddy = 0xffe0; |
| 3475 | fullAddy |= pp; |
| 3476 | return fullAddy; |
| 2224 | 3477 | } |
| 2225 | 3478 | |
| 2226 | | static UINT16 AssembleAddressFrom6BitSignedRelativeShortAddress(UINT16 srs) |
| 3479 | static UINT16 assemble_address_from_6bit_signed_relative_short_address(UINT16 srs) |
| 2227 | 3480 | { |
| 2228 | 3481 | UINT16 fullAddy = srs ; |
| 2229 | | if (fullAddy & 0x0020) fullAddy |= 0xffc0 ; |
| 3482 | if (fullAddy & 0x0020) |
| 3483 | fullAddy |= 0xffc0 ; |
| 2230 | 3484 | |
| 2231 | 3485 | return fullAddy ; |
| 2232 | 3486 | } |
| 2233 | 3487 | |
| 2234 | | static int DecodeccccTable(UINT16 cccc) |
| 3488 | static void dsp56k_process_loop(void) |
| 2235 | 3489 | { |
| 2236 | | int retVal = 0 ; |
| 3490 | if (LF_bit()) |
| 3491 | { |
| 3492 | if (PC == LA) |
| 3493 | { |
| 3494 | if (LC == 1) |
| 3495 | { |
| 3496 | /* End of loop processing */ |
| 3497 | SR = SSL; /* TODO: A-83. I believe only the Loop Flag comes back here. */ |
| 3498 | SP--; |
| 2237 | 3499 | |
| 2238 | | // !!! go back and check me again someday - potential bugs !!! |
| 2239 | | switch (cccc) |
| 2240 | | { |
| 2241 | | // Arranged according to mnemonic table - not decoding table... |
| 2242 | | case 0x0: if( C_bit() == 0) retVal = 1 ; break ; // cc(hs) |
| 2243 | | case 0x8: if( C_bit() == 1) retVal = 1 ; break ; // cs(lo) |
| 2244 | | case 0x5: if( E_bit() == 0) retVal = 1 ; break ; // ec |
| 2245 | | case 0xa: if( Z_bit() == 1) retVal = 1 ; break ; // eq |
| 2246 | | case 0xd: if( E_bit() == 1) retVal = 1 ; break ; // es |
| 2247 | | case 0x1: if((N_bit() ^ V_bit()) == 0) retVal = 1 ; break ; // ge |
| 2248 | | case 0x7: if((Z_bit() + (N_bit() ^ V_bit())) == 0) retVal = 1 ; break ; // gt |
| 2249 | | case 0x6: if( L_bit() == 0) retVal = 1 ; break ; // lc |
| 2250 | | case 0xf: if((Z_bit() + (N_bit() ^ V_bit())) == 1) retVal = 1 ; break ; // le |
| 2251 | | case 0xe: if( L_bit() == 1) retVal = 1 ; break ; // ls |
| 2252 | | case 0x9: if((N_bit() ^ V_bit()) == 1) retVal = 1 ; break ; // lt |
| 2253 | | case 0xb: if( N_bit() == 1) retVal = 1 ; break ; // mi |
| 2254 | | case 0x2: if( Z_bit() == 0) retVal = 1 ; break ; // ne |
| 2255 | | case 0xc: if((Z_bit() + ((!U_bit()) & (!E_bit()))) == 1) retVal = 1 ; break ; // nr |
| 2256 | | case 0x3: if( N_bit() == 0) retVal = 1 ; break ; // pl |
| 2257 | | case 0x4: if((Z_bit() + ((!U_bit()) & (!E_bit()))) == 0) retVal = 1 ; break ; // nn |
| 3500 | LA = SSH; |
| 3501 | LC = SSL; |
| 3502 | SP--; |
| 3503 | } |
| 3504 | else |
| 3505 | { |
| 3506 | LC--; |
| 3507 | PC = SSH; |
| 3508 | change_pc(PC); |
| 3509 | } |
| 3510 | } |
| 2258 | 3511 | } |
| 2259 | | |
| 2260 | | return retVal ; |
| 2261 | 3512 | } |
| 2262 | 3513 | |
| 2263 | | static void Decodeh0hFTable(UINT16 h0h, UINT16 F, |
| 2264 | | void **source, unsigned char *st, |
| 2265 | | void **dest, unsigned char *dt) |
| 3514 | static void dsp56k_process_rep(size_t repSize) |
| 2266 | 3515 | { |
| 2267 | | UINT16 switchVal = (h0h << 1) | F ; |
| 2268 | | |
| 2269 | | switch (switchVal) |
| 3516 | if (core.repFlag) |
| 2270 | 3517 | { |
| 2271 | | case 0x8: *source = &X0 ; *st = DT_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2272 | | case 0x9: *source = &X0 ; *st = DT_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 2273 | | case 0xa: *source = &Y0 ; *st = DT_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2274 | | case 0xb: *source = &Y0 ; *st = DT_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 2275 | | case 0x2: *source = &A ; *st = DT_LONG_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2276 | | case 0x1: *source = &A ; *st = DT_LONG_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 2277 | | case 0x0: *source = &B ; *st = DT_LONG_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2278 | | case 0x3: *source = &B ; *st = DT_LONG_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 3518 | if (PC == core.repAddr) |
| 3519 | { |
| 3520 | if (LC == 1) |
| 3521 | { |
| 3522 | /* End of rep processing */ |
| 3523 | LC = TEMP; |
| 3524 | core.repFlag = 0; |
| 3525 | core.repAddr = 0x0000; |
| 3526 | } |
| 3527 | else |
| 3528 | { |
| 3529 | LC--; |
| 3530 | PC -= repSize; /* A little strange - rewind by the size of the rep'd op */ |
| 3531 | change_pc(PC); |
| 3532 | } |
| 3533 | } |
| 2279 | 3534 | } |
| 2280 | 3535 | } |
| 2281 | 3536 | |
| 2282 | | static void *DecodeFTable(UINT16 F, unsigned char *dt) |
| 2283 | | { |
| 2284 | | void *retAddress = 0x00 ; |
| 2285 | 3537 | |
| 2286 | | switch(F) |
| 2287 | | { |
| 2288 | | case 0x0: retAddress = &A ; *dt = DT_LONG_WORD ; break ; |
| 2289 | | case 0x1: retAddress = &B ; *dt = DT_LONG_WORD ; break ; |
| 2290 | | } |
| 2291 | | |
| 2292 | | return retAddress ; |
| 2293 | | } |
| 2294 | | |
| 2295 | | static void DecodeJJJFTable(UINT16 JJJ, UINT16 F, |
| 2296 | | void **source, unsigned char *st, |
| 2297 | | void **dest, unsigned char *dt) |
| 3538 | /*************************************************************************** |
| 3539 | Parallel Memory Ops |
| 3540 | ***************************************************************************/ |
| 3541 | /* Register to Register Data Move : 0100 IIII ---- ---- */ |
| 3542 | static void execute_register_to_register_data_move(const UINT16 op, typed_pointer* d_register, UINT64* prev_accum_value) |
| 2298 | 3543 | { |
| 2299 | | UINT16 switchVal = (JJJ << 1) | F ; |
| 3544 | typed_pointer S = {NULL, DT_BYTE}; |
| 3545 | typed_pointer D = {NULL, DT_BYTE}; |
| 2300 | 3546 | |
| 2301 | | switch(switchVal) |
| 2302 | | { |
| 2303 | | case 0x0: *source = &B ; *st = DT_LONG_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2304 | | case 0x1: *source = &A ; *st = DT_LONG_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 2305 | | case 0x4: *source = &X ; *st = DT_DOUBLE_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2306 | | case 0x5: *source = &X ; *st = DT_DOUBLE_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 2307 | | case 0x6: *source = &Y ; *st = DT_DOUBLE_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2308 | | case 0x7: *source = &Y ; *st = DT_DOUBLE_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 2309 | | case 0x8: *source = &X0 ; *st = DT_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2310 | | case 0x9: *source = &X0 ; *st = DT_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 2311 | | case 0xa: *source = &Y0 ; *st = DT_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2312 | | case 0xb: *source = &Y0 ; *st = DT_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 2313 | | case 0xc: *source = &X1 ; *st = DT_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2314 | | case 0xd: *source = &X1 ; *st = DT_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 2315 | | case 0xe: *source = &Y1 ; *st = DT_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2316 | | case 0xf: *source = &Y1 ; *st = DT_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 2317 | | } |
| 2318 | | } |
| 3547 | decode_IIII_table(BITS(op,0x0f00), &S, &D, d_register->addr); |
| 2319 | 3548 | |
| 2320 | | static void DecodeJJFTable(UINT16 JJ, UINT16 F, |
| 2321 | | void **source, unsigned char *st, |
| 2322 | | void **dest, unsigned char *dt) |
| 2323 | | { |
| 2324 | | UINT16 switchVal = (JJ << 1) | F ; |
| 2325 | | |
| 2326 | | switch (switchVal) |
| 3549 | /* If the source is the same as the ALU destination, use the previous accumulator value */ |
| 3550 | if (d_register->addr == S.addr) |
| 2327 | 3551 | { |
| 2328 | | case 0x0: *source = &X0 ; *st = DT_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2329 | | case 0x1: *source = &X0 ; *st = DT_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 2330 | | case 0x2: *source = &Y0 ; *st = DT_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2331 | | case 0x3: *source = &Y0 ; *st = DT_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 2332 | | case 0x4: *source = &X1 ; *st = DT_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2333 | | case 0x5: *source = &X1 ; *st = DT_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 2334 | | case 0x6: *source = &Y1 ; *st = DT_WORD ; *dest = &A ; *dt = DT_LONG_WORD ; break ; |
| 2335 | | case 0x7: *source = &Y1 ; *st = DT_WORD ; *dest = &B ; *dt = DT_LONG_WORD ; break ; |
| 3552 | typed_pointer tempTP; |
| 3553 | tempTP.addr = prev_accum_value; |
| 3554 | tempTP.data_type = DT_LONG_WORD; |
| 3555 | SetDestinationValue(tempTP, D); |
| 2336 | 3556 | } |
| 2337 | | } |
| 2338 | | |
| 2339 | | // Types not necessary - we know what we are... |
| 2340 | | static void DecodeQQFTableSp(UINT16 QQ, UINT16 F, void **S1, void **S2, void **D) |
| 2341 | | { |
| 2342 | | UINT16 switchVal = (QQ << 1) | F ; |
| 2343 | | |
| 2344 | | switch(switchVal) |
| 3557 | else |
| 2345 | 3558 | { |
| 2346 | | case 0x0: *S1 = &Y0 ; *S2 = &X0 ; *D = &A ; break ; |
| 2347 | | case 0x1: *S1 = &Y0 ; *S2 = &X0 ; *D = &B ; break ; |
| 2348 | | case 0x2: *S1 = &Y1 ; *S2 = &X0 ; *D = &A ; break ; |
| 2349 | | case 0x3: *S1 = &Y1 ; *S2 = &X0 ; *D = &B ; break ; |
| 2350 | | case 0x4: *S1 = &X1 ; *S2 = &Y0 ; *D = &A ; break ; |
| 2351 | | case 0x5: *S1 = &X1 ; *S2 = &Y0 ; *D = &B ; break ; |
| 2352 | | case 0x6: *S1 = &X1 ; *S2 = &Y1 ; *D = &A ; break ; |
| 2353 | | case 0x7: *S1 = &X1 ; *S2 = &Y1 ; *D = &B ; break ; |
| 3559 | SetDestinationValue(S, D); |
| 2354 | 3560 | } |
| 2355 | 3561 | } |
| 2356 | 3562 | |
| 2357 | | static void DecodeIIIITable(UINT16 IIII, |
| 2358 | | void **source, unsigned char *st, |
| 2359 | | void **dest, unsigned char *dt, |
| 2360 | | void *working) |
| 3563 | /* X Memory Data Move : 1mRR HHHW ---- ---- : A-137 */ |
| 3564 | static void execute_x_memory_data_move(const UINT16 op, typed_pointer* d_register, UINT64* prev_accum_value) |
| 2361 | 3565 | { |
| 2362 | | void *opposite = 0x00 ; |
| 3566 | UINT16 W; |
| 3567 | typed_pointer R = {NULL, DT_BYTE}; |
| 3568 | typed_pointer SD = {NULL, DT_BYTE}; |
| 2363 | 3569 | |
| 2364 | | if (working == &A) opposite = &B ; |
| 2365 | | else opposite = &A ; |
| 3570 | W = BITS(op,0x0100); |
| 3571 | decode_HHH_table(BITS(op,0x0e00), &SD); |
| 3572 | decode_RR_table(BITS(op,0x3000),&R); |
| 2366 | 3573 | |
| 2367 | | switch(IIII) |
| 3574 | if (W) |
| 2368 | 3575 | { |
| 2369 | | case 0x0: *source = &X0 ; *st = DT_WORD ; *dest = opposite ; *dt = DT_LONG_WORD ; break ; |
| 2370 | | case 0x1: *source = &Y0 ; *st = DT_WORD ; *dest = opposite ; *dt = DT_LONG_WORD ; break ; |
| 2371 | | case 0x2: *source = &X1 ; *st = DT_WORD ; *dest = opposite ; *dt = DT_LONG_WORD ; break ; |
| 2372 | | case 0x3: *source = &Y1 ; *st = DT_WORD ; *dest = opposite ; *dt = DT_LONG_WORD ; break ; |
| 2373 | | case 0x4: *source = &A ; *st = DT_LONG_WORD ; *dest = &X0 ; *dt = DT_WORD ; break ; |
| 2374 | | case 0x5: *source = &B ; *st = DT_LONG_WORD ; *dest = &Y0 ; *dt = DT_WORD ; break ; |
| 2375 | | case 0x6: *source = &A0 ; *st = DT_WORD ; *dest = &X0 ; *dt = DT_WORD ; break ; |
| 2376 | | case 0x7: *source = &B0 ; *st = DT_WORD ; *dest = &Y0 ; *dt = DT_WORD ; break ; |
| 2377 | | case 0x8: *source = working ; *st = DT_LONG_WORD ; *dest = opposite ; *dt = DT_LONG_WORD ; break ; |
| 2378 | | case 0x9: *source = working ; *st = DT_LONG_WORD ; *dest = opposite ; *dt = DT_LONG_WORD ; break ; |
| 2379 | | case 0xc: *source = &A ; *st = DT_LONG_WORD ; *dest = &X1 ; *dt = DT_WORD ; break ; |
| 2380 | | case 0xd: *source = &B ; *st = DT_LONG_WORD ; *dest = &Y1 ; *dt = DT_WORD ; break ; |
| 2381 | | case 0xe: *source = &A0 ; *st = DT_WORD ; *dest = &X1 ; *dt = DT_WORD ; break ; |
| 2382 | | case 0xf: *source = &B0 ; *st = DT_WORD ; *dest = &Y1 ; *dt = DT_WORD ; break ; |
| 2383 | | } |
| 2384 | | } |
| 3576 | /* From X:<ea> to SD */ |
| 3577 | UINT16 data = data_read_word_16le(WORD(*((UINT16*)R.addr))); |
| 2385 | 3578 | |
| 2386 | | /* |
| 2387 | | MEMORY OPS |
| 2388 | | */ |
| 3579 | typed_pointer tempTP; |
| 3580 | tempTP.addr = &data; |
| 3581 | tempTP.data_type = DT_WORD; |
| 2389 | 3582 | |
| 2390 | | static void XMDMOperation(UINT16 parameters, void *working, UINT64 *pa) |
| 2391 | | { |
| 2392 | | UINT16 W ; |
| 2393 | | unsigned char rdt = 0x00 ; |
| 2394 | | void *R = 0x00 ; |
| 2395 | | |
| 2396 | | unsigned char sdt = 0x00 ; |
| 2397 | | void *SD = 0x00 ; |
| 2398 | | |
| 2399 | | // Get the source |
| 2400 | | SD = DecodeHHHTable(BITS(parameters,0x000e), &sdt) ; |
| 2401 | | |
| 2402 | | // Get the destination |
| 2403 | | R = DecodeRRTable(BITS(parameters,0x0030), &rdt) ; |
| 2404 | | |
| 2405 | | // Move the data |
| 2406 | | W = BITS(parameters,0x0001) ; |
| 2407 | | |
| 2408 | | if (W) |
| 2409 | | { |
| 2410 | | // from X:<ea> to SD... |
| 2411 | | // !!! TODO : Fill in similar comments for other "if (W)'s" !!! |
| 2412 | | UINT16 data = data_read_word_16le((*((UINT16*)R))<<1) ; // read the word out |
| 2413 | | SetDestinationValue(&data, DT_WORD, SD, sdt) ; |
| 3583 | SetDestinationValue(tempTP, SD); |
| 2414 | 3584 | } |
| 2415 | 3585 | else |
| 2416 | 3586 | { |
| 2417 | | // from SD to X:<ea>... |
| 3587 | /* From SD to X:<ea> */ |
| 3588 | /* If the source is the same as the ALU destination, use the previous accumulator value */ |
| 3589 | if (d_register->addr == SD.addr) |
| 3590 | { |
| 3591 | typed_pointer tempTP; |
| 3592 | tempTP.addr = prev_accum_value; |
| 3593 | tempTP.data_type = DT_LONG_WORD; |
| 2418 | 3594 | |
| 2419 | | // If the source is the same as the ALU destination, use the Previous Accumulator value |
| 2420 | | if (working == SD) |
| 2421 | | { |
| 2422 | | // the value before the ALU operation was executed... |
| 2423 | | SetDataMemoryValue(pa, DT_LONG_WORD, (*((UINT16*)R))<<1) ; |
| 3595 | SetDataMemoryValue(tempTP, WORD(*((UINT16*)R.addr))) ; |
| 2424 | 3596 | } |
| 2425 | 3597 | else |
| 2426 | 3598 | { |
| 2427 | | // Expected memory move |
| 2428 | | SetDataMemoryValue(SD, sdt, (*((UINT16*)R))<<1) ; |
| 3599 | SetDataMemoryValue(SD, WORD(*((UINT16*)R.addr))) ; |
| 2429 | 3600 | } |
| 2430 | 3601 | } |
| 2431 | 3602 | |
| 2432 | | // Postincrement |
| 2433 | | ExecutemTable(BITS(parameters,0x0030), BITS(parameters,0x0040)) ; |
| 3603 | execute_m_table(BITS(op,0x3000), BITS(op,0x4000)); |
| 2434 | 3604 | } |
| 2435 | 3605 | |
| 2436 | | static void RRDMOperation(UINT16 parameters, void *working, UINT64 *pa) |
| 3606 | |
| 3607 | /* X Memory Data Move : 0101 HHHW ---- ---- : A-137 */ |
| 3608 | /* NOTE: previous accumulator value is not needed since ^F1 is always the opposite accumulator */ |
| 3609 | static void execute_x_memory_data_move2(const UINT16 op, typed_pointer* d_register) |
| 2437 | 3610 | { |
| 2438 | | unsigned char st = 0x00, dt = 0x00 ; |
| 2439 | | void *S = 0x00, *D = 0x00; |
| 3611 | UINT16 W; |
| 3612 | UINT16* mem_offset = NULL; |
| 3613 | typed_pointer SD = {NULL, DT_BYTE}; |
| 2440 | 3614 | |
| 2441 | | DecodeIIIITable(BITS(parameters,0x000f), &S, &st, &D, &dt, working) ; |
| 3615 | W = BITS(op,0x0100); |
| 3616 | decode_HHH_table(BITS(op,0x0e000), &SD); |
| 2442 | 3617 | |
| 2443 | | // If the source is what we're working with, use the old value |
| 2444 | | if (S == working) |
| 2445 | | SetDestinationValue(pa, DT_LONG_WORD, D, dt) ; |
| 3618 | if (d_register->addr == &A) |
| 3619 | mem_offset = &B1; |
| 2446 | 3620 | else |
| 2447 | | SetDestinationValue(S, st, D, dt) ; |
| 2448 | | } |
| 3621 | mem_offset = &A1; |
| 2449 | 3622 | |
| 2450 | | |
| 2451 | | static void XMDMSpecialOperation(UINT16 parameters, void *working) |
| 2452 | | { |
| 2453 | | UINT16 W ; |
| 2454 | | UINT16 *dest = 0x00 ; |
| 2455 | | |
| 2456 | | // Get the source/destination |
| 2457 | | unsigned char sdt = 0x00 ; |
| 2458 | | void *SD = 0x00 ; |
| 2459 | | SD = DecodeHHHTable(BITS(parameters,0x000e), &sdt) ; |
| 2460 | | |
| 2461 | | // Get the opposite A/B depending on what was used before |
| 2462 | | if (working == &A) |
| 2463 | | dest = &B1 ; |
| 2464 | | else if (working == &B) |
| 2465 | | dest = &A1 ; |
| 2466 | | else |
| 2467 | | { |
| 2468 | | mame_printf_debug("WTF MF\n") ; |
| 2469 | | return ; |
| 2470 | | } |
| 2471 | | |
| 2472 | | // Move the data |
| 2473 | | W = BITS(parameters,0x0001) ; |
| 2474 | | |
| 2475 | 3623 | if (W) |
| 2476 | 3624 | { |
| 2477 | | // from X:<ea> to SD... |
| 2478 | | // !!! DOES THIS WORK ??? |
| 2479 | | UINT16 data = data_read_word_16le((*dest)<<1) ; // read the word out |
| 2480 | | SetDestinationValue(&data, DT_WORD, SD, sdt) ; |
| 3625 | /* Write D */ |
| 3626 | UINT16 value = data_read_word_16le(WORD(*mem_offset)); |
| 3627 | typed_pointer tempV = {&value, DT_WORD}; |
| 3628 | SetDestinationValue(tempV, SD); |
| 2481 | 3629 | } |
| 2482 | 3630 | else |
| 2483 | 3631 | { |
| 2484 | | // Normal memory move |
| 2485 | | SetDataMemoryValue(SD, sdt, (*dest)<<1) ; |
| 3632 | /* Read S */ |
| 3633 | SetDataMemoryValue(SD, WORD(*mem_offset)); |
| 2486 | 3634 | } |
| 2487 | 3635 | } |
| 2488 | 3636 | |
| 2489 | | static void ARUOperation(UINT16 parameters) |
| 2490 | | { |
| 2491 | | ExecutezTable(BITS(parameters, 0x0003), BITS(parameters, 0x0004)) ; |
| 2492 | | } |
| 2493 | 3637 | |
| 2494 | | |
| 2495 | | /* |
| 2496 | | HELPERS |
| 2497 | | */ |
| 3638 | /*************************************************************************** |
| 3639 | Helper Functions |
| 3640 | ***************************************************************************/ |
| 2498 | 3641 | static UINT16 Dsp56kOpMask(UINT16 cur, UINT16 mask) |
| 2499 | 3642 | { |
| 2500 | 3643 | int i ; |
| r3485 | r3486 | |
| 2516 | 3659 | return temp ; |
| 2517 | 3660 | } |
| 2518 | 3661 | |
| 2519 | | |
| 2520 | | static void SetDestinationValue(void *sourcePointer, unsigned char sourceType, |
| 2521 | | void *destinationPointer, unsigned char destinationType) |
| 3662 | static void SetDestinationValue(typed_pointer source, typed_pointer dest) |
| 2522 | 3663 | { |
| 2523 | 3664 | UINT64 destinationValue = 0 ; |
| 2524 | 3665 | |
| 2525 | | switch(destinationType) |
| 3666 | switch(dest.data_type) |
| 2526 | 3667 | { |
| 3668 | /* Copying to an 8-bit value */ |
| 2527 | 3669 | case DT_BYTE: |
| 2528 | | switch(sourceType) |
| 3670 | switch(source.data_type) |
| 2529 | 3671 | { |
| 2530 | | case DT_BYTE: *((UINT8*)destinationPointer) = *((UINT8*) sourcePointer) ; break ; |
| 2531 | | case DT_WORD: *((UINT8*)destinationPointer) = *((UINT16*)sourcePointer) ; break ; |
| 2532 | | case DT_DOUBLE_WORD: *((UINT8*)destinationPointer) = *((UINT32*)sourcePointer) ; break ; |
| 2533 | | case DT_LONG_WORD: *((UINT8*)destinationPointer) = *((UINT64*)sourcePointer) ; break ; |
| 3672 | /* From a ? */ |
| 3673 | case DT_BYTE: *((UINT8*)dest.addr) = (*((UINT8*) source.addr)) & 0xff; break; |
| 3674 | case DT_WORD: *((UINT8*)dest.addr) = (*((UINT16*)source.addr)) & 0x00ff; break; |
| 3675 | case DT_DOUBLE_WORD: *((UINT8*)dest.addr) = (*((UINT32*)source.addr)) & 0x000000ff; break; |
| 3676 | case DT_LONG_WORD: *((UINT8*)dest.addr) = (*((UINT64*)source.addr)) & U64(0x00000000000000ff); break; |
| 2534 | 3677 | } |
| 2535 | 3678 | break ; |
| 2536 | 3679 | |
| 3680 | /* Copying to a 16-bit value */ |
| 2537 | 3681 | case DT_WORD: |
| 2538 | | switch(sourceType) |
| 3682 | switch(source.data_type) |
| 2539 | 3683 | { |
| 2540 | | case DT_BYTE: *((UINT16*)destinationPointer) = *((UINT8*) sourcePointer) ; break ; |
| 2541 | | case DT_WORD: *((UINT16*)destinationPointer) = *((UINT16*)sourcePointer) ; break ; |
| 2542 | | case DT_DOUBLE_WORD: *((UINT16*)destinationPointer) = *((UINT32*)sourcePointer) ; break ; |
| 2543 | | // !!! This one is interesting too - shifter limiter action !!! |
| 2544 | | case DT_LONG_WORD: *((UINT16*)destinationPointer) = *((UINT64*)sourcePointer) ; break ; |
| 3684 | case DT_BYTE: *((UINT16*)dest.addr) = (*((UINT8*) source.addr)) & 0xff; break; |
| 3685 | case DT_WORD: *((UINT16*)dest.addr) = (*((UINT16*)source.addr)) & 0xffff; break; |
| 3686 | case DT_DOUBLE_WORD: *((UINT16*)dest.addr) = (*((UINT32*)source.addr)) & 0x0000ffff; break; |
| 3687 | case DT_LONG_WORD: *((UINT16*)dest.addr) = (*((UINT64*)source.addr)) & U64(0x000000000000ffff); break; /* Shift limiter action? */ |
| 2545 | 3688 | } |
| 2546 | 3689 | break ; |
| 2547 | 3690 | |
| 3691 | /* Copying to a 32-bit value */ |
| 2548 | 3692 | case DT_DOUBLE_WORD: |
| 2549 | | switch(sourceType) |
| 3693 | switch(source.data_type) |
| 2550 | 3694 | { |
| 2551 | | case DT_BYTE: *((UINT32*)destinationPointer) = *((UINT8*) sourcePointer) ; break ; |
| 2552 | | case DT_WORD: *((UINT32*)destinationPointer) = *((UINT16*)sourcePointer) ; break ; |
| 2553 | | case DT_DOUBLE_WORD: *((UINT32*)destinationPointer) = *((UINT32*)sourcePointer) ; break ; |
| 2554 | | case DT_LONG_WORD: *((UINT32*)destinationPointer) = *((UINT64*)sourcePointer) ; break ; |
| 3695 | case DT_BYTE: *((UINT32*)dest.addr) = (*((UINT8*) source.addr)) & 0xff; break; |
| 3696 | case DT_WORD: *((UINT32*)dest.addr) = (*((UINT16*)source.addr)) & 0xffff; break; |
| 3697 | case DT_DOUBLE_WORD: *((UINT32*)dest.addr) = (*((UINT32*)source.addr)) & 0xffffffff; break; |
| 3698 | case DT_LONG_WORD: *((UINT32*)dest.addr) = (*((UINT64*)source.addr)) & U64(0x00000000ffffffff); break; |
| 2555 | 3699 | } |
| 2556 | 3700 | break ; |
| 2557 | 3701 | |
| 3702 | /* Copying to a 64-bit value */ |
| 2558 | 3703 | case DT_LONG_WORD: |
| 2559 | | switch(sourceType) |
| 3704 | switch(source.data_type) |
| 2560 | 3705 | { |
| 2561 | | case DT_BYTE: *((UINT64*)destinationPointer) = *((UINT8*) sourcePointer) ; break ; |
| 3706 | case DT_BYTE: *((UINT64*)dest.addr) = (*((UINT8*)source.addr)) & 0xff; break; |
| 2562 | 3707 | |
| 2563 | | // !!! sign extending works on intel, others ??? |
| 2564 | | // !!! Need to check the shift limiter here too !!! |
| 2565 | | case DT_WORD: destinationValue = (*((INT16*)sourcePointer)) << 16 ; // Insure sign extending |
| 2566 | | destinationValue &= (UINT64)U64(0x000000ffffff0000) ; |
| 2567 | | *((UINT64*)destinationPointer) = destinationValue ; break ; |
| 3708 | case DT_WORD: destinationValue = (*((INT16*)source.addr)) << 16; /* Sign extend */ |
| 3709 | destinationValue &= U64(0x000000ffffff0000); |
| 3710 | *((UINT64*)dest.addr) = destinationValue; break; /* Forget not, yon shift register */ |
| 2568 | 3711 | |
| 2569 | | case DT_DOUBLE_WORD: *((UINT64*)destinationPointer) = *((UINT32*)sourcePointer) ; break ; |
| 2570 | | case DT_LONG_WORD: *((UINT64*)destinationPointer) = *((UINT64*)sourcePointer) ; break ; |
| 3712 | case DT_DOUBLE_WORD: *((UINT64*)dest.addr) = (*((UINT32*)source.addr)) & 0xffffffff; break; |
| 3713 | case DT_LONG_WORD: *((UINT64*)dest.addr) = (*((UINT64*)source.addr)) & U64(0x000000ffffffffff); break; |
| 2571 | 3714 | } |
| 2572 | 3715 | break ; |
| 2573 | 3716 | } |
| 2574 | 3717 | } |
| 2575 | 3718 | |
| 2576 | | // !! redundant functions (data and memory) can be handled with function pointers !! |
| 2577 | | static void SetDataMemoryValue(void *sourcePointer, unsigned char sourceType, UINT32 destinationAddr) |
| 3719 | /* TODO: Wait-state timings! */ |
| 3720 | static void SetDataMemoryValue(typed_pointer source, UINT32 destinationAddr) |
| 2578 | 3721 | { |
| 2579 | | // mame_printf_debug("%d %x\n", sourceType, destinationAddr) ; |
| 2580 | | |
| 2581 | | // I wonder if this is how this should be done??? |
| 2582 | | switch(sourceType) |
| 3722 | switch(source.data_type) |
| 2583 | 3723 | { |
| 2584 | | case DT_BYTE: data_write_word_16le(destinationAddr, (UINT16)( (*((UINT8*) sourcePointer) & 0xff) ) ) ; break ; |
| 2585 | | case DT_WORD: data_write_word_16le(destinationAddr, (UINT16)( (*((UINT16*)sourcePointer) & 0xffff) ) ) ; break ; |
| 2586 | | case DT_DOUBLE_WORD: data_write_word_16le(destinationAddr, (UINT16)( (*((UINT32*)sourcePointer) & 0x0000ffff) ) ) ; break ; |
| 3724 | case DT_BYTE: data_write_word_16le(destinationAddr, (UINT16)( (*((UINT8*) source.addr) & 0xff) ) ) ; break ; |
| 3725 | case DT_WORD: data_write_word_16le(destinationAddr, (UINT16)( (*((UINT16*)source.addr) & 0xffff) ) ) ; break ; |
| 3726 | case DT_DOUBLE_WORD: data_write_word_16le(destinationAddr, (UINT16)( (*((UINT32*)source.addr) & 0x0000ffff) ) ) ; break ; |
| 2587 | 3727 | |
| 2588 | 3728 | // !!! Is this universal ??? |
| 2589 | 3729 | // !!! Forget not, yon shift-limiter !!! |
| 2590 | | case DT_LONG_WORD: data_write_word_16le(destinationAddr, (UINT16)( ((*((UINT64*)sourcePointer)) & (UINT64)U64(0x00000000ffff0000)) >> 16) ) ; break ; |
| 3730 | case DT_LONG_WORD: data_write_word_16le(destinationAddr, (UINT16)( ((*((UINT64*)source.addr)) & U64(0x00000000ffff0000)) >> 16) ) ; break ; |
| 2591 | 3731 | } |
| 2592 | 3732 | } |
| 2593 | 3733 | |
| 2594 | | static void SetProgramMemoryValue(void *sourcePointer, unsigned char sourceType, UINT32 destinationAddr) |
| 3734 | /* TODO: Wait-state timings! */ |
| 3735 | static void SetProgramMemoryValue(typed_pointer source, UINT32 destinationAddr) |
| 2595 | 3736 | { |
| 2596 | | // I wonder if this is how this should be done??? |
| 2597 | | switch(sourceType) |
| 3737 | switch(source.data_type) |
| 2598 | 3738 | { |
| 2599 | | case DT_BYTE: program_write_word_16le(destinationAddr, (UINT16)( (*((UINT8*) sourcePointer) & 0xff) ) ) ; break ; |
| 2600 | | case DT_WORD: program_write_word_16le(destinationAddr, (UINT16)( (*((UINT16*)sourcePointer) & 0xffff) ) ) ; break ; |
| 2601 | | case DT_DOUBLE_WORD: program_write_word_16le(destinationAddr, (UINT16)( (*((UINT32*)sourcePointer) & 0x0000ffff) ) ) ; break ; |
| 3739 | case DT_BYTE: program_write_word_16le(destinationAddr, (UINT16)( (*((UINT8*) source.addr) & 0xff) ) ) ; break ; |
| 3740 | case DT_WORD: program_write_word_16le(destinationAddr, (UINT16)( (*((UINT16*)source.addr) & 0xffff) ) ) ; break ; |
| 3741 | case DT_DOUBLE_WORD: program_write_word_16le(destinationAddr, (UINT16)( (*((UINT32*)source.addr) & 0x0000ffff) ) ) ; break ; |
| 2602 | 3742 | |
| 2603 | 3743 | // !!! Is this universal ??? |
| 2604 | 3744 | // !!! Forget not, yon shift-limiter !!! |
| 2605 | | case DT_LONG_WORD: program_write_word_16le(destinationAddr, (UINT16)( ((*((UINT64*)sourcePointer)) & (UINT64)U64(0x00000000ffff0000)) >> 16) ) ; break ; |
| 3745 | case DT_LONG_WORD: program_write_word_16le(destinationAddr, (UINT16)( ((*((UINT64*)source.addr)) & U64(0x00000000ffff0000)) >> 16) ) ; break ; |
| 2606 | 3746 | } |
| 2607 | 3747 | } |
| 2608 | 3748 | |
src/emu/cpu/i8051/i8051.c
| r3485 | r3486 | |
| 53 | 53 | * July 28,2004: Fixed MOVX command and added External Ram Paging Support |
| 54 | 54 | * July 31,2004: Added Serial Mode 0 Support & Fixed Interrupt Flags for Serial Port |
| 55 | 55 | * |
| 56 | | * Todo: Full Timer support (all modes) |
| 57 | | * |
| 58 | 56 | * NOW Implemented: RAM paging using hardware configured addressing... |
| 59 | 57 | * (July 28,2004) the "MOVX a,@R0/R1" and "MOVX @R0/R1,a" commands can use any of the other ports |
| 60 | 58 | * to output a page offset into external ram, but it is totally based on the hardware setup. |
| 61 | 59 | * |
| 62 | 60 | * Timing needs to be implemented via MAME timers perhaps? |
| 63 | 61 | * |
| 62 | * October, 2008, Couriersud - Major rewrite |
| 63 | * |
| 64 | 64 | *****************************************************************************/ |
| 65 | 65 | |
| 66 | /* TODO: Varios |
| 67 | * - EA pin - defined by architecture, must implement: |
| 68 | * 1 means external access, bypassing internal ROM |
| 69 | * - T0 output clock ? |
| 70 | * |
| 71 | * - Full Timer support (all modes) |
| 72 | * - Implement cmos features |
| 73 | * - Fix serial communication - This is a big hack (but working) right now. |
| 74 | * - Implement 87C751 in sslam.c |
| 75 | * - Fix cardline.c |
| 76 | * - Fix sslam.c and cardline.c |
| 77 | * most likely due to different behaviour of I/O pins. The boards |
| 78 | * actually use 80CXX, i.e. CMOS versions. |
| 79 | * "Normal" 805X will return a 0 if reading from a output port which has |
| 80 | * a 0 written to it's latch. At least cardline expects a 1 here. |
| 81 | * |
| 82 | * Done: |
| 83 | * - Fix segas18.c (segaic16.c) memory handling. |
| 84 | * - Fix sslam.c |
| 85 | * - Fix limenko.c videopkr.c : Issue with core allocation of ram (duplicate savestate) |
| 86 | * - Handle internal ram better (debugger visible) |
| 87 | * - Fixed port reading |
| 88 | * - Rewrote Macros for better readibility |
| 89 | * - Fixed and rewrote Interrupt handling |
| 90 | * - Now returns INTERNAL_DIVIDER, adjusted cycle counts |
| 91 | * - Remove unnecessary and duplicated code |
| 92 | * - Remove unnecessary functions |
| 93 | * - Rewrite to have sfr-registers stored in int_ram. |
| 94 | * - Debugger may now watch sfr-registers as well. |
| 95 | * - implemented interrupt callbacks (HOLD_LINE now supported) |
| 96 | * - Runtime switch for processor type - remove ifdefs |
| 97 | * - internal memory maps for internal rom versions (internal ram now displayed in debugger) |
| 98 | * - more timer cleanups from manual |
| 99 | */ |
| 100 | |
| 66 | 101 | #include "debugger.h" |
| 67 | 102 | #include "deprecat.h" |
| 68 | 103 | #include "i8051.h" |
| 69 | 104 | |
| 70 | | #define VERBOSE |
| 105 | #define VERBOSE 1 |
| 71 | 106 | |
| 72 | 107 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 73 | 108 | |
| 109 | /*************************************************************************** |
| 110 | CONSTANTS |
| 111 | ***************************************************************************/ |
| 74 | 112 | |
| 75 | | //Prototypes |
| 76 | | INLINE void push_pc(void); |
| 77 | | INLINE void pop_pc(void); |
| 78 | | INLINE void set_parity(void); |
| 79 | | INLINE void do_add_flags(UINT8 a, UINT8 data, UINT8 c); |
| 80 | | INLINE void do_sub_flags(UINT8 a, UINT8 data, UINT8 c); |
| 81 | | INLINE UINT8 check_interrupts(void); |
| 82 | | INLINE void update_timer(int cyc); |
| 83 | | INLINE void update_serial(int cyc); |
| 84 | | INLINE void serial_transmit(UINT8 data); |
| 85 | | static READ8_HANDLER(internal_ram_read); |
| 86 | | static WRITE8_HANDLER(internal_ram_write); |
| 87 | | static READ8_HANDLER(internal_ram_iread); |
| 88 | | static READ32_HANDLER(external_ram_iaddr); |
| 89 | | static WRITE8_HANDLER(internal_ram_iwrite); |
| 90 | | static READ8_HANDLER(sfr_read); |
| 91 | | static WRITE8_HANDLER(sfr_write); |
| 92 | | static WRITE8_HANDLER( bit_address_w ); |
| 93 | | static READ8_HANDLER( bit_address_r ); |
| 113 | enum |
| 114 | { |
| 115 | FEATURE_NONE = 0, |
| 116 | FEATURE_I8052_UART = 1, |
| 117 | FEATURE_CMOS_IDLE = 2, |
| 118 | FEATURE_CMOS_POWERDOWN = 4, |
| 119 | }; |
| 94 | 120 | |
| 95 | | #if (HAS_I8052 || HAS_I8752) |
| 96 | | static READ8_HANDLER(i8052_internal_ram_iread); |
| 97 | | static WRITE8_HANDLER(i8052_internal_ram_iwrite); |
| 98 | | #endif |
| 99 | | // |
| 121 | /* Internal address in SFR of registers */ |
| 122 | enum |
| 123 | { |
| 124 | ADDR_PSW = 0xd0, |
| 125 | ADDR_ACC = 0xe0, |
| 126 | ADDR_B = 0xf0, |
| 100 | 127 | |
| 101 | | typedef struct { |
| 102 | | UINT8 timerbaud; //Flag set if timer overflow is controlling baud |
| 103 | | UINT8 sending; //Flag set when uart is sending |
| 128 | ADDR_P0 = 0x80, |
| 129 | ADDR_SP = 0x81, |
| 130 | ADDR_DPL = 0x82, |
| 131 | ADDR_DPH = 0x83, |
| 132 | ADDR_PCON = 0x87, |
| 133 | ADDR_TCON = 0x88, |
| 134 | ADDR_TMOD = 0x89, |
| 135 | ADDR_TL0 = 0x8a, |
| 136 | ADDR_TL1 = 0x8b, |
| 137 | ADDR_TH0 = 0x8c, |
| 138 | ADDR_TH1 = 0x8d, |
| 139 | ADDR_P1 = 0x90, |
| 140 | ADDR_SCON = 0x98, |
| 141 | ADDR_SBUF = 0x99, |
| 142 | ADDR_P2 = 0xa0, |
| 143 | ADDR_IE = 0xa8, |
| 144 | ADDR_P3 = 0xb0, |
| 145 | ADDR_IP = 0xb8, |
| 146 | |
| 147 | /* 8052 Only registers */ |
| 148 | ADDR_T2CON = 0xc8, |
| 149 | ADDR_RCAP2L = 0xca, |
| 150 | ADDR_RCAP2H = 0xcb, |
| 151 | ADDR_TL2 = 0xcc, |
| 152 | ADDR_TH2 = 0xcd, |
| 153 | }; |
| 154 | |
| 155 | /* PC vectors */ |
| 156 | |
| 157 | enum |
| 158 | { |
| 159 | V_RESET = 0x000, /* power on address */ |
| 160 | V_IE0 = 0x003, /* External Interrupt 0 */ |
| 161 | V_TF0 = 0x00b, /* Timer 0 Overflow */ |
| 162 | V_IE1 = 0x013, /* External Interrupt 1 */ |
| 163 | V_TF1 = 0x01b, /* Timer 1 Overflow */ |
| 164 | V_RITI = 0x023, /* Serial Receive/Transmit */ |
| 165 | |
| 166 | /* 8052 Only Vectors */ |
| 167 | V_TF2 = 0x02b, /* Timer 2 Overflow */ |
| 168 | }; |
| 169 | |
| 170 | /*************************************************************************** |
| 171 | TYPE DEFINITIONS |
| 172 | ***************************************************************************/ |
| 173 | |
| 174 | typedef struct _mcs51_uart mcs51_uart; |
| 175 | struct _mcs51_uart |
| 176 | { |
| 104 | 177 | UINT8 data_out; //Data to send out |
| 105 | 178 | UINT8 bits_to_send; //How many bits left to send when transmitting out the serial port |
| 106 | | UINT8 bitcycles; //# of bitcycles passed since last bit was sent |
| 107 | | } I8051_UART; |
| 108 | 179 | |
| 109 | | typedef struct { |
| 180 | int smod_div; /* signal divided by 2^SMOD */ |
| 181 | int rx_clk; /* rx clock */ |
| 182 | int tx_clk; /* tx clock */ |
| 183 | UINT8 delay_cycles; //Gross Hack; |
| 184 | }; |
| 110 | 185 | |
| 186 | typedef struct _mcs51_regs mcs51_regs; |
| 187 | struct _mcs51_regs |
| 188 | { |
| 111 | 189 | //Internal stuff |
| 112 | 190 | UINT16 ppc; //previous pc |
| 113 | 191 | UINT16 pc; //current pc |
| 114 | | UINT16 subtype; //specific version of the cpu, ie 8031, or 8051 for example |
| 192 | UINT16 features; //features of this cpu |
| 115 | 193 | UINT8 cur_irq; //Holds value of any current IRQ being serviced |
| 116 | 194 | UINT8 irq_priority; //Holds value of the current IRQ Priority Level |
| 117 | 195 | UINT8 rwm; //Signals that the current instruction is a read/write/modify instruction |
| 118 | | UINT8 prev_used_cycles; //Track previous # of used cycles |
| 119 | | UINT8 last_int0; //Store state of int0 |
| 120 | | UINT8 last_int1; //Store state of int1 |
| 121 | | UINT8 int_vec; //Pending Interrupt Vector |
| 122 | | UINT8 priority_request; //Priority level of incoming new irq |
| 123 | | //SFR Registers (Note: Appear in order as they do in memory) |
| 124 | | UINT8 po; //Port 0 |
| 125 | | UINT8 sp; //Stack Pointer |
| 126 | | UINT8 dpl; //Data Pointer (DPTR) (Hi bit) |
| 127 | | UINT8 dph; //Data Pointer (DPTR) (Lo bit) |
| 128 | | UINT8 pcon; //Power Mode Control |
| 129 | | UINT8 tcon; //Timer/Counter Control |
| 130 | | UINT8 tmod; //Timer/Counter Mode Control |
| 131 | | UINT8 tl0; //Timer 0 Lo |
| 132 | | UINT8 tl1; //Timer 1 Lo |
| 133 | | UINT8 th0; //Timer 0 Hi |
| 134 | | UINT8 th1; //Timer 1 Hi |
| 135 | | UINT8 p1; //Port 1 |
| 136 | | UINT8 scon; //Serial Control |
| 137 | | UINT8 sbuf; //Serial Data Buffer |
| 138 | | UINT8 p2; //Port 2 |
| 139 | | UINT8 ie; //Interrupt Enable |
| 140 | | UINT8 p3; //Port 3 |
| 141 | | UINT8 ip; //Interrupt Priority |
| 142 | | //8052 Only registers |
| 143 | | #if (HAS_I8052 || HAS_I8752) |
| 144 | | UINT8 t2con; //Timer/Counter 2 Control |
| 145 | | UINT8 rcap2l; //Timer/Counter 2 Capture Register Lo |
| 146 | | UINT8 rcap2h; //Timer/Counter 2 Capture Register Hi |
| 147 | | UINT8 tl2; //Timer 2 Lo |
| 148 | | UINT8 th2; //Timer 2 Hi |
| 149 | | #endif |
| 150 | | UINT8 psw; //Program Status Word |
| 151 | | UINT8 acc; //Accumulator |
| 152 | | UINT8 b; //Register B |
| 153 | 196 | |
| 154 | | //Internal Ram |
| 155 | | UINT8 IntRam[0xff+1]; //Max 256 Bytes of Internal RAM (8031/51 have 128, 8032/52 have 256) |
| 197 | int inst_cycles; /* cycles for the current instruction */ |
| 198 | int ram_mask; /* second ram bank for indirect access available ? */ |
| 199 | int num_interrupts; /* number of interrupts supported */ |
| 200 | int recalc_parity; /* recalculate parity before next instruction */ |
| 201 | int last_line_state; /* last state of input lines line */ |
| 202 | int t0_cnt; /* number of 0->1 transistions on T0 line */ |
| 203 | int t1_cnt; /* number of 0->1 transistions on T1 line */ |
| 204 | int t2_cnt; /* number of 0->1 transistions on T2 line */ |
| 205 | int t2ex_cnt; /* number of 0->1 transistions on T2EX line */ |
| 156 | 206 | |
| 207 | mcs51_uart uart; /* internal uart */ |
| 208 | |
| 209 | /* Internal Ram */ |
| 210 | UINT8 *internal_ram; /* 128 RAM (8031/51) + 128 RAM in second bank (8032/52) */ |
| 211 | UINT8 *sfr_ram; /* 128 SFR - these are in 0x80 - 0xFF */ |
| 212 | |
| 213 | // SFR Callbacks |
| 214 | void (*sfr_write)(size_t offset, UINT8 data); |
| 215 | UINT8 (*sfr_read)(size_t offset); |
| 216 | |
| 157 | 217 | //Interrupt Callback |
| 158 | 218 | int (*irq_callback)(int irqline); |
| 159 | 219 | |
| 160 | | //Serial Port TX/RX Call backs |
| 220 | //Serial Port TX/RX Callbacks |
| 221 | // TODO: Move to special port r/w |
| 161 | 222 | void (*serial_tx_callback)(int data); //Call back funciton when sending data out of serial port |
| 162 | 223 | int (*serial_rx_callback)(void); //Call back function to retrieve data when receiving serial port data |
| 163 | 224 | |
| 164 | | //Internal Indirect Read/Write Handlers |
| 165 | | READ8_HANDLER((*iram_iread)); |
| 166 | | WRITE8_HANDLER((*iram_iwrite)); |
| 225 | }; |
| 167 | 226 | |
| 168 | | //External Ram Address Callback for generating the hardware specific access to external ram |
| 169 | | READ32_HANDLER((*eram_iaddr_callback)); |
| 227 | /*************************************************************************** |
| 228 | MACROS |
| 229 | ***************************************************************************/ |
| 170 | 230 | |
| 171 | | } I8051; |
| 231 | #undef change_pc |
| 232 | #define change_pc(x) |
| 172 | 233 | |
| 173 | | static int i8051_icount; |
| 174 | | |
| 175 | | static I8051 i8051; |
| 176 | | static I8051_UART uart; |
| 177 | | |
| 178 | | //Hold callback functions so they can be set by caller (before the cpu reset) |
| 179 | | static void (*hold_serial_tx_callback)(int data); |
| 180 | | static int (*hold_serial_rx_callback)(void); |
| 181 | | static READ32_HANDLER((*hold_eram_iaddr_callback)); |
| 182 | | |
| 183 | | /*Short cuts*/ |
| 184 | | |
| 185 | | /*************************************************************** |
| 186 | | * Read Opcode/Opcode Arguments from Program Code |
| 187 | | ***************************************************************/ |
| 234 | /* Read Opcode/Opcode Arguments from Program Code */ |
| 188 | 235 | #define ROP(pc) cpu_readop(pc) |
| 189 | 236 | #define ROP_ARG(pc) cpu_readop_arg(pc) |
| 190 | | /***************************************************************************** |
| 191 | | * Read a byte from External Code Memory (Usually Program Rom(s) Space) |
| 192 | | ***************************************************************************** |
| 193 | | This area is mapped from 0-FFFF internally (64K) */ |
| 237 | |
| 238 | /* Read a byte from External Code Memory (Usually Program Rom(s) Space) */ |
| 194 | 239 | #define CODEMEM_R(a) (UINT8)program_read_byte_8le(a) |
| 195 | | /***************************************************************************** |
| 196 | | * Read/Write a byte from/to External Data Memory (Usually RAM or other I/O) |
| 197 | | ***************************************************************************** |
| 198 | | This area is *ALSO* mapped from 0-FFFF internally (64K) |
| 199 | | ** HOWEVER ** |
| 200 | | We *FORCE* the address space into the range 10000-1FFFF to allow both |
| 201 | | Code Memory and Data Memory to be pyshically separate while mapped @ the same |
| 202 | | addresses, w/o any contention. |
| 203 | | As far as the 8051 program code which is executing knows data memory still lives |
| 204 | | in the 0-FFFF range.*/ |
| 205 | | #define DATAMEM_R(a) (UINT8)data_read_byte_8le(a) |
| 206 | | #define DATAMEM_W(a,v) data_write_byte_8le(a,v) |
| 207 | 240 | |
| 208 | | /*************************************************************** |
| 209 | | * Read/Write a byte from/to the Internal RAM |
| 210 | | ***************************************************************/ |
| 211 | | #define IRAM_R(a) internal_ram_read(Machine,a) |
| 212 | | #define IRAM_W(a,v) internal_ram_write(Machine,a,v) |
| 213 | | /*************************************************************** |
| 214 | | * Read/Write a byte from/to the Internal RAM indirectly (called from indirect addressing) |
| 215 | | ***************************************************************/ |
| 216 | | #define IRAM_IR(a) internal_ram_iread(Machine,a) |
| 217 | | #define IRAM_IW(a,v) internal_ram_iwrite(Machine,a,v) |
| 218 | | /*************************************************************** |
| 219 | | * Form an Address to Read/Write to External RAM indirectly (called from indirect addressing) |
| 220 | | ***************************************************************/ |
| 221 | | #define ERAM_ADDR(a,m) external_ram_iaddr(Machine,a,m) |
| 222 | | /*************************************************************** |
| 223 | | * Read/Write a byte from/to the SFR Registers |
| 224 | | ***************************************************************/ |
| 225 | | #define SFR_R(a) sfr_read(Machine,a) |
| 226 | | #define SFR_W(a,v) sfr_write(Machine,a,v) |
| 227 | | /*************************************************************** |
| 228 | | * Read/Write a bit from Bit Addressable Memory |
| 229 | | ***************************************************************/ |
| 230 | | #define BIT_R(a) bit_address_r(Machine,a) |
| 231 | | #define BIT_W(a,v) bit_address_w(Machine,a,v) |
| 232 | | /*************************************************************** |
| 233 | | * Input/Output a byte from given I/O port |
| 234 | | ***************************************************************/ |
| 235 | | #define IN(port) ((UINT8)io_read_byte(port)) |
| 236 | | #define OUT(port,value) io_write_byte(port,value) |
| 237 | | /*************************************************************** |
| 238 | | * Access the 4 banks of R registers (R0...R7) |
| 239 | | ***************************************************************/ |
| 240 | | #define R_R(n) i8051.IntRam[(GET_RS*8)+(n)] |
| 241 | | /*************************************************************** |
| 242 | | * Easy macro for working with 16 bit DPTR |
| 243 | | ***************************************************************/ |
| 244 | | #define R_DPTR ((R_DPH<<8) | R_DPL) |
| 245 | | #define DPTR_W(n) SFR_W(DPH, ((n)>>8)&0xff);\ |
| 246 | | SFR_W(DPL, ((n)&0xff)); |
| 247 | | /*************************************************************** |
| 248 | | * Easy macros for Setting Flags |
| 249 | | ***************************************************************/ |
| 250 | | /*PSW Flags*/ |
| 251 | | #define SET_CY(n) R_PSW = (R_PSW & 0x7f) | (n<<7); //Carry Flag |
| 252 | | #define SET_AC(n) R_PSW = (R_PSW & 0xbf) | (n<<6); //Aux.Carry Flag |
| 253 | | #define SET_FO(n) R_PSW = (R_PSW & 0xdf) | (n<<5); //User Flag |
| 254 | | #define SET_RS(n) R_PSW = (R_PSW & 0xe7) | (n<<3); //R Bank Select |
| 255 | | #define SET_OV(n) R_PSW = (R_PSW & 0xfb) | (n<<2); //Overflow Flag |
| 256 | | #define SET_P(n) R_PSW = (R_PSW & 0xfe) | (n<<0); //Parity Flag |
| 257 | | /*IE Flags*/ |
| 258 | | #define SET_EA(n) R_IE = (R_IE & 0x7f) | (n<<7); //Global Interrupt Enable/Disable |
| 259 | | #if (HAS_I8052 || HAS_I8752) |
| 260 | | #define SET_ET2(n) R_IE = (R_IE & 0xdf) | (n<<5); //Timer 2 Interrupt Enable/Disable |
| 261 | | #endif |
| 262 | | #define SET_ES(n) R_IE = (R_IE & 0xef) | (n<<4); //Serial Interrupt Enable/Disable |
| 263 | | #define SET_ET1(n) R_IE = (R_IE & 0xf7) | (n<<3); //Timer 1 Interrupt Enable/Disable |
| 264 | | #define SET_EX1(n) R_IE = (R_IE & 0xfb) | (n<<2); //External Int 1 Interrupt Enable/Disable |
| 265 | | #define SET_ET0(n) R_IE = (R_IE & 0xfd) | (n<<1); //Timer 0 Interrupt Enable/Disable |
| 266 | | #define SET_EX0(n) R_IE = (R_IE & 0xfe) | (n<<0); //External Int 0 Interrupt Enable/Disable |
| 267 | | /*IP Flags*/ |
| 268 | | #if (HAS_I8052 || HAS_I8752) |
| 269 | | #define SET_PT2(n) R_IP = (R_IP & 0xdf) | (n<<5); //Set Timer 2 Priority Level |
| 270 | | #endif |
| 271 | | #define SET_PS0(n) R_IP = (R_IP & 0xef) | (n<<4); //Set Serial Priority Level |
| 272 | | #define SET_PT1(n) R_IP = (R_IP & 0xf7) | (n<<3); //Set Timer 1 Priority Level |
| 273 | | #define SET_PX1(n) R_IP = (R_IP & 0xfb) | (n<<2); //Set External Int 1 Priority Level |
| 274 | | #define SET_PT0(n) R_IP = (R_IP & 0xfd) | (n<<1); //Set Timer 0 Priority Level |
| 275 | | #define SET_PX0(n) R_IP = (R_IP & 0xfe) | (n<<0); //Set External Int 0 Priority Level |
| 276 | | /*TCON Flags*/ |
| 277 | | #define SET_TF1(n) R_TCON = (R_TCON & 0x7f) | (n<<7); //Indicated Timer 1 Overflow Int Triggered |
| 278 | | #define SET_TR1(n) R_TCON = (R_TCON & 0xbf) | (n<<6); //IndicateS Timer 1 is running |
| 279 | | #define SET_TF0(n) R_TCON = (R_TCON & 0xdf) | (n<<5); //Indicated Timer 0 Overflow Int Triggered |
| 280 | | #define SET_TR0(n) R_TCON = (R_TCON & 0xef) | (n<<4); //IndicateS Timer 0 is running |
| 281 | | #define SET_IE1(n) R_TCON = (R_TCON & 0xf7) | (n<<3); //Indicated External Int 1 Triggered |
| 282 | | #define SET_IT1(n) R_TCON = (R_TCON & 0xfb) | (n<<2); //Indicates how External Int 1 is Triggered |
| 283 | | #define SET_IE0(n) R_TCON = (R_TCON & 0xfd) | (n<<1); //Indicated External Int 0 Triggered |
| 284 | | #define SET_IT0(n) R_TCON = (R_TCON & 0xfe) | (n<<0); //Indicates how External Int 0 is Triggered |
| 285 | | /*SCON Flags*/ |
| 286 | | #define SET_SM0(n) R_SCON = (R_SCON & 0x7f) | (n<<7); //Sets Serial Port Mode |
| 287 | | #define SET_SM1(n) R_SCON = (R_SCON & 0xbf) | (n<<6); //Sets Serial Port Mode |
| 288 | | #define SET_SM2(n) R_SCON = (R_SCON & 0xdf) | (n<<5); //Sets Serial Port Mode (Multiprocesser mode) |
| 289 | | #define SET_REN(n) R_SCON = (R_SCON & 0xef) | (n<<4); //Sets Serial Port Receive Enable |
| 290 | | #define SET_TB8(n) R_SCON = (R_SCON & 0xf7) | (n<<3); //Transmit 8th Bit |
| 291 | | #define SET_RB8(n) R_SCON = (R_SCON & 0xfb) | (n<<2); //Receive 8th Bit |
| 292 | | #define SET_TI(n) R_SCON = (R_SCON & 0xfd) | (n<<1); //Indicates Transmit Interrupt Occurred |
| 293 | | #define SET_RI(n) R_SCON = (R_SCON & 0xfe) | (n<<0); //Indicates Receive Interrupt Occurred |
| 294 | | /*TMOD Flags*/ |
| 295 | | #define SET_GATE1(n) R_TMOD = (R_TMOD & 0x7f) | (n<<7); //Timer 1 Gate Mode |
| 296 | | #define SET_CT1(n) R_TMOD = (R_TMOD & 0xbf) | (n<<6); //Timer 1 Counter Mode |
| 297 | | #define SET_M1_1(n) R_TMOD = (R_TMOD & 0xdf) | (n<<5); //Timer 1 Timer Mode Bit 1 |
| 298 | | #define SET_M1_0(n) R_TMOD = (R_TMOD & 0xef) | (n<<4); //Timer 1 Timer Mode Bit 0 |
| 299 | | #define SET_GATE0(n) R_TMOD = (R_TMOD & 0xf7) | (n<<3); //Timer 0 Gate Mode |
| 300 | | #define SET_CT0(n) R_TMOD = (R_TMOD & 0xfb) | (n<<2); //Timer 0 Counter Mode |
| 301 | | #define SET_M0_1(n) R_TMOD = (R_TMOD & 0xfd) | (n<<1); //Timer 0 Timer Mode Bit 1 |
| 302 | | #define SET_M0_0(n) R_TMOD = (R_TMOD & 0xfe) | (n<<0); //Timer 0 Timer Mode Bit 0 |
| 241 | /* Read/Write a byte from/to External Data Memory (Usually RAM or other I/O) */ |
| 242 | #define DATAMEM_R(a) (UINT8)io_read_byte_8le(a) |
| 243 | #define DATAMEM_W(a,v) io_write_byte_8le(a,v) |
| 244 | //#define DATAMEM_R(a) (UINT8)data_read_byte_8le(a) |
| 245 | //#define DATAMEM_W(a,v) data_write_byte_8le(a,v) |
| 303 | 246 | |
| 304 | | #if (HAS_I8052 || HAS_I8752) |
| 305 | | /*T2CON Flags*/ |
| 306 | | #define SET_TF2(n) R_T2CON = (R_T2CON & 0x7f) | (n<<7); //Indicated Timer 2 Overflow Int Triggered |
| 307 | | #define SET_EXF2(n) R_T2CON = (R_T2CON & 0xbf) | (n<<6); //Indicates Timer 2 External Flag |
| 308 | | #define SET_RCLK(n) R_T2CON = (R_T2CON & 0xdf) | (n<<5); //Receive Clock |
| 309 | | #define SET_TCLK(n) R_T2CON = (R_T2CON & 0xef) | (n<<4); //Transmit Clock |
| 310 | | #define SET_EXEN2(n) R_T2CON = (R_T2CON & 0xf7) | (n<<3); //Timer 2 External Interrupt Enable |
| 311 | | #define SET_TR2(n) R_T2CON = (R_T2CON & 0xfb) | (n<<2); //Indicates Timer 2 is running |
| 312 | | #define SET_CT2(n) R_T2CON = (R_T2CON & 0xfd) | (n<<1); //Sets Timer 2 Counter/Timer Mode |
| 313 | | #define SET_CP(n) R_T2CON = (R_T2CON & 0xfe) | (n<<0); //Sets Timer 2 Capture/Reload Mode |
| 314 | | #endif |
| 247 | /* Read/Write a byte from/to the Internal RAM */ |
| 315 | 248 | |
| 316 | | /*************************************************************** |
| 317 | | * Easy macros for Getting Flags |
| 318 | | ***************************************************************/ |
| 319 | | /*PSW Flags*/ |
| 320 | | #define GET_CY ((R_PSW & 0x80)>>7) |
| 321 | | #define GET_AC ((R_PSW & 0x40)>>6) |
| 322 | | #define GET_FO ((R_PSW & 0x20)>>5) |
| 323 | | #define GET_RS ((R_PSW & 0x18)>>3) |
| 324 | | #define GET_OV ((R_PSW & 0x04)>>2) |
| 325 | | #define GET_P ((R_PSW & 0x01)>>0) |
| 326 | | /*IE Flags*/ |
| 327 | | #define GET_EA ((R_IE & 0x80)>>7) |
| 328 | | #define GET_ET2 ((R_IE & 0x20)>>5) |
| 329 | | #define GET_ES ((R_IE & 0x10)>>4) |
| 330 | | #define GET_ET1 ((R_IE & 0x08)>>3) |
| 331 | | #define GET_EX1 ((R_IE & 0x04)>>2) |
| 332 | | #define GET_ET0 ((R_IE & 0x02)>>1) |
| 333 | | #define GET_EX0 ((R_IE & 0x01)>>0) |
| 334 | | /*IP Flags*/ |
| 335 | | #if (HAS_I8052 || HAS_I8752) |
| 336 | | #define GET_PT2 ((R_IP & 0x20)>>5) |
| 337 | | #endif |
| 338 | | #define GET_PS ((R_IP & 0x10)>>4) |
| 339 | | #define GET_PT1 ((R_IP & 0x08)>>3) |
| 340 | | #define GET_PX1 ((R_IP & 0x04)>>2) |
| 341 | | #define GET_PT0 ((R_IP & 0x02)>>1) |
| 342 | | #define GET_PX0 ((R_IP & 0x01)>>0) |
| 343 | | /*TCON Flags*/ |
| 344 | | #define GET_TF1 ((R_TCON & 0x80)>>7) |
| 345 | | #define GET_TR1 ((R_TCON & 0x40)>>6) |
| 346 | | #define GET_TF0 ((R_TCON & 0x20)>>5) |
| 347 | | #define GET_TR0 ((R_TCON & 0x10)>>4) |
| 348 | | #define GET_IE1 ((R_TCON & 0x08)>>3) |
| 349 | | #define GET_IT1 ((R_TCON & 0x04)>>2) |
| 350 | | #define GET_IE0 ((R_TCON & 0x02)>>1) |
| 351 | | #define GET_IT0 ((R_TCON & 0x01)>>0) |
| 352 | | /*SCON Flags*/ |
| 353 | | #define GET_SM0 ((R_SCON & 0x80)>>7) |
| 354 | | #define GET_SM1 ((R_SCON & 0x40)>>6) |
| 355 | | #define GET_SM2 ((R_SCON & 0x20)>>5) |
| 356 | | #define GET_REN ((R_SCON & 0x10)>>4) |
| 357 | | #define GET_TB8 ((R_SCON & 0x08)>>3) |
| 358 | | #define GET_RB8 ((R_SCON & 0x04)>>2) |
| 359 | | #define GET_TI ((R_SCON & 0x02)>>1) |
| 360 | | #define GET_RI ((R_SCON & 0x01)>>0) |
| 361 | | /*TMOD Flags*/ |
| 362 | | #define GET_GATE1 ((R_TMOD & 0x80)>>7) |
| 363 | | #define GET_CT1 ((R_TMOD & 0x40)>>6) |
| 364 | | #define GET_M1_1 ((R_TMOD & 0x20)>>5) |
| 365 | | #define GET_M1_0 ((R_TMOD & 0x10)>>4) |
| 366 | | #define GET_GATE0 ((R_TMOD & 0x08)>>3) |
| 367 | | #define GET_CT0 ((R_TMOD & 0x04)>>2) |
| 368 | | #define GET_M0_1 ((R_TMOD & 0x02)>>1) |
| 369 | | #define GET_M0_0 ((R_TMOD & 0x01)>>0) |
| 249 | #define IRAM_R(a) iram_read(a) |
| 250 | #define IRAM_W(a, d) iram_write(a, d) |
| 370 | 251 | |
| 371 | | #if (HAS_I8052 || HAS_I8752) |
| 372 | | /*T2CON Flags*/ |
| 373 | | #define GET_TF2 ((R_T2CON & 0x80)>>7) |
| 374 | | #define GET_EXF2 ((R_T2CON & 0x40)>>6) |
| 375 | | #define GET_RCLK ((R_T2CON & 0x20)>>5) |
| 376 | | #define GET_TCLK ((R_T2CON & 0x10)>>4) |
| 377 | | #define GET_EXEN2 ((R_T2CON & 0x08)>>3) |
| 378 | | #define GET_TR2 ((R_T2CON & 0x04)>>2) |
| 379 | | #define GET_CT2 ((R_T2CON & 0x02)>>1) |
| 380 | | #define GET_CP ((R_T2CON & 0x01)>>0) |
| 381 | | #endif |
| 252 | /* Read/Write a byte from/to the Internal RAM indirectly */ |
| 253 | /* (called from indirect addressing) */ |
| 254 | #define IRAM_IR(a) data_read_byte_8le((a) & mcs51.ram_mask) |
| 255 | #define IRAM_IW(a, d) data_write_byte_8le((a) & mcs51.ram_mask, d) |
| 382 | 256 | |
| 383 | | /*Add and Subtract Flag settings*/ |
| 384 | | #define DO_ADD_FLAGS(a,d,c) do_add_flags(a,d,c); |
| 385 | | #define DO_SUB_FLAGS(a,d,c) do_sub_flags(a,d,c); |
| 257 | /* Form an Address to Read/Write to External RAM indirectly */ |
| 258 | /* (called from indirect addressing) */ |
| 259 | #define ERAM_ADDR(a,m) external_ram_iaddr(a,m) |
| 386 | 260 | |
| 387 | | #define SET_PARITY set_parity(); |
| 388 | | #define PUSH_PC push_pc(); |
| 389 | | #define POP_PC pop_pc(); |
| 261 | /* Read/Write a bit from Bit Addressable Memory */ |
| 262 | #define BIT_R(a) bit_address_r(a) |
| 263 | #define BIT_W(a,v) bit_address_w(a,v) |
| 390 | 264 | |
| 391 | | /* PC vectors */ |
| 392 | | #define V_RESET 0x000 /* power on address */ |
| 393 | | #define V_IE0 0x003 /* External Interrupt 0 */ |
| 394 | | #define V_TF0 0x00b /* Timer 0 Overflow */ |
| 395 | | #define V_IE1 0x013 /* External Interrupt 1 */ |
| 396 | | #define V_TF1 0x01b /* Timer 1 Overflow */ |
| 397 | | #define V_RITI 0x023 /* Serial Receive/Transmit */ |
| 265 | /* Input/Output a byte from given I/O port */ |
| 266 | #define IN(port) ((UINT8)io_read_byte(port)) |
| 267 | #define OUT(port,value) io_write_byte(port,value) |
| 398 | 268 | |
| 399 | | #if (HAS_I8052 || HAS_I8752) |
| 400 | | #define V_TF2 0x02b /* Timer 2 Overflow */ |
| 401 | | #endif |
| 402 | 269 | |
| 403 | | /* Any pending IRQ */ |
| 404 | | #define SERIALPORT_IRQ ((R_SCON & 0x03) && GET_ES) |
| 405 | | #define TIMERS_IRQ ((GET_TF0 && GET_ET0) || (GET_TF1 && GET_ET1)) |
| 406 | | #define EXTERNAL_IRQ ((GET_IE0 && GET_EX0) || (GET_IE1 && GET_EX1)) |
| 270 | /*************************************************************************** |
| 271 | SHORTCUTS |
| 272 | ***************************************************************************/ |
| 407 | 273 | |
| 408 | | #if (HAS_I8052 || HAS_I8752) |
| 409 | | #define NO_PENDING_IRQ !(TIMERS_IRQ) && !(EXTERNAL_IRQ) && !(SERIALPORT_IRQ) && !(GET_ET2 && (GET_TF2 || GET_EXF2)) |
| 410 | | #else |
| 411 | | #define NO_PENDING_IRQ !(TIMERS_IRQ) && !(EXTERNAL_IRQ) && !(SERIALPORT_IRQ) |
| 412 | | #endif |
| 274 | #define PPC mcs51.ppc |
| 275 | #define PC mcs51.pc |
| 276 | #define RWM mcs51.rwm |
| 413 | 277 | |
| 414 | | /* Clear Current IRQ */ |
| 415 | | #define CLEAR_CURRENT_IRQ i8051.cur_irq = 0xff;\ |
| 416 | | i8051.irq_priority = 0; |
| 278 | /* SFR Registers - These are accessed directly for speed on read */ |
| 279 | /* Read accessors */ |
| 417 | 280 | |
| 418 | | /* shorter names for the I8051 structure elements */ |
| 281 | #define SFR_A(a) mcs51.sfr_ram[(a)] |
| 282 | #define SET_SFR_A(a,v) do { SFR_A(a) = (v); } while (0) |
| 419 | 283 | |
| 420 | | //Internal stuff |
| 421 | | #define PPC i8051.ppc |
| 422 | | #define PC i8051.pc |
| 423 | | #define TYPE i8051.subtype |
| 424 | | #define RWM i8051.rwm |
| 284 | #define ACC ((const UINT8) SFR_A(ADDR_ACC)) |
| 285 | #define PSW ((const UINT8) SFR_A(ADDR_PSW)) |
| 425 | 286 | |
| 426 | | //SFR Registers |
| 427 | | #define R_P0 i8051.po |
| 428 | | #define R_SP i8051.sp |
| 429 | | #define R_DPL i8051.dpl |
| 430 | | #define R_DPH i8051.dph |
| 431 | | #define R_PCON i8051.pcon |
| 432 | | #define R_TCON i8051.tcon |
| 433 | | #define R_TMOD i8051.tmod |
| 434 | | #define R_TL0 i8051.tl0 |
| 435 | | #define R_TL1 i8051.tl1 |
| 436 | | #define R_TH0 i8051.th0 |
| 437 | | #define R_TH1 i8051.th1 |
| 438 | | #define R_P1 i8051.p1 |
| 439 | | #define R_SCON i8051.scon |
| 440 | | #define R_SBUF i8051.sbuf |
| 441 | | #define R_P2 i8051.p2 |
| 442 | | #define R_IE i8051.ie |
| 443 | | #define R_P3 i8051.p3 |
| 444 | | #define R_IP i8051.ip |
| 445 | | //8052 Only registers |
| 446 | | #if (HAS_I8052 || HAS_I8752) |
| 447 | | #define R_T2CON i8051.t2con |
| 448 | | #define R_RCAP2L i8051.rcap2l |
| 449 | | #define R_RCAP2H i8051.rcap2h |
| 450 | | #define R_TL2 i8051.tl2 |
| 451 | | #define R_TH2 i8051.th2 |
| 452 | | #endif |
| 453 | | #define R_PSW i8051.psw |
| 454 | | #define R_ACC i8051.acc |
| 455 | | #define R_B i8051.b |
| 287 | #define P0 ((const UINT8) SFR_A(ADDR_P0)) |
| 288 | #define P1 ((const UINT8) SFR_A(ADDR_P1)) |
| 289 | #define P2 ((const UINT8) SFR_A(ADDR_P2)) |
| 290 | #define P3 ((const UINT8) SFR_A(ADDR_P3)) |
| 456 | 291 | |
| 457 | | /* # of oscilations each opcode requires*/ |
| 458 | | static const UINT8 i8051_cycles[] = { |
| 459 | | 12,24,24,12,12,12,12,12,12,12,12,12,12,12,12,12, |
| 460 | | 24,24,24,12,12,12,12,12,12,12,12,12,12,12,12,12, |
| 461 | | 24,24,24,12,12,12,12,12,12,12,12,12,12,12,12,12, |
| 462 | | 24,24,24,12,12,12,12,12,12,12,12,12,12,12,12,12, |
| 463 | | 24,24,12,24,12,12,12,12,12,12,12,12,12,12,12,12, |
| 464 | | 24,24,12,24,12,12,12,12,12,12,12,12,12,12,12,12, |
| 465 | | 24,24,12,24,12,12,12,12,12,12,12,12,12,12,12,12, |
| 466 | | 24,24,24,24,12,24,12,12,12,12,12,12,12,12,12,12, |
| 467 | | 24,24,24,24,48,24,24,24,24,24,24,24,24,24,24,24, |
| 468 | | 24,24,24,24,12,12,12,12,12,12,12,12,12,12,12,12, |
| 469 | | 24,24,12,24,48,12,24,24,24,24,24,24,24,24,24,24, |
| 470 | | 24,24,12,12,24,24,24,24,24,24,24,24,24,24,24,24, |
| 471 | | 24,24,12,12,12,12,12,12,12,12,12,12,12,12,12,12, |
| 472 | | 24,24,12,12,12,24,12,12,24,24,24,24,24,24,24,24, |
| 473 | | 24,24,24,24,12,12,12,12,12,12,12,12,12,12,12,12, |
| 474 | | 24,24,24,24,12,12,12,12,12,12,12,12,12,12,12,12 |
| 475 | | }; |
| 292 | #define SP SFR_A(ADDR_SP) |
| 293 | #define DPL SFR_A(ADDR_DPL) |
| 294 | #define DPH SFR_A(ADDR_DPH) |
| 295 | #define PCON SFR_A(ADDR_PCON) |
| 296 | #define TCON SFR_A(ADDR_TCON) |
| 297 | #define TMOD SFR_A(ADDR_TMOD) |
| 298 | #define TL0 SFR_A(ADDR_TL0) |
| 299 | #define TL1 SFR_A(ADDR_TL1) |
| 300 | #define TH0 SFR_A(ADDR_TH0) |
| 301 | #define TH1 SFR_A(ADDR_TH1) |
| 302 | #define SCON SFR_A(ADDR_SCON) |
| 303 | #define IE SFR_A(ADDR_IE) |
| 304 | #define IP SFR_A(ADDR_IP) |
| 305 | #define B SFR_A(ADDR_B) |
| 306 | #define SBUF SFR_A(ADDR_SBUF) |
| 476 | 307 | |
| 477 | | /* Include Opcode functions */ |
| 478 | | #include "i8051ops.c" |
| 308 | #define R_REG(r) mcs51.internal_ram[(r) | (PSW & 0x18)] |
| 309 | #define DPTR ((DPH<<8) | DPL) |
| 479 | 310 | |
| 480 | | void i8051_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 481 | | { |
| 482 | | i8051_set_irq_callback(irqcallback); |
| 311 | /* 8052 Only registers */ |
| 312 | #define T2CON SFR_A(ADDR_T2CON) |
| 313 | #define RCAP2L SFR_A(ADDR_RCAP2L) |
| 314 | #define RCAP2H SFR_A(ADDR_RCAP2H) |
| 315 | #define TL2 SFR_A(ADDR_TL2) |
| 316 | #define TH2 SFR_A(ADDR_TH2) |
| 483 | 317 | |
| 484 | | //Internal stuff |
| 485 | | state_save_register_item("i8051", index, i8051.ppc); |
| 486 | | state_save_register_item("i8051", index, i8051.pc); |
| 487 | | state_save_register_item("i8051", index, i8051.subtype); |
| 488 | | state_save_register_item("i8051", index, i8051.rwm ); |
| 489 | | state_save_register_item("i8051", index, i8051.cur_irq ); |
| 490 | | state_save_register_item("i8051", index, i8051.irq_priority ); |
| 491 | | state_save_register_item("i8051", index, i8051.prev_used_cycles ); |
| 492 | | state_save_register_item("i8051", index, i8051.last_int0 ); |
| 493 | | state_save_register_item("i8051", index, i8051.last_int1 ); |
| 494 | | state_save_register_item("i8051", index, i8051.int_vec ); |
| 495 | | state_save_register_item("i8051", index, i8051.priority_request ); |
| 496 | | //SFR Registers |
| 497 | | state_save_register_item("i8051", index, i8051.po); |
| 498 | | state_save_register_item("i8051", index, i8051.sp); |
| 499 | | state_save_register_item("i8051", index, i8051.dpl); |
| 500 | | state_save_register_item("i8051", index, i8051.dph); |
| 501 | | state_save_register_item("i8051", index, i8051.pcon); |
| 502 | | state_save_register_item("i8051", index, i8051.tcon); |
| 503 | | state_save_register_item("i8051", index, i8051.tmod); |
| 504 | | state_save_register_item("i8051", index, i8051.tl0); |
| 505 | | state_save_register_item("i8051", index, i8051.tl1); |
| 506 | | state_save_register_item("i8051", index, i8051.th0); |
| 507 | | state_save_register_item("i8051", index, i8051.th1); |
| 508 | | state_save_register_item("i8051", index, i8051.p1); |
| 509 | | state_save_register_item("i8051", index, i8051.scon); |
| 510 | | state_save_register_item("i8051", index, i8051.sbuf); |
| 511 | | state_save_register_item("i8051", index, i8051.p2); |
| 512 | | state_save_register_item("i8051", index, i8051.ie); |
| 513 | | state_save_register_item("i8051", index, i8051.p3); |
| 514 | | state_save_register_item("i8051", index, i8051.ip); |
| 515 | | //8052 Only registers |
| 516 | | #if (HAS_I8052 || HAS_I8752) |
| 517 | | state_save_register_item("i8051", index, i8051.t2con); |
| 518 | | state_save_register_item("i8051", index, i8051.rcap2l); |
| 519 | | state_save_register_item("i8051", index, i8051.rcap2h); |
| 520 | | state_save_register_item("i8051", index, i8051.tl2); |
| 521 | | state_save_register_item("i8051", index, i8051.th2); |
| 522 | | #endif |
| 523 | | state_save_register_item("i8051", index, i8051.psw); |
| 524 | | state_save_register_item("i8051", index, i8051.acc); |
| 525 | | state_save_register_item("i8051", index, i8051.b); |
| 526 | | state_save_register_item_array("i8051", index, i8051.IntRam); |
| 527 | | } |
| 318 | /* WRITE accessors */ |
| 528 | 319 | |
| 529 | | /* Reset registers to the initial values */ |
| 530 | | void i8051_reset(void) |
| 531 | | { |
| 532 | | int (*save_irqcallback)(int); |
| 320 | /* Shortcuts */ |
| 533 | 321 | |
| 534 | | save_irqcallback = i8051.irq_callback; |
| 535 | | memset(&i8051, 0, sizeof(I8051)); |
| 536 | | i8051.irq_callback = save_irqcallback; |
| 322 | #define SET_PSW(v) do { SFR_A(ADDR_PSW) = (v); SET_PARITY(); } while (0) |
| 323 | #define SET_ACC(v) do { SFR_A(ADDR_ACC) = (v); SET_PARITY(); } while (0) |
| 537 | 324 | |
| 538 | | memset(&uart, 0, sizeof(I8051_UART)); |
| 539 | | i8051.subtype = 8051; |
| 325 | /* These trigger actions on modification and have to be written through SFR_W */ |
| 326 | #define SET_P0(v) IRAM_W(ADDR_P0, v) |
| 327 | #define SET_P1(v) IRAM_W(ADDR_P1, v) |
| 328 | #define SET_P2(v) IRAM_W(ADDR_P2, v) |
| 329 | #define SET_P3(v) IRAM_W(ADDR_P3, v) |
| 540 | 330 | |
| 541 | | //Set up 8051 specific internal read/write (indirect) handlers.. |
| 542 | | i8051.iram_iread = internal_ram_read; //Indirect ram read/write handled the same as direct for 8051! |
| 543 | | i8051.iram_iwrite = internal_ram_write; //Indirect ram read/write handled the same as direct for 8051! |
| 331 | /* Within the cpu core, do not trigger a send */ |
| 332 | #define SET_SBUF(v) SET_SFR_A(ADDR_SBUF, v) |
| 544 | 333 | |
| 545 | | //Set up serial call back handlers |
| 546 | | i8051.serial_tx_callback = hold_serial_tx_callback; |
| 547 | | hold_serial_tx_callback = NULL; |
| 548 | | i8051.serial_rx_callback = hold_serial_rx_callback; |
| 549 | | hold_serial_rx_callback = NULL; |
| 334 | /* No actions triggered on write */ |
| 335 | #define SET_REG(r, v) do { mcs51.internal_ram[(r) | (PSW & 0x18)] = (v); } while (0) |
| 550 | 336 | |
| 551 | | //Setup External ram callback handlers |
| 552 | | i8051.eram_iaddr_callback = hold_eram_iaddr_callback; |
| 553 | | hold_eram_iaddr_callback = NULL; |
| 337 | #define SET_DPTR(n) do { DPH = ((n) >> 8) & 0xff; DPL = (n) & 0xff; } while (0) |
| 554 | 338 | |
| 555 | | //Clear Ram (w/0xff) |
| 556 | | memset(&i8051.IntRam,0xff,sizeof(i8051.IntRam)); |
| 339 | /* Macros for Setting Flags */ |
| 340 | #define SET_X(R, v) do { R = (v);} while (0) |
| 557 | 341 | |
| 558 | | /* these are all defined reset states */ |
| 559 | | PC = 0; |
| 560 | | SFR_W(SP, 0x7); |
| 561 | | SFR_W(PSW, 0); |
| 562 | | SFR_W(DPH, 0); |
| 563 | | SFR_W(DPL, 0); |
| 564 | | SFR_W(ACC, 0); |
| 565 | | SFR_W(B, 0); |
| 566 | | SFR_W(IP, 0); |
| 567 | | SFR_W(IE, 0); |
| 568 | | SFR_W(SCON, 0); |
| 569 | | SFR_W(TCON, 0); |
| 570 | | SFR_W(TMOD, 0); |
| 571 | | SFR_W(TH1, 0); |
| 572 | | SFR_W(TH0, 0); |
| 573 | | SFR_W(TL1, 0); |
| 574 | | SFR_W(TL0, 0); |
| 575 | | /* set the port configurations to all 1's */ |
| 576 | | SFR_W(P3, 0xff); |
| 577 | | SFR_W(P2, 0xff); |
| 578 | | SFR_W(P1, 0xff); |
| 579 | | SFR_W(P0, 0xff); |
| 342 | #define SET_CY(n) SET_PSW((PSW & 0x7f) | (n<<7)) //Carry Flag |
| 343 | #define SET_AC(n) SET_PSW((PSW & 0xbf) | (n<<6)) //Aux.Carry Flag |
| 344 | #define SET_FO(n) SET_PSW((PSW & 0xdf) | (n<<5)) //User Flag |
| 345 | #define SET_RS(n) SET_PSW((PSW & 0xe7) | (n<<3)) //R Bank Select |
| 346 | #define SET_OV(n) SET_PSW((PSW & 0xfb) | (n<<2)) //Overflow Flag |
| 347 | #define SET_P(n) SET_PSW((PSW & 0xfe) | (n<<0)) //Parity Flag |
| 580 | 348 | |
| 581 | | /* Flag as NO IRQ in Progress */ |
| 582 | | CLEAR_CURRENT_IRQ |
| 583 | | } |
| 349 | #define SET_BIT(R, n, v) do { R = (R & ~(1<<(n))) | ((v) << (n));} while (0) |
| 350 | #define GET_BIT(R, n) (((R)>>(n)) & 0x01) |
| 584 | 351 | |
| 585 | | /* Shut down CPU core */ |
| 586 | | void i8051_exit(void) |
| 587 | | { |
| 588 | | /* nothing to do */ |
| 589 | | } |
| 352 | #define SET_EA(n) SET_BIT(IE, 7, n) //Global Interrupt Enable/Disable |
| 353 | #define SET_ES(n) SET_BIT(IE, 4, v) //Serial Interrupt Enable/Disable |
| 354 | #define SET_ET1(n) SET_BIT(IE, 3, n) //Timer 1 Interrupt Enable/Disable |
| 355 | #define SET_EX1(n) SET_BIT(IE, 2, n) //External Int 1 Interrupt Enable/Disable |
| 356 | #define SET_ET0(n) SET_BIT(IE, 1, n) //Timer 0 Interrupt Enable/Disable |
| 357 | #define SET_EX0(n) SET_BIT(IE, 0, n) //External Int 0 Interrupt Enable/Disable |
| 358 | /* 8052 Only flags */ |
| 359 | #define SET_ET2(n) SET_BIT(IE, 5, n) //Timer 2 Interrupt Enable/Disable |
| 590 | 360 | |
| 591 | | /* Execute cycles - returns number of cycles actually run */ |
| 592 | | int i8051_execute(int cycles) |
| 593 | | { |
| 594 | | i8051_icount = cycles; |
| 361 | /* 8052 Only flags */ |
| 362 | #define SET_PT2(n) SET_BIT(IP, 5, n); //Set Timer 2 Priority Level |
| 595 | 363 | |
| 596 | | do |
| 597 | | { |
| 598 | | //Read next opcode |
| 599 | | UINT8 op = cpu_readop(PC); |
| 364 | #define SET_PS0(n) SET_BIT(IP, 4, n) //Set Serial Priority Level |
| 365 | #define SET_PT1(n) SET_BIT(IP, 3, n) //Set Timer 1 Priority Level |
| 366 | #define SET_PX1(n) SET_BIT(IP, 2, n) //Set External Int 1 Priority Level |
| 367 | #define SET_PT0(n) SET_BIT(IP, 1, n) //Set Timer 0 Priority Level |
| 368 | #define SET_PX0(n) SET_BIT(IP, 0, n) //Set External Int 0 Priority Level |
| 600 | 369 | |
| 601 | | //Store previous PC |
| 602 | | PPC = PC; |
| 370 | #define SET_TF1(n) SET_BIT(TCON, 7, n) //Indicated Timer 1 Overflow Int Triggered |
| 371 | #define SET_TR1(n) SET_BIT(TCON, 6, n) //IndicateS Timer 1 is running |
| 372 | #define SET_TF0(n) SET_BIT(TCON, 5, n) //Indicated Timer 0 Overflow Int Triggered |
| 373 | #define SET_TR0(n) SET_BIT(TCON, 4, n) //IndicateS Timer 0 is running |
| 374 | #define SET_IE1(n) SET_BIT(TCON, 3, n) //Indicated External Int 1 Triggered |
| 375 | #define SET_IT1(n) SET_BIT(TCON, 2, n) //Indicates how External Int 1 is Triggered |
| 376 | #define SET_IE0(n) SET_BIT(TCON, 1, n) //Indicated External Int 0 Triggered |
| 377 | #define SET_IT0(n) SET_BIT(TCON, 0, n) //Indicates how External Int 0 is Triggered |
| 603 | 378 | |
| 604 | | //Call Debugger |
| 605 | | debugger_instruction_hook(Machine, PC); |
| 379 | #define SET_SM0(n) SET_BIT(SCON, 7, n) //Sets Serial Port Mode |
| 380 | #define SET_SM1(n) SET_BIT(SCON, 6, n) //Sets Serial Port Mode |
| 381 | #define SET_SM2(n) SET_BIT(SCON, 5, n) //Sets Serial Port Mode (Multiprocesser mode) |
| 382 | #define SET_REN(n) SET_BIT(SCON, 4, n) //Sets Serial Port Receive Enable |
| 383 | #define SET_TB8(n) SET_BIT(SCON, 3, n) //Transmit 8th Bit |
| 384 | #define SET_RB8(n) SET_BIT(SCON, 2, n) //Receive 8th Bit |
| 385 | #define SET_TI(n) SET_BIT(SCON, 1, n) //Indicates Transmit Interrupt Occurred |
| 386 | #define SET_RI(n) SET_BIT(SCON, 0, n) //Indicates Receive Interrupt Occurred |
| 606 | 387 | |
| 607 | | //remove after testing |
| 608 | | if(PC != PPC) op = cpu_readop(PC); |
| 388 | #define SET_GATE1(n) SET_BIT(TMOD, 7, n) //Timer 1 Gate Mode |
| 389 | #define SET_CT1(n) SET_BIT(TMOD, 6, n) //Timer 1 Counter Mode |
| 390 | #define SET_M1_1(n) SET_BIT(TMOD, 5, n) //Timer 1 Timer Mode Bit 1 |
| 391 | #define SET_M1_0(n) SET_BIT(TMOD, 4, n) //Timer 1 Timer Mode Bit 0 |
| 392 | #define SET_GATE0(n) SET_BIT(TMOD, 3, n) //Timer 0 Gate Mode |
| 393 | #define SET_CT0(n) SET_BIT(TMOD, 2, n) //Timer 0 Counter Mode |
| 394 | #define SET_M0_1(n) SET_BIT(TMOD, 1, n) //Timer 0 Timer Mode Bit 1 |
| 395 | #define SET_M0_0(n) SET_BIT(TMOD, 0, n) //Timer 0 Timer Mode Bit 0 |
| 609 | 396 | |
| 610 | | //Update Timer (if any timers are running) |
| 611 | | if(GET_TR0 || GET_TR1) |
| 612 | | update_timer(i8051.prev_used_cycles); |
| 613 | 397 | |
| 614 | | //Update Serial (if serial port sending data) |
| 615 | | if(uart.sending) |
| 616 | | update_serial(i8051.prev_used_cycles); |
| 617 | 398 | |
| 618 | | //Update PC |
| 619 | | PC += 1; |
| 620 | | //Decrement total count by # of cycles used for this opcode |
| 621 | | i8051_icount -= (i8051_cycles[op]); |
| 399 | /* 8052 Only flags - T2CON Flags */ |
| 400 | #define SET_TF2(n) SET_BIT(T2CON, 7, n) //Indicated Timer 2 Overflow Int Triggered |
| 401 | #define SET_EXF2(n) SET_BIT(T2CON, 6, n) //Indicates Timer 2 External Flag |
| 402 | #define SET_RCLK(n) SET_BIT(T2CON, 5, n) //Receive Clock |
| 403 | #define SET_TCLK(n) SET_BIT(T2CON, 4, n) //Transmit Clock |
| 404 | #define SET_EXEN2(n) SET_BIT(T2CON, 3, n) //Timer 2 External Interrupt Enable |
| 405 | #define SET_TR2(n) SET_BIT(T2CON, 2, n) //Indicates Timer 2 is running |
| 406 | #define SET_CT2(n) SET_BIT(T2CON, 1, n) //Sets Timer 2 Counter/Timer Mode |
| 407 | #define SET_CP(n) SET_BIT(T2CON, 0, n) //Sets Timer 2 Capture/Reload Mode |
| 622 | 408 | |
| 623 | | switch( op ) |
| 624 | | { |
| 625 | | //NOP |
| 626 | | case 0x00: /* 1: 0000 0000 */ |
| 627 | | nop(); |
| 628 | | break; |
| 629 | | //AJMP code addr /* 1: aaa0 0001 */ |
| 630 | | case 0x01: |
| 631 | | ajmp(); |
| 632 | | break; |
| 633 | | //LJMP code addr |
| 634 | | case 0x02: /* 1: 0000 0010 */ |
| 635 | | ljmp(); |
| 636 | | break; |
| 637 | | //RR A |
| 638 | | case 0x03: /* 1: 0000 0011 */ |
| 639 | | rr_a(); |
| 640 | | break; |
| 641 | | //INC A |
| 642 | | case 0x04: /* 1: 0000 0100 */ |
| 643 | | inc_a(); |
| 644 | | break; |
| 645 | | //INC data addr |
| 646 | | case 0x05: /* 1: 0000 0101 */ |
| 647 | | RWM=1; |
| 648 | | inc_mem(); |
| 649 | | RWM=0; |
| 650 | | break; |
| 651 | | //INC @R0/@R1 /* 1: 0000 011i */ |
| 652 | | case 0x06: |
| 653 | | case 0x07: |
| 654 | | inc_ir(op&1); |
| 655 | | break; |
| 656 | | //INC R0 to R7 /* 1: 0000 1rrr */ |
| 657 | | case 0x08: |
| 658 | | case 0x09: |
| 659 | | case 0x0a: |
| 660 | | case 0x0b: |
| 661 | | case 0x0c: |
| 662 | | case 0x0d: |
| 663 | | case 0x0e: |
| 664 | | case 0x0f: |
| 665 | | inc_r(op&7); |
| 666 | | break; |
| 667 | | //JBC bit addr, code addr |
| 668 | | case 0x10: /* 1: 0001 0000 */ |
| 669 | | RWM=1; |
| 670 | | jbc(); |
| 671 | | RWM=0; |
| 672 | | break; |
| 673 | | //ACALL code addr /* 1: aaa1 0001 */ |
| 674 | | case 0x11: |
| 675 | | acall(); |
| 676 | | break; |
| 677 | | //LCALL code addr |
| 678 | | case 0x12: /* 1: 0001 0010 */ |
| 679 | | lcall(); |
| 680 | | break; |
| 681 | | //RRC A |
| 682 | | case 0x13: /* 1: 0001 0011 */ |
| 683 | | rrc_a(); |
| 684 | | break; |
| 685 | | //DEC A |
| 686 | | case 0x14: /* 1: 0001 0100 */ |
| 687 | | dec_a(); |
| 688 | | break; |
| 689 | | //DEC data addr |
| 690 | | case 0x15: /* 1: 0001 0101 */ |
| 691 | | RWM=1; |
| 692 | | dec_mem(); |
| 693 | | RWM=0; |
| 694 | | break; |
| 695 | | //DEC @R0/@R1 /* 1: 0001 011i */ |
| 696 | | case 0x16: |
| 697 | | case 0x17: |
| 698 | | dec_ir(op&1); |
| 699 | | break; |
| 700 | | //DEC R0 to R7 /* 1: 0001 1rrr */ |
| 701 | | case 0x18: |
| 702 | | case 0x19: |
| 703 | | case 0x1a: |
| 704 | | case 0x1b: |
| 705 | | case 0x1c: |
| 706 | | case 0x1d: |
| 707 | | case 0x1e: |
| 708 | | case 0x1f: |
| 709 | | dec_r(op&7); |
| 710 | | break; |
| 711 | | //JB bit addr, code addr |
| 712 | | case 0x20: /* 1: 0010 0000 */ |
| 713 | | jb(); |
| 714 | | break; |
| 715 | | //AJMP code addr /* 1: aaa0 0001 */ |
| 716 | | case 0x21: |
| 717 | | ajmp(); |
| 718 | | break; |
| 719 | | //RET |
| 720 | | case 0x22: /* 1: 0010 0010 */ |
| 721 | | ret(); |
| 722 | | break; |
| 723 | | //RL A |
| 724 | | case 0x23: /* 1: 0010 0011 */ |
| 725 | | rl_a(); |
| 726 | | break; |
| 727 | | //ADD A, #data |
| 728 | | case 0x24: /* 1: 0010 0100 */ |
| 729 | | add_a_byte(); |
| 730 | | break; |
| 731 | | //ADD A, data addr |
| 732 | | case 0x25: /* 1: 0010 0101 */ |
| 733 | | add_a_mem(); |
| 734 | | break; |
| 735 | | //ADD A, @R0/@R1 /* 1: 0010 011i */ |
| 736 | | case 0x26: |
| 737 | | case 0x27: |
| 738 | | add_a_ir(op&1); |
| 739 | | break; |
| 740 | | //ADD A, R0 to R7 /* 1: 0010 1rrr */ |
| 741 | | case 0x28: |
| 742 | | case 0x29: |
| 743 | | case 0x2a: |
| 744 | | case 0x2b: |
| 745 | | case 0x2c: |
| 746 | | case 0x2d: |
| 747 | | case 0x2e: |
| 748 | | case 0x2f: |
| 749 | | add_a_r(op&7); |
| 750 | | break; |
| 751 | | //JNB bit addr, code addr |
| 752 | | case 0x30: /* 1: 0011 0000 */ |
| 753 | | jnb(); |
| 754 | | break; |
| 755 | | //ACALL code addr /* 1: aaa1 0001 */ |
| 756 | | case 0x31: |
| 757 | | acall(); |
| 758 | | break; |
| 759 | | //RETI |
| 760 | | case 0x32: /* 1: 0011 0010 */ |
| 761 | | reti(); |
| 762 | | break; |
| 763 | | //RLC A |
| 764 | | case 0x33: /* 1: 0011 0011 */ |
| 765 | | rlc_a(); |
| 766 | | break; |
| 767 | | //ADDC A, #data |
| 768 | | case 0x34: /* 1: 0011 0100 */ |
| 769 | | addc_a_byte(); |
| 770 | | break; |
| 771 | | //ADDC A, data addr |
| 772 | | case 0x35: /* 1: 0011 0101 */ |
| 773 | | addc_a_mem(); |
| 774 | | break; |
| 775 | | //ADDC A, @R0/@R1 /* 1: 0011 011i */ |
| 776 | | case 0x36: |
| 777 | | case 0x37: |
| 778 | | addc_a_ir(op&1); |
| 779 | | break; |
| 780 | | //ADDC A, R0 to R7 /* 1: 0011 1rrr */ |
| 781 | | case 0x38: |
| 782 | | case 0x39: |
| 783 | | case 0x3a: |
| 784 | | case 0x3b: |
| 785 | | case 0x3c: |
| 786 | | case 0x3d: |
| 787 | | case 0x3e: |
| 788 | | case 0x3f: |
| 789 | | addc_a_r(op&7); |
| 790 | | break; |
| 791 | | //JC code addr |
| 792 | | case 0x40: /* 1: 0100 0000 */ |
| 793 | | jc(); |
| 794 | | break; |
| 795 | | //AJMP code addr /* 1: aaa0 0001 */ |
| 796 | | case 0x41: |
| 797 | | ajmp(); |
| 798 | | break; |
| 799 | | //ORL data addr, A |
| 800 | | case 0x42: /* 1: 0100 0010 */ |
| 801 | | RWM=1; |
| 802 | | orl_mem_a(); |
| 803 | | RWM=0; |
| 804 | | break; |
| 805 | | //ORL data addr, #data |
| 806 | | case 0x43: /* 1: 0100 0011 */ |
| 807 | | RWM=1; |
| 808 | | orl_mem_byte(); |
| 809 | | RWM=0; |
| 810 | | break; |
| 811 | | //ORL A, #data |
| 812 | | case 0x44: /* 1: 0100 0100 */ |
| 813 | | orl_a_byte(); |
| 814 | | break; |
| 815 | | //ORL A, data addr |
| 816 | | case 0x45: /* 1: 0100 0101 */ |
| 817 | | orl_a_mem(); |
| 818 | | break; |
| 819 | | //ORL A, @RO/@R1 /* 1: 0100 011i */ |
| 820 | | case 0x46: |
| 821 | | case 0x47: |
| 822 | | orl_a_ir(op&1); |
| 823 | | break; |
| 824 | | //ORL A, RO to R7 /* 1: 0100 1rrr */ |
| 825 | | case 0x48: |
| 826 | | case 0x49: |
| 827 | | case 0x4a: |
| 828 | | case 0x4b: |
| 829 | | case 0x4c: |
| 830 | | case 0x4d: |
| 831 | | case 0x4e: |
| 832 | | case 0x4f: |
| 833 | | orl_a_r(op&7); |
| 834 | | break; |
| 835 | | //JNC code addr |
| 836 | | case 0x50: /* 1: 0101 0000 */ |
| 837 | | jnc(); |
| 838 | | break; |
| 839 | | //ACALL code addr /* 1: aaa1 0001 */ |
| 840 | | case 0x51: |
| 841 | | acall(); |
| 842 | | break; |
| 843 | | //ANL data addr, A |
| 844 | | case 0x52: /* 1: 0101 0010 */ |
| 845 | | RWM=1; |
| 846 | | anl_mem_a(); |
| 847 | | RWM=0; |
| 848 | | break; |
| 849 | | //ANL data addr, #data |
| 850 | | case 0x53: /* 1: 0101 0011 */ |
| 851 | | RWM=1; |
| 852 | | anl_mem_byte(); |
| 853 | | RWM=0; |
| 854 | | break; |
| 855 | | //ANL A, #data |
| 856 | | case 0x54: /* 1: 0101 0100 */ |
| 857 | | anl_a_byte(); |
| 858 | | break; |
| 859 | | //ANL A, data addr |
| 860 | | case 0x55: /* 1: 0101 0101 */ |
| 861 | | anl_a_mem(); |
| 862 | | break; |
| 863 | | //ANL A, @RO/@R1 /* 1: 0101 011i */ |
| 864 | | case 0x56: |
| 865 | | case 0x57: |
| 866 | | anl_a_ir(op&1); |
| 867 | | break; |
| 868 | | //ANL A, RO to R7 /* 1: 0101 1rrr */ |
| 869 | | case 0x58: |
| 870 | | case 0x59: |
| 871 | | case 0x5a: |
| 872 | | case 0x5b: |
| 873 | | case 0x5c: |
| 874 | | case 0x5d: |
| 875 | | case 0x5e: |
| 876 | | case 0x5f: |
| 877 | | anl_a_r(op&7); |
| 878 | | break; |
| 879 | | //JZ code addr |
| 880 | | case 0x60: /* 1: 0110 0000 */ |
| 881 | | jz(); |
| 882 | | break; |
| 883 | | //AJMP code addr /* 1: aaa0 0001 */ |
| 884 | | case 0x61: |
| 885 | | ajmp(); |
| 886 | | break; |
| 887 | | //XRL data addr, A |
| 888 | | case 0x62: /* 1: 0110 0010 */ |
| 889 | | RWM=1; |
| 890 | | xrl_mem_a(); |
| 891 | | RWM=0; |
| 892 | | break; |
| 893 | | //XRL data addr, #data |
| 894 | | case 0x63: /* 1: 0110 0011 */ |
| 895 | | RWM=1; |
| 896 | | xrl_mem_byte(); |
| 897 | | RWM=0; |
| 898 | | break; |
| 899 | | //XRL A, #data |
| 900 | | case 0x64: /* 1: 0110 0100 */ |
| 901 | | xrl_a_byte(); |
| 902 | | break; |
| 903 | | //XRL A, data addr |
| 904 | | case 0x65: /* 1: 0110 0101 */ |
| 905 | | xrl_a_mem(); |
| 906 | | break; |
| 907 | | //XRL A, @R0/@R1 /* 1: 0110 011i */ |
| 908 | | case 0x66: |
| 909 | | case 0x67: |
| 910 | | xrl_a_ir(op&1); |
| 911 | | break; |
| 912 | | //XRL A, R0 to R7 /* 1: 0110 1rrr */ |
| 913 | | case 0x68: |
| 914 | | case 0x69: |
| 915 | | case 0x6a: |
| 916 | | case 0x6b: |
| 917 | | case 0x6c: |
| 918 | | case 0x6d: |
| 919 | | case 0x6e: |
| 920 | | case 0x6f: |
| 921 | | xrl_a_r(op&7); |
| 922 | | break; |
| 923 | | //JNZ code addr |
| 924 | | case 0x70: /* 1: 0111 0000 */ |
| 925 | | jnz(); |
| 926 | | break; |
| 927 | | //ACALL code addr /* 1: aaa1 0001 */ |
| 928 | | case 0x71: |
| 929 | | acall(); |
| 930 | | break; |
| 931 | | //ORL C, bit addr |
| 932 | | case 0x72: /* 1: 0111 0010 */ |
| 933 | | orl_c_bitaddr(); |
| 934 | | break; |
| 935 | | //JMP @A+DPTR |
| 936 | | case 0x73: /* 1: 0111 0011 */ |
| 937 | | jmp_iadptr(); |
| 938 | | break; |
| 939 | | //MOV A, #data |
| 940 | | case 0x74: /* 1: 0111 0100 */ |
| 941 | | mov_a_byte(); |
| 942 | | break; |
| 943 | | //MOV data addr, #data |
| 944 | | case 0x75: /* 1: 0111 0101 */ |
| 945 | | mov_mem_byte(); |
| 946 | | break; |
| 947 | | //MOV @R0/@R1, #data /* 1: 0111 011i */ |
| 948 | | case 0x76: |
| 949 | | case 0x77: |
| 950 | | mov_ir_byte(op&1); |
| 951 | | break; |
| 952 | | //MOV R0 to R7, #data /* 1: 0111 1rrr */ |
| 953 | | case 0x78: |
| 954 | | case 0x79: |
| 955 | | case 0x7a: |
| 956 | | case 0x7b: |
| 957 | | case 0x7c: |
| 958 | | case 0x7d: |
| 959 | | case 0x7e: |
| 960 | | case 0x7f: |
| 961 | | mov_r_byte(op&7); |
| 962 | | break; |
| 963 | | //SJMP code addr |
| 964 | | case 0x80: /* 1: 1000 0000 */ |
| 965 | | sjmp(); |
| 966 | | break; |
| 967 | | //AJMP code addr /* 1: aaa0 0001 */ |
| 968 | | case 0x81: |
| 969 | | ajmp(); |
| 970 | | break; |
| 971 | | //ANL C, bit addr |
| 972 | | case 0x82: /* 1: 1000 0010 */ |
| 973 | | anl_c_bitaddr(); |
| 974 | | break; |
| 975 | | //MOVC A, @A + PC |
| 976 | | case 0x83: /* 1: 1000 0011 */ |
| 977 | | movc_a_iapc(); |
| 978 | | break; |
| 979 | | //DIV AB |
| 980 | | case 0x84: /* 1: 1000 0100 */ |
| 981 | | div_ab(); |
| 982 | | break; |
| 983 | | //MOV data addr, data addr |
| 984 | | case 0x85: /* 1: 1000 0101 */ |
| 985 | | mov_mem_mem(); |
| 986 | | break; |
| 987 | | //MOV data addr, @R0/@R1 /* 1: 1000 011i */ |
| 988 | | case 0x86: |
| 989 | | case 0x87: |
| 990 | | mov_mem_ir(op&1); |
| 991 | | break; |
| 992 | | //MOV data addr,R0 to R7 /* 1: 1000 1rrr */ |
| 993 | | case 0x88: |
| 994 | | case 0x89: |
| 995 | | case 0x8a: |
| 996 | | case 0x8b: |
| 997 | | case 0x8c: |
| 998 | | case 0x8d: |
| 999 | | case 0x8e: |
| 1000 | | case 0x8f: |
| 1001 | | mov_mem_r(op&7); |
| 1002 | | break; |
| 1003 | | //MOV DPTR, #data |
| 1004 | | case 0x90: /* 1: 1001 0000 */ |
| 1005 | | mov_dptr_byte(); |
| 1006 | | break; |
| 1007 | | //ACALL code addr /* 1: aaa1 0001 */ |
| 1008 | | case 0x91: |
| 1009 | | acall(); |
| 1010 | | break; |
| 1011 | | //MOV bit addr, C |
| 1012 | | case 0x92: /* 1: 1001 0010 */ |
| 1013 | | RWM = 1; |
| 1014 | | mov_bitaddr_c(); |
| 1015 | | RWM = 0; |
| 1016 | | break; |
| 1017 | | //MOVC A, @A + DPTR |
| 1018 | | case 0x93: /* 1: 1001 0011 */ |
| 1019 | | movc_a_iadptr(); |
| 1020 | | break; |
| 1021 | | //SUBB A, #data |
| 1022 | | case 0x94: /* 1: 1001 0100 */ |
| 1023 | | subb_a_byte(); |
| 1024 | | break; |
| 1025 | | //SUBB A, data addr |
| 1026 | | case 0x95: /* 1: 1001 0101 */ |
| 1027 | | subb_a_mem(); |
| 1028 | | break; |
| 1029 | | //SUBB A, @R0/@R1 /* 1: 1001 011i */ |
| 1030 | | case 0x96: |
| 1031 | | case 0x97: |
| 1032 | | subb_a_ir(op&1); |
| 1033 | | break; |
| 1034 | | //SUBB A, R0 to R7 /* 1: 1001 1rrr */ |
| 1035 | | case 0x98: |
| 1036 | | case 0x99: |
| 1037 | | case 0x9a: |
| 1038 | | case 0x9b: |
| 1039 | | case 0x9c: |
| 1040 | | case 0x9d: |
| 1041 | | case 0x9e: |
| 1042 | | case 0x9f: |
| 1043 | | subb_a_r(op&7); |
| 1044 | | break; |
| 1045 | | //ORL C, /bit addr |
| 1046 | | case 0xa0: /* 1: 1010 0000 */ |
| 1047 | | orl_c_nbitaddr(); |
| 1048 | | break; |
| 1049 | | //AJMP code addr /* 1: aaa0 0001 */ |
| 1050 | | case 0xa1: |
| 1051 | | ajmp(); |
| 1052 | | break; |
| 1053 | | //MOV C, bit addr |
| 1054 | | case 0xa2: /* 1: 1010 0010 */ |
| 1055 | | mov_c_bitaddr(); |
| 1056 | | break; |
| 1057 | | //INC DPTR |
| 1058 | | case 0xa3: /* 1: 1010 0011 */ |
| 1059 | | inc_dptr(); |
| 1060 | | break; |
| 1061 | | //MUL AB |
| 1062 | | case 0xa4: /* 1: 1010 0100 */ |
| 1063 | | mul_ab(); |
| 1064 | | break; |
| 1065 | | //reserved |
| 1066 | | case 0xa5: /* 1: 1010 0101 */ |
| 1067 | | illegal(); |
| 1068 | | break; |
| 1069 | | //MOV @R0/@R1, data addr /* 1: 1010 011i */ |
| 1070 | | case 0xa6: |
| 1071 | | case 0xa7: |
| 1072 | | mov_ir_mem(op&1); |
| 1073 | | break; |
| 1074 | | //MOV R0 to R7, data addr /* 1: 1010 1rrr */ |
| 1075 | | case 0xa8: |
| 1076 | | case 0xa9: |
| 1077 | | case 0xaa: |
| 1078 | | case 0xab: |
| 1079 | | case 0xac: |
| 1080 | | case 0xad: |
| 1081 | | case 0xae: |
| 1082 | | case 0xaf: |
| 1083 | | mov_r_mem(op&7); |
| 1084 | | break; |
| 1085 | | //ANL C,/bit addr |
| 1086 | | case 0xb0: /* 1: 1011 0000 */ |
| 1087 | | anl_c_nbitaddr(); |
| 1088 | | break; |
| 1089 | | //ACALL code addr /* 1: aaa1 0001 */ |
| 1090 | | case 0xb1: |
| 1091 | | acall(); |
| 1092 | | break; |
| 1093 | | //CPL bit addr |
| 1094 | | case 0xb2: /* 1: 1011 0010 */ |
| 1095 | | RWM=1; |
| 1096 | | cpl_bitaddr(); |
| 1097 | | RWM=0; |
| 1098 | | break; |
| 1099 | | //CPL C |
| 1100 | | case 0xb3: /* 1: 1011 0011 */ |
| 1101 | | cpl_c(); |
| 1102 | | break; |
| 1103 | | //CJNE A, #data, code addr |
| 1104 | | case 0xb4: /* 1: 1011 0100 */ |
| 1105 | | cjne_a_byte(); |
| 1106 | | break; |
| 1107 | | //CJNE A, data addr, code addr |
| 1108 | | case 0xb5: /* 1: 1011 0101 */ |
| 1109 | | cjne_a_mem(); |
| 1110 | | break; |
| 1111 | | //CJNE @R0/@R1, #data, code addr /* 1: 1011 011i */ |
| 1112 | | case 0xb6: |
| 1113 | | case 0xb7: |
| 1114 | | cjne_ir_byte(op&1); |
| 1115 | | break; |
| 1116 | | //CJNE R0 to R7, #data, code addr/* 1: 1011 1rrr */ |
| 1117 | | case 0xb8: |
| 1118 | | case 0xb9: |
| 1119 | | case 0xba: |
| 1120 | | case 0xbb: |
| 1121 | | case 0xbc: |
| 1122 | | case 0xbd: |
| 1123 | | case 0xbe: |
| 1124 | | case 0xbf: |
| 1125 | | cjne_r_byte(op&7); |
| 1126 | | break; |
| 1127 | | //PUSH data addr |
| 1128 | | case 0xc0: /* 1: 1100 0000 */ |
| 1129 | | push(); |
| 1130 | | break; |
| 1131 | | //AJMP code addr /* 1: aaa0 0001 */ |
| 1132 | | case 0xc1: |
| 1133 | | ajmp(); |
| 1134 | | break; |
| 1135 | | //CLR bit addr |
| 1136 | | case 0xc2: /* 1: 1100 0010 */ |
| 1137 | | RWM=1; |
| 1138 | | clr_bitaddr(); |
| 1139 | | RWM=0; |
| 1140 | | break; |
| 1141 | | //CLR C |
| 1142 | | case 0xc3: /* 1: 1100 0011 */ |
| 1143 | | clr_c(); |
| 1144 | | break; |
| 1145 | | //SWAP A |
| 1146 | | case 0xc4: /* 1: 1100 0100 */ |
| 1147 | | swap_a(); |
| 1148 | | break; |
| 1149 | | //XCH A, data addr |
| 1150 | | case 0xc5: /* 1: 1100 0101 */ |
| 1151 | | xch_a_mem(); |
| 1152 | | break; |
| 1153 | | //XCH A, @RO/@R1 /* 1: 1100 011i */ |
| 1154 | | case 0xc6: |
| 1155 | | case 0xc7: |
| 1156 | | xch_a_ir(op&1); |
| 1157 | | break; |
| 1158 | | //XCH A, RO to R7 /* 1: 1100 1rrr */ |
| 1159 | | case 0xc8: |
| 1160 | | case 0xc9: |
| 1161 | | case 0xca: |
| 1162 | | case 0xcb: |
| 1163 | | case 0xcc: |
| 1164 | | case 0xcd: |
| 1165 | | case 0xce: |
| 1166 | | case 0xcf: |
| 1167 | | xch_a_r(op&7); |
| 1168 | | break; |
| 1169 | | //POP data addr |
| 1170 | | case 0xd0: /* 1: 1101 0000 */ |
| 1171 | | pop(); |
| 1172 | | break; |
| 1173 | | //ACALL code addr /* 1: aaa1 0001 */ |
| 1174 | | case 0xd1: |
| 1175 | | acall(); |
| 1176 | | break; |
| 1177 | | //SETB bit addr |
| 1178 | | case 0xd2: /* 1: 1101 0010 */ |
| 1179 | | RWM=1; |
| 1180 | | setb_bitaddr(); |
| 1181 | | RWM=0; |
| 1182 | | break; |
| 1183 | | //SETB C |
| 1184 | | case 0xd3: /* 1: 1101 0011 */ |
| 1185 | | setb_c(); |
| 1186 | | break; |
| 1187 | | //DA A |
| 1188 | | case 0xd4: /* 1: 1101 0100 */ |
| 1189 | | da_a(); |
| 1190 | | break; |
| 1191 | | //DJNZ data addr, code addr |
| 1192 | | case 0xd5: /* 1: 1101 0101 */ |
| 1193 | | RWM=1; |
| 1194 | | djnz_mem(); |
| 1195 | | RWM=0; |
| 1196 | | break; |
| 1197 | | //XCHD A, @R0/@R1 /* 1: 1101 011i */ |
| 1198 | | case 0xd6: |
| 1199 | | case 0xd7: |
| 1200 | | xchd_a_ir(op&1); |
| 1201 | | break; |
| 1202 | | //DJNZ R0 to R7,code addr /* 1: 1101 1rrr */ |
| 1203 | | case 0xd8: |
| 1204 | | case 0xd9: |
| 1205 | | case 0xda: |
| 1206 | | case 0xdb: |
| 1207 | | case 0xdc: |
| 1208 | | case 0xdd: |
| 1209 | | case 0xde: |
| 1210 | | case 0xdf: |
| 1211 | | djnz_r(op&7); |
| 1212 | | break; |
| 1213 | | //MOVX A,@DPTR |
| 1214 | | case 0xe0: /* 1: 1110 0000 */ |
| 1215 | | movx_a_idptr(); |
| 1216 | | break; |
| 1217 | | //AJMP code addr /* 1: aaa0 0001 */ |
| 1218 | | case 0xe1: |
| 1219 | | ajmp(); |
| 1220 | | break; |
| 1221 | | //MOVX A, @R0/@R1 /* 1: 1110 001i */ |
| 1222 | | case 0xe2: |
| 1223 | | case 0xe3: |
| 1224 | | movx_a_ir(op&1); |
| 1225 | | break; |
| 1226 | | //CLR A |
| 1227 | | case 0xe4: /* 1: 1110 0100 */ |
| 1228 | | clr_a(); |
| 1229 | | break; |
| 1230 | | //MOV A, data addr |
| 1231 | | case 0xe5: /* 1: 1110 0101 */ |
| 1232 | | mov_a_mem(); |
| 1233 | | break; |
| 1234 | | //MOV A,@RO/@R1 /* 1: 1110 011i */ |
| 1235 | | case 0xe6: |
| 1236 | | case 0xe7: |
| 1237 | | mov_a_ir(op&1); |
| 1238 | | break; |
| 1239 | | //MOV A,R0 to R7 /* 1: 1110 1rrr */ |
| 1240 | | case 0xe8: |
| 1241 | | case 0xe9: |
| 1242 | | case 0xea: |
| 1243 | | case 0xeb: |
| 1244 | | case 0xec: |
| 1245 | | case 0xed: |
| 1246 | | case 0xee: |
| 1247 | | case 0xef: |
| 1248 | | mov_a_r(op&7); |
| 1249 | | break; |
| 1250 | | //MOVX @DPTR,A |
| 1251 | | case 0xf0: /* 1: 1111 0000 */ |
| 1252 | | movx_idptr_a(); |
| 1253 | | break; |
| 1254 | | //ACALL code addr /* 1: aaa1 0001 */ |
| 1255 | | case 0xf1: |
| 1256 | | acall(); |
| 1257 | | break; |
| 1258 | | //MOVX @R0/@R1,A /* 1: 1111 001i */ |
| 1259 | | case 0xf2: |
| 1260 | | case 0xf3: |
| 1261 | | movx_ir_a(op&1); |
| 1262 | | break; |
| 1263 | | //CPL A |
| 1264 | | case 0xf4: /* 1: 1111 0100 */ |
| 1265 | | cpl_a(); |
| 1266 | | break; |
| 1267 | | //MOV data addr, A |
| 1268 | | case 0xf5: /* 1: 1111 0101 */ |
| 1269 | | mov_mem_a(); |
| 1270 | | break; |
| 1271 | | //MOV @R0/@R1, A /* 1: 1111 011i */ |
| 1272 | | case 0xf6: |
| 1273 | | case 0xf7: |
| 1274 | | mov_ir_a(op&1); |
| 1275 | | break; |
| 1276 | | //MOV R0 to R7, A /* 1: 1111 1rrr */ |
| 1277 | | case 0xf8: |
| 1278 | | case 0xf9: |
| 1279 | | case 0xfa: |
| 1280 | | case 0xfb: |
| 1281 | | case 0xfc: |
| 1282 | | case 0xfd: |
| 1283 | | case 0xfe: |
| 1284 | | case 0xff: |
| 1285 | | mov_r_a(op&7); |
| 1286 | | break; |
| 1287 | | default: |
| 1288 | | illegal(); |
| 1289 | | } |
| 409 | /* Macros for accessing flags */ |
| 1290 | 410 | |
| 1291 | | //Store # of used cycles for this opcode (for timer & serial check at top of code) |
| 1292 | | i8051.prev_used_cycles = i8051_cycles[op]; |
| 411 | #define GET_CY GET_BIT(PSW, 7) |
| 412 | #define GET_AC GET_BIT(PSW, 6) |
| 413 | #define GET_FO GET_BIT(PSW, 5) |
| 414 | #define GET_RS GET_BIT(PSW, 3) |
| 415 | #define GET_OV GET_BIT(PSW, 2) |
| 416 | #define GET_P GET_BIT(PSW, 0) |
| 1293 | 417 | |
| 1294 | | //Check for pending interrupts & handle - remove cycles used |
| 1295 | | i8051_icount-=check_interrupts(); |
| 418 | #define GET_EA GET_BIT(IE, 7) |
| 419 | #define GET_ET2 GET_BIT(IE, 5) |
| 420 | #define GET_ES GET_BIT(IE, 4) |
| 421 | #define GET_ET1 GET_BIT(IE, 3) |
| 422 | #define GET_EX1 GET_BIT(IE, 2) |
| 423 | #define GET_ET0 GET_BIT(IE, 1) |
| 424 | #define GET_EX0 GET_BIT(IE, 0) |
| 1296 | 425 | |
| 1297 | | } while( i8051_icount > 0 ); |
| 426 | /* 8052 Only flags */ |
| 427 | #define GET_PT2 GET_BIT(IP, 5) |
| 1298 | 428 | |
| 1299 | | return cycles - i8051_icount; |
| 1300 | | } |
| 429 | #define GET_PS GET_BIT(IP, 4) |
| 430 | #define GET_PT1 GET_BIT(IP, 3) |
| 431 | #define GET_PX1 GET_BIT(IP, 2) |
| 432 | #define GET_PT0 GET_BIT(IP, 1) |
| 433 | #define GET_PX0 GET_BIT(IP, 0) |
| 1301 | 434 | |
| 1302 | | /* Get registers, return context size */ |
| 1303 | | void i8051_get_context(void *dst) |
| 1304 | | { |
| 1305 | | if( dst ) |
| 1306 | | memcpy(dst, &i8051, sizeof(I8051)); |
| 1307 | | } |
| 435 | #define GET_TF1 GET_BIT(TCON, 7) |
| 436 | #define GET_TR1 GET_BIT(TCON, 6) |
| 437 | #define GET_TF0 GET_BIT(TCON, 5) |
| 438 | #define GET_TR0 GET_BIT(TCON, 4) |
| 439 | #define GET_IE1 GET_BIT(TCON, 3) |
| 440 | #define GET_IT1 GET_BIT(TCON, 2) |
| 441 | #define GET_IE0 GET_BIT(TCON, 1) |
| 442 | #define GET_IT0 GET_BIT(TCON, 0) |
| 1308 | 443 | |
| 1309 | | /* Set registers */ |
| 1310 | | void i8051_set_context(void *src) |
| 1311 | | { |
| 1312 | | if( src ) |
| 1313 | | memcpy(&i8051, src, sizeof(I8051)); |
| 1314 | | } |
| 444 | #define GET_SM0 GET_BIT(SCON, 7) |
| 445 | #define GET_SM1 GET_BIT(SCON, 6) |
| 446 | #define GET_SM2 GET_BIT(SCON, 5) |
| 447 | #define GET_REN GET_BIT(SCON, 4) |
| 448 | #define GET_TB8 GET_BIT(SCON, 3) |
| 449 | #define GET_RB8 GET_BIT(SCON, 2) |
| 450 | #define GET_TI GET_BIT(SCON, 1) |
| 451 | #define GET_RI GET_BIT(SCON, 0) |
| 1315 | 452 | |
| 1316 | | /* Get Internal RAM value */ |
| 1317 | | unsigned i8051_get_intram(int offset) |
| 1318 | | { |
| 1319 | | UINT8 ram_ret = 0; |
| 1320 | | RWM = 1; |
| 1321 | | ram_ret = IRAM_R(offset); |
| 1322 | | RWM = 0; |
| 1323 | | return ram_ret; |
| 1324 | | } |
| 453 | #define GET_GATE1 GET_BIT(TMOD, 7) |
| 454 | #define GET_CT1 GET_BIT(TMOD, 6) |
| 455 | #define GET_M1_1 GET_BIT(TMOD, 5) |
| 456 | #define GET_M1_0 GET_BIT(TMOD, 4) |
| 457 | #define GET_GATE0 GET_BIT(TMOD, 3) |
| 458 | #define GET_CT0 GET_BIT(TMOD, 2) |
| 459 | #define GET_M0_1 GET_BIT(TMOD, 1) |
| 460 | #define GET_M0_0 GET_BIT(TMOD, 0) |
| 1325 | 461 | |
| 1326 | | /*NOTE: These are not used by the opcode functions, they are here only for MAME requirements*/ |
| 1327 | | unsigned i8051_get_reg(int regnum) |
| 1328 | | { |
| 1329 | | switch( regnum ) |
| 1330 | | { |
| 1331 | | case REG_PREVIOUSPC: return PPC; |
| 1332 | | case REG_PC: |
| 1333 | | case I8051_PC: return PC; |
| 1334 | | case REG_SP: |
| 1335 | | case I8051_SP: return R_SP; |
| 1336 | | case I8051_ACC: return R_ACC; |
| 1337 | | case I8051_PSW: return R_PSW; |
| 1338 | | case I8051_B: return R_B; |
| 1339 | | case I8051_DPH: return R_DPH; |
| 1340 | | case I8051_DPL: return R_DPL; |
| 1341 | | case I8051_IE: return R_IE; |
| 1342 | | //Not real registers |
| 1343 | | case I8051_R0: return R_R(0); |
| 1344 | | case I8051_R1: return R_R(1); |
| 1345 | | case I8051_R2: return R_R(2); |
| 1346 | | case I8051_R3: return R_R(3); |
| 1347 | | case I8051_R4: return R_R(4); |
| 1348 | | case I8051_R5: return R_R(5); |
| 1349 | | case I8051_R6: return R_R(6); |
| 1350 | | case I8051_R7: return R_R(7); |
| 1351 | | case I8051_RB: return GET_RS; |
| 1352 | | default: |
| 1353 | | return 0; |
| 1354 | | } |
| 1355 | | } |
| 462 | #define GET_SMOD GET_BIT(PCON, 7) |
| 463 | #define GET_GF1 GET_BIT(TMOD, 3) |
| 464 | #define GET_GF0 GET_BIT(TMOD, 2) |
| 465 | #define GET_PD GET_BIT(TMOD, 1) /* Only in 80C51BH */ |
| 466 | #define GET_IDL GET_BIT(TMOD, 0) /* Only in 80C51BH */ |
| 1356 | 467 | |
| 1357 | | /*NOTE: These are not used by the opcode functions, they are here only for MAME requirements*/ |
| 1358 | | void i8051_set_reg (int regnum, unsigned val) |
| 1359 | | { |
| 1360 | | switch( regnum ) |
| 1361 | | { |
| 1362 | | case REG_PC: |
| 1363 | | case I8051_PC: PC = val & 0xffff; break; |
| 1364 | | case REG_SP: |
| 1365 | | case I8051_SP: SFR_W(SP,val); break; //Use SFR to handle error checking |
| 1366 | | case I8051_ACC: SFR_W(ACC,val); break; |
| 1367 | | case I8051_PSW: SFR_W(PSW,val); break; |
| 1368 | | case I8051_B: SFR_W(B,val); break; |
| 1369 | | case I8051_DPH: SFR_W(DPH,val); break; |
| 1370 | | case I8051_DPL: SFR_W(DPL,val); break; |
| 1371 | | case I8051_IE: SFR_W(IE,val); break; |
| 1372 | | //Not real registers |
| 1373 | | case I8051_R0: R_R(0) = val; break; |
| 1374 | | case I8051_R1: R_R(1) = val; break; |
| 1375 | | case I8051_R2: R_R(2) = val; break; |
| 1376 | | case I8051_R3: R_R(3) = val; break; |
| 1377 | | case I8051_R4: R_R(4) = val; break; |
| 1378 | | case I8051_R5: R_R(5) = val; break; |
| 1379 | | case I8051_R6: R_R(6) = val; break; |
| 1380 | | case I8051_R7: R_R(7) = val; break; |
| 1381 | | case I8051_RB: SET_RS( (val&3) ); break; |
| 468 | /* 8052 Only flags */ |
| 469 | #define GET_TF2 GET_BIT(T2CON, 7) |
| 470 | #define GET_EXF2 GET_BIT(T2CON, 6) |
| 471 | #define GET_RCLK GET_BIT(T2CON, 5) |
| 472 | #define GET_TCLK GET_BIT(T2CON, 4) |
| 473 | #define GET_EXEN2 GET_BIT(T2CON, 3) |
| 474 | #define GET_TR2 GET_BIT(T2CON, 2) |
| 475 | #define GET_CT2 GET_BIT(T2CON, 1) |
| 476 | #define GET_CP GET_BIT(T2CON, 0) |
| 1382 | 477 | |
| 1383 | | default: |
| 1384 | | return; |
| 1385 | | } |
| 1386 | | } |
| 478 | /*Add and Subtract Flag settings*/ |
| 479 | #define DO_ADD_FLAGS(a,d,c) do_add_flags(a,d,c) |
| 480 | #define DO_SUB_FLAGS(a,d,c) do_sub_flags(a,d,c) |
| 1387 | 481 | |
| 1388 | | void i8051_set_irq_line(int irqline, int state) |
| 1389 | | { |
| 1390 | | switch( irqline ) |
| 1391 | | { |
| 1392 | | //External Interrupt 0 |
| 1393 | | case I8051_INT0_LINE: |
| 1394 | | //Line Asserted? |
| 1395 | | if (state != CLEAR_LINE) { |
| 1396 | | //Is the enable flag for this interrupt set? |
| 1397 | | if(GET_EX0) { |
| 1398 | | //Need cleared->active line transition? (Logical 1-0 Pulse on the line) - CLEAR->ASSERT Transition since INT0 active lo! |
| 1399 | | if(GET_IT0){ |
| 1400 | | if(i8051.last_int0 == CLEAR_LINE) |
| 1401 | | SET_IE0(1); |
| 1402 | | } |
| 1403 | | else |
| 1404 | | SET_IE0(1); //Nope, just set it.. |
| 1405 | | } |
| 1406 | | } |
| 1407 | | else |
| 1408 | | SET_IE0(0); //Clear Int occurred flag |
| 1409 | | i8051.last_int0 = state; |
| 482 | #define SET_PARITY() do {mcs51.recalc_parity |= 1;} while (0) |
| 483 | #define PUSH_PC() push_pc() |
| 484 | #define POP_PC() pop_pc() |
| 1410 | 485 | |
| 1411 | | //Do the interrupt & handle - remove machine cycles used |
| 1412 | | if(GET_IE0) |
| 1413 | | i8051_icount-=check_interrupts(); |
| 1414 | | break; |
| 486 | #if 0 |
| 487 | /* Any pending IRQ */ |
| 488 | #define SERIALPORT_IRQ ((R_SCON & 0x03) && GET_ES) |
| 489 | #define TIMERS_IRQ ((GET_TF0 && GET_ET0) || (GET_TF1 && GET_ET1)) |
| 490 | #define EXTERNAL_IRQ ((GET_IE0 && GET_EX0) || (GET_IE1 && GET_EX1)) |
| 1415 | 491 | |
| 1416 | | //External Interrupt 1 |
| 1417 | | case I8051_INT1_LINE: |
| 1418 | | |
| 1419 | | //Line Asserted? |
| 1420 | | if (state != CLEAR_LINE) { |
| 1421 | | if(GET_EX1) { |
| 1422 | | //Need cleared->active line transition? (Logical 1-0 Pulse on the line) - CLEAR->ASSERT Transition since INT1 active lo! |
| 1423 | | if(GET_IT1){ |
| 1424 | | if(i8051.last_int1 == CLEAR_LINE) |
| 1425 | | SET_IE1(1); |
| 1426 | | } |
| 1427 | | else |
| 1428 | | SET_IE1(1); //Nope, just set it.. |
| 1429 | | } |
| 1430 | | } |
| 1431 | | else |
| 1432 | | SET_IE1(0); //Clear Int occurred flag |
| 1433 | | i8051.last_int1 = state; |
| 1434 | | |
| 1435 | | //Do the interrupt & handle - remove machine cycles used |
| 1436 | | if(GET_IE1) |
| 1437 | | i8051_icount-=check_interrupts(); |
| 1438 | | break; |
| 1439 | | |
| 1440 | | //Serial Port Receive |
| 1441 | | case I8051_RX_LINE: |
| 1442 | | //Is the enable flags for this interrupt set? |
| 1443 | | if(GET_ES && GET_REN) { |
| 1444 | | int data = 0; |
| 1445 | | //Call our callball function to retrieve the data |
| 1446 | | if(i8051.serial_rx_callback) |
| 1447 | | data = i8051.serial_rx_callback(); |
| 1448 | | //Update the register directly, since SFR_W() will trigger a serial transmit instead! |
| 1449 | | R_SBUF=data; |
| 1450 | | //Flag the IRQ |
| 1451 | | SET_RI(1); |
| 1452 | | } |
| 1453 | | break; |
| 1454 | | //Note: we won't call check interrupts, we'll let the main loop catch it |
| 1455 | | } |
| 1456 | | } |
| 1457 | | |
| 1458 | | /*********************************************************************************** |
| 1459 | | Check for pending Interrupts and process - returns # of cycles used for the int |
| 1460 | | |
| 1461 | | Note about priority & interrupting interrupts.. |
| 1462 | | 1) A high priority interrupt cannot be interrupted by anything! |
| 1463 | | 2) A low priority interrupt can ONLY be interrupted by a high priority interrupt |
| 1464 | | 3) If more than 1 Interrupt Flag is set (ie, 2 simultaneous requests occur), |
| 1465 | | the following logic works as follows: |
| 1466 | | 1) If two requests come in of different priority levels, the higher one is selected.. |
| 1467 | | 2) If the requests are of the same level, an internal order is used: |
| 1468 | | a) IEO |
| 1469 | | b) TFO |
| 1470 | | c) IE1 |
| 1471 | | d) TF1 |
| 1472 | | e) RI+TI |
| 1473 | | f) TF2+EXF2 |
| 1474 | | **********************************************************************************/ |
| 1475 | | INLINE UINT8 check_interrupts(void) |
| 1476 | | { |
| 1477 | | //If All Inerrupts Disabled or no pending abort.. |
| 1478 | | if(!GET_EA) return 0; |
| 1479 | | |
| 1480 | | //Any Interrupts Pending? |
| 1481 | | if(NO_PENDING_IRQ) return 0; |
| 1482 | | |
| 1483 | | //Skip if current irq in progress is high priority! |
| 1484 | | if(i8051.irq_priority) { /* LOG(("high priority irq in progress, skipping irq request\n")); */ return 0; } |
| 1485 | | |
| 1486 | | //Check which interrupt(s) requests have occurred.. |
| 1487 | | //NOTE: The order of checking is based on the internal/default priority levels when levels are the same |
| 1488 | | |
| 1489 | | //External Int 0 |
| 1490 | | if(GET_IE0) { |
| 1491 | | //Set vector & priority level request |
| 1492 | | i8051.int_vec = V_IE0; |
| 1493 | | i8051.priority_request = GET_PX0; |
| 1494 | | } |
| 1495 | | //Timer 0 overflow |
| 1496 | | if(!i8051.priority_request && GET_TF0 && (!i8051.int_vec || (i8051.int_vec && GET_PT0))) { |
| 1497 | | //Set vector & priority level request |
| 1498 | | i8051.int_vec = V_TF0; |
| 1499 | | i8051.priority_request = GET_PT0; |
| 1500 | | } |
| 1501 | | //External Int 1 |
| 1502 | | if(!i8051.priority_request && GET_IE1 && (!i8051.int_vec || (i8051.int_vec && GET_PX1))) { |
| 1503 | | //Set vector & priority level request |
| 1504 | | i8051.int_vec = V_IE1; |
| 1505 | | i8051.priority_request = GET_PX1; |
| 1506 | | } |
| 1507 | | //Timer 1 overflow |
| 1508 | | if(!i8051.priority_request && GET_TF1 && (!i8051.int_vec || (i8051.int_vec && GET_PT1))) { |
| 1509 | | //Set vector & priority level request |
| 1510 | | i8051.int_vec = V_TF1; |
| 1511 | | i8051.priority_request = GET_PT1; |
| 1512 | | } |
| 1513 | | //Serial Interrupt Transmit/Receive Interrupts (Note: ES Bit - Serial Interrupts must be enabled) |
| 1514 | | if(!i8051.priority_request && GET_ES && (GET_TI || GET_RI) && (!i8051.int_vec || (i8051.int_vec && GET_PS))) { |
| 1515 | | //Set vector & priority level request |
| 1516 | | i8051.int_vec = V_RITI; |
| 1517 | | i8051.priority_request = GET_PS; |
| 1518 | | } |
| 1519 | 492 | #if (HAS_I8052 || HAS_I8752) |
| 1520 | | //Timer 2 overflow (Either Timer Overflow OR External Interrupt) |
| 1521 | | if(!i8051.priority_request && GET_ET2 && (GET_TF2 || GET_EXF2) && (!i8051.int_vec || (i8051.int_vec && GET_PT2))) { |
| 1522 | | //Set vector & priority level request |
| 1523 | | i8051.int_vec = V_TF2; |
| 1524 | | i8051.priority_request = GET_PT2; |
| 1525 | | } |
| 493 | #define NO_PENDING_IRQ !(TIMERS_IRQ) && !(EXTERNAL_IRQ) && !(SERIALPORT_IRQ) && !(GET_ET2 && (GET_TF2 || GET_EXF2)) |
| 494 | #else |
| 495 | #define NO_PENDING_IRQ !(TIMERS_IRQ) && !(EXTERNAL_IRQ) && !(SERIALPORT_IRQ) |
| 1526 | 496 | #endif |
| 497 | #endif |
| 1527 | 498 | |
| 1528 | | //Skip the interrupt request if currently processing is lo priority, and the new request IS NOT HI PRIORITY! |
| 1529 | | if(i8051.cur_irq < 0xff && !i8051.priority_request) |
| 1530 | | { LOG(("low priority irq in progress already, skipping low irq request\n")); return 0; } |
| 499 | /* Clear Current IRQ */ |
| 500 | #define CLEAR_CURRENT_IRQ() do { mcs51.cur_irq = 0xff; mcs51.irq_priority = 0; } while (0) |
| 1531 | 501 | |
| 1532 | | /*** --- Perform the interrupt --- ***/ |
| 502 | /*************************************************************************** |
| 503 | GLOBAL VARIABLES |
| 504 | ***************************************************************************/ |
| 1533 | 505 | |
| 1534 | | //Save current pc to stack, set pc to new interrupt vector |
| 1535 | | push_pc(); |
| 1536 | | PC = i8051.int_vec; |
| 506 | static int mcs51_icount; |
| 1537 | 507 | |
| 1538 | | //Set current Irq & Priority being serviced |
| 1539 | | i8051.cur_irq = i8051.int_vec; |
| 1540 | | i8051.irq_priority = i8051.priority_request; |
| 508 | static mcs51_regs mcs51; |
| 1541 | 509 | |
| 1542 | | //Clear any interrupt flags that should be cleared since we're servicing the irq! |
| 1543 | | switch(i8051.cur_irq) { |
| 1544 | | case V_IE0: |
| 1545 | | //External Int Flag only cleared when configured as Edge Triggered.. |
| 1546 | | //if(GET_IT0) - for some reason having this, breaks alving dmd games |
| 1547 | | SET_IE0(0); |
| 1548 | | break; |
| 1549 | | case V_TF0: |
| 1550 | | //Timer 0 - Always clear Flag |
| 1551 | | SET_TF0(0); |
| 1552 | | break; |
| 1553 | | case V_IE1: |
| 1554 | | //External Int Flag only cleared when configured as Edge Triggered.. |
| 1555 | | //if(GET_IT1) - for some reason having this, breaks alving dmd games |
| 1556 | | SET_IE1(0); |
| 1557 | | break; |
| 1558 | | case V_TF1: |
| 1559 | | //Timer 0 - Always clear Flag |
| 1560 | | SET_TF1(0); |
| 1561 | | break; |
| 1562 | | case V_RITI: |
| 1563 | | // no flags are cleared, TI and RI remain set until reset by software |
| 1564 | | break; |
| 1565 | | #if (HAS_I8052 || HAS_I8752) |
| 1566 | | case V_TF2: |
| 1567 | | // no flags are cleared according to manual |
| 1568 | | break; |
| 1569 | | #endif |
| 1570 | | } |
| 1571 | 510 | |
| 1572 | | //Clear vars.. (these are part of the 8051 structure for speed, so we don't have to dynamically allocate space each time) |
| 1573 | | i8051.int_vec = 0; |
| 1574 | | i8051.priority_request = 0; |
| 511 | /*************************************************************************** |
| 512 | FUNCTION PROTOTYPES |
| 513 | ***************************************************************************/ |
| 1575 | 514 | |
| 1576 | | //All interrupts use 2 machine cycles |
| 1577 | | return 24; |
| 1578 | | } |
| 515 | static void check_irqs(void); |
| 516 | INLINE void serial_transmit(UINT8 data); |
| 1579 | 517 | |
| 518 | /* Hold callback functions so they can be set by caller (before the cpu reset) */ |
| 1580 | 519 | |
| 1581 | | void i8051_set_irq_callback(int (*callback)(int irqline)) |
| 1582 | | { |
| 1583 | | i8051.irq_callback = callback; |
| 1584 | | } |
| 520 | static void (*hold_serial_tx_callback)(int data); |
| 521 | static int (*hold_serial_rx_callback)(void); |
| 1585 | 522 | |
| 1586 | | void i8051_set_serial_tx_callback(void (*callback)(int data)) |
| 1587 | | { |
| 1588 | | //Hold in static variable since this function can get called before reset has run, which wipes i8051 memory clean |
| 1589 | | hold_serial_tx_callback = callback; |
| 1590 | | } |
| 1591 | | void i8051_set_serial_rx_callback(int (*callback)(void)) |
| 1592 | | { |
| 1593 | | //Hold in static variable since this function can get called before reset has run, which wipes i8051 memory clean |
| 1594 | | hold_serial_rx_callback = callback; |
| 1595 | | } |
| 523 | /*************************************************************************** |
| 524 | INLINE FUNCTIONS |
| 525 | ***************************************************************************/ |
| 1596 | 526 | |
| 1597 | | void i8051_set_eram_iaddr_callback(READ32_HANDLER((*callback))) |
| 1598 | | { |
| 1599 | | //Hold in static variable since this function can get called before reset has run, which wipes i8051 memory clean |
| 1600 | | hold_eram_iaddr_callback = callback; |
| 1601 | | } |
| 527 | INLINE UINT8 r_acc(void) { return SFR_A(ADDR_ACC); } |
| 1602 | 528 | |
| 529 | INLINE UINT8 r_psw(void) { return SFR_A(ADDR_PSW); } |
| 1603 | 530 | |
| 1604 | | void i8051_state_save(void *file) |
| 531 | INLINE void update_ptrs(void) |
| 1605 | 532 | { |
| 533 | mcs51.internal_ram = memory_get_write_ptr(cpu_getactivecpu(), ADDRESS_SPACE_DATA, 0x00); |
| 534 | mcs51.sfr_ram = memory_get_write_ptr(cpu_getactivecpu(), ADDRESS_SPACE_DATA, 0x100); |
| 1606 | 535 | } |
| 1607 | 536 | |
| 1608 | | void i8051_state_load(void *file) |
| 1609 | | { |
| 1610 | | } |
| 1611 | 537 | |
| 1612 | | /* HELPER FUNCTIONS */ |
| 538 | /* Generate an external ram address for read/writing using indirect addressing mode */ |
| 539 | /*The lowest 8 bits of the address are passed in (from the R0/R1 register), however |
| 540 | the hardware can be configured to set the rest of the address lines to any available output port pins, which |
| 541 | means the only way we can implement this is to allow the driver to setup a callback to generate the |
| 542 | address as defined by the specific hardware setup. We'll assume the address won't be bigger than 32 bits |
| 1613 | 543 | |
| 1614 | | /*All writes to SFR are handled here*/ |
| 1615 | | static WRITE8_HANDLER(sfr_write) |
| 1616 | | { |
| 1617 | | data &= 0xff; //Ensure only 8 bits |
| 1618 | | switch (offset) |
| 1619 | | { |
| 1620 | | case P0: |
| 1621 | | R_P0 = data; |
| 1622 | | OUT(0,data); |
| 1623 | | break; |
| 544 | Couriersud, October 2008: |
| 545 | There is no way external hardware can distinguish between 8bit access and 16 bit access. |
| 546 | During 16bit access the high order byte of the address is output on port 2. We therefore |
| 547 | assume that most hardware will use port 2 for 8bit access as well. |
| 1624 | 548 | |
| 1625 | | case SP: |
| 1626 | | if(offset > 0xff) |
| 1627 | | LOG(("i8051 #%d: attemping to write value to SP past 256 bytes at 0x%04x\n", cpu_getactivecpu(), PC)); |
| 1628 | | R_SP = data&0xff; //keep sp w/in 256 bytes |
| 1629 | | break; |
| 549 | On configurations where 8 bit access in conjunction with other ports is used, |
| 550 | it is up to the driver to use AM_MIRROR to mask out the high level address and |
| 551 | provide it's own mapping. |
| 552 | */ |
| 1630 | 553 | |
| 1631 | | case DPL: R_DPL = data; break; |
| 1632 | | case DPH: R_DPH = data; break; |
| 1633 | | case PCON: R_PCON= data; break; |
| 1634 | | case TCON: R_TCON= data; break; |
| 1635 | | case TMOD: R_TMOD= data; break; |
| 1636 | | case TL0: R_TL0 = data; break; |
| 1637 | | case TL1: R_TL1 = data; break; |
| 1638 | | case TH0: R_TH0 = data; break; |
| 1639 | | case TH1: R_TH1 = data; break; |
| 1640 | | |
| 1641 | | case P1: |
| 1642 | | R_P1 = data; |
| 1643 | | OUT(1,data); |
| 1644 | | break; |
| 1645 | | |
| 1646 | | case SCON: { |
| 1647 | | //Update register |
| 1648 | | R_SCON = data; |
| 1649 | | break; |
| 1650 | | } |
| 1651 | | |
| 1652 | | case SBUF: |
| 1653 | | //R_SBUF = data; //This register is used only for "Receiving data coming in!" |
| 1654 | | serial_transmit(data); //Set up to transmit the data |
| 1655 | | break; |
| 1656 | | |
| 1657 | | case P2: |
| 1658 | | R_P2 = data; |
| 1659 | | OUT(2,data); |
| 1660 | | break; |
| 1661 | | |
| 1662 | | case IE: R_IE = data; break; |
| 1663 | | |
| 1664 | | case P3: |
| 1665 | | R_P3 = data; |
| 1666 | | OUT(3,data); |
| 1667 | | break; |
| 1668 | | |
| 1669 | | case IP: R_IP = data; break; |
| 1670 | | |
| 1671 | | //8052 Only registers |
| 1672 | | #if (HAS_I8052 || HAS_I8752) |
| 1673 | | case T2CON: R_T2CON = data; break; |
| 1674 | | case RCAP2L: R_RCAP2L = data; break; |
| 1675 | | case RCAP2H: R_RCAP2H = data; break; |
| 1676 | | case TL2: R_TL2 = data; break; |
| 1677 | | case TH2: R_TH2 = data; break; |
| 1678 | | #endif |
| 1679 | | |
| 1680 | | case PSW: |
| 1681 | | R_PSW = data; |
| 1682 | | SET_PARITY; |
| 1683 | | break; |
| 1684 | | |
| 1685 | | case ACC: |
| 1686 | | R_ACC = data; |
| 1687 | | SET_PARITY; |
| 1688 | | break; |
| 1689 | | |
| 1690 | | case B: R_B = data; break; |
| 1691 | | |
| 1692 | | /* Illegal or non-implemented sfr */ |
| 1693 | | default: |
| 1694 | | LOG(("i8051 #%d: attemping to write to an invalid/non-implemented SFR address: %x at 0x%04x, data=%x\n", cpu_getactivecpu(), offset,PC,data)); |
| 1695 | | } |
| 1696 | | } |
| 1697 | | |
| 1698 | | /*All reads to SFR are handled here*/ |
| 1699 | | static READ8_HANDLER(sfr_read) |
| 554 | INLINE offs_t external_ram_iaddr(offs_t offset, offs_t mem_mask) |
| 1700 | 555 | { |
| 1701 | | switch (offset) |
| 1702 | | { |
| 1703 | | case P0: |
| 1704 | | if(RWM) |
| 1705 | | return R_P0; //Read directly from port latch |
| 1706 | | else |
| 1707 | | return IN(0); //Read from actual port |
| 1708 | | case SP: return R_SP; |
| 1709 | | case DPL: return R_DPL; |
| 1710 | | case DPH: return R_DPH; |
| 1711 | | case PCON: return R_PCON; |
| 1712 | | case TCON: return R_TCON; |
| 1713 | | case TMOD: return R_TMOD; |
| 1714 | | case TL0: return R_TL0; |
| 1715 | | case TL1: return R_TL1; |
| 1716 | | case TH0: return R_TH0; |
| 1717 | | case TH1: return R_TH1; |
| 1718 | | case P1: |
| 1719 | | if(RWM) |
| 1720 | | return R_P1; //Read directly from port latch |
| 1721 | | else |
| 1722 | | return IN(1); //Read from actual port |
| 1723 | | case SCON: return R_SCON; |
| 1724 | | case SBUF: return R_SBUF; |
| 1725 | | case P2: |
| 1726 | | if(RWM) |
| 1727 | | return R_P2; //Read directly from port latch |
| 1728 | | else |
| 1729 | | return IN(2); //Read from actual port |
| 1730 | | case IE: return R_IE; |
| 1731 | | case P3: |
| 1732 | | if(RWM) |
| 1733 | | return R_P3; //Read directly from port latch |
| 1734 | | else |
| 1735 | | return IN(3); //Read from actual port |
| 1736 | | case IP: return R_IP; |
| 1737 | | //8052 Only registers |
| 1738 | | #if (HAS_I8052 || HAS_I8752) |
| 1739 | | case T2CON: return R_T2CON; |
| 1740 | | case RCAP2L: return R_RCAP2L; |
| 1741 | | case RCAP2H: return R_RCAP2H; |
| 1742 | | case TL2: return R_TL2; |
| 1743 | | case TH2: return R_TH2; |
| 1744 | | #endif |
| 1745 | | case PSW: return R_PSW; |
| 1746 | | case ACC: return R_ACC; |
| 1747 | | case B: return R_B; |
| 1748 | | |
| 1749 | | /* Illegal or non-implemented sfr */ |
| 1750 | | default: |
| 1751 | | LOG(("i8051 #%d: attemping to read an invalid/non-implemented SFR address: %x at 0x%04x\n", cpu_getactivecpu(), offset,PC)); |
| 1752 | | } |
| 1753 | | return 0xff; |
| 556 | if (mem_mask == 0x00ff) |
| 557 | return (offset & mem_mask) | (P2 << 8); |
| 558 | #if 0 |
| 559 | if(mcs51.eram_iaddr_callback) |
| 560 | return mcs51.eram_iaddr_callback(machine,offset,mem_mask); |
| 561 | else |
| 562 | if (mem_mask <= 0x100) LOG(("mcs51 #%d: external ram address requested (8 bit offset=%02x), but no callback available! at PC:%04x\n", cpu_getactivecpu(), offset, PC)); |
| 563 | #endif |
| 564 | return offset; |
| 1754 | 565 | } |
| 1755 | 566 | |
| 1756 | | /* Reads the contents of the Internal RAM memory */ |
| 1757 | | /* Anything above 0x7f is a sfr/register */ |
| 1758 | | static READ8_HANDLER(internal_ram_read) |
| 1759 | | { |
| 1760 | | if (offset < 0x80) |
| 1761 | | return i8051.IntRam[offset]; |
| 1762 | | else { |
| 1763 | | if (offset < 0x100) |
| 1764 | | return SFR_R(offset); |
| 1765 | | else |
| 1766 | | LOG(("i8051 #%d: attemping to read from an invalid Internal Ram address: %x at 0x%04x\n", cpu_getactivecpu(), offset,PC)); |
| 1767 | | } |
| 1768 | | return 0xff; |
| 1769 | | } |
| 567 | /* Internal ram read/write */ |
| 1770 | 568 | |
| 1771 | | /* Writes the contents of the Internal RAM memory */ |
| 1772 | | /* Anything above 0x7f is a sfr/register */ |
| 1773 | | static WRITE8_HANDLER(internal_ram_write) |
| 569 | INLINE UINT8 iram_read(size_t offset) |
| 1774 | 570 | { |
| 1775 | | data &= 0xff; //Ensure it's only 8 bits |
| 1776 | | if (offset < 0x80) |
| 1777 | | i8051.IntRam[offset] = data; |
| 1778 | | else { |
| 1779 | | if (offset < 0x100) |
| 1780 | | SFR_W(offset,data); |
| 1781 | | else |
| 1782 | | LOG(("i8051 #%d: attemping to write to invalid Internal Ram address: %x at 0x%04x\n", cpu_getactivecpu(), offset,PC)); |
| 1783 | | } |
| 571 | return (((offset) < 0x80) ? data_read_byte_8le(offset) : mcs51.sfr_read(offset)); |
| 1784 | 572 | } |
| 1785 | 573 | |
| 1786 | | /* Reads the contents of the Internal RAM memory (BUT CALLED FROM AN INDIRECT ADDRESSING MODE) */ |
| 1787 | | /* Different chip types handle differently, for speed, simply call the chip's handler */ |
| 1788 | | static READ8_HANDLER(internal_ram_iread) |
| 574 | INLINE void iram_write(size_t offset, UINT8 data) |
| 1789 | 575 | { |
| 1790 | | return i8051.iram_iread(machine,offset); |
| 576 | if ((offset) < 0x80) |
| 577 | data_write_byte_8le(offset, data); |
| 578 | else |
| 579 | mcs51.sfr_write(offset, data); |
| 1791 | 580 | } |
| 1792 | 581 | |
| 1793 | | /* Writes the contents of the Internal RAM memory (BUT CALLED FROM AN INDIRECT ADDRESSING MODE) */ |
| 1794 | | /* Different chip types handle differently, for speed, simply call the chip's handler */ |
| 1795 | | static WRITE8_HANDLER(internal_ram_iwrite) |
| 1796 | | { |
| 1797 | | i8051.iram_iwrite(machine,offset,data); |
| 1798 | | } |
| 1799 | | |
| 1800 | | /*Generate an external ram address for read/writing using indirect addressing mode */ |
| 1801 | | /*The lowest 8 bits of the address are passed in (from the R0/R1 register), however |
| 1802 | | the hardware can be configured to set the rest of the address lines to any available output port pins, which |
| 1803 | | means the only way we can implement this is to allow the driver to setup a callback to generate the |
| 1804 | | address as defined by the specific hardware setup. We'll assume the address won't be bigger than 32 bits |
| 1805 | | */ |
| 1806 | | static READ32_HANDLER(external_ram_iaddr) |
| 1807 | | { |
| 1808 | | if(i8051.eram_iaddr_callback) |
| 1809 | | return i8051.eram_iaddr_callback(machine,offset,mem_mask); |
| 1810 | | else |
| 1811 | | LOG(("i8051 #%d: external ram address requested (8 bit offset=%02x), but no callback available! at PC:%04x\n", cpu_getactivecpu(), offset, PC)); |
| 1812 | | |
| 1813 | | return offset; |
| 1814 | | } |
| 1815 | | |
| 1816 | 582 | /*Push the current PC to the stack*/ |
| 1817 | | INLINE void push_pc() |
| 583 | INLINE void push_pc(void) |
| 1818 | 584 | { |
| 1819 | | UINT8 tmpSP = R_SP; //Grab and Increment Stack Pointer |
| 585 | UINT8 tmpSP = SP+1; //Grab and Increment Stack Pointer |
| 586 | IRAM_IW(tmpSP, (PC & 0xff)); //Store low byte of PC to Internal Ram (Use IRAM_IW to store stack above 128 bytes) |
| 1820 | 587 | tmpSP++; // "" |
| 1821 | | SFR_W(SP,tmpSP); // "" |
| 1822 | | if (tmpSP == R_SP) //Ensure it was able to write to new stack location |
| 1823 | | IRAM_IW(tmpSP, (PC & 0xff)); //Store low byte of PC to Internal Ram (Use IRAM_IW to store stack above 128 bytes) |
| 1824 | | tmpSP = R_SP; //Increment Stack Pointer |
| 1825 | | tmpSP++; // "" |
| 1826 | | SFR_W(SP,tmpSP); // "" |
| 1827 | | if (tmpSP == R_SP) //Ensure it was able to write to new stack location |
| 1828 | | IRAM_IW(tmpSP, ( (PC & 0xff00) >> 8)); //Store hi byte of PC to next address in Internal Ram (Use IRAM_IW to store stack above 128 bytes) |
| 588 | SP = tmpSP; // "" |
| 589 | IRAM_IW(tmpSP, ( (PC & 0xff00) >> 8)); //Store hi byte of PC to next address in Internal Ram (Use IRAM_IW to store stack above 128 bytes) |
| 1829 | 590 | } |
| 1830 | 591 | |
| 1831 | 592 | /*Pop the current PC off the stack and into the pc*/ |
| 1832 | | INLINE void pop_pc() |
| 593 | INLINE void pop_pc(void) |
| 1833 | 594 | { |
| 1834 | | UINT8 tmpSP = R_SP; //Grab Stack Pointer |
| 1835 | | PC = (IRAM_IR(tmpSP) & 0xff) << 8; //Store hi byte to PC (must use IRAM_IR to access stack pointing above 128 bytes) |
| 1836 | | tmpSP = R_SP-1; //Decrement Stack Pointer |
| 1837 | | SFR_W(SP,tmpSP); // "" |
| 1838 | | if (tmpSP == R_SP) //Ensure it was able to write to new stack location |
| 1839 | | PC = PC | IRAM_IR(tmpSP); //Store lo byte to PC (must use IRAM_IR to access stack pointing above 128 bytes) |
| 1840 | | SFR_W(SP,tmpSP-1); //Decrement Stack Pointer |
| 595 | UINT8 tmpSP = SP; //Grab Stack Pointer |
| 596 | PC = (IRAM_IR(tmpSP--) & 0xff) << 8; //Store hi byte to PC (must use IRAM_IR to access stack pointing above 128 bytes) |
| 597 | PC = PC | IRAM_IR(tmpSP--); //Store lo byte to PC (must use IRAM_IR to access stack pointing above 128 bytes) |
| 598 | SP = tmpSP; //Decrement Stack Pointer |
| 599 | change_pc(PC); |
| 1841 | 600 | } |
| 1842 | 601 | |
| 1843 | 602 | //Set the PSW Parity Flag |
| 1844 | | INLINE void set_parity() |
| 603 | INLINE void set_parity(void) |
| 1845 | 604 | { |
| 1846 | 605 | //This flag will be set when the accumulator contains an odd # of bits set.. |
| 1847 | | int i, |
| 1848 | | p = 0; |
| 1849 | | for (i=1; i<=128; i=i*2) { //Test for each of the 8 bits in the ACC! |
| 1850 | | if ((R_ACC & i) != 0) |
| 1851 | | p++; //Keep track of how many bits are set |
| 606 | UINT8 p = 0; |
| 607 | int i; |
| 608 | UINT8 a = ACC; |
| 609 | |
| 610 | for (i=0; i<8; i++) { //Test for each of the 8 bits in the ACC! |
| 611 | p ^= (a & 1); |
| 612 | a = (a >> 1); |
| 1852 | 613 | } |
| 1853 | 614 | |
| 1854 | | //Update the PSW Pairty bit |
| 1855 | 615 | SET_P(p & 1); |
| 1856 | 616 | } |
| 1857 | 617 | |
| 1858 | | static READ8_HANDLER(bit_address_r) |
| 618 | INLINE UINT8 bit_address_r(UINT8 offset) |
| 1859 | 619 | { |
| 1860 | | int word; |
| 1861 | | int mask; |
| 620 | UINT8 word; |
| 621 | UINT8 mask; |
| 1862 | 622 | int bit_pos; |
| 1863 | | int base; /* base of bit space or sfr */ |
| 1864 | 623 | int distance; /* distance between bit addressable words */ |
| 1865 | 624 | /* 1 for normal bits, 8 for sfr bit addresses */ |
| 1866 | 625 | |
| 1867 | | offset &= 0xff; |
| 1868 | | |
| 1869 | 626 | //User defined bit addresses 0x20-0x2f (values are 0x0-0x7f) |
| 1870 | 627 | if (offset < 0x80) { |
| 1871 | | base = 0x20; |
| 1872 | 628 | distance = 1; |
| 629 | word = ( (offset & 0x78) >> 3) * distance + 0x20; |
| 630 | bit_pos = offset & 0x7; |
| 631 | mask = (0x1 << bit_pos); |
| 632 | return((IRAM_R(word) & mask) >> bit_pos); |
| 1873 | 633 | } |
| 1874 | 634 | //SFR bit addressable registers |
| 1875 | 635 | else { |
| 1876 | | base = 0x80; |
| 1877 | 636 | distance = 8; |
| 637 | word = ( (offset & 0x78) >> 3) * distance + 0x80; |
| 638 | bit_pos = offset & 0x7; |
| 639 | mask = (0x1 << bit_pos); |
| 640 | return ((IRAM_R(word) & mask) >> bit_pos); |
| 1878 | 641 | } |
| 1879 | | word = ( (offset & 0x78) >> 3) * distance + base; |
| 1880 | | bit_pos = offset & 0x7; |
| 1881 | | mask = 0x1 << bit_pos; |
| 1882 | | return((IRAM_R(word) & mask) >> bit_pos); //Do not use IRAM_IR |
| 1883 | 642 | } |
| 1884 | 643 | |
| 1885 | 644 | |
| 1886 | | static WRITE8_HANDLER(bit_address_w) |
| 645 | INLINE void bit_address_w(UINT8 offset, UINT8 bit) |
| 1887 | 646 | { |
| 1888 | 647 | int word; |
| 1889 | | int mask; |
| 648 | UINT8 mask; |
| 1890 | 649 | int bit_pos; |
| 1891 | | int result; |
| 1892 | | int base; |
| 650 | UINT8 result; |
| 1893 | 651 | int distance; |
| 1894 | 652 | |
| 1895 | | offset &= 0xff; |
| 1896 | | |
| 1897 | | //User defined bit addresses 0x20-0x2f (values are 0x0-0x7f) |
| 653 | /* User defined bit addresses 0x20-0x2f (values are 0x0-0x7f) */ |
| 1898 | 654 | if (offset < 0x80) { |
| 1899 | | base = 0x20; |
| 1900 | 655 | distance = 1; |
| 656 | word = ((offset & 0x78) >> 3) * distance + 0x20; |
| 657 | bit_pos = offset & 0x7; |
| 658 | bit = (bit & 0x1) << bit_pos; |
| 659 | mask = ~(1 << bit_pos) & 0xff; |
| 660 | result = IRAM_R(word) & mask; |
| 661 | result = result | bit; |
| 662 | IRAM_W(word, result); |
| 1901 | 663 | } |
| 1902 | | //SFR bit addressable registers |
| 664 | /* SFR bit addressable registers */ |
| 1903 | 665 | else { |
| 1904 | | base = 0x80; |
| 1905 | 666 | distance = 8; |
| 667 | word = ((offset & 0x78) >> 3) * distance + 0x80; |
| 668 | bit_pos = offset & 0x7; |
| 669 | bit = (bit & 0x1) << bit_pos; |
| 670 | mask = ~(1 << bit_pos) & 0xff; |
| 671 | result = IRAM_R(word) & mask; |
| 672 | result = result | bit; |
| 673 | IRAM_W(word, result); |
| 1906 | 674 | } |
| 1907 | | word = ((offset & 0x78) >> 3) * distance + base; |
| 1908 | | bit_pos = offset & 0x7; |
| 1909 | | data = (data & 0x1) << bit_pos; |
| 1910 | | mask = ~(1 << bit_pos) & 0xff; |
| 1911 | | result = IRAM_R(word) & mask; //Do not use IRAM_IR |
| 1912 | | result = result | data; |
| 1913 | | IRAM_W(word, result); //Do not use IRAM_IW |
| 1914 | 675 | } |
| 1915 | 676 | |
| 1916 | | /* The following two handlers are used by the MAME Debugger Memory Window... |
| 1917 | | By keeping these functions separate from the internally used IRAM_W/IRAM_R functions, |
| 1918 | | we can manipulate and display internal memory in the debugger memory window in a layout |
| 1919 | | that is not necessarily how the real memory is.. this will be especially useful for |
| 1920 | | the 8052 chip where both the SFR and the upper 128 bytes of ram are mapped to the same |
| 1921 | | address, so we can handle that here by mapping the sfr to a different address */ |
| 1922 | | |
| 1923 | | READ8_HANDLER(i8051_internal_r) |
| 1924 | | { |
| 1925 | | //Restrict internal ram to 256 Bytes max |
| 1926 | | if(offset < 0x100) |
| 1927 | | return IRAM_R(offset); |
| 1928 | | else |
| 1929 | | return 0; |
| 1930 | | } |
| 1931 | | WRITE8_HANDLER(i8051_internal_w) |
| 1932 | | { |
| 1933 | | //Restrict internal ram to 256 Bytes max |
| 1934 | | if(offset < 0x100) |
| 1935 | | IRAM_W(offset,data); |
| 1936 | | } |
| 1937 | | |
| 1938 | 677 | INLINE void do_add_flags(UINT8 a, UINT8 data, UINT8 c) |
| 1939 | 678 | { |
| 1940 | 679 | UINT16 result = a+data+c; |
| 1941 | 680 | INT16 result1 = (INT8)a+(INT8)data+c; |
| 1942 | | int cy, ac, ov; |
| 1943 | 681 | |
| 1944 | | cy = (result & 0x100) >> 8; |
| 682 | SET_CY((result & 0x100) >> 8); |
| 1945 | 683 | result = (a&0x0f)+(data&0x0f)+c; |
| 1946 | | ac = (result & 0x10) >> 4; |
| 1947 | | ov = (result1 < -128 || result1 > 127); |
| 1948 | | |
| 1949 | | SET_CY(cy); |
| 1950 | | SET_AC(ac); |
| 1951 | | SET_OV(ov); |
| 1952 | | |
| 1953 | | // mame_printf_debug("add: result=%x, c=%x, ac=%x, ov=%x\n",a+data+c,cy,ac,ov); |
| 684 | SET_AC((result & 0x10) >> 4); |
| 685 | SET_OV(result1 < -128 || result1 > 127); |
| 1954 | 686 | } |
| 1955 | 687 | |
| 1956 | 688 | INLINE void do_sub_flags(UINT8 a, UINT8 data, UINT8 c) |
| 1957 | 689 | { |
| 1958 | 690 | UINT16 result = a-(data+c); |
| 1959 | 691 | INT16 result1 = (INT8)a-(INT8)(data+c); |
| 1960 | | int cy, ac, ov; |
| 1961 | | cy = (result & 0x100) >> 8; |
| 692 | |
| 693 | SET_CY((result & 0x100) >> 8); |
| 1962 | 694 | result = (a&0x0f)-((data&0x0f)+c); |
| 1963 | | ac = (result & 0x10) >> 4; |
| 1964 | | ov = (result1 < -128 || result1 > 127); |
| 1965 | | SET_CY(cy); |
| 1966 | | SET_AC(ac); |
| 1967 | | SET_OV(ov); |
| 695 | SET_AC((result & 0x10) >> 4); |
| 696 | SET_OV((result1 < -128 || result1 > 127)); |
| 697 | } |
| 1968 | 698 | |
| 1969 | | // mame_printf_debug("sub: a=%x, d=%x, c=%x, result=%x, cy=%x, ac=%x, ov=%x\n",a,data,c,a-data-c,cy,ac,ov); |
| 699 | INLINE void transmit_receive(int source) |
| 700 | { |
| 701 | int mode = (GET_SM0<<1) | GET_SM1; |
| 702 | |
| 703 | if (source == 1) /* timer1 */ |
| 704 | mcs51.uart.smod_div = (mcs51.uart.smod_div + 1) & (2-GET_SMOD); |
| 705 | |
| 706 | switch(mode) { |
| 707 | //8 bit shifter ( + start,stop bit ) - baud set by clock freq / 12 |
| 708 | case 0: |
| 709 | mcs51.uart.rx_clk += (source == 0) ? 16 : 0; /* clock / 12 */ |
| 710 | mcs51.uart.tx_clk += (source == 0) ? 16 : 0; /* clock / 12 */ |
| 711 | break; |
| 712 | //8 bit uart ( + start,stop bit ) - baud set by timer1 or timer2 |
| 713 | case 1: |
| 714 | case 3: |
| 715 | if (source == 1) |
| 716 | { |
| 717 | mcs51.uart.tx_clk += (GET_TCLK ? 0 : !mcs51.uart.smod_div); |
| 718 | mcs51.uart.rx_clk += (GET_RCLK ? 0 : !mcs51.uart.smod_div); |
| 719 | } |
| 720 | if (source == 2) |
| 721 | { |
| 722 | mcs51.uart.tx_clk += (GET_TCLK ? 1 : 0); |
| 723 | mcs51.uart.rx_clk += (GET_RCLK ? 1 : 0); |
| 724 | } |
| 725 | break; |
| 726 | //9 bit uart |
| 727 | case 2: |
| 728 | mcs51.uart.rx_clk += (source == 0) ? (GET_SMOD ? 6 : 3) : 0; /* clock / 12 * 3 / 8 (16) = clock / 32 (64)*/ |
| 729 | mcs51.uart.tx_clk += (source == 0) ? (GET_SMOD ? 6 : 3) : 0; /* clock / 12 */ |
| 730 | break; |
| 731 | } |
| 732 | /* transmit ? */ |
| 733 | if (mcs51.uart.tx_clk >= 16) |
| 734 | { |
| 735 | mcs51.uart.tx_clk &= 0x0f; |
| 736 | if(mcs51.uart.bits_to_send) |
| 737 | { |
| 738 | mcs51.uart.bits_to_send--; |
| 739 | if(mcs51.uart.bits_to_send == 0) { |
| 740 | //printf("Here1 %d\n", mcs51.uart.bits_to_send); |
| 741 | //Call the callback function |
| 742 | if(mcs51.serial_tx_callback) |
| 743 | mcs51.serial_tx_callback(mcs51.uart.data_out); |
| 744 | //Set Interrupt Flag |
| 745 | SET_TI(1); |
| 746 | //Note: we'll let the main loop catch the interrupt |
| 747 | } |
| 748 | } |
| 749 | |
| 750 | } |
| 751 | /* receive */ |
| 752 | if (mcs51.uart.rx_clk >= 16) |
| 753 | { |
| 754 | mcs51.uart.rx_clk &= 0x0f; |
| 755 | if (mcs51.uart.delay_cycles>0) |
| 756 | { |
| 757 | mcs51.uart.delay_cycles--; |
| 758 | if (mcs51.uart.delay_cycles == 0) |
| 759 | { |
| 760 | int data = 0; |
| 761 | //Call our callball function to retrieve the data |
| 762 | if(mcs51.serial_rx_callback) |
| 763 | data = mcs51.serial_rx_callback(); |
| 764 | //printf("RX Deliver %d\n", data); |
| 765 | SET_SBUF(data); |
| 766 | //Flag the IRQ |
| 767 | SET_RI(1); |
| 768 | } |
| 769 | } |
| 770 | } |
| 1970 | 771 | } |
| 1971 | 772 | |
| 1972 | | INLINE void update_timer(int cyc) |
| 773 | |
| 774 | INLINE void update_timer_t0(int cycles) |
| 1973 | 775 | { |
| 1974 | | //This code sucks, needs to be rewritten SJE |
| 776 | int mode = (GET_M0_1<<1) | GET_M0_0; |
| 777 | UINT32 count = 0; |
| 1975 | 778 | |
| 1976 | | //Todo: Probably better to store the current mode of the timer on a write, so we don't waste time reading it. |
| 779 | if (GET_TR0) |
| 780 | { |
| 781 | UINT32 delta; |
| 1977 | 782 | |
| 1978 | | //Note: Counting modes increment on 1 machine cycle (12 oscilator periods) - except Timer 2 in certain modes |
| 783 | /* counter / external input */ |
| 784 | delta = GET_CT0 ? mcs51.t0_cnt : cycles; |
| 785 | /* taken, reset */ |
| 786 | mcs51.t0_cnt = 0; |
| 787 | /* TODO: Not sure about IE0. The manual specifies INT0=high, |
| 788 | * which in turn means CLEAR_LINE. |
| 789 | * IE0 may be edge triggered depending on IT0 */ |
| 790 | if (GET_GATE0 && !GET_IE0) |
| 791 | delta = 0; |
| 1979 | 792 | |
| 1980 | | /* Update Timer 0 */ |
| 1981 | | if(GET_TR0) { |
| 1982 | | //Determine Mode |
| 1983 | | int mode = (GET_M0_1<<1) | GET_M0_0; |
| 1984 | | UINT32 count = 0; |
| 1985 | 793 | switch(mode) { |
| 1986 | 794 | case 0: /* 13 Bit Timer Mode */ |
| 1987 | | count = ((R_TH0<<5) | ( R_TL0 & 0x1F ) ); |
| 1988 | | /* Update the timer */ |
| 1989 | | /* Gate Bit Set? Timer only incremented if Int0 is set! */ |
| 1990 | | if(GET_GATE0 && GET_IE0) |
| 1991 | | count += (cyc/12); |
| 1992 | | /* Counter Mode? Only increment on 1-0 transition of the Port 3's T0 Line */ |
| 1993 | | if(GET_CT0) |
| 1994 | | { |
| 1995 | | /* Not supported */ |
| 1996 | | } |
| 1997 | | /* Neither, regular timer mode */ |
| 1998 | | if(!GET_GATE0 && !GET_CT0) |
| 1999 | | count += (cyc/12); |
| 2000 | | |
| 2001 | | /* Check for overflow */ |
| 2002 | | if ( count & 0xffffe000 ) |
| 2003 | | { |
| 795 | count = ((TH0<<5) | ( TL0 & 0x1f ) ); |
| 796 | count += delta; |
| 797 | if ( count & 0xffffe000 ) /* Check for overflow */ |
| 2004 | 798 | SET_TF0(1); |
| 2005 | | } |
| 2006 | | /* Update new values of the counter */ |
| 2007 | | R_TH0 = (count>>5) & 0xff; |
| 2008 | | R_TL0 = count & 0x1f; |
| 799 | TH0 = (count>>5) & 0xff; |
| 800 | TL0 = count & 0x1f ; |
| 2009 | 801 | break; |
| 2010 | 802 | case 1: /* 16 Bit Timer Mode */ |
| 2011 | | count = ((R_TH0<<8) | R_TL0); |
| 2012 | | /* Update the timer */ |
| 2013 | | /* Gate Bit Set? Timer only incremented if Int0 is set! */ |
| 2014 | | if(GET_GATE0 && GET_IE0) |
| 2015 | | count += (cyc/12); |
| 2016 | | /* Counter Mode? Only increment on 1-0 transition of the Port 3's T0 Line */ |
| 2017 | | if(GET_CT0) |
| 2018 | | { |
| 2019 | | /* Not supported */ |
| 2020 | | } |
| 2021 | | /* Neither, regular timer mode */ |
| 2022 | | if(!GET_GATE0 && !GET_CT0) |
| 2023 | | count += (cyc/12); |
| 2024 | | |
| 2025 | | /* Check for overflow */ |
| 2026 | | if ( count & 0xffff0000 ) |
| 2027 | | { |
| 803 | count = ((TH0<<8) | TL0); |
| 804 | count += delta; |
| 805 | if ( count & 0xffff0000 ) /* Check for overflow */ |
| 2028 | 806 | SET_TF0(1); |
| 2029 | | } |
| 2030 | | /* Update new values of the counter */ |
| 2031 | | R_TH0 = (count>>8) & 0xff; |
| 2032 | | R_TL0 = count & 0xff; |
| 807 | TH0 = (count>>8) & 0xff; |
| 808 | TL0 = count & 0xff; |
| 2033 | 809 | break; |
| 2034 | 810 | case 2: /* 8 Bit Autoreload */ |
| 2035 | | count = R_TL0; |
| 2036 | | count += (cyc/12); |
| 2037 | | /* Check for overflow */ |
| 2038 | | if ( count & 0xffffff00 ) |
| 811 | count = (UINT32) TL0 + delta; |
| 812 | if ( count & 0xffffff00 ) /* Check for overflow */ |
| 2039 | 813 | { |
| 2040 | 814 | SET_TF0(1); |
| 2041 | | /* Reload timer */ |
| 2042 | | count += R_TH0; |
| 815 | count += TH0; /* Reload timer */ |
| 2043 | 816 | } |
| 2044 | 817 | /* Update new values of the counter */ |
| 2045 | | R_TL0 = count & 0xff; |
| 818 | TL0 = count & 0xff; |
| 2046 | 819 | break; |
| 2047 | | case 3: /* Split Timer */ |
| 820 | case 3: |
| 2048 | 821 | /* Split Timer 1 */ |
| 2049 | | count = R_TL0; |
| 2050 | | count += (cyc/12); |
| 2051 | | /* Check for overflow */ |
| 2052 | | if ( count & 0xffffff00 ) |
| 2053 | | { |
| 822 | count = (UINT16) TL0 + delta; |
| 823 | if ( count & 0xffffff00 ) /* Check for overflow */ |
| 2054 | 824 | SET_TF0(1); |
| 2055 | | } |
| 2056 | | /* Update new values of the counter */ |
| 2057 | | R_TL0 = count & 0xff; |
| 2058 | | |
| 2059 | | /* Split Timer 2 */ |
| 2060 | | count = R_TH0; |
| 2061 | | count += (cyc/12); |
| 2062 | | /* Check for overflow */ |
| 2063 | | if ( count & 0xffffff00 ) |
| 2064 | | { |
| 2065 | | SET_TF1(1); |
| 2066 | | } |
| 2067 | | /* Update new values of the counter */ |
| 2068 | | R_TH0 = count & 0xff; |
| 825 | TL0 = count & 0xff; /* Update new values of the counter */ |
| 2069 | 826 | break; |
| 2070 | 827 | } |
| 2071 | 828 | } |
| 829 | if (GET_TR1) |
| 830 | { |
| 831 | switch(mode) |
| 832 | { |
| 833 | case 3: |
| 834 | /* Split Timer 2 */ |
| 835 | count = (UINT16) TH0 + cycles; /* No gate control or counting !*/ |
| 836 | if ( count & 0xffffff00 ) /* Check for overflow */ |
| 837 | SET_TF1(1); |
| 838 | TH0 = count & 0xff; /* Update new values of the counter */ |
| 839 | break; |
| 840 | } |
| 841 | } |
| 842 | } |
| 2072 | 843 | |
| 2073 | | /* Update Timer 1 */ |
| 2074 | | if(GET_TR1) { |
| 2075 | | /* Determine Mode */ |
| 2076 | | int mode = (GET_M1_1<<1) | GET_M1_0; |
| 2077 | | UINT32 count = 0; |
| 844 | INLINE void update_timer_t1(int cycles) |
| 845 | { |
| 846 | int mode = (GET_M1_1<<1) | GET_M1_0; |
| 847 | UINT32 count = 0; |
| 848 | |
| 849 | if (GET_TR1) |
| 850 | { |
| 851 | UINT32 delta; |
| 852 | int overflow = 0; |
| 853 | |
| 854 | /* counter / external input */ |
| 855 | delta = GET_CT1 ? mcs51.t1_cnt : cycles; |
| 856 | /* taken, reset */ |
| 857 | mcs51.t1_cnt = 0; |
| 858 | /* TODO: Not sure about IE0. The manual specifies INT0=high, |
| 859 | * which in turn means CLEAR_LINE. Change to access last_state? |
| 860 | * IE0 may be edge triggered depending on IT0 */ |
| 861 | if (GET_GATE1 && !GET_IE1) |
| 862 | delta = 0; |
| 863 | |
| 864 | //printf("mode: %d\n", mode); |
| 2078 | 865 | switch(mode) { |
| 2079 | 866 | case 0: /* 13 Bit Timer Mode */ |
| 2080 | | count = ((R_TH1<<5) | ( R_TL1 & 0x1F ) ); |
| 2081 | | /* Update the timer */ |
| 2082 | | /* Gate Bit Set? Timer only incremented if Int0 is set! */ |
| 2083 | | if(GET_GATE1 && GET_IE1) |
| 2084 | | count += (cyc/12); |
| 2085 | | /* Counter Mode? Only increment on 1-0 transition of the Port 3's T1 Line */ |
| 2086 | | if(GET_CT1) |
| 2087 | | { |
| 2088 | | /* Not supported */ |
| 2089 | | } |
| 2090 | | /* Neither, regular timer mode */ |
| 2091 | | if(!GET_GATE1 && !GET_CT1) |
| 2092 | | count += (cyc/12); |
| 2093 | | |
| 2094 | | /* Check for overflow */ |
| 2095 | | if ( count & 0xffffe000 ) |
| 2096 | | { |
| 867 | count = ((TH1<<5) | ( TL1 & 0x1f ) ); |
| 868 | count += delta; |
| 869 | overflow = count & 0xffffe000; /* Check for overflow */ |
| 870 | if ( overflow ) |
| 2097 | 871 | SET_TF1(1); |
| 2098 | | } |
| 2099 | | /* Update new values of the counter */ |
| 2100 | | R_TH1 = (count>>5) & 0xff; |
| 2101 | | R_TL1 = count & 0x1f; |
| 872 | TH1 = (count>>5) & 0xff; |
| 873 | TL1 = count & 0x1f ; |
| 2102 | 874 | break; |
| 2103 | 875 | case 1: /* 16 Bit Timer Mode */ |
| 2104 | | count = ((R_TH1<<8) | R_TL1); |
| 2105 | | /* Update the timer */ |
| 2106 | | /* Gate Bit Set? Timer only incremented if Int1 is set! */ |
| 2107 | | if(GET_GATE1 && GET_IE1) |
| 2108 | | count += (cyc/12); |
| 2109 | | /* Counter Mode? Only increment on 1-0 transition of the Port 3's T1 Line */ |
| 2110 | | if(GET_CT1) |
| 876 | count = ((TH1<<8) | TL1); |
| 877 | count += delta; |
| 878 | overflow = count & 0xffff0000; /* Check for overflow */ |
| 879 | if ( overflow ) |
| 2111 | 880 | { |
| 2112 | | /* Not supported */ |
| 2113 | | } |
| 2114 | | /* Neither, regular timer mode */ |
| 2115 | | if(!GET_GATE1 && !GET_CT1) |
| 2116 | | count += (cyc/12); |
| 2117 | | |
| 2118 | | /* Check for overflow */ |
| 2119 | | if ( count & 0xffff0000 ) |
| 2120 | | { |
| 2121 | | //TODO: Timer 1 can be set as Serial Baud Rate in the 8051 only... process bits here.. |
| 2122 | 881 | SET_TF1(1); |
| 2123 | 882 | } |
| 2124 | | /* Update new values of the counter */ |
| 2125 | | R_TH1 = (count>>8) & 0xff; |
| 2126 | | R_TL1 = count & 0xff; |
| 883 | TH1 = (count>>8) & 0xff; |
| 884 | TL1 = count & 0xff; |
| 2127 | 885 | break; |
| 2128 | 886 | case 2: /* 8 Bit Autoreload */ |
| 2129 | | count = R_TL1; |
| 2130 | | count += (cyc/12); |
| 2131 | | /* Check for overflow */ |
| 2132 | | if ( count & 0xffffff00 ) |
| 887 | count = (UINT32) TL1 + delta; |
| 888 | overflow = count & 0xffffff00; /* Check for overflow */ |
| 889 | if ( overflow ) |
| 2133 | 890 | { |
| 2134 | 891 | SET_TF1(1); |
| 2135 | | /* Reload timer */ |
| 2136 | | count += R_TH1; |
| 892 | count += TH1; /* Reload timer */ |
| 2137 | 893 | } |
| 2138 | 894 | /* Update new values of the counter */ |
| 2139 | | R_TL1 = count & 0xff; |
| 895 | TL1 = count & 0xff; |
| 2140 | 896 | break; |
| 897 | case 3: |
| 898 | /* do nothing */ |
| 899 | break; |
| 2141 | 900 | } |
| 901 | if (overflow) |
| 902 | transmit_receive(1); |
| 2142 | 903 | } |
| 904 | } |
| 2143 | 905 | |
| 2144 | | #if (HAS_I8052 || HAS_I8752) |
| 906 | INLINE void update_timer_t2(int cycles) |
| 907 | { |
| 2145 | 908 | /* Update Timer 2 */ |
| 2146 | 909 | if(GET_TR2) { |
| 2147 | | UINT32 count = ((R_TH2<<8) | R_TL2); |
| 910 | int mode = ((GET_TCLK | GET_RCLK) << 1) | GET_CP; |
| 911 | int delta = GET_CT2 ? mcs51.t2_cnt : (mode & 2) ? cycles * (12/2) : cycles; |
| 2148 | 912 | |
| 2149 | | /* Are we in counter mode? */ |
| 2150 | | if(GET_CT2) |
| 2151 | | { |
| 2152 | | /* Not supported */ |
| 2153 | | } |
| 2154 | | /* Are we in timer mode? */ |
| 2155 | | else |
| 2156 | | { |
| 2157 | | /* 16 Bit Timer Mode */ |
| 2158 | | /* Timer 2 Used as Baud Generator? (For now, only *same* send/receive rates supported) */ |
| 2159 | | if(GET_TCLK || GET_RCLK) |
| 2160 | | count += cyc/2; /* Timer increments every cycles/2 in baud mode */ |
| 2161 | | else |
| 2162 | | /* REGULAR TIMER - */ |
| 2163 | | count += cyc/12; /* Timer increments every cycles/12 in normal mode */ |
| 913 | UINT32 count = ((TH2<<8) | TL2) + delta; |
| 914 | mcs51.t2_cnt = 0; |
| 2164 | 915 | |
| 2165 | | /* Check for overflow */ |
| 2166 | | if ( count & 0xffff0000 ) |
| 2167 | | { |
| 2168 | | /* Set Interrupt flag *unless* used as baud generator */ |
| 2169 | | if(!GET_TCLK && !GET_RCLK) |
| 916 | switch (mode) |
| 917 | { |
| 918 | case 0: /* 16 Bit Auto Reload */ |
| 919 | if ( count & 0xffff0000 ) |
| 2170 | 920 | { |
| 2171 | 921 | SET_TF2(1); |
| 922 | count += ((RCAP2H<<8) | RCAP2L); |
| 2172 | 923 | } |
| 2173 | | else |
| 924 | else if (GET_EXEN2 && mcs51.t2ex_cnt>0) |
| 2174 | 925 | { |
| 2175 | | /* Update bits sent if sending & bits left to send! */ |
| 2176 | | if(uart.sending && uart.bits_to_send && uart.timerbaud) |
| 2177 | | uart.bits_to_send-=1; |
| 926 | count += ((RCAP2H<<8) | RCAP2L); |
| 927 | mcs51.t2ex_cnt = 0; |
| 2178 | 928 | } |
| 2179 | | /* Auto reload? */ |
| 2180 | | if(!GET_CP) |
| 2181 | | count += ((R_RCAP2H<<8) | R_RCAP2L); |
| 2182 | | } |
| 2183 | | /* Update new values of the counter */ |
| 2184 | | R_TH2 = (count>>8) & 0xff; |
| 2185 | | R_TL2 = count & 0xff; |
| 929 | TH2 = (count>>8) & 0xff; |
| 930 | TL2 = count & 0xff; |
| 931 | break; |
| 932 | case 1: /* 16 Bit Capture */ |
| 933 | if ( count & 0xffff0000 ) |
| 934 | SET_TF2(1); |
| 935 | TH2 = (count>>8) & 0xff; |
| 936 | TL2 = count & 0xff; |
| 937 | |
| 938 | if (GET_EXEN2 && mcs51.t2ex_cnt>0) |
| 939 | { |
| 940 | RCAP2H = TH2; |
| 941 | RCAP2L = TL2; |
| 942 | mcs51.t2ex_cnt = 0; |
| 943 | } |
| 944 | break; |
| 945 | case 2: |
| 946 | case 3: /* Baud rate */ |
| 947 | if ( count & 0xffff0000 ) |
| 948 | { |
| 949 | count += ((RCAP2H<<8) | RCAP2L); |
| 950 | transmit_receive(2); |
| 951 | } |
| 952 | TH2 = (count>>8) & 0xff; |
| 953 | TL2 = count & 0xff; |
| 954 | break; |
| 2186 | 955 | } |
| 2187 | 956 | } |
| 2188 | | #endif |
| 2189 | 957 | } |
| 2190 | 958 | |
| 959 | INLINE void update_timers(int cycles) |
| 960 | { |
| 961 | if (cycles == 0) |
| 962 | return; /* nothing to do */ |
| 963 | /* Update Timer 0 */ |
| 964 | update_timer_t0(cycles); |
| 965 | update_timer_t1(cycles); |
| 966 | |
| 967 | if (mcs51.features & FEATURE_I8052_UART) |
| 968 | { |
| 969 | update_timer_t2(cycles); |
| 970 | } |
| 971 | } |
| 972 | |
| 2191 | 973 | //Set up to transmit data out of serial port |
| 2192 | 974 | //NOTE: Enable Serial Port Interrupt bit is NOT required to send/receive data! |
| 975 | |
| 2193 | 976 | INLINE void serial_transmit(UINT8 data) |
| 2194 | 977 | { |
| 2195 | 978 | int mode = (GET_SM0<<1) | GET_SM1; |
| 2196 | 979 | |
| 2197 | 980 | //Flag that we're sending data |
| 2198 | | uart.sending = 1; |
| 2199 | | uart.data_out = data; |
| 981 | mcs51.uart.data_out = data; |
| 982 | //printf("serial_tansmit: %x %x\n", mode, data); |
| 2200 | 983 | switch(mode) { |
| 2201 | 984 | //8 bit shifter ( + start,stop bit ) - baud set by clock freq / 12 |
| 2202 | 985 | case 0: |
| 2203 | | uart.timerbaud = 0; |
| 2204 | | uart.bitcycles = 0; |
| 2205 | | uart.bits_to_send = 8+2; |
| 986 | mcs51.uart.bits_to_send = 8+2; |
| 2206 | 987 | break; |
| 2207 | 988 | //8 bit uart ( + start,stop bit ) - baud set by timer1 or timer2 |
| 2208 | 989 | case 1: |
| 2209 | | uart.timerbaud = 1; |
| 2210 | | uart.bits_to_send = 8+2; |
| 990 | mcs51.uart.bits_to_send = 8+2; |
| 2211 | 991 | break; |
| 2212 | 992 | //9 bit uart |
| 2213 | 993 | case 2: |
| 2214 | 994 | case 3: |
| 2215 | | LOG(("Serial mode 2 & 3 not supported in i8051!\n")); |
| 995 | LOG(("Serial mode %d not supported in mcs51!\n", mode)); |
| 2216 | 996 | break; |
| 2217 | 997 | } |
| 2218 | 998 | } |
| 2219 | 999 | |
| 1000 | INLINE void serial_receive(void) |
| 1001 | { |
| 1002 | int mode = (GET_SM0<<1) | GET_SM1; |
| 1003 | |
| 1004 | if(GET_ES && GET_REN) { |
| 1005 | switch(mode) { |
| 1006 | //8 bit shifter ( + start,stop bit ) - baud set by clock freq / 12 |
| 1007 | case 0: |
| 1008 | mcs51.uart.delay_cycles = 8+2; |
| 1009 | break; |
| 1010 | //8 bit uart ( + start,stop bit ) - baud set by timer1 or timer2 |
| 1011 | case 1: |
| 1012 | mcs51.uart.delay_cycles = 8+2; |
| 1013 | break; |
| 1014 | //9 bit uart |
| 1015 | case 2: |
| 1016 | case 3: |
| 1017 | LOG(("Serial mode %d not supported in mcs51!\n", mode)); |
| 1018 | break; |
| 1019 | } |
| 1020 | } |
| 1021 | } |
| 1022 | |
| 2220 | 1023 | //Check and update status of serial port |
| 2221 | | INLINE void update_serial(int cyc) |
| 1024 | INLINE void update_serial(int cycles) |
| 2222 | 1025 | { |
| 2223 | | //Any bits left to send? |
| 2224 | | if(uart.bits_to_send) { |
| 2225 | | //Timer Generated baud? |
| 2226 | | if(uart.timerbaud) { |
| 2227 | | //Let Timer overflow handle removing bits |
| 1026 | while (--cycles>=0) |
| 1027 | transmit_receive(0); |
| 1028 | } |
| 1029 | |
| 1030 | /*************************************************************************** |
| 1031 | CALLBACKS - TODO: Remove |
| 1032 | ***************************************************************************/ |
| 1033 | |
| 1034 | |
| 1035 | void i8051_set_serial_tx_callback(void (*callback)(int data)) |
| 1036 | { |
| 1037 | //Hold in static variable since this function can get called before reset has run, which wipes i8051 memory clean |
| 1038 | hold_serial_tx_callback = callback; |
| 1039 | } |
| 1040 | |
| 1041 | void i8051_set_serial_rx_callback(int (*callback)(void)) |
| 1042 | { |
| 1043 | //Hold in static variable since this function can get called before reset has run, which wipes i8051 memory clean |
| 1044 | hold_serial_rx_callback = callback; |
| 1045 | } |
| 1046 | |
| 1047 | /*************************************************************************** |
| 1048 | OPCODES |
| 1049 | ***************************************************************************/ |
| 1050 | |
| 1051 | #include "i8051ops.c" |
| 1052 | |
| 1053 | |
| 1054 | static void execute_op(UINT8 op) |
| 1055 | { |
| 1056 | if (mcs51.recalc_parity) |
| 1057 | { |
| 1058 | set_parity(); |
| 1059 | mcs51.recalc_parity = 0; |
| 1060 | } |
| 1061 | |
| 1062 | switch( op ) |
| 1063 | { |
| 1064 | |
| 1065 | case 0x00: nop(); break; //NOP |
| 1066 | case 0x01: ajmp(op); break; //AJMP code addr |
| 1067 | case 0x02: ljmp(); break; //LJMP code addr |
| 1068 | case 0x03: rr_a(); break; //RR A |
| 1069 | case 0x04: inc_a(); break; //INC A |
| 1070 | case 0x05: RWM=1; inc_mem(); RWM=0; break; //INC data addr |
| 1071 | |
| 1072 | case 0x06: |
| 1073 | case 0x07: inc_ir(op&1); break; //INC @R0/@R1 |
| 1074 | |
| 1075 | case 0x08: |
| 1076 | case 0x09: |
| 1077 | case 0x0a: |
| 1078 | case 0x0b: |
| 1079 | case 0x0c: |
| 1080 | case 0x0d: |
| 1081 | case 0x0e: |
| 1082 | case 0x0f: inc_r(op&7); break; //INC R0 to R7 |
| 1083 | |
| 1084 | case 0x10: RWM=1; jbc(); RWM=0; break; //JBC bit addr, code addr |
| 1085 | case 0x11: acall(op); break; //ACALL code addr |
| 1086 | case 0x12: lcall(); break; //LCALL code addr |
| 1087 | case 0x13: rrc_a(); break; //RRC A |
| 1088 | case 0x14: dec_a(); break; //DEC A |
| 1089 | case 0x15: RWM=1; dec_mem(); RWM=0; break; //DEC data addr |
| 1090 | |
| 1091 | case 0x16: |
| 1092 | case 0x17: dec_ir(op&1); break; //DEC @R0/@R1 |
| 1093 | |
| 1094 | case 0x18: |
| 1095 | case 0x19: |
| 1096 | case 0x1a: |
| 1097 | case 0x1b: |
| 1098 | case 0x1c: |
| 1099 | case 0x1d: |
| 1100 | case 0x1e: |
| 1101 | case 0x1f: dec_r(op&7); break; //DEC R0 to R7 |
| 1102 | |
| 1103 | case 0x20: jb(); break; //JB bit addr, code addr |
| 1104 | case 0x21: ajmp(op); break; //AJMP code addr |
| 1105 | case 0x22: ret(); break; //RET |
| 1106 | case 0x23: rl_a(); break; //RL A |
| 1107 | case 0x24: add_a_byte(); break; //ADD A, #data |
| 1108 | case 0x25: add_a_mem(); break; //ADD A, data addr |
| 1109 | |
| 1110 | case 0x26: |
| 1111 | case 0x27: add_a_ir(op&1); break; //ADD A, @R0/@R1 |
| 1112 | |
| 1113 | case 0x28: |
| 1114 | case 0x29: |
| 1115 | case 0x2a: |
| 1116 | case 0x2b: |
| 1117 | case 0x2c: |
| 1118 | case 0x2d: |
| 1119 | case 0x2e: |
| 1120 | case 0x2f: add_a_r(op&7); break; //ADD A, R0 to R7 |
| 1121 | |
| 1122 | case 0x30: jnb(); break; //JNB bit addr, code addr |
| 1123 | case 0x31: acall(op); break; //ACALL code addr |
| 1124 | case 0x32: reti(); break; //RETI |
| 1125 | case 0x33: rlc_a(); break; //RLC A |
| 1126 | case 0x34: addc_a_byte(); break; //ADDC A, #data |
| 1127 | case 0x35: addc_a_mem(); break; //ADDC A, data addr |
| 1128 | |
| 1129 | case 0x36: |
| 1130 | case 0x37: addc_a_ir(op&1); break; //ADDC A, @R0/@R1 |
| 1131 | |
| 1132 | case 0x38: |
| 1133 | case 0x39: |
| 1134 | case 0x3a: |
| 1135 | case 0x3b: |
| 1136 | case 0x3c: |
| 1137 | case 0x3d: |
| 1138 | case 0x3e: |
| 1139 | case 0x3f: addc_a_r(op&7); break; //ADDC A, R0 to R7 |
| 1140 | |
| 1141 | case 0x40: jc(); break; //JC code addr |
| 1142 | case 0x41: ajmp(op); break; //AJMP code addr |
| 1143 | case 0x42: RWM=1; orl_mem_a(); RWM=0; break; //ORL data addr, A |
| 1144 | case 0x43: RWM=1; orl_mem_byte(); RWM=0; break; //ORL data addr, #data |
| 1145 | case 0x44: orl_a_byte(); break; |
| 1146 | case 0x45: orl_a_mem(); break; //ORL A, data addr |
| 1147 | |
| 1148 | case 0x46: |
| 1149 | case 0x47: orl_a_ir(op&1); break; //ORL A, @RO/@R1 |
| 1150 | |
| 1151 | case 0x48: |
| 1152 | case 0x49: |
| 1153 | case 0x4a: |
| 1154 | case 0x4b: |
| 1155 | case 0x4c: |
| 1156 | case 0x4d: |
| 1157 | case 0x4e: |
| 1158 | case 0x4f: orl_a_r(op&7); break; //ORL A, RO to R7 |
| 1159 | |
| 1160 | case 0x50: jnc(); break; //JNC code addr |
| 1161 | case 0x51: acall(op); break; //ACALL code addr |
| 1162 | case 0x52: RWM=1; anl_mem_a(); RWM=0; break; //ANL data addr, A |
| 1163 | case 0x53: RWM=1; anl_mem_byte(); RWM=0; break; //ANL data addr, #data |
| 1164 | case 0x54: anl_a_byte(); break; //ANL A, #data |
| 1165 | case 0x55: anl_a_mem(); break; //ANL A, data addr |
| 1166 | |
| 1167 | case 0x56: |
| 1168 | case 0x57: anl_a_ir(op&1); break; //ANL A, @RO/@R1 |
| 1169 | |
| 1170 | case 0x58: |
| 1171 | case 0x59: |
| 1172 | case 0x5a: |
| 1173 | case 0x5b: |
| 1174 | case 0x5c: |
| 1175 | case 0x5d: |
| 1176 | case 0x5e: |
| 1177 | case 0x5f: anl_a_r(op&7); break; //ANL A, RO to R7 |
| 1178 | |
| 1179 | case 0x60: jz(); break; //JZ code addr |
| 1180 | case 0x61: ajmp(op); break; //AJMP code addr |
| 1181 | case 0x62: RWM=1; xrl_mem_a(); RWM=0; break; //XRL data addr, A |
| 1182 | case 0x63: RWM=1; xrl_mem_byte(); RWM=0; break; //XRL data addr, #data |
| 1183 | case 0x64: xrl_a_byte(); break; //XRL A, #data |
| 1184 | case 0x65: xrl_a_mem(); break; //XRL A, data addr |
| 1185 | |
| 1186 | case 0x66: |
| 1187 | case 0x67: xrl_a_ir(op&1); break; //XRL A, @R0/@R1 |
| 1188 | |
| 1189 | case 0x68: |
| 1190 | case 0x69: |
| 1191 | case 0x6a: |
| 1192 | case 0x6b: |
| 1193 | case 0x6c: |
| 1194 | case 0x6d: |
| 1195 | case 0x6e: |
| 1196 | case 0x6f: xrl_a_r(op&7); break; //XRL A, R0 to R7 |
| 1197 | |
| 1198 | case 0x70: jnz(); break; //JNZ code addr |
| 1199 | case 0x71: acall(op); break; //ACALL code addr |
| 1200 | case 0x72: orl_c_bitaddr(); break; //ORL C, bit addr |
| 1201 | case 0x73: jmp_iadptr(); break; //JMP @A+DPTR |
| 1202 | case 0x74: mov_a_byte(); break; //MOV A, #data |
| 1203 | case 0x75: mov_mem_byte(); break; //MOV data addr, #data |
| 1204 | |
| 1205 | case 0x76: |
| 1206 | case 0x77: mov_ir_byte(op&1); break; //MOV @R0/@R1, #data |
| 1207 | |
| 1208 | case 0x78: |
| 1209 | case 0x79: |
| 1210 | case 0x7a: |
| 1211 | case 0x7b: |
| 1212 | case 0x7c: |
| 1213 | case 0x7d: |
| 1214 | case 0x7e: |
| 1215 | case 0x7f: mov_r_byte(op&7); break; //MOV R0 to R7, #data |
| 1216 | |
| 1217 | case 0x80: sjmp(); break; //SJMP code addr |
| 1218 | case 0x81: ajmp(op); break; //AJMP code addr |
| 1219 | case 0x82: anl_c_bitaddr(); break; //ANL C, bit addr |
| 1220 | case 0x83: movc_a_iapc(); break; //MOVC A, @A + PC |
| 1221 | case 0x84: div_ab(); break; //DIV AB |
| 1222 | case 0x85: mov_mem_mem(); break; //MOV data addr, data addr |
| 1223 | |
| 1224 | case 0x86: |
| 1225 | case 0x87: mov_mem_ir(op&1); break; //MOV data addr, @R0/@R1 |
| 1226 | |
| 1227 | case 0x88: |
| 1228 | case 0x89: |
| 1229 | case 0x8a: |
| 1230 | case 0x8b: |
| 1231 | case 0x8c: |
| 1232 | case 0x8d: |
| 1233 | case 0x8e: |
| 1234 | case 0x8f: mov_mem_r(op&7); break; //MOV data addr,R0 to R7 |
| 1235 | |
| 1236 | case 0x90: mov_dptr_byte(); break; //MOV DPTR, #data |
| 1237 | case 0x91: acall(op); break; //ACALL code addr |
| 1238 | case 0x92: RWM = 1; mov_bitaddr_c(); RWM = 0; break; //MOV bit addr, C |
| 1239 | case 0x93: movc_a_iadptr(); break; //MOVC A, @A + DPTR |
| 1240 | case 0x94: subb_a_byte(); break; //SUBB A, #data |
| 1241 | case 0x95: subb_a_mem(); break; //SUBB A, data addr |
| 1242 | |
| 1243 | case 0x96: |
| 1244 | case 0x97: subb_a_ir(op&1); break; //SUBB A, @R0/@R1 |
| 1245 | |
| 1246 | case 0x98: |
| 1247 | case 0x99: |
| 1248 | case 0x9a: |
| 1249 | case 0x9b: |
| 1250 | case 0x9c: |
| 1251 | case 0x9d: |
| 1252 | case 0x9e: |
| 1253 | case 0x9f: subb_a_r(op&7); break; //SUBB A, R0 to R7 |
| 1254 | |
| 1255 | case 0xa0: orl_c_nbitaddr(); break; //ORL C, /bit addr |
| 1256 | case 0xa1: ajmp(op); break; //AJMP code addr |
| 1257 | case 0xa2: mov_c_bitaddr(); break; //MOV C, bit addr |
| 1258 | case 0xa3: inc_dptr(); break; //INC DPTR |
| 1259 | case 0xa4: mul_ab(); break; //MUL AB |
| 1260 | case 0xa5: illegal(op); break; //reserved |
| 1261 | |
| 1262 | case 0xa6: |
| 1263 | case 0xa7: mov_ir_mem(op&1); break; //MOV @R0/@R1, data addr |
| 1264 | |
| 1265 | case 0xa8: |
| 1266 | case 0xa9: |
| 1267 | case 0xaa: |
| 1268 | case 0xab: |
| 1269 | case 0xac: |
| 1270 | case 0xad: |
| 1271 | case 0xae: |
| 1272 | case 0xaf: mov_r_mem(op&7); break; //MOV R0 to R7, data addr |
| 1273 | |
| 1274 | case 0xb0: anl_c_nbitaddr(); break; //ANL C,/bit addr |
| 1275 | case 0xb1: acall(op); break; //ACALL code addr |
| 1276 | case 0xb2: RWM=1; cpl_bitaddr(); RWM=0; break; //CPL bit addr |
| 1277 | case 0xb3: cpl_c(); break; //CPL C |
| 1278 | case 0xb4: cjne_a_byte(); break; //CJNE A, #data, code addr |
| 1279 | case 0xb5: cjne_a_mem(); break; //CJNE A, data addr, code addr |
| 1280 | |
| 1281 | case 0xb6: |
| 1282 | case 0xb7: cjne_ir_byte(op&1); break; //CJNE @R0/@R1, #data, code addr |
| 1283 | |
| 1284 | case 0xb8: |
| 1285 | case 0xb9: |
| 1286 | case 0xba: |
| 1287 | case 0xbb: |
| 1288 | case 0xbc: |
| 1289 | case 0xbd: |
| 1290 | case 0xbe: |
| 1291 | case 0xbf: cjne_r_byte(op&7); break; //CJNE R0 to R7, #data, code addr |
| 1292 | |
| 1293 | case 0xc0: push(); break; //PUSH data addr |
| 1294 | case 0xc1: ajmp(op); break; //AJMP code addr |
| 1295 | case 0xc2: RWM=1; clr_bitaddr(); RWM=0; break; //CLR bit addr |
| 1296 | case 0xc3: clr_c(); break; //CLR C |
| 1297 | case 0xc4: swap_a(); break; //SWAP A |
| 1298 | case 0xc5: xch_a_mem(); break; //XCH A, data addr |
| 1299 | |
| 1300 | case 0xc6: |
| 1301 | case 0xc7: xch_a_ir(op&1); break; //XCH A, @RO/@R1 |
| 1302 | |
| 1303 | case 0xc8: |
| 1304 | case 0xc9: |
| 1305 | case 0xca: |
| 1306 | case 0xcb: |
| 1307 | case 0xcc: |
| 1308 | case 0xcd: |
| 1309 | case 0xce: |
| 1310 | case 0xcf: xch_a_r(op&7); break; //XCH A, RO to R7 |
| 1311 | |
| 1312 | case 0xd0: pop(); break; //POP data addr |
| 1313 | case 0xd1: acall(op); break; //ACALL code addr |
| 1314 | case 0xd2: RWM=1; setb_bitaddr(); RWM=0; break; //SETB bit addr |
| 1315 | case 0xd3: setb_c(); break; //SETB C |
| 1316 | case 0xd4: da_a(); break; //DA A |
| 1317 | case 0xd5: RWM=1; djnz_mem(); RWM=0; break; //DJNZ data addr, code addr |
| 1318 | |
| 1319 | case 0xd6: |
| 1320 | case 0xd7: xchd_a_ir(op&1); break; //XCHD A, @R0/@R1 |
| 1321 | |
| 1322 | case 0xd8: |
| 1323 | case 0xd9: |
| 1324 | case 0xda: |
| 1325 | case 0xdb: |
| 1326 | case 0xdc: |
| 1327 | case 0xdd: |
| 1328 | case 0xde: |
| 1329 | case 0xdf: djnz_r(op&7); break; //DJNZ R0 to R7,code addr |
| 1330 | |
| 1331 | case 0xe0: movx_a_idptr(); break; //MOVX A,@DPTR |
| 1332 | case 0xe1: ajmp(op); break; //AJMP code addr |
| 1333 | |
| 1334 | case 0xe2: |
| 1335 | case 0xe3: movx_a_ir(op&1); break; //MOVX A, @R0/@R1 |
| 1336 | |
| 1337 | case 0xe4: clr_a(); break; //CLR A |
| 1338 | case 0xe5: mov_a_mem(); break; //MOV A, data addr |
| 1339 | case 0xe6: |
| 1340 | case 0xe7: mov_a_ir(op&1); break; //MOV A,@RO/@R1 |
| 1341 | |
| 1342 | case 0xe8: |
| 1343 | case 0xe9: |
| 1344 | case 0xea: |
| 1345 | case 0xeb: |
| 1346 | case 0xec: |
| 1347 | case 0xed: |
| 1348 | case 0xee: |
| 1349 | case 0xef: mov_a_r(op&7); break; //MOV A,R0 to R7 |
| 1350 | |
| 1351 | case 0xf0: movx_idptr_a(); break; //MOVX @DPTR,A |
| 1352 | case 0xf1: acall(op); break; //ACALL code addr |
| 1353 | |
| 1354 | case 0xf2: |
| 1355 | case 0xf3: movx_ir_a(op&1); break; //MOVX @R0/@R1,A |
| 1356 | |
| 1357 | case 0xf4: cpl_a(); break; //CPL A |
| 1358 | case 0xf5: mov_mem_a(); break; //MOV data addr, A |
| 1359 | |
| 1360 | case 0xf6: |
| 1361 | case 0xf7: mov_ir_a(op&1); break; //MOV @R0/@R1, A |
| 1362 | |
| 1363 | case 0xf8: |
| 1364 | case 0xf9: |
| 1365 | case 0xfa: |
| 1366 | case 0xfb: |
| 1367 | case 0xfc: |
| 1368 | case 0xfd: |
| 1369 | case 0xfe: |
| 1370 | case 0xff: mov_r_a(op&7); break; //MOV R0 to R7, A |
| 1371 | default: |
| 1372 | illegal(op); |
| 1373 | } |
| 1374 | } |
| 1375 | |
| 1376 | /*************************************************************************** |
| 1377 | OPCODE CYCLES |
| 1378 | ***************************************************************************/ |
| 1379 | |
| 1380 | /* # of oscilations each opcode requires*/ |
| 1381 | static const UINT8 mcs51_cycles[] = { |
| 1382 | 1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1, |
| 1383 | 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1, |
| 1384 | 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1, |
| 1385 | 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1, |
| 1386 | 2,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1, |
| 1387 | 2,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1, |
| 1388 | 2,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1, |
| 1389 | 2,2,2,2,1,2,1,1,1,1,1,1,1,1,1,1, |
| 1390 | 2,2,2,2,4,2,2,2,2,2,2,2,2,2,2,2, |
| 1391 | 2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1, |
| 1392 | 2,2,1,2,4,1,2,2,2,2,2,2,2,2,2,2, |
| 1393 | 2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,2, |
| 1394 | 2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
| 1395 | 2,2,1,1,1,2,1,1,2,2,2,2,2,2,2,2, |
| 1396 | 2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1, |
| 1397 | 2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1 |
| 1398 | }; |
| 1399 | |
| 1400 | /*********************************************************************************** |
| 1401 | Check for pending Interrupts and process - returns # of cycles used for the int |
| 1402 | |
| 1403 | Note about priority & interrupting interrupts.. |
| 1404 | 1) A high priority interrupt cannot be interrupted by anything! |
| 1405 | 2) A low priority interrupt can ONLY be interrupted by a high priority interrupt |
| 1406 | 3) If more than 1 Interrupt Flag is set (ie, 2 simultaneous requests occur), |
| 1407 | the following logic works as follows: |
| 1408 | 1) If two requests come in of different priority levels, the higher one is selected.. |
| 1409 | 2) If the requests are of the same level, an internal order is used: |
| 1410 | a) IEO |
| 1411 | b) TFO |
| 1412 | c) IE1 |
| 1413 | d) TF1 |
| 1414 | e) RI+TI |
| 1415 | f) TF2+EXF2 |
| 1416 | **********************************************************************************/ |
| 1417 | static void check_irqs(void) |
| 1418 | { |
| 1419 | UINT8 ints = (GET_IE0 | (GET_TF0<<1) | (GET_IE1<<2) | (GET_TF1<<3) |
| 1420 | | ((GET_RI|GET_TI)<<4)); |
| 1421 | UINT8 ip = IP; |
| 1422 | UINT8 int_vec = 0; |
| 1423 | UINT8 priority_request = 0; |
| 1424 | int i; |
| 1425 | |
| 1426 | //If All Inerrupts Disabled or no pending abort.. |
| 1427 | if(!GET_EA) return; |
| 1428 | |
| 1429 | if (mcs51.features & FEATURE_I8052_UART) |
| 1430 | ints |= ((GET_TF2|GET_EXF2)<<5); |
| 1431 | |
| 1432 | /* mask out interrupts not enabled */ |
| 1433 | ints &= IE; |
| 1434 | |
| 1435 | if (!ints) return; |
| 1436 | |
| 1437 | if(mcs51.irq_priority) |
| 1438 | { |
| 1439 | LOG(("high priority irq in progress, skipping irq request\n")); |
| 1440 | return; |
| 1441 | } |
| 1442 | |
| 1443 | for (i=0; i<mcs51.num_interrupts; i++) |
| 1444 | { |
| 1445 | if (ints & (1<<i)) |
| 1446 | { |
| 1447 | int_vec = (i<<3) | 3; |
| 1448 | priority_request = (ip & (1<<i)); |
| 1449 | if (priority_request) |
| 1450 | break; |
| 2228 | 1451 | } |
| 2229 | | else { |
| 2230 | | //Oscillator Based baud rate = Osc/12 baud rate, however it also means 1 bit = 12 cycles. |
| 2231 | | uart.bitcycles+=cyc; |
| 2232 | | if(uart.bitcycles > 11) { |
| 2233 | | int bits_sent = uart.bitcycles / 12; |
| 2234 | | int diff = uart.bitcycles % 12; |
| 2235 | | //don't allow more bits sent than ready to send |
| 2236 | | if(bits_sent > uart.bits_to_send) { |
| 2237 | | bits_sent = uart.bits_to_send; |
| 2238 | | diff = 0; |
| 1452 | } |
| 1453 | |
| 1454 | //Skip the interrupt request if currently processing is lo priority, and the new request IS NOT HI PRIORITY! |
| 1455 | if(mcs51.cur_irq < 0xff && !priority_request) |
| 1456 | { |
| 1457 | LOG(("low priority irq in progress already, skipping low irq request\n")); |
| 1458 | return; |
| 1459 | } |
| 1460 | |
| 1461 | //Save current pc to stack, set pc to new interrupt vector |
| 1462 | push_pc(); |
| 1463 | PC = int_vec; |
| 1464 | change_pc(PC); |
| 1465 | |
| 1466 | /* interrupts take 24 cycles */ |
| 1467 | mcs51.inst_cycles += 2; |
| 1468 | |
| 1469 | //Set current Irq & Priority being serviced |
| 1470 | mcs51.cur_irq = int_vec; |
| 1471 | mcs51.irq_priority = priority_request; |
| 1472 | |
| 1473 | //Clear any interrupt flags that should be cleared since we're servicing the irq! |
| 1474 | switch(mcs51.cur_irq) { |
| 1475 | case V_IE0: |
| 1476 | //External Int Flag only cleared when configured as Edge Triggered.. |
| 1477 | if(GET_IT0) /* for some reason having this, breaks alving dmd games */ |
| 1478 | SET_IE0(0); |
| 1479 | |
| 1480 | /* indicate we took the external IRQ */ |
| 1481 | if (mcs51.irq_callback != NULL) |
| 1482 | (*mcs51.irq_callback)(0); |
| 1483 | |
| 1484 | break; |
| 1485 | case V_TF0: |
| 1486 | //Timer 0 - Always clear Flag |
| 1487 | SET_TF0(0); |
| 1488 | break; |
| 1489 | case V_IE1: |
| 1490 | //External Int Flag only cleared when configured as Edge Triggered.. |
| 1491 | if(GET_IT1) /* for some reason having this, breaks alving dmd games */ |
| 1492 | SET_IE1(0); |
| 1493 | /* indicate we took the external IRQ */ |
| 1494 | if (mcs51.irq_callback != NULL) |
| 1495 | (*mcs51.irq_callback)(1); |
| 1496 | |
| 1497 | break; |
| 1498 | case V_TF1: |
| 1499 | //Timer 1 - Always clear Flag |
| 1500 | SET_TF1(0); |
| 1501 | break; |
| 1502 | case V_RITI: |
| 1503 | // no flags are cleared, TI and RI remain set until reset by software |
| 1504 | break; |
| 1505 | /* I8052 specific */ |
| 1506 | case V_TF2: |
| 1507 | // no flags are cleared according to manual |
| 1508 | break; |
| 1509 | } |
| 1510 | } |
| 1511 | |
| 1512 | INLINE void burn_cycles(int cycles) |
| 1513 | { |
| 1514 | /* Update Timer (if any timers are running) */ |
| 1515 | update_timers(cycles); |
| 1516 | |
| 1517 | /* Update Serial (only for mode 0) */ |
| 1518 | update_serial(cycles); |
| 1519 | |
| 1520 | /* check_irqs */ |
| 1521 | check_irqs(); |
| 1522 | } |
| 1523 | |
| 1524 | static void mcs51_set_irq_line(int irqline, int state) |
| 1525 | { |
| 1526 | /* From the manual: |
| 1527 | * |
| 1528 | * <cite>In operatiom all the interrupt tlags are latched into the |
| 1529 | * interrupt control system during State 5 of every ma- |
| 1530 | * chine cycle. The samples are polled during the follow- |
| 1531 | * ing machine cycle.</cite> |
| 1532 | * |
| 1533 | * ==> Since we do not emulate substates, this assumes that the signal is present |
| 1534 | * for at least one cycle (12 states) |
| 1535 | * |
| 1536 | */ |
| 1537 | int new_state = (mcs51.last_line_state & ~(1 << irqline)) | ((state != CLEAR_LINE) << irqline); |
| 1538 | /* detect 0->1 transistions */ |
| 1539 | int tr_state = (~mcs51.last_line_state) & new_state; |
| 1540 | |
| 1541 | switch( irqline ) |
| 1542 | { |
| 1543 | //External Interrupt 0 |
| 1544 | case I8051_INT0_LINE: |
| 1545 | //Line Asserted? |
| 1546 | if (state != CLEAR_LINE) { |
| 1547 | //Is the enable flag for this interrupt set? |
| 1548 | if (GET_EX0) { |
| 1549 | //Need cleared->active line transition? (Logical 1-0 Pulse on the line) - CLEAR->ASSERT Transition since INT0 active lo! |
| 1550 | if (GET_IT0) { |
| 1551 | if (GET_BIT(tr_state, I8051_INT0_LINE)) |
| 1552 | SET_IE0(1); |
| 1553 | } |
| 1554 | else |
| 1555 | SET_IE0(1); //Nope, just set it.. |
| 2239 | 1556 | } |
| 2240 | | uart.bits_to_send-=bits_sent; |
| 2241 | | uart.bitcycles = diff; |
| 2242 | 1557 | } |
| 2243 | | } |
| 1558 | else |
| 1559 | { |
| 1560 | if (!GET_IT0) /* clear if level triggered */ |
| 1561 | SET_IE0(0); |
| 1562 | } |
| 1563 | |
| 1564 | break; |
| 1565 | |
| 1566 | //External Interrupt 1 |
| 1567 | case I8051_INT1_LINE: |
| 1568 | |
| 1569 | //Line Asserted? |
| 1570 | if (state != CLEAR_LINE) { |
| 1571 | if(GET_EX1) { |
| 1572 | //Need cleared->active line transition? (Logical 1-0 Pulse on the line) - CLEAR->ASSERT Transition since INT1 active lo! |
| 1573 | if(GET_IT1){ |
| 1574 | if (GET_BIT(tr_state, I8051_INT1_LINE)) |
| 1575 | SET_IE1(1); |
| 1576 | } |
| 1577 | else |
| 1578 | SET_IE1(1); //Nope, just set it.. |
| 1579 | } |
| 1580 | } |
| 1581 | else |
| 1582 | { |
| 1583 | if (!GET_IT1) /* clear if level triggered */ |
| 1584 | SET_IE1(0); |
| 1585 | } |
| 1586 | break; |
| 1587 | |
| 1588 | case MCS51_T0_LINE: |
| 1589 | if (GET_BIT(tr_state, MCS51_T0_LINE)) |
| 1590 | mcs51.t0_cnt++; |
| 1591 | break; |
| 1592 | |
| 1593 | case MCS51_T1_LINE: |
| 1594 | if (GET_BIT(tr_state, MCS51_T1_LINE)) |
| 1595 | mcs51.t1_cnt++; |
| 1596 | break; |
| 1597 | |
| 1598 | case MCS51_T2_LINE: |
| 1599 | if (mcs51.features & FEATURE_I8052_UART) |
| 1600 | { |
| 1601 | if (GET_BIT(tr_state, MCS51_T2_LINE)) |
| 1602 | mcs51.t2_cnt++; |
| 1603 | } |
| 1604 | else |
| 1605 | fatalerror("mcs51: Trying to set T2_LINE on a non I8052 type cpu.\n"); |
| 1606 | break; |
| 1607 | |
| 1608 | case MCS51_T2EX_LINE: |
| 1609 | if (mcs51.features & FEATURE_I8052_UART) |
| 1610 | { |
| 1611 | if (GET_TR2 && GET_EXEN2) |
| 1612 | if (GET_BIT(tr_state, MCS51_T2EX_LINE)) |
| 1613 | { |
| 1614 | SET_EXF2(1); |
| 1615 | mcs51.t2ex_cnt++; |
| 1616 | } |
| 1617 | } |
| 1618 | else |
| 1619 | fatalerror("mcs51: Trying to set T2EX_LINE on a non I8052 type cpu.\n"); |
| 1620 | break; |
| 1621 | //Serial Port Receive |
| 1622 | case I8051_RX_LINE: |
| 1623 | //Is the enable flags for this interrupt set? |
| 1624 | if (state != CLEAR_LINE) |
| 1625 | { |
| 1626 | serial_receive(); |
| 1627 | } |
| 1628 | break; |
| 2244 | 1629 | } |
| 2245 | | //If no bits left to send - flag the interrupt & call the callback |
| 2246 | | if(!uart.bits_to_send) { |
| 2247 | | //Clear sending flag |
| 2248 | | uart.sending = 0; |
| 2249 | | uart.bitcycles = 0; |
| 2250 | | //Call the callback function |
| 2251 | | if(i8051.serial_tx_callback) |
| 2252 | | i8051.serial_tx_callback(uart.data_out); |
| 2253 | | //Set Interrupt Flag |
| 2254 | | SET_TI(1); |
| 2255 | | //Note: we'll let the main loop catch the interrupt |
| 2256 | | } |
| 1630 | mcs51.last_line_state = new_state; |
| 2257 | 1631 | } |
| 2258 | 1632 | |
| 1633 | /* Execute cycles - returns number of cycles actually run */ |
| 1634 | static int mcs51_execute(int cycles) |
| 1635 | { |
| 1636 | UINT8 op; |
| 2259 | 1637 | |
| 1638 | mcs51_icount = cycles; |
| 1639 | |
| 1640 | /* external interrupts may have been set since we last checked */ |
| 1641 | mcs51.inst_cycles = 0; |
| 1642 | check_irqs(); |
| 1643 | mcs51_icount -= mcs51.inst_cycles; |
| 1644 | burn_cycles(mcs51.inst_cycles); |
| 1645 | |
| 1646 | do |
| 1647 | { |
| 1648 | /* Read next opcode */ |
| 1649 | PPC = PC; |
| 1650 | debugger_instruction_hook(Machine, PC); |
| 1651 | op = cpu_readop(PC++); |
| 1652 | |
| 1653 | /* process opcode and count cycles */ |
| 1654 | mcs51.inst_cycles = mcs51_cycles[op]; |
| 1655 | execute_op(op); |
| 1656 | |
| 1657 | /* burn the cycles */ |
| 1658 | mcs51_icount -= mcs51.inst_cycles; |
| 1659 | burn_cycles(mcs51.inst_cycles); |
| 1660 | |
| 1661 | } while( mcs51_icount > 0 ); |
| 1662 | |
| 1663 | return cycles - mcs51_icount; |
| 1664 | } |
| 1665 | |
| 1666 | |
| 2260 | 1667 | /**************************************************************************** |
| 2261 | | * 8752 Section |
| 1668 | * MCS51/8051 Section |
| 2262 | 1669 | ****************************************************************************/ |
| 2263 | | #if (HAS_I8052 || HAS_I8752) |
| 2264 | | void i8752_init (int index, int clock, const void *config, int (*irqcallback)(int)) { i8051_init(index, clock, config, irqcallback); } |
| 2265 | | void i8752_reset (void) |
| 1670 | |
| 1671 | static void mcs51_sfr_write(size_t offset, UINT8 data) |
| 2266 | 1672 | { |
| 2267 | | memset(&i8051, 0, sizeof(I8051)); |
| 2268 | | memset(&uart, 0, sizeof(I8051_UART)); |
| 2269 | | i8051.subtype = 8752; |
| 1673 | /* update register */ |
| 1674 | assert(offset >= 0x80 && offset <= 0xff); |
| 2270 | 1675 | |
| 2271 | | //Set up 8052 specific internal read/write (indirect) handlers.. |
| 2272 | | i8051.iram_iread = i8052_internal_ram_iread; |
| 2273 | | i8051.iram_iwrite = i8052_internal_ram_iwrite; |
| 1676 | /* TODO: Move to memory map */ |
| 1677 | switch (offset) |
| 1678 | { |
| 1679 | case ADDR_P0: OUT(MCS51_PORT_P0,data); break; |
| 1680 | case ADDR_P1: OUT(MCS51_PORT_P1,data); break; |
| 1681 | case ADDR_P2: OUT(MCS51_PORT_P2,data); break; |
| 1682 | case ADDR_P3: OUT(MCS51_PORT_P3,data); break; |
| 1683 | case ADDR_SBUF: serial_transmit(data); break; |
| 1684 | case ADDR_PSW: SET_PARITY(); break; |
| 1685 | case ADDR_ACC: SET_PARITY(); break; |
| 1686 | /* R_SBUF = data; //This register is used only for "Receiving data coming in!" */ |
| 2274 | 1687 | |
| 1688 | case ADDR_B: |
| 1689 | case ADDR_IP: |
| 1690 | case ADDR_SP: |
| 1691 | case ADDR_DPL: |
| 1692 | case ADDR_DPH: |
| 1693 | case ADDR_PCON: |
| 1694 | case ADDR_TCON: |
| 1695 | case ADDR_TMOD: |
| 1696 | case ADDR_IE: |
| 1697 | case ADDR_TL0: |
| 1698 | case ADDR_TL1: |
| 1699 | case ADDR_TH0: |
| 1700 | case ADDR_TH1: |
| 1701 | case ADDR_SCON: |
| 1702 | break; |
| 1703 | default: |
| 1704 | LOG(("mcs51 #%d: attemping to write to an invalid/non-implemented SFR address: %zx at 0x%04x, data=%x\n", cpu_getactivecpu(), offset,PC,data)); |
| 1705 | /* no write in this case according to manual */ |
| 1706 | return; |
| 1707 | } |
| 1708 | data_write_byte_8le((size_t)offset | 0x100, data); |
| 1709 | } |
| 1710 | |
| 1711 | static UINT8 mcs51_sfr_read(size_t offset) |
| 1712 | { |
| 1713 | assert(offset >= 0x80 && offset <= 0xff); |
| 1714 | |
| 1715 | switch (offset) |
| 1716 | { |
| 1717 | /* Read/Write/Modify operations read the port latch ! */ |
| 1718 | /* Move to memory map */ |
| 1719 | case ADDR_P0: return RWM ? P0 : P0 & IN(MCS51_PORT_P0); |
| 1720 | case ADDR_P1: return RWM ? P1 : P1 & IN(MCS51_PORT_P1); |
| 1721 | case ADDR_P2: return RWM ? P2 : P2 & IN(MCS51_PORT_P2); |
| 1722 | case ADDR_P3: return RWM ? P3 : P3 & IN(MCS51_PORT_P3); |
| 1723 | |
| 1724 | case ADDR_PSW: |
| 1725 | case ADDR_ACC: |
| 1726 | case ADDR_B: |
| 1727 | case ADDR_SP: |
| 1728 | case ADDR_DPL: |
| 1729 | case ADDR_DPH: |
| 1730 | case ADDR_PCON: |
| 1731 | case ADDR_TCON: |
| 1732 | case ADDR_TMOD: |
| 1733 | case ADDR_TL0: |
| 1734 | case ADDR_TL1: |
| 1735 | case ADDR_TH0: |
| 1736 | case ADDR_TH1: |
| 1737 | case ADDR_SCON: |
| 1738 | case ADDR_SBUF: |
| 1739 | case ADDR_IE: |
| 1740 | case ADDR_IP: |
| 1741 | return data_read_byte_8le((size_t) offset | 0x100); |
| 1742 | /* Illegal or non-implemented sfr */ |
| 1743 | default: |
| 1744 | LOG(("mcs51 #%d: attemping to read an invalid/non-implemented SFR address: %zx at 0x%04x\n", cpu_getactivecpu(), offset,PC)); |
| 1745 | /* according to the manual, the read may return random bits */ |
| 1746 | return 0xff; |
| 1747 | } |
| 1748 | } |
| 1749 | |
| 1750 | |
| 1751 | static void mcs51_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1752 | { |
| 1753 | mcs51.irq_callback = irqcallback; |
| 1754 | |
| 1755 | mcs51.features = FEATURE_NONE; |
| 1756 | mcs51.ram_mask = 0x7F; /* 128 bytes of ram */ |
| 1757 | mcs51.num_interrupts = 5; /* 5 interrupts */ |
| 1758 | mcs51.sfr_read = mcs51_sfr_read; |
| 1759 | mcs51.sfr_write = mcs51_sfr_write; |
| 1760 | |
| 1761 | /* Save states */ |
| 1762 | state_save_register_item("mcs51", index, mcs51.ppc); |
| 1763 | state_save_register_item("mcs51", index, mcs51.pc); |
| 1764 | state_save_register_item("mcs51", index, mcs51.rwm ); |
| 1765 | state_save_register_item("mcs51", index, mcs51.cur_irq ); |
| 1766 | state_save_register_item("mcs51", index, mcs51.irq_priority ); |
| 1767 | state_save_register_item("mcs51", index, mcs51.last_line_state ); |
| 1768 | state_save_register_item("mcs51", index, mcs51.t0_cnt ); |
| 1769 | state_save_register_item("mcs51", index, mcs51.t1_cnt ); |
| 1770 | state_save_register_item("mcs51", index, mcs51.t2_cnt ); |
| 1771 | state_save_register_item("mcs51", index, mcs51.t2ex_cnt ); |
| 1772 | state_save_register_item("mcs51", index, mcs51.recalc_parity ); |
| 1773 | } |
| 1774 | |
| 1775 | static void i80c51_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1776 | { |
| 1777 | mcs51_init(index, clock, config, irqcallback); |
| 1778 | |
| 1779 | mcs51.features |= (FEATURE_CMOS_IDLE | FEATURE_CMOS_POWERDOWN); |
| 1780 | } |
| 1781 | |
| 1782 | /* Reset registers to the initial values */ |
| 1783 | static void mcs51_reset(void) |
| 1784 | { |
| 1785 | update_ptrs(); |
| 2275 | 1786 | //Set up serial call back handlers |
| 2276 | | i8051.serial_tx_callback = hold_serial_tx_callback; |
| 1787 | mcs51.serial_tx_callback = hold_serial_tx_callback; |
| 2277 | 1788 | hold_serial_tx_callback = NULL; |
| 2278 | | i8051.serial_rx_callback = hold_serial_rx_callback; |
| 1789 | mcs51.serial_rx_callback = hold_serial_rx_callback; |
| 2279 | 1790 | hold_serial_rx_callback = NULL; |
| 2280 | 1791 | |
| 2281 | | //Setup External ram callback handlers |
| 2282 | | i8051.eram_iaddr_callback = hold_eram_iaddr_callback; |
| 2283 | | hold_eram_iaddr_callback = NULL; |
| 1792 | mcs51.last_line_state = 0; |
| 1793 | mcs51.t0_cnt = 0; |
| 1794 | mcs51.t1_cnt = 0; |
| 1795 | mcs51.t2_cnt = 0; |
| 1796 | mcs51.t2ex_cnt = 0; |
| 2284 | 1797 | |
| 2285 | | //Clear Ram (w/0xff) |
| 2286 | | memset(&i8051.IntRam,0xff,sizeof(i8051.IntRam)); |
| 2287 | | |
| 2288 | 1798 | /* these are all defined reset states */ |
| 2289 | 1799 | PC = 0; |
| 2290 | | SFR_W(SP, 0x7); |
| 2291 | | SFR_W(PSW, 0); |
| 2292 | | SFR_W(DPH, 0); |
| 2293 | | SFR_W(DPL, 0); |
| 2294 | | SFR_W(ACC, 0); |
| 2295 | | SFR_W(B, 0); |
| 2296 | | SFR_W(IP, 0); |
| 2297 | | SFR_W(IE, 0); |
| 2298 | | SFR_W(SCON, 0); |
| 2299 | | SFR_W(TCON, 0); |
| 2300 | | SFR_W(TMOD, 0); |
| 2301 | | SFR_W(TH1, 0); |
| 2302 | | SFR_W(TH0, 0); |
| 2303 | | SFR_W(TL1, 0); |
| 2304 | | SFR_W(TL0, 0); |
| 2305 | | //8052 Only registers |
| 2306 | | SFR_W(T2CON, 0); |
| 2307 | | SFR_W(RCAP2L, 0); |
| 2308 | | SFR_W(RCAP2H, 0); |
| 2309 | | SFR_W(TL2, 0); |
| 2310 | | SFR_W(TH2, 0); |
| 2311 | | |
| 1800 | SP = 0x7; |
| 1801 | SET_PSW(0); |
| 1802 | SET_ACC(0); |
| 1803 | DPH = 0; |
| 1804 | DPL = 0; |
| 1805 | B = 0; |
| 1806 | IP = 0; |
| 1807 | IE = 0; |
| 1808 | SCON = 0; |
| 1809 | TCON = 0; |
| 1810 | TMOD = 0; |
| 1811 | TH1 = 0; |
| 1812 | TH0 = 0; |
| 1813 | TL1 = 0; |
| 1814 | TL0 = 0; |
| 2312 | 1815 | /* set the port configurations to all 1's */ |
| 2313 | | SFR_W(P3, 0xff); |
| 2314 | | SFR_W(P2, 0xff); |
| 2315 | | SFR_W(P1, 0xff); |
| 2316 | | SFR_W(P0, 0xff); |
| 1816 | SET_P3(0xff); |
| 1817 | SET_P2(0xff); |
| 1818 | SET_P1(0xff); |
| 1819 | SET_P0(0xff); |
| 2317 | 1820 | |
| 2318 | 1821 | /* Flag as NO IRQ in Progress */ |
| 2319 | | CLEAR_CURRENT_IRQ |
| 1822 | CLEAR_CURRENT_IRQ(); |
| 2320 | 1823 | } |
| 2321 | 1824 | |
| 2322 | | void i8752_exit (void) { i8051_exit(); } |
| 2323 | | int i8752_execute(int cycles) { return i8051_execute(cycles); } |
| 2324 | | void i8752_get_context (void *dst) { i8051_get_context(dst); } |
| 2325 | | void i8752_set_context (void *src) { i8051_set_context(src); } |
| 2326 | | unsigned i8752_get_reg (int regnum) { return i8051_get_reg(regnum); } |
| 2327 | | void i8752_set_reg (int regnum, unsigned val) { i8051_set_reg(regnum,val); } |
| 2328 | | void i8752_set_irq_line(int irqline, int state) { i8051_set_irq_line(irqline,state); } |
| 2329 | | void i8752_set_irq_callback(int (*callback)(int irqline)) { i8051_set_irq_callback(callback); } |
| 2330 | | void i8752_set_serial_tx_callback(void (*callback)(int data)) { i8051_set_serial_tx_callback(callback); } |
| 2331 | | void i8752_set_serial_rx_callback(int (*callback)(void)) { i8051_set_serial_rx_callback(callback); } |
| 2332 | | void i8752_state_save(void *file) { i8051_state_save(file); } |
| 2333 | | void i8752_state_load(void *file) { i8051_state_load(file); } |
| 1825 | /* Shut down CPU core */ |
| 1826 | static void mcs51_exit(void) |
| 1827 | { |
| 1828 | /* nothing to do */ |
| 1829 | } |
| 2334 | 1830 | |
| 2335 | | /* The following two handlers are used by the MAME Debugger Memory Window... |
| 2336 | | By keeping these functions separate from the internally used IRAM_W/IRAM_R functions, |
| 2337 | | we can manipulate and display internal memory in the debugger memory window in a layout |
| 2338 | | that is not necessarily how the real memory is.. this will be especially useful for |
| 2339 | | the 8052 chip where both the SFR and the upper 128 bytes of ram are mapped to the same |
| 2340 | | address, so we can handle that here by mapping the sfr to a different address */ |
| 1831 | /**************************************************************************** |
| 1832 | * 8052 Section |
| 1833 | ****************************************************************************/ |
| 2341 | 1834 | |
| 2342 | | READ8_HANDLER(i8752_internal_r) |
| 1835 | static void i8052_sfr_write(size_t offset, UINT8 data) |
| 2343 | 1836 | { |
| 2344 | | //USE INDIRECT READ TO ALLOW FULL 256 Bytes of RAM to show in the debugger |
| 2345 | | if(offset < 0x100) |
| 2346 | | return IRAM_IR(offset); |
| 2347 | | else |
| 2348 | | //MAP SFR registers starting at 256 (they are only 128 bytes in size) |
| 2349 | | if(offset < 0x100+0x80) |
| 2350 | | return SFR_R(offset-0x80); |
| 2351 | | else |
| 2352 | | //Everything else is 0 (and invalid) |
| 2353 | | return 0; |
| 1837 | switch (offset) |
| 1838 | { |
| 1839 | /* 8052 family specific */ |
| 1840 | case ADDR_T2CON: |
| 1841 | case ADDR_RCAP2L: |
| 1842 | case ADDR_RCAP2H: |
| 1843 | case ADDR_TL2: |
| 1844 | case ADDR_TH2: |
| 1845 | data_write_byte_8le((size_t) offset | 0x100, data); |
| 1846 | break; |
| 1847 | |
| 1848 | default: |
| 1849 | mcs51_sfr_write(offset, data); |
| 1850 | } |
| 2354 | 1851 | } |
| 2355 | | WRITE8_HANDLER(i8752_internal_w) |
| 1852 | |
| 1853 | static UINT8 i8052_sfr_read(size_t offset) |
| 2356 | 1854 | { |
| 2357 | | //USE INDIRECT WRITE TO ALLOW FULL 256 Bytes of RAM to show in the debugger |
| 2358 | | if(offset < 0x100) |
| 2359 | | IRAM_IW(offset,data); |
| 2360 | | else |
| 2361 | | if(offset < 0x100+0x80) |
| 2362 | | SFR_W(offset-0x80,data); |
| 1855 | switch (offset) |
| 1856 | { |
| 1857 | /* 8052 family specific */ |
| 1858 | case ADDR_T2CON: |
| 1859 | case ADDR_RCAP2L: |
| 1860 | case ADDR_RCAP2H: |
| 1861 | case ADDR_TL2: |
| 1862 | case ADDR_TH2: |
| 1863 | return data_read_byte_8le((size_t) offset | 0x100); |
| 1864 | default: |
| 1865 | return mcs51_sfr_read(offset); |
| 1866 | } |
| 2363 | 1867 | } |
| 2364 | 1868 | |
| 2365 | | /* Reads the contents of the Internal RAM memory INDIRECTLY */ |
| 2366 | | /* Anything above 0x7f is NOT sfr/register, but rather UPPER 128K OF INTERNAL RAM */ |
| 2367 | | static READ8_HANDLER(i8052_internal_ram_iread) |
| 1869 | static void i8052_init (int index, int clock, const void *config, int (*irqcallback)(int)) |
| 2368 | 1870 | { |
| 2369 | | if (offset < 0x100) |
| 2370 | | return i8051.IntRam[offset]; |
| 2371 | | else |
| 2372 | | LOG(("i8051 #%d: attemping to read from an invalid Internal Ram address: %x at 0x%04x\n", cpu_getactivecpu(), offset,PC)); |
| 2373 | | return 0xff; |
| 1871 | mcs51_init(index, clock, config, irqcallback); |
| 1872 | |
| 1873 | mcs51.ram_mask = 0xFF; /* 256 bytes of ram */ |
| 1874 | mcs51.num_interrupts = 6; /* 6 interrupts */ |
| 1875 | |
| 1876 | mcs51.features |= FEATURE_I8052_UART; |
| 1877 | mcs51.sfr_read = i8052_sfr_read; |
| 1878 | mcs51.sfr_write = i8052_sfr_write; |
| 2374 | 1879 | } |
| 2375 | 1880 | |
| 2376 | | /* Writes the contents of the Internal RAM memory INDIRECTLY */ |
| 2377 | | /* Anything above 0x7f is NOT sfr/register, but rather UPPER 128K OF INTERNAL RAM */ |
| 2378 | | static WRITE8_HANDLER(i8052_internal_ram_iwrite) |
| 1881 | static void i80c52_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 2379 | 1882 | { |
| 2380 | | data &= 0xff; //Ensure it's only 8 bits |
| 2381 | | if (offset < 0x100) |
| 2382 | | i8051.IntRam[offset] = data; |
| 2383 | | else |
| 2384 | | LOG(("i8051 #%d: attemping to write to an invalid Internal Ram address: %x at 0x%04x\n", cpu_getactivecpu(), offset,PC)); |
| 1883 | i8052_init(index, clock, config, irqcallback); |
| 1884 | |
| 1885 | mcs51.features |= (FEATURE_CMOS_IDLE | FEATURE_CMOS_POWERDOWN); |
| 2385 | 1886 | } |
| 2386 | 1887 | |
| 2387 | | #endif //(HAS_8752) |
| 1888 | static void i8052_reset(void) |
| 1889 | { |
| 1890 | mcs51_reset(); |
| 2388 | 1891 | |
| 1892 | //8052 Only registers |
| 1893 | T2CON = 0; |
| 1894 | RCAP2L = 0; |
| 1895 | RCAP2H = 0; |
| 1896 | TL2 = 0; |
| 1897 | TH2 = 0; |
| 1898 | } |
| 1899 | |
| 1900 | /*************************************************************************** |
| 1901 | ADDRESS MAPS |
| 1902 | ***************************************************************************/ |
| 1903 | |
| 1904 | |
| 1905 | /* FIXME: the memory maps should probably support rom banking for EA */ |
| 1906 | static ADDRESS_MAP_START(program_12bit, ADDRESS_SPACE_PROGRAM, 8) |
| 1907 | AM_RANGE(0x00, 0x0fff) AM_ROM |
| 1908 | ADDRESS_MAP_END |
| 1909 | |
| 1910 | static ADDRESS_MAP_START(program_13bit, ADDRESS_SPACE_PROGRAM, 8) |
| 1911 | AM_RANGE(0x00, 0x1fff) AM_ROM |
| 1912 | ADDRESS_MAP_END |
| 1913 | |
| 1914 | static ADDRESS_MAP_START(data_7bit, ADDRESS_SPACE_DATA, 8) |
| 1915 | AM_RANGE(0x0000, 0x007f) AM_RAM |
| 1916 | AM_RANGE(0x0100, 0x01ff) AM_RAM /* SFR */ |
| 1917 | ADDRESS_MAP_END |
| 1918 | |
| 1919 | static ADDRESS_MAP_START(data_8bit, ADDRESS_SPACE_DATA, 8) |
| 1920 | AM_RANGE(0x0000, 0x00ff) AM_RAM |
| 1921 | AM_RANGE(0x0100, 0x01ff) AM_RAM /* SFR */ |
| 1922 | ADDRESS_MAP_END |
| 1923 | |
| 1924 | |
| 1925 | /*************************************************************************** |
| 1926 | GENERAL CONTEXT ACCESS |
| 1927 | ***************************************************************************/ |
| 1928 | |
| 1929 | static void mcs51_get_context(void *dst) |
| 1930 | { |
| 1931 | if( dst ) |
| 1932 | memcpy(dst, &mcs51, sizeof(mcs51_regs)); |
| 1933 | } |
| 1934 | |
| 1935 | static void mcs51_set_context(void *src) |
| 1936 | { |
| 1937 | if( src ) |
| 1938 | memcpy(&mcs51, src, sizeof(mcs51_regs)); |
| 1939 | change_pc(PC); |
| 1940 | update_ptrs(); |
| 1941 | } |
| 1942 | |
| 2389 | 1943 | /************************************************************************** |
| 2390 | 1944 | * Generic set_info |
| 2391 | 1945 | **************************************************************************/ |
| 2392 | 1946 | |
| 2393 | | static void i8051_set_info(UINT32 state, cpuinfo *info) |
| 1947 | static void mcs51_set_info(UINT32 state, cpuinfo *info) |
| 2394 | 1948 | { |
| 2395 | 1949 | switch (state) |
| 2396 | 1950 | { |
| 2397 | 1951 | /* --- the following bits of info are set as 64-bit signed integers --- */ |
| 2398 | 1952 | case CPUINFO_INT_PC: PC = info->i; break; |
| 2399 | | case CPUINFO_INT_SP: i8051.sp = info->i; break; |
| 1953 | case CPUINFO_INT_SP: SP = info->i; break; |
| 2400 | 1954 | |
| 2401 | | case CPUINFO_INT_INPUT_STATE + I8051_INT0_LINE: i8051_set_irq_line(I8051_INT0_LINE, info->i); break; |
| 2402 | | case CPUINFO_INT_INPUT_STATE + I8051_INT1_LINE: i8051_set_irq_line(I8051_INT1_LINE, info->i); break; |
| 2403 | | case CPUINFO_INT_INPUT_STATE + I8051_T0_LINE: i8051_set_irq_line(I8051_T0_LINE, info->i); break; |
| 2404 | | case CPUINFO_INT_INPUT_STATE + I8051_T1_LINE: i8051_set_irq_line(I8051_T1_LINE, info->i); break; |
| 2405 | | case CPUINFO_INT_INPUT_STATE + I8051_RX_LINE: i8051_set_irq_line(I8051_RX_LINE, info->i); break; |
| 1955 | case CPUINFO_INT_INPUT_STATE + I8051_INT0_LINE: mcs51_set_irq_line(I8051_INT0_LINE, info->i); break; |
| 1956 | case CPUINFO_INT_INPUT_STATE + I8051_INT1_LINE: mcs51_set_irq_line(I8051_INT1_LINE, info->i); break; |
| 1957 | case CPUINFO_INT_INPUT_STATE + MCS51_T0_LINE: mcs51_set_irq_line(MCS51_T0_LINE, info->i); break; |
| 1958 | case CPUINFO_INT_INPUT_STATE + MCS51_T1_LINE: mcs51_set_irq_line(MCS51_T1_LINE, info->i); break; |
| 1959 | case CPUINFO_INT_INPUT_STATE + I8051_RX_LINE: mcs51_set_irq_line(I8051_RX_LINE, info->i); break; |
| 2406 | 1960 | |
| 2407 | | case CPUINFO_INT_REGISTER + I8051_PC: PC = info->i; break; |
| 2408 | | case CPUINFO_INT_REGISTER + I8051_SP: R_SP = info->i; break; |
| 2409 | | case CPUINFO_INT_REGISTER + I8051_PSW: i8051.psw = info->i; break; |
| 2410 | | case CPUINFO_INT_REGISTER + I8051_ACC: i8051.acc = info->i; break; |
| 2411 | | case CPUINFO_INT_REGISTER + I8051_B: i8051.b = info->i; break; |
| 2412 | | case CPUINFO_INT_REGISTER + I8051_DPH: i8051.dph = info->i; break; |
| 2413 | | case CPUINFO_INT_REGISTER + I8051_DPL: i8051.dpl = info->i; break; |
| 2414 | | case CPUINFO_INT_REGISTER + I8051_IE: i8051.ie = info->i; break; |
| 2415 | | case CPUINFO_INT_REGISTER + I8051_R0: i8051.IntRam[0+(8*((i8051.psw & 0x18)>>3))] = info->i; break; |
| 2416 | | case CPUINFO_INT_REGISTER + I8051_R1: i8051.IntRam[1+(8*((i8051.psw & 0x18)>>3))] = info->i; break; |
| 2417 | | case CPUINFO_INT_REGISTER + I8051_R2: i8051.IntRam[2+(8*((i8051.psw & 0x18)>>3))] = info->i; break; |
| 2418 | | case CPUINFO_INT_REGISTER + I8051_R3: i8051.IntRam[3+(8*((i8051.psw & 0x18)>>3))] = info->i; break; |
| 2419 | | case CPUINFO_INT_REGISTER + I8051_R4: i8051.IntRam[4+(8*((i8051.psw & 0x18)>>3))] = info->i; break; |
| 2420 | | case CPUINFO_INT_REGISTER + I8051_R5: i8051.IntRam[5+(8*((i8051.psw & 0x18)>>3))] = info->i; break; |
| 2421 | | case CPUINFO_INT_REGISTER + I8051_R6: i8051.IntRam[6+(8*((i8051.psw & 0x18)>>3))] = info->i; break; |
| 2422 | | case CPUINFO_INT_REGISTER + I8051_R7: i8051.IntRam[7+(8*((i8051.psw & 0x18)>>3))] = info->i; break; |
| 2423 | | case CPUINFO_INT_REGISTER + I8051_RB: i8051.IntRam[8+(8*((i8051.psw & 0x18)>>3))] = info->i; break; |
| 1961 | case CPUINFO_INT_REGISTER + I8051_PC: PC = info->i; break; |
| 1962 | case CPUINFO_INT_REGISTER + I8051_SP: SP = info->i; break; |
| 1963 | case CPUINFO_INT_REGISTER + I8051_PSW: SET_PSW(info->i); break; |
| 1964 | case CPUINFO_INT_REGISTER + I8051_ACC: SET_ACC(info->i); break; |
| 1965 | case CPUINFO_INT_REGISTER + I8051_B: B = info->i; break; |
| 1966 | case CPUINFO_INT_REGISTER + I8051_DPH: DPH = info->i; break; |
| 1967 | case CPUINFO_INT_REGISTER + I8051_DPL: DPL = info->i; break; |
| 1968 | case CPUINFO_INT_REGISTER + I8051_IE: IE = info->i; break; |
| 1969 | case CPUINFO_INT_REGISTER + I8051_R0: SET_REG(0, info->i); break; |
| 1970 | case CPUINFO_INT_REGISTER + I8051_R1: SET_REG(1, info->i); break; |
| 1971 | case CPUINFO_INT_REGISTER + I8051_R2: SET_REG(2, info->i); break; |
| 1972 | case CPUINFO_INT_REGISTER + I8051_R3: SET_REG(3, info->i); break; |
| 1973 | case CPUINFO_INT_REGISTER + I8051_R4: SET_REG(4, info->i); break; |
| 1974 | case CPUINFO_INT_REGISTER + I8051_R5: SET_REG(5, info->i); break; |
| 1975 | case CPUINFO_INT_REGISTER + I8051_R6: SET_REG(6, info->i); break; |
| 1976 | case CPUINFO_INT_REGISTER + I8051_R7: SET_REG(7, info->i); break; |
| 1977 | case CPUINFO_INT_REGISTER + I8051_RB: SET_RS(info->i); break; |
| 2424 | 1978 | } |
| 2425 | 1979 | } |
| 2426 | 1980 | |
| 1981 | |
| 1982 | |
| 2427 | 1983 | /************************************************************************** |
| 2428 | 1984 | * Generic get_info |
| 2429 | 1985 | **************************************************************************/ |
| 2430 | 1986 | |
| 2431 | | void i8051_get_info(UINT32 state, cpuinfo *info) |
| 1987 | static void mcs51_get_info(UINT32 state, cpuinfo *info) |
| 2432 | 1988 | { |
| 2433 | | I8051 *r = &i8051; |
| 1989 | mcs51_regs *r = &mcs51; |
| 2434 | 1990 | |
| 2435 | 1991 | switch (state) |
| 2436 | 1992 | { |
| 2437 | 1993 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 2438 | | case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(i8051); break; |
| 1994 | case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(mcs51); break; |
| 2439 | 1995 | case CPUINFO_INT_DEFAULT_IRQ_VECTOR: info->i = 0; break; |
| 2440 | 1996 | case CPUINFO_INT_ENDIANNESS: info->i = CPU_IS_LE; break; |
| 2441 | 1997 | case CPUINFO_INT_CLOCK_MULTIPLIER: info->i = 1; break; |
| 2442 | | case CPUINFO_INT_CLOCK_DIVIDER: info->i = 1; break; |
| 1998 | case CPUINFO_INT_CLOCK_DIVIDER: info->i = 12; break; |
| 2443 | 1999 | case CPUINFO_INT_MIN_INSTRUCTION_BYTES: info->i = 1; break; |
| 2444 | 2000 | case CPUINFO_INT_MAX_INSTRUCTION_BYTES: info->i = 5; break; |
| 2445 | 2001 | case CPUINFO_INT_MIN_CYCLES: info->i = 1; break; |
| r3485 | r3486 | |
| 2450 | 2006 | case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16; break; |
| 2451 | 2007 | case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0; break; |
| 2452 | 2008 | case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA: info->i = 8; break; |
| 2453 | | case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA: info->i = 16; break; |
| 2009 | case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA: info->i = 9; /* due to sfr mapping */ break; |
| 2454 | 2010 | case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA: info->i = 0; break; |
| 2455 | 2011 | case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO: info->i = 8; break; |
| 2456 | | case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO: info->i = 16; break; |
| 2012 | case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO: info->i = 17; break; |
| 2457 | 2013 | case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO: info->i = 0; break; |
| 2458 | 2014 | |
| 2459 | 2015 | case CPUINFO_INT_PREVIOUSPC: info->i = PPC; break; |
| 2460 | 2016 | case CPUINFO_INT_PC: info->i = PC; break; |
| 2461 | | case CPUINFO_INT_SP: info->i = R_SP; break; |
| 2017 | case CPUINFO_INT_SP: info->i = SP; break; |
| 2462 | 2018 | |
| 2463 | 2019 | case CPUINFO_INT_REGISTER + I8051_PC: info->i = PC; break; |
| 2464 | | case CPUINFO_INT_REGISTER + I8051_SP: info->i = R_SP; break; |
| 2465 | | case CPUINFO_INT_REGISTER + I8051_PSW: info->i = i8051.psw; break; |
| 2466 | | case CPUINFO_INT_REGISTER + I8051_ACC: info->i = i8051.acc; break; |
| 2467 | | case CPUINFO_INT_REGISTER + I8051_B: info->i = i8051.b; break; |
| 2468 | | case CPUINFO_INT_REGISTER + I8051_DPH: info->i = i8051.dph; break; |
| 2469 | | case CPUINFO_INT_REGISTER + I8051_DPL: info->i = i8051.dpl; break; |
| 2470 | | case CPUINFO_INT_REGISTER + I8051_IE: info->i = i8051.ie; break; |
| 2471 | | case CPUINFO_INT_REGISTER + I8051_R0: info->i = i8051.IntRam[0+(8*((i8051.psw & 0x18)>>3))]; break; |
| 2472 | | case CPUINFO_INT_REGISTER + I8051_R1: info->i = i8051.IntRam[1+(8*((i8051.psw & 0x18)>>3))]; break; |
| 2473 | | case CPUINFO_INT_REGISTER + I8051_R2: info->i = i8051.IntRam[2+(8*((i8051.psw & 0x18)>>3))]; break; |
| 2474 | | case CPUINFO_INT_REGISTER + I8051_R3: info->i = i8051.IntRam[3+(8*((i8051.psw & 0x18)>>3))]; break; |
| 2475 | | case CPUINFO_INT_REGISTER + I8051_R4: info->i = i8051.IntRam[4+(8*((i8051.psw & 0x18)>>3))]; break; |
| 2476 | | case CPUINFO_INT_REGISTER + I8051_R5: info->i = i8051.IntRam[5+(8*((i8051.psw & 0x18)>>3))]; break; |
| 2477 | | case CPUINFO_INT_REGISTER + I8051_R6: info->i = i8051.IntRam[6+(8*((i8051.psw & 0x18)>>3))]; break; |
| 2478 | | case CPUINFO_INT_REGISTER + I8051_R7: info->i = i8051.IntRam[7+(8*((i8051.psw & 0x18)>>3))]; break; |
| 2479 | | case CPUINFO_INT_REGISTER + I8051_RB: info->i = i8051.IntRam[8+(8*((i8051.psw & 0x18)>>3))]; break; |
| 2020 | case CPUINFO_INT_REGISTER + I8051_SP: info->i = SP; break; |
| 2021 | case CPUINFO_INT_REGISTER + I8051_PSW: info->i = PSW; break; |
| 2022 | case CPUINFO_INT_REGISTER + I8051_ACC: info->i = ACC; break; |
| 2023 | case CPUINFO_INT_REGISTER + I8051_B: info->i = B; break; |
| 2024 | case CPUINFO_INT_REGISTER + I8051_DPH: info->i = DPH; break; |
| 2025 | case CPUINFO_INT_REGISTER + I8051_DPL: info->i = DPL; break; |
| 2026 | case CPUINFO_INT_REGISTER + I8051_IE: info->i = IE; break; |
| 2027 | case CPUINFO_INT_REGISTER + I8051_R0: info->i = R_REG(0); break; |
| 2028 | case CPUINFO_INT_REGISTER + I8051_R1: info->i = R_REG(1); break; |
| 2029 | case CPUINFO_INT_REGISTER + I8051_R2: info->i = R_REG(2); break; |
| 2030 | case CPUINFO_INT_REGISTER + I8051_R3: info->i = R_REG(3); break; |
| 2031 | case CPUINFO_INT_REGISTER + I8051_R4: info->i = R_REG(4); break; |
| 2032 | case CPUINFO_INT_REGISTER + I8051_R5: info->i = R_REG(5); break; |
| 2033 | case CPUINFO_INT_REGISTER + I8051_R6: info->i = R_REG(6); break; |
| 2034 | case CPUINFO_INT_REGISTER + I8051_R7: info->i = R_REG(7); break; |
| 2035 | case CPUINFO_INT_REGISTER + I8051_RB: info->i = R_REG(8); break; |
| 2480 | 2036 | |
| 2481 | 2037 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 2482 | | case CPUINFO_PTR_SET_INFO: info->setinfo = i8051_set_info; break; |
| 2483 | | case CPUINFO_PTR_GET_CONTEXT: info->getcontext = i8051_get_context; break; |
| 2484 | | case CPUINFO_PTR_SET_CONTEXT: info->setcontext = i8051_set_context; break; |
| 2485 | | case CPUINFO_PTR_INIT: info->init = i8051_init; break; |
| 2486 | | case CPUINFO_PTR_RESET: info->reset = i8051_reset; break; |
| 2487 | | case CPUINFO_PTR_EXIT: info->exit = i8051_exit; break; |
| 2488 | | case CPUINFO_PTR_EXECUTE: info->execute = i8051_execute; break; |
| 2038 | case CPUINFO_PTR_SET_INFO: info->setinfo = mcs51_set_info; break; |
| 2039 | case CPUINFO_PTR_GET_CONTEXT: info->getcontext = mcs51_get_context; break; |
| 2040 | case CPUINFO_PTR_SET_CONTEXT: info->setcontext = mcs51_set_context; break; |
| 2041 | case CPUINFO_PTR_INIT: info->init = mcs51_init; break; |
| 2042 | case CPUINFO_PTR_RESET: info->reset = mcs51_reset; break; |
| 2043 | case CPUINFO_PTR_EXIT: info->exit = mcs51_exit; break; |
| 2044 | case CPUINFO_PTR_EXECUTE: info->execute = mcs51_execute; break; |
| 2489 | 2045 | case CPUINFO_PTR_BURN: info->burn = NULL; break; |
| 2490 | 2046 | case CPUINFO_PTR_DISASSEMBLE: info->disassemble = i8051_dasm; break; |
| 2491 | | case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &i8051_icount; break; |
| 2047 | case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &mcs51_icount; break; |
| 2492 | 2048 | |
| 2493 | 2049 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = NULL; break; |
| 2494 | 2050 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map8 = NULL; break; |
| 2495 | 2051 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO: info->internal_map8 = NULL; break; |
| 2496 | 2052 | |
| 2497 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 2498 | 2053 | case CPUINFO_STR_NAME: strcpy(info->s, "I8051"); break; |
| 2499 | 2054 | case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "MCS-51"); break; |
| 2500 | 2055 | case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break; |
| r3485 | r3486 | |
| 2503 | 2058 | |
| 2504 | 2059 | case CPUINFO_STR_FLAGS: |
| 2505 | 2060 | sprintf(info->s, "%c%c%c%c%c%c%c%c", |
| 2506 | | r->psw & 0x80 ? 'C':'.', |
| 2507 | | r->psw & 0x40 ? 'A':'.', |
| 2508 | | r->psw & 0x20 ? 'F':'.', |
| 2509 | | r->psw & 0x10 ? '0':'.', |
| 2510 | | r->psw & 0x08 ? '1':'.', |
| 2511 | | r->psw & 0x04 ? 'V':'.', |
| 2512 | | r->psw & 0x02 ? '?':'.', |
| 2513 | | r->psw & 0x01 ? 'P':'.'); |
| 2061 | PSW & 0x80 ? 'C':'.', |
| 2062 | PSW & 0x40 ? 'A':'.', |
| 2063 | PSW & 0x20 ? 'F':'.', |
| 2064 | PSW & 0x10 ? '0':'.', |
| 2065 | PSW & 0x08 ? '1':'.', |
| 2066 | PSW & 0x04 ? 'V':'.', |
| 2067 | PSW & 0x02 ? '?':'.', |
| 2068 | PSW & 0x01 ? 'P':'.'); |
| 2514 | 2069 | break; |
| 2515 | 2070 | |
| 2516 | 2071 | case CPUINFO_STR_REGISTER + I8051_PC: sprintf(info->s, "PC:%04X", r->pc); break; |
| 2517 | | case CPUINFO_STR_REGISTER + I8051_SP: sprintf(info->s, "SP:%02X", r->sp); break; |
| 2518 | | case CPUINFO_STR_REGISTER + I8051_PSW: sprintf(info->s, "PSW:%02X", r->psw); break; |
| 2519 | | case CPUINFO_STR_REGISTER + I8051_ACC: sprintf(info->s, "A:%02X", r->acc); break; |
| 2520 | | case CPUINFO_STR_REGISTER + I8051_B: sprintf(info->s, "B:%02X", r->b); break; |
| 2521 | | case CPUINFO_STR_REGISTER + I8051_DPH: sprintf(info->s, "DPH:%02X", r->dph); break; |
| 2522 | | case CPUINFO_STR_REGISTER + I8051_DPL: sprintf(info->s, "DPL:%02X", r->dpl); break; |
| 2523 | | case CPUINFO_STR_REGISTER + I8051_IE: sprintf(info->s, "IE:%02X", r->ie); break; |
| 2524 | | case CPUINFO_STR_REGISTER + I8051_R0: sprintf(info->s, "R0:%02X", r->IntRam[0+(8*((r->psw & 0x18)>>3))]); break; |
| 2525 | | case CPUINFO_STR_REGISTER + I8051_R1: sprintf(info->s, "R1:%02X", r->IntRam[1+(8*((r->psw & 0x18)>>3))]); break; |
| 2526 | | case CPUINFO_STR_REGISTER + I8051_R2: sprintf(info->s, "R2:%02X", r->IntRam[2+(8*((r->psw & 0x18)>>3))]); break; |
| 2527 | | case CPUINFO_STR_REGISTER + I8051_R3: sprintf(info->s, "R3:%02X", r->IntRam[3+(8*((r->psw & 0x18)>>3))]); break; |
| 2528 | | case CPUINFO_STR_REGISTER + I8051_R4: sprintf(info->s, "R4:%02X", r->IntRam[4+(8*((r->psw & 0x18)>>3))]); break; |
| 2529 | | case CPUINFO_STR_REGISTER + I8051_R5: sprintf(info->s, "R5:%02X", r->IntRam[5+(8*((r->psw & 0x18)>>3))]); break; |
| 2530 | | case CPUINFO_STR_REGISTER + I8051_R6: sprintf(info->s, "R6:%02X", r->IntRam[6+(8*((r->psw & 0x18)>>3))]); break; |
| 2531 | | case CPUINFO_STR_REGISTER + I8051_R7: sprintf(info->s, "R7:%02X", r->IntRam[7+(8*((r->psw & 0x18)>>3))]); break; |
| 2532 | | case CPUINFO_STR_REGISTER + I8051_RB: sprintf(info->s, "RB:%02X", ((r->psw & 0x18)>>3)); break; |
| 2072 | case CPUINFO_STR_REGISTER + I8051_SP: sprintf(info->s, "SP:%02X", SP); break; |
| 2073 | case CPUINFO_STR_REGISTER + I8051_PSW: sprintf(info->s, "PSW:%02X", PSW); break; |
| 2074 | case CPUINFO_STR_REGISTER + I8051_ACC: sprintf(info->s, "A:%02X", ACC); break; |
| 2075 | case CPUINFO_STR_REGISTER + I8051_B: sprintf(info->s, "B:%02X", B); break; |
| 2076 | case CPUINFO_STR_REGISTER + I8051_DPH: sprintf(info->s, "DPH:%02X", DPH); break; |
| 2077 | case CPUINFO_STR_REGISTER + I8051_DPL: sprintf(info->s, "DPL:%02X", DPL); break; |
| 2078 | case CPUINFO_STR_REGISTER + I8051_IE: sprintf(info->s, "IE:%02X", IE); break; |
| 2079 | case CPUINFO_STR_REGISTER + I8051_R0: sprintf(info->s, "R0:%02X", R_REG(0)); break; |
| 2080 | case CPUINFO_STR_REGISTER + I8051_R1: sprintf(info->s, "R1:%02X", R_REG(1)); break; |
| 2081 | case CPUINFO_STR_REGISTER + I8051_R2: sprintf(info->s, "R2:%02X", R_REG(2)); break; |
| 2082 | case CPUINFO_STR_REGISTER + I8051_R3: sprintf(info->s, "R3:%02X", R_REG(3)); break; |
| 2083 | case CPUINFO_STR_REGISTER + I8051_R4: sprintf(info->s, "R4:%02X", R_REG(4)); break; |
| 2084 | case CPUINFO_STR_REGISTER + I8051_R5: sprintf(info->s, "R5:%02X", R_REG(5)); break; |
| 2085 | case CPUINFO_STR_REGISTER + I8051_R6: sprintf(info->s, "R6:%02X", R_REG(6)); break; |
| 2086 | case CPUINFO_STR_REGISTER + I8051_R7: sprintf(info->s, "R7:%02X", R_REG(7)); break; |
| 2087 | case CPUINFO_STR_REGISTER + I8051_RB: sprintf(info->s, "RB:%02X", ((PSW & 0x18)>>3)); break; |
| 2533 | 2088 | } |
| 2534 | 2089 | } |
| 2535 | 2090 | |
| 2536 | | #if (HAS_I8052) |
| 2091 | /************************************************************************** |
| 2092 | * Specific get_info |
| 2093 | **************************************************************************/ |
| 2094 | |
| 2095 | void i8031_get_info(UINT32 state, cpuinfo *info) |
| 2096 | { |
| 2097 | switch (state) |
| 2098 | { |
| 2099 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map8 = address_map_data_7bit; break; |
| 2100 | |
| 2101 | case CPUINFO_STR_NAME: strcpy(info->s, "I8031"); break; |
| 2102 | default: mcs51_get_info(state, info); break; |
| 2103 | } |
| 2104 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 2105 | } |
| 2106 | |
| 2107 | void i8051_get_info(UINT32 state, cpuinfo *info) |
| 2108 | { |
| 2109 | switch (state) |
| 2110 | { |
| 2111 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = address_map_program_12bit; break; |
| 2112 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map8 = address_map_data_7bit; break; |
| 2113 | |
| 2114 | case CPUINFO_STR_NAME: strcpy(info->s, "I8051"); break; |
| 2115 | default: mcs51_get_info(state, info); break; |
| 2116 | } |
| 2117 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 2118 | } |
| 2119 | |
| 2120 | void i8032_get_info(UINT32 state, cpuinfo *info) |
| 2121 | { |
| 2122 | switch (state) |
| 2123 | { |
| 2124 | case CPUINFO_PTR_INIT: info->init = i8052_init; break; |
| 2125 | case CPUINFO_PTR_RESET: info->reset = i8052_reset; break; |
| 2126 | |
| 2127 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map8 = address_map_data_8bit; break; |
| 2128 | |
| 2129 | case CPUINFO_STR_NAME: strcpy(info->s, "I8032"); break; |
| 2130 | |
| 2131 | default: mcs51_get_info(state, info); break; |
| 2132 | } |
| 2133 | } |
| 2134 | |
| 2537 | 2135 | void i8052_get_info(UINT32 state, cpuinfo *info) |
| 2538 | 2136 | { |
| 2539 | 2137 | switch (state) |
| 2540 | 2138 | { |
| 2541 | | case CPUINFO_PTR_GET_CONTEXT: info->getcontext = i8752_get_context; break; |
| 2542 | | case CPUINFO_PTR_SET_CONTEXT: info->setcontext = i8752_set_context; break; |
| 2543 | | case CPUINFO_PTR_INIT: info->init = i8752_init; break; |
| 2544 | | case CPUINFO_PTR_RESET: info->reset = i8752_reset; break; |
| 2545 | | case CPUINFO_PTR_EXIT: info->exit = i8752_exit; break; |
| 2546 | | case CPUINFO_PTR_EXECUTE: info->execute = i8752_execute; break; |
| 2139 | case CPUINFO_PTR_INIT: info->init = i8052_init; break; |
| 2140 | case CPUINFO_PTR_RESET: info->reset = i8052_reset; break; |
| 2547 | 2141 | |
| 2142 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = address_map_program_13bit; break; |
| 2143 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map8 = address_map_data_8bit; break; |
| 2144 | |
| 2548 | 2145 | case CPUINFO_STR_NAME: strcpy(info->s, "I8052"); break; |
| 2549 | 2146 | |
| 2550 | | default: i8051_get_info(state, info); break; |
| 2147 | default: mcs51_get_info(state, info); break; |
| 2551 | 2148 | } |
| 2552 | 2149 | } |
| 2553 | | #endif |
| 2554 | 2150 | |
| 2555 | | #if (HAS_I8751) |
| 2556 | 2151 | void i8751_get_info(UINT32 state, cpuinfo *info) |
| 2557 | 2152 | { |
| 2558 | 2153 | switch (state) |
| 2559 | 2154 | { |
| 2155 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = address_map_program_12bit; break; |
| 2156 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map8 = address_map_data_7bit; break; |
| 2157 | |
| 2560 | 2158 | case CPUINFO_STR_NAME: strcpy(info->s, "I8751"); break; |
| 2561 | 2159 | |
| 2562 | | default: i8051_get_info(state, info); break; |
| 2160 | default: mcs51_get_info(state, info); break; |
| 2563 | 2161 | } |
| 2564 | 2162 | } |
| 2565 | | #endif |
| 2566 | 2163 | |
| 2567 | | #if (HAS_I8752) |
| 2568 | 2164 | void i8752_get_info(UINT32 state, cpuinfo *info) |
| 2569 | 2165 | { |
| 2570 | 2166 | switch (state) |
| 2571 | 2167 | { |
| 2572 | | case CPUINFO_PTR_GET_CONTEXT: info->getcontext = i8752_get_context; break; |
| 2573 | | case CPUINFO_PTR_SET_CONTEXT: info->setcontext = i8752_set_context; break; |
| 2574 | | case CPUINFO_PTR_INIT: info->init = i8752_init; break; |
| 2575 | | case CPUINFO_PTR_RESET: info->reset = i8752_reset; break; |
| 2576 | | case CPUINFO_PTR_EXIT: info->exit = i8752_exit; break; |
| 2577 | | case CPUINFO_PTR_EXECUTE: info->execute = i8752_execute; break; |
| 2168 | case CPUINFO_PTR_INIT: info->init = i8052_init; break; |
| 2169 | case CPUINFO_PTR_RESET: info->reset = i8052_reset; break; |
| 2578 | 2170 | |
| 2171 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = address_map_program_13bit; break; |
| 2172 | case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map8 = address_map_data_8bit; break; |
| 2173 | |
| 2579 | 2174 | case CPUINFO_STR_NAME: strcpy(info->s, "I8752"); break; |
| 2580 | 2175 | |
| 2176 | default: mcs51_get_info(state, info); break; |
| 2177 | } |
| 2178 | } |
| 2179 | |
| 2180 | /************************************************************************** |
| 2181 | * CMOS get_info |
| 2182 | **************************************************************************/ |
| 2183 | |
| 2184 | void i80c31_get_info(UINT32 state, cpuinfo *info) |
| 2185 | { |
| 2186 | switch (state) |
| 2187 | { |
| 2188 | case CPUINFO_PTR_INIT: info->init = i80c51_init; break; |
| 2189 | case CPUINFO_STR_NAME: strcpy(info->s, "I80C31"); break; |
| 2190 | default: i8031_get_info(state, info); break; |
| 2191 | } |
| 2192 | } |
| 2193 | |
| 2194 | void i80c51_get_info(UINT32 state, cpuinfo *info) |
| 2195 | { |
| 2196 | switch (state) |
| 2197 | { |
| 2198 | case CPUINFO_PTR_INIT: info->init = i80c51_init; break; |
| 2199 | case CPUINFO_STR_NAME: strcpy(info->s, "I80C51"); break; |
| 2581 | 2200 | default: i8051_get_info(state, info); break; |
| 2582 | 2201 | } |
| 2583 | 2202 | } |
| 2584 | | #endif |
| 2203 | |
| 2204 | void i80c32_get_info(UINT32 state, cpuinfo *info) |
| 2205 | { |
| 2206 | switch (state) |
| 2207 | { |
| 2208 | case CPUINFO_PTR_INIT: info->init = i80c52_init; break; |
| 2209 | case CPUINFO_STR_NAME: strcpy(info->s, "I80C32"); break; |
| 2210 | default: i8032_get_info(state, info); break; |
| 2211 | } |
| 2212 | } |
| 2213 | |
| 2214 | void i80c52_get_info(UINT32 state, cpuinfo *info) |
| 2215 | { |
| 2216 | switch (state) |
| 2217 | { |
| 2218 | case CPUINFO_PTR_INIT: info->init = i80c52_init; break; |
| 2219 | case CPUINFO_STR_NAME: strcpy(info->s, "I80C52"); break; |
| 2220 | default: i8052_get_info(state, info); break; |
| 2221 | } |
| 2222 | } |
| 2223 | |
| 2224 | void i87c51_get_info(UINT32 state, cpuinfo *info) |
| 2225 | { |
| 2226 | switch (state) |
| 2227 | { |
| 2228 | case CPUINFO_PTR_INIT: info->init = i80c51_init; break; |
| 2229 | case CPUINFO_STR_NAME: strcpy(info->s, "I87C51"); break; |
| 2230 | default: i8751_get_info(state, info); break; |
| 2231 | } |
| 2232 | } |
| 2233 | |
| 2234 | void i87c52_get_info(UINT32 state, cpuinfo *info) |
| 2235 | { |
| 2236 | switch (state) |
| 2237 | { |
| 2238 | case CPUINFO_PTR_INIT: info->init = i80c52_init; break; |
| 2239 | case CPUINFO_STR_NAME: strcpy(info->s, "I87C52"); break; |
| 2240 | default: i8752_get_info(state, info); break; |
| 2241 | } |
| 2242 | } |
| 2243 | |
| 2244 | /************************************************************************** |
| 2245 | * Other variants get_info |
| 2246 | **************************************************************************/ |
| 2247 | |
| 2248 | void at89c4051_get_info(UINT32 state, cpuinfo *info) |
| 2249 | { |
| 2250 | switch (state) |
| 2251 | { |
| 2252 | case CPUINFO_PTR_INIT: info->init = i80c51_init; break; |
| 2253 | case CPUINFO_STR_NAME: strcpy(info->s, "AT89C4051"); break; |
| 2254 | default: i8051_get_info(state, info); break; |
| 2255 | } |
| 2256 | } |