src/mess/machine/nes_pcb.c
| r8325 | r8326 | |
| 322 | 322 | { "BANDAI-LZ93D50+24C02", BANDAI_LZ93EX }, |
| 323 | 323 | { "BANDAI-FCG-1", BANDAI_FCG }, |
| 324 | 324 | { "BANDAI-FCG-2", BANDAI_FCG }, |
| 325 | | { "BANDAI-JUMP2", BANDAI_JUMP2 }, |
| 325 | { "BANDAI-JUMP2", BANDAI_JUMP2 }, |
| 326 | 326 | { "BANDAI-DATACH", BANDAI_DATACH }, |
| 327 | 327 | { "BANDAI-KARAOKE", BANDAI_KARAOKE }, |
| 328 | 328 | { "BANDAI-OEKAKIDS", BANDAI_OEKAKIDS }, |
| r8325 | r8326 | |
| 530 | 530 | { "BTL-TOBIDASEDAISAKUSEN", UNSUPPORTED_BOARD },// mapper 120 |
| 531 | 531 | { "BTL-SHUIGUANPIPE", UNSUPPORTED_BOARD },// mapper 183 |
| 532 | 532 | { "BTL-PIKACHUY2K", UNSUPPORTED_BOARD },// mapper 254 |
| 533 | | // |
| 533 | // |
| 534 | 534 | { "BMC-190IN1", BMC_190IN1 }, |
| 535 | 535 | { "BMC-64IN1NOREPEAT", BMC_64IN1NR }, |
| 536 | 536 | { "BMC-A65AS", BMC_A65AS }, |
| r8325 | r8326 | |
| 623 | 623 | |
| 624 | 624 | PCB Emulation (to be moved to MAME later) |
| 625 | 625 | |
| 626 | | In the end, iNES, UNIF and xml should be |
| 627 | | simply handled through a look-up table |
| 626 | In the end, iNES, UNIF and xml should be |
| 627 | simply handled through a look-up table |
| 628 | 628 | which associates the mapper/board/feature |
| 629 | 629 | to the correct pcb_id and then the core |
| 630 | 630 | function pcb_handlers_setup should be called |
| 631 | 631 | to set-up the expected handlers and callbacks |
| 632 | | |
| 633 | | Similarly, PC-10, VSNES and NES-based |
| 634 | | multigame boards, should simply call |
| 635 | | pcb_handlers_setup with the proper pcb_id |
| 632 | |
| 633 | Similarly, PC-10, VSNES and NES-based |
| 634 | multigame boards, should simply call |
| 635 | pcb_handlers_setup with the proper pcb_id |
| 636 | 636 | at the beginning, rather than use ad hoc |
| 637 | 637 | implementations. |
| 638 | | |
| 638 | |
| 639 | 639 | ************************************************/ |
| 640 | 640 | |
| 641 | 641 | |
| 642 | 642 | /************************************************************* |
| 643 | | |
| 643 | |
| 644 | 644 | UxROM board emulation |
| 645 | | |
| 645 | |
| 646 | 646 | writes to 0x8000-0xffff change PRG 16K lower banks |
| 647 | | |
| 647 | |
| 648 | 648 | missing BC? |
| 649 | 649 | |
| 650 | 650 | iNES: mapper 2 |
| r8325 | r8326 | |
| 654 | 654 | static WRITE8_HANDLER( uxrom_w ) |
| 655 | 655 | { |
| 656 | 656 | LOG_MMC(("uxrom_w, offset: %04x, data: %02x\n", offset, data)); |
| 657 | | |
| 657 | |
| 658 | 658 | prg16_89ab(space->machine, data); |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | /************************************************************* |
| 662 | | |
| 662 | |
| 663 | 663 | Nihon Bussan UNROM M5 |
| 664 | 664 | |
| 665 | 665 | Games: Crazy Climber Jpn |
| 666 | | |
| 666 | |
| 667 | 667 | Very simple mapper: prg16_89ab is always set to bank 0, |
| 668 | 668 | while prg16_cdef is set by writes to 0x8000-0xffff. The game |
| 669 | 669 | uses a custim controller. |
| 670 | | |
| 670 | |
| 671 | 671 | iNES: mapper 180 |
| 672 | | |
| 672 | |
| 673 | 673 | In MESS: Supported. |
| 674 | | |
| 674 | |
| 675 | 675 | *************************************************************/ |
| 676 | 676 | |
| 677 | 677 | static WRITE8_HANDLER( uxrom_cc_w ) |
| 678 | 678 | { |
| 679 | 679 | LOG_MMC(("uxrom_cc_w, offset: %04x, data: %02x\n", offset, data)); |
| 680 | | |
| 680 | |
| 681 | 681 | prg16_cdef(space->machine, data); |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | /************************************************************* |
| 685 | | |
| 685 | |
| 686 | 686 | UN1ROM board emulation |
| 687 | | |
| 688 | | writes to 0x8000-0xffff change PRG 16K lower banks |
| 689 | | |
| 687 | |
| 688 | writes to 0x8000-0xffff change PRG 16K lower banks |
| 689 | |
| 690 | 690 | missing BC? |
| 691 | 691 | |
| 692 | 692 | iNES: mapper 94 |
| 693 | | |
| 693 | |
| 694 | 694 | *************************************************************/ |
| 695 | 695 | |
| 696 | 696 | static WRITE8_HANDLER( un1rom_w ) |
| 697 | 697 | { |
| 698 | 698 | LOG_MMC(("un1rom_w, offset: %04x, data: %02x\n", offset, data)); |
| 699 | | |
| 699 | |
| 700 | 700 | prg16_89ab(space->machine, data >> 2); |
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | /************************************************************* |
| 704 | | |
| 704 | |
| 705 | 705 | CNROM board emulation |
| 706 | | |
| 706 | |
| 707 | 707 | writes to 0x8000-0xffff change CHR 8K banks |
| 708 | | |
| 708 | |
| 709 | 709 | missing BC? |
| 710 | 710 | |
| 711 | 711 | iNES: mapper 3 |
| 712 | | |
| 713 | | Notice that BANDAI_PT554 board (Aerobics Studio) uses very |
| 714 | | similar hardware but with an additional sound chip which |
| 712 | |
| 713 | Notice that BANDAI_PT554 board (Aerobics Studio) uses very |
| 714 | similar hardware but with an additional sound chip which |
| 715 | 715 | gets writes to 0x6000 (currently unemulated in MESS) |
| 716 | 716 | |
| 717 | 717 | *************************************************************/ |
| r8325 | r8326 | |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | /************************************************************* |
| 738 | | |
| 738 | |
| 739 | 739 | Bandai PT-554 board emulation |
| 740 | | |
| 740 | |
| 741 | 741 | This is used by Aerobics Studio. It is basically a CNROM board |
| 742 | 742 | with an additional sound chip which is not currently emulated by |
| 743 | 743 | MESS |
| 744 | | |
| 744 | |
| 745 | 745 | iNES: mapper 3? |
| 746 | 746 | |
| 747 | 747 | *************************************************************/ |
| r8325 | r8326 | |
| 749 | 749 | static WRITE8_HANDLER( bandai_pt554_m_w ) |
| 750 | 750 | { |
| 751 | 751 | LOG_MMC(("Bandai PT-554 Sound write, data: %02x\n", data)); |
| 752 | | |
| 752 | |
| 753 | 753 | // according to NEStopia, this is the effect |
| 754 | 754 | if (!BIT(data, 6)) |
| 755 | 755 | { |
| r8325 | r8326 | |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | /************************************************************* |
| 761 | | |
| 761 | |
| 762 | 762 | CPROM board emulation |
| 763 | | |
| 763 | |
| 764 | 764 | writes to 0x8000-0xffff change CHR 4K lower banks |
| 765 | | |
| 765 | |
| 766 | 766 | iNES: mapper 13 |
| 767 | | |
| 767 | |
| 768 | 768 | *************************************************************/ |
| 769 | 769 | |
| 770 | 770 | static WRITE8_HANDLER( cprom_w ) |
| r8325 | r8326 | |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | /************************************************************* |
| 777 | | |
| 777 | |
| 778 | 778 | AxROM board emulation |
| 779 | | |
| 779 | |
| 780 | 780 | writes to 0x8000-0xffff change PRG banks + sets mirroring |
| 781 | | |
| 781 | |
| 782 | 782 | missing BC for AMROM? |
| 783 | | |
| 783 | |
| 784 | 784 | iNES: mapper 7 |
| 785 | | |
| 785 | |
| 786 | 786 | *************************************************************/ |
| 787 | 787 | |
| 788 | 788 | static WRITE8_HANDLER( axrom_w ) |
| 789 | 789 | { |
| 790 | 790 | LOG_MMC(("axrom_w, offset: %04x, data: %02x\n", offset, data)); |
| 791 | | |
| 791 | |
| 792 | 792 | set_nt_mirroring(space->machine, BIT(data, 4) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 793 | 793 | prg32(space->machine, data); |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | /************************************************************* |
| 797 | | |
| 797 | |
| 798 | 798 | BxROM board emulation |
| 799 | | |
| 799 | |
| 800 | 800 | writes to 0x8000-0xffff change PRG banks |
| 801 | | |
| 801 | |
| 802 | 802 | missing BC? |
| 803 | | |
| 803 | |
| 804 | 804 | iNES: mapper 34 |
| 805 | | |
| 805 | |
| 806 | 806 | *************************************************************/ |
| 807 | 807 | |
| 808 | 808 | static WRITE8_HANDLER( bxrom_w ) |
| r8325 | r8326 | |
| 810 | 810 | /* This portion of the mapper is nearly identical to Mapper 7, except no one-screen mirroring */ |
| 811 | 811 | /* Deadly Towers is really a BxROM game - the demo screens look wrong using mapper 7. */ |
| 812 | 812 | LOG_MMC(("bxrom_w, offset: %04x, data: %02x\n", offset, data)); |
| 813 | | |
| 813 | |
| 814 | 814 | prg32(space->machine, data); |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | /************************************************************* |
| 818 | | |
| 818 | |
| 819 | 819 | GxROM/MxROM board emulation |
| 820 | | |
| 820 | |
| 821 | 821 | writes to 0x8000-0xffff change PRG and CHR banks |
| 822 | | |
| 822 | |
| 823 | 823 | missing BC? |
| 824 | | |
| 824 | |
| 825 | 825 | iNES: mapper 66 |
| 826 | | |
| 826 | |
| 827 | 827 | *************************************************************/ |
| 828 | 828 | |
| 829 | 829 | static WRITE8_HANDLER( gxrom_w ) |
| 830 | 830 | { |
| 831 | 831 | LOG_MMC(("gxrom_w, offset %04x, data: %02x\n", offset, data)); |
| 832 | | |
| 832 | |
| 833 | 833 | prg32(space->machine, (data & 0xf0) >> 4); |
| 834 | 834 | chr8(space->machine, data & 0x0f, CHRROM); |
| 835 | 835 | } |
| 836 | 836 | |
| 837 | 837 | /************************************************************* |
| 838 | | |
| 838 | |
| 839 | 839 | SxROM (MMC1 based) board emulation |
| 840 | | |
| 841 | | iNES: mapper 1 (and 155 for the MMC1A variant which does not |
| 840 | |
| 841 | iNES: mapper 1 (and 155 for the MMC1A variant which does not |
| 842 | 842 | have WRAM disable bit) |
| 843 | | |
| 843 | |
| 844 | 844 | *************************************************************/ |
| 845 | 845 | |
| 846 | 846 | static TIMER_CALLBACK( mmc1_resync_callback ) |
| r8325 | r8326 | |
| 890 | 890 | { |
| 891 | 891 | nes_state *state = (nes_state *)machine->driver_data; |
| 892 | 892 | UINT8 prg_mode, prg_offset; |
| 893 | | |
| 893 | |
| 894 | 894 | prg_mode = state->mmc_reg[0] & 0x0c; |
| 895 | 895 | /* prg_mode&0x8 determines bank size: 32k (if 0) or 16k (if 1)? when in 16k mode, |
| 896 | | prg_mode&0x4 determines which half of the PRG space we can swap: if it is 4, |
| 897 | | mmc_reg[3] sets banks at 0x8000; if it is 0, mmc_reg[3] sets banks at 0xc000. */ |
| 898 | | |
| 896 | prg_mode&0x4 determines which half of the PRG space we can swap: if it is 4, |
| 897 | mmc_reg[3] sets banks at 0x8000; if it is 0, mmc_reg[3] sets banks at 0xc000. */ |
| 898 | |
| 899 | 899 | prg_offset = state->mmc_reg[1] & 0x10; |
| 900 | 900 | /* In principle, mmc_reg[2]&0x10 might affect "extended" banks as well, when chr_mode=1. |
| 901 | | However, quoting Disch's docs: When in 4k CHR mode, 0x10 in both $A000 and $C000 *must* be |
| 902 | | set to the same value, or else pages will constantly be swapped as graphics render! |
| 903 | | Hence, we use only mmc_reg[1]&0x10 for prg_offset */ |
| 901 | However, quoting Disch's docs: When in 4k CHR mode, 0x10 in both $A000 and $C000 *must* be |
| 902 | set to the same value, or else pages will constantly be swapped as graphics render! |
| 903 | Hence, we use only mmc_reg[1]&0x10 for prg_offset */ |
| 904 | 904 | |
| 905 | 905 | switch (prg_mode) |
| 906 | 906 | { |
| 907 | 907 | case 0x00: |
| 908 | 908 | case 0x04: |
| 909 | | // printf("PRG 32 bank %d \n", (prg_offset + state->mmc_reg[3]) >> 1); |
| 909 | // printf("PRG 32 bank %d \n", (prg_offset + state->mmc_reg[3]) >> 1); |
| 910 | 910 | prg32(machine, (prg_offset + state->mmc_reg[3]) >> 1); |
| 911 | 911 | break; |
| 912 | 912 | case 0x08: |
| 913 | | // printf("PRG 16 bank %d (high) \n", prg_offset + state->mmc_reg[3]); |
| 913 | // printf("PRG 16 bank %d (high) \n", prg_offset + state->mmc_reg[3]); |
| 914 | 914 | prg16_89ab(machine, prg_offset + 0); |
| 915 | 915 | prg16_cdef(machine, prg_offset + state->mmc_reg[3]); |
| 916 | 916 | break; |
| 917 | 917 | case 0x0c: |
| 918 | | // printf("PRG 16 bank %d (low) \n", prg_offset + state->mmc_reg[3]); |
| 918 | // printf("PRG 16 bank %d (low) \n", prg_offset + state->mmc_reg[3]); |
| 919 | 919 | prg16_89ab(machine, prg_offset + state->mmc_reg[3]); |
| 920 | 920 | prg16_cdef(machine, prg_offset + 0x0f); |
| 921 | 921 | break; |
| r8325 | r8326 | |
| 932 | 932 | { |
| 933 | 933 | nes_state *state = (nes_state *)machine->driver_data; |
| 934 | 934 | UINT8 chr_mode = BIT(state->mmc_reg[0], 4); |
| 935 | | |
| 935 | |
| 936 | 936 | if (chr_mode) |
| 937 | 937 | { |
| 938 | 938 | chr4_0(machine, state->mmc_reg[1] & 0x1f, state->mmc_chr_source); |
| r8325 | r8326 | |
| 947 | 947 | running_machine *machine = space->machine; |
| 948 | 948 | nes_state *state = (nes_state *)machine->driver_data; |
| 949 | 949 | /* Note that there is only one latch and shift counter, shared amongst the 4 regs */ |
| 950 | | /* Space Shuttle will not work if they have independent variables. */ |
| 951 | | |
| 950 | /* Space Shuttle will not work if they have independent variables. */ |
| 951 | |
| 952 | 952 | /* here we would need to add an if(cpu_cycles_passed>1) test, and |
| 953 | | if requirement is not met simply return without writing anything. |
| 954 | | Some games (AD&D Hillsfar, Bill & Ted Excellent Adventure, Cosmic |
| 955 | | Wars, Rocket Ranger, Sesame Street 123 and Snow Brothers) rely on |
| 956 | | this behavior!! */ |
| 953 | if requirement is not met simply return without writing anything. |
| 954 | Some games (AD&D Hillsfar, Bill & Ted Excellent Adventure, Cosmic |
| 955 | Wars, Rocket Ranger, Sesame Street 123 and Snow Brothers) rely on |
| 956 | this behavior!! */ |
| 957 | 957 | if (state->mmc1_reg_write_enable == 0) |
| 958 | 958 | { |
| 959 | 959 | return; |
| r8325 | r8326 | |
| 968 | 968 | { |
| 969 | 969 | state->mmc_count = 0; |
| 970 | 970 | state->mmc_latch1 = 0; |
| 971 | | |
| 971 | |
| 972 | 972 | /* Set reg at 0x8000 to size 16k and lower half swap - needed for Robocop 3, Dynowars */ |
| 973 | 973 | state->mmc_reg[0] |= 0x0c; |
| 974 | 974 | mmc1_set_prg_wram(space, board); |
| 975 | 975 | return; |
| 976 | 976 | } |
| 977 | | |
| 977 | |
| 978 | 978 | if (state->mmc_count < 5) |
| 979 | 979 | { |
| 980 | 980 | if (state->mmc_count == 0) state->mmc_latch1 = 0; |
| r8325 | r8326 | |
| 982 | 982 | state->mmc_latch1 |= (data & 0x01) ? 0x10 : 0x00; |
| 983 | 983 | state->mmc_count++; |
| 984 | 984 | } |
| 985 | | |
| 985 | |
| 986 | 986 | if (state->mmc_count == 5) |
| 987 | 987 | { |
| 988 | 988 | switch (offset & 0x6000) /* Which reg shall we write to? */ |
| 989 | 989 | { |
| 990 | 990 | case 0x0000: |
| 991 | 991 | state->mmc_reg[0] = state->mmc_latch1; |
| 992 | | |
| 992 | |
| 993 | 993 | switch (state->mmc_reg[0] & 0x03) |
| 994 | 994 | { |
| 995 | 995 | case 0: set_nt_mirroring(machine, PPU_MIRROR_LOW); break; |
| r8325 | r8326 | |
| 1014 | 1014 | mmc1_set_prg_wram(space, board); |
| 1015 | 1015 | break; |
| 1016 | 1016 | } |
| 1017 | | |
| 1017 | |
| 1018 | 1018 | state->mmc_count = 0; |
| 1019 | 1019 | } |
| 1020 | 1020 | } |
| r8325 | r8326 | |
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | /************************************************************* |
| 1031 | | |
| 1031 | |
| 1032 | 1032 | PxROM (MMC2 based) board emulation |
| 1033 | | |
| 1033 | |
| 1034 | 1034 | iNES: mapper 9 |
| 1035 | | |
| 1035 | |
| 1036 | 1036 | *************************************************************/ |
| 1037 | 1037 | |
| 1038 | 1038 | static void mmc2_latch( running_device *device, offs_t offset ) |
| r8325 | r8326 | |
| 1103 | 1103 | } |
| 1104 | 1104 | |
| 1105 | 1105 | /************************************************************* |
| 1106 | | |
| 1106 | |
| 1107 | 1107 | FxROM (MMC4 based) board emulation |
| 1108 | | |
| 1108 | |
| 1109 | 1109 | iNES: mapper 10 |
| 1110 | | |
| 1110 | |
| 1111 | 1111 | *************************************************************/ |
| 1112 | 1112 | |
| 1113 | 1113 | static WRITE8_HANDLER( fxrom_w ) |
| r8325 | r8326 | |
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | 1127 | /************************************************************* |
| 1128 | | |
| 1128 | |
| 1129 | 1129 | TxROM (MMC3 based) board emulation |
| 1130 | | |
| 1130 | |
| 1131 | 1131 | iNES: mapper 4 |
| 1132 | | |
| 1132 | |
| 1133 | 1133 | *************************************************************/ |
| 1134 | 1134 | |
| 1135 | 1135 | static void mmc3_set_wram( const address_space *space ) |
| 1136 | 1136 | { |
| 1137 | 1137 | running_machine *machine = space->machine; |
| 1138 | 1138 | nes_state *state = (nes_state *)machine->driver_data; |
| 1139 | | |
| 1139 | |
| 1140 | 1140 | // skip this function if we are emulating a MMC3 clone with mid writes |
| 1141 | 1141 | if (state->mmc_write_mid != NULL) |
| 1142 | 1142 | return; |
| r8325 | r8326 | |
| 1162 | 1162 | { |
| 1163 | 1163 | nes_state *state = (nes_state *)machine->driver_data; |
| 1164 | 1164 | UINT8 prg_flip = (state->mmc_latch1 & 0x40) ? 2 : 0; |
| 1165 | | |
| 1165 | |
| 1166 | 1166 | prg8_89(machine, prg_base | (state->mmc_prg_bank[0 ^ prg_flip] & prg_mask)); |
| 1167 | 1167 | prg8_ab(machine, prg_base | (state->mmc_prg_bank[1] & prg_mask)); |
| 1168 | 1168 | prg8_cd(machine, prg_base | (state->mmc_prg_bank[2 ^ prg_flip] & prg_mask)); |
| r8325 | r8326 | |
| 1173 | 1173 | { |
| 1174 | 1174 | nes_state *state = (nes_state *)machine->driver_data; |
| 1175 | 1175 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 1176 | | |
| 1176 | |
| 1177 | 1177 | chr1_x(machine, chr_page ^ 0, chr_base | ((state->mmc_vrom_bank[0] & ~0x01) & chr_mask), chr); |
| 1178 | 1178 | chr1_x(machine, chr_page ^ 1, chr_base | ((state->mmc_vrom_bank[0] | 0x01) & chr_mask), chr); |
| 1179 | 1179 | chr1_x(machine, chr_page ^ 2, chr_base | ((state->mmc_vrom_bank[1] & ~0x01) & chr_mask), chr); |
| r8325 | r8326 | |
| 1188 | 1188 | static void mmc3_irq( running_device *device, int scanline, int vblank, int blanked ) |
| 1189 | 1189 | { |
| 1190 | 1190 | nes_state *state = (nes_state *)device->machine->driver_data; |
| 1191 | | |
| 1191 | |
| 1192 | 1192 | if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE) |
| 1193 | 1193 | { |
| 1194 | 1194 | int priorCount = state->IRQ_count; |
| r8325 | r8326 | |
| 1196 | 1196 | state->IRQ_count = state->IRQ_count_latch; |
| 1197 | 1197 | else |
| 1198 | 1198 | state->IRQ_count--; |
| 1199 | | |
| 1199 | |
| 1200 | 1200 | if (state->IRQ_enable && !blanked && (state->IRQ_count == 0) && (priorCount || state->IRQ_clear /*|| !state->mmc3_alt_irq*/)) // according to blargg the latter should be present as well, but it breaks Rampart and Joe & Mac US: they probably use the alt irq! |
| 1201 | 1201 | { |
| 1202 | 1202 | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, |
| r8325 | r8326 | |
| 1211 | 1211 | { |
| 1212 | 1212 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 1213 | 1213 | UINT8 mmc3_helper, cmd; |
| 1214 | | |
| 1214 | |
| 1215 | 1215 | LOG_MMC(("txrom_w, offset: %04x, data: %02x\n", offset, data)); |
| 1216 | | |
| 1216 | |
| 1217 | 1217 | switch (offset & 0x6001) |
| 1218 | 1218 | { |
| 1219 | 1219 | case 0x0000: |
| 1220 | 1220 | mmc3_helper = state->mmc_latch1 ^ data; |
| 1221 | 1221 | state->mmc_latch1 = data; |
| 1222 | | |
| 1222 | |
| 1223 | 1223 | /* Has PRG Mode changed? */ |
| 1224 | 1224 | if (mmc3_helper & 0x40) |
| 1225 | 1225 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 1226 | | |
| 1226 | |
| 1227 | 1227 | /* Has CHR Mode changed? */ |
| 1228 | 1228 | if (mmc3_helper & 0x80) |
| 1229 | 1229 | mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 1230 | 1230 | break; |
| 1231 | | |
| 1231 | |
| 1232 | 1232 | case 0x0001: |
| 1233 | 1233 | cmd = state->mmc_latch1 & 0x07; |
| 1234 | 1234 | switch (cmd) |
| r8325 | r8326 | |
| 1245 | 1245 | break; |
| 1246 | 1246 | } |
| 1247 | 1247 | break; |
| 1248 | | |
| 1248 | |
| 1249 | 1249 | case 0x2000: |
| 1250 | 1250 | set_nt_mirroring(space->machine, BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 1251 | 1251 | break; |
| 1252 | | |
| 1252 | |
| 1253 | 1253 | case 0x2001: |
| 1254 | 1254 | state->mmc_latch2 = data; |
| 1255 | 1255 | mmc3_set_wram(space); |
| 1256 | 1256 | break; |
| 1257 | | |
| 1257 | |
| 1258 | 1258 | case 0x4000: |
| 1259 | 1259 | state->IRQ_count_latch = data; |
| 1260 | 1260 | break; |
| 1261 | | |
| 1261 | |
| 1262 | 1262 | case 0x4001: |
| 1263 | 1263 | state->IRQ_count = 0; |
| 1264 | 1264 | break; |
| 1265 | | |
| 1265 | |
| 1266 | 1266 | case 0x6000: |
| 1267 | 1267 | state->IRQ_enable = 0; |
| 1268 | 1268 | break; |
| 1269 | | |
| 1269 | |
| 1270 | 1270 | case 0x6001: |
| 1271 | 1271 | state->IRQ_enable = 1; |
| 1272 | 1272 | break; |
| 1273 | | |
| 1273 | |
| 1274 | 1274 | default: |
| 1275 | 1275 | logerror("txrom_w uncaught: %04x value: %02x\n", offset + 0x8000, data); |
| 1276 | 1276 | break; |
| r8325 | r8326 | |
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | 1280 | /************************************************************* |
| 1281 | | |
| 1281 | |
| 1282 | 1282 | HKROM (MMC6 based) board emulation |
| 1283 | | |
| 1283 | |
| 1284 | 1284 | iNES: mapper 4 |
| 1285 | | |
| 1285 | |
| 1286 | 1286 | *************************************************************/ |
| 1287 | 1287 | |
| 1288 | 1288 | static WRITE8_HANDLER( hkrom_m_w ) |
| r8325 | r8326 | |
| 1290 | 1290 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 1291 | 1291 | UINT8 write_hi, write_lo; |
| 1292 | 1292 | LOG_MMC(("hkrom_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 1293 | | |
| 1293 | |
| 1294 | 1294 | if (offset < 0x1000) |
| 1295 | | return; |
| 1295 | return; |
| 1296 | 1296 | |
| 1297 | 1297 | // banks can be written only if both read & write is enabled! |
| 1298 | 1298 | write_hi = ((state->mmc6_reg & 0xc0) == 0xc0); |
| r8325 | r8326 | |
| 1300 | 1300 | |
| 1301 | 1301 | if (BIT(offset, 9) && write_hi) // access to upper 1k |
| 1302 | 1302 | state->mapper_ram[offset & (state->mapper_ram_size - 1)] = data; |
| 1303 | | |
| 1303 | |
| 1304 | 1304 | if (!BIT(offset, 9) && write_lo) // access to lower 1k |
| 1305 | 1305 | state->mapper_ram[offset & (state->mapper_ram_size - 1)] = data; |
| 1306 | 1306 | } |
| r8325 | r8326 | |
| 1309 | 1309 | { |
| 1310 | 1310 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 1311 | 1311 | LOG_MMC(("hkrom_m_r, offset: %04x\n", offset)); |
| 1312 | | |
| 1312 | |
| 1313 | 1313 | if (offset < 0x1000) |
| 1314 | 1314 | return 0xff; // here it should be open bus |
| 1315 | 1315 | |
| r8325 | r8326 | |
| 1340 | 1340 | |
| 1341 | 1341 | if (!state->mmc_latch2 && BIT(data, 5)) // if WRAM is disabled and has to be enabled, write |
| 1342 | 1342 | state->mmc_latch2 = BIT(data, 5); // (once WRAM has been enabled, it cannot be disabled without resetting the game) |
| 1343 | | |
| 1343 | |
| 1344 | 1344 | /* Has PRG Mode changed? */ |
| 1345 | 1345 | if (BIT(mmc6_helper, 6)) |
| 1346 | 1346 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 1347 | | |
| 1347 | |
| 1348 | 1348 | /* Has CHR Mode changed? */ |
| 1349 | 1349 | if (BIT(mmc6_helper, 7)) |
| 1350 | 1350 | mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| r8325 | r8326 | |
| 1359 | 1359 | state->IRQ_count = 0; |
| 1360 | 1360 | state->IRQ_clear = 1; |
| 1361 | 1361 | break; |
| 1362 | | |
| 1362 | |
| 1363 | 1363 | default: |
| 1364 | 1364 | txrom_w(space, offset, data); |
| 1365 | 1365 | break; |
| r8325 | r8326 | |
| 1367 | 1367 | } |
| 1368 | 1368 | |
| 1369 | 1369 | /************************************************************* |
| 1370 | | |
| 1370 | |
| 1371 | 1371 | TxSROM (MMC3 based) board emulation |
| 1372 | | |
| 1372 | |
| 1373 | 1373 | iNES: mapper 118 |
| 1374 | | |
| 1374 | |
| 1375 | 1375 | *************************************************************/ |
| 1376 | 1376 | |
| 1377 | 1377 | static void txsrom_set_mirror( running_machine *machine ) |
| r8325 | r8326 | |
| 1398 | 1398 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 1399 | 1399 | UINT8 MMC3_helper, cmd; |
| 1400 | 1400 | LOG_MMC(("mapper118_w, offset: %04x, data: %02x\n", offset, data)); |
| 1401 | | |
| 1401 | |
| 1402 | 1402 | switch (offset & 0x6001) |
| 1403 | 1403 | { |
| 1404 | 1404 | case 0x0000: |
| 1405 | 1405 | MMC3_helper = state->mmc_latch1 ^ data; |
| 1406 | 1406 | state->mmc_latch1 = data; |
| 1407 | | |
| 1407 | |
| 1408 | 1408 | /* Has PRG Mode changed? */ |
| 1409 | 1409 | if (MMC3_helper & 0x40) |
| 1410 | 1410 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 1411 | | |
| 1411 | |
| 1412 | 1412 | /* Has CHR Mode changed? */ |
| 1413 | 1413 | if (MMC3_helper & 0x80) |
| 1414 | 1414 | { |
| r8325 | r8326 | |
| 1416 | 1416 | mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 1417 | 1417 | } |
| 1418 | 1418 | break; |
| 1419 | | |
| 1419 | |
| 1420 | 1420 | case 0x0001: |
| 1421 | 1421 | cmd = state->mmc_latch1 & 0x07; |
| 1422 | 1422 | switch (cmd) |
| r8325 | r8326 | |
| 1434 | 1434 | break; |
| 1435 | 1435 | } |
| 1436 | 1436 | break; |
| 1437 | | |
| 1437 | |
| 1438 | 1438 | case 0x2000: |
| 1439 | 1439 | break; |
| 1440 | | |
| 1440 | |
| 1441 | 1441 | default: |
| 1442 | 1442 | txrom_w(space, offset, data); |
| 1443 | 1443 | break; |
| r8325 | r8326 | |
| 1445 | 1445 | } |
| 1446 | 1446 | |
| 1447 | 1447 | /************************************************************* |
| 1448 | | |
| 1448 | |
| 1449 | 1449 | TQROM (MMC3 based) board emulation |
| 1450 | | |
| 1450 | |
| 1451 | 1451 | iNES: mapper 119 |
| 1452 | | |
| 1452 | |
| 1453 | 1453 | *************************************************************/ |
| 1454 | 1454 | |
| 1455 | 1455 | static void tqrom_set_chr( running_machine *machine ) |
| r8325 | r8326 | |
| 1458 | 1458 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 1459 | 1459 | UINT8 chr_src[6], chr_mask[6]; |
| 1460 | 1460 | int i; |
| 1461 | | |
| 1461 | |
| 1462 | 1462 | for (i = 0; i < 6; i++) |
| 1463 | 1463 | { |
| 1464 | 1464 | chr_src[i] = (state->mmc_vrom_bank[i] & 0x40) ? CHRRAM : CHRROM; |
| 1465 | 1465 | chr_mask[i] = (state->mmc_vrom_bank[i] & 0x40) ? 0x07 : 0x3f; |
| 1466 | 1466 | } |
| 1467 | | |
| 1467 | |
| 1468 | 1468 | chr1_x(machine, chr_page ^ 0, ((state->mmc_vrom_bank[0] & ~0x01) & chr_mask[0]), chr_src[0]); |
| 1469 | 1469 | chr1_x(machine, chr_page ^ 1, ((state->mmc_vrom_bank[0] | 0x01) & chr_mask[0]), chr_src[0]); |
| 1470 | 1470 | chr1_x(machine, chr_page ^ 2, ((state->mmc_vrom_bank[1] & ~0x01) & chr_mask[1]), chr_src[1]); |
| r8325 | r8326 | |
| 1480 | 1480 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 1481 | 1481 | UINT8 MMC3_helper, cmd; |
| 1482 | 1482 | LOG_MMC(("mapper119_w, offset: %04x, data: %02x\n", offset, data)); |
| 1483 | | |
| 1483 | |
| 1484 | 1484 | switch (offset & 0x6001) |
| 1485 | 1485 | { |
| 1486 | 1486 | case 0x0000: |
| 1487 | 1487 | MMC3_helper = state->mmc_latch1 ^ data; |
| 1488 | 1488 | state->mmc_latch1 = data; |
| 1489 | | |
| 1489 | |
| 1490 | 1490 | /* Has PRG Mode changed? */ |
| 1491 | 1491 | if (MMC3_helper & 0x40) |
| 1492 | 1492 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 1493 | | |
| 1493 | |
| 1494 | 1494 | /* Has CHR Mode changed? */ |
| 1495 | 1495 | if (MMC3_helper & 0x80) |
| 1496 | 1496 | tqrom_set_chr(space->machine); |
| r8325 | r8326 | |
| 1511 | 1511 | break; |
| 1512 | 1512 | } |
| 1513 | 1513 | break; |
| 1514 | | |
| 1514 | |
| 1515 | 1515 | default: |
| 1516 | 1516 | txrom_w(space, offset, data); |
| 1517 | 1517 | break; |
| r8325 | r8326 | |
| 1519 | 1519 | } |
| 1520 | 1520 | |
| 1521 | 1521 | /************************************************************* |
| 1522 | | |
| 1522 | |
| 1523 | 1523 | PAL-ZZ board (MMC3 variant for European 3-in-1 Nintendo cart |
| 1524 | 1524 | Super Mario Bros. + Tetris + Nintendo World Cup) |
| 1525 | | |
| 1525 | |
| 1526 | 1526 | iNES: mapper 37 |
| 1527 | | |
| 1527 | |
| 1528 | 1528 | *************************************************************/ |
| 1529 | 1529 | |
| 1530 | 1530 | static WRITE8_HANDLER( zz_m_w ) |
| r8325 | r8326 | |
| 1532 | 1532 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 1533 | 1533 | UINT8 map37_helper; |
| 1534 | 1534 | LOG_MMC(("zz_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 1535 | | |
| 1535 | |
| 1536 | 1536 | map37_helper = data & 0x07; |
| 1537 | | |
| 1537 | |
| 1538 | 1538 | state->mmc_prg_base = (BIT(map37_helper, 2) << 4) | (((map37_helper & 0x03) == 0x03) ? 0x08 : 0); |
| 1539 | 1539 | state->mmc_prg_mask = (map37_helper << 1) | 0x07; |
| 1540 | 1540 | state->mmc_chr_base = BIT(map37_helper, 2) << 7; |
| r8325 | r8326 | |
| 1544 | 1544 | } |
| 1545 | 1545 | |
| 1546 | 1546 | /************************************************************* |
| 1547 | | |
| 1547 | |
| 1548 | 1548 | NES-QJ board (MMC3 variant for US 2-in-1 Nintendo cart |
| 1549 | 1549 | Super Spike V'Ball + Nintendo World Cup) |
| 1550 | | |
| 1550 | |
| 1551 | 1551 | iNES: mapper 47 |
| 1552 | | |
| 1552 | |
| 1553 | 1553 | *************************************************************/ |
| 1554 | 1554 | |
| 1555 | 1555 | static WRITE8_HANDLER( qj_m_w ) |
| 1556 | 1556 | { |
| 1557 | 1557 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 1558 | 1558 | LOG_MMC(("qj_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 1559 | | |
| 1559 | |
| 1560 | 1560 | state->mmc_prg_base = BIT(data, 0) << 4; |
| 1561 | 1561 | state->mmc_prg_mask = 0x0f; |
| 1562 | 1562 | state->mmc_chr_base = BIT(data, 0) << 7; |
| r8325 | r8326 | |
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | 1568 | /************************************************************* |
| 1569 | | |
| 1569 | |
| 1570 | 1570 | ExROM (MMC5 based) board emulation |
| 1571 | | |
| 1571 | |
| 1572 | 1572 | iNES: mapper 5 |
| 1573 | | |
| 1573 | |
| 1574 | 1574 | MESS status: Mostly Unsupported |
| 1575 | | |
| 1575 | |
| 1576 | 1576 | *************************************************************/ |
| 1577 | 1577 | |
| 1578 | 1578 | static void mmc5_irq( running_device *device, int scanline, int vblank, int blanked ) |
| 1579 | 1579 | { |
| 1580 | 1580 | nes_state *state = (nes_state *)device->machine->driver_data; |
| 1581 | | |
| 1581 | |
| 1582 | 1582 | #if 1 |
| 1583 | 1583 | if (scanline == 0) |
| 1584 | 1584 | state->IRQ_status |= 0x40; |
| 1585 | 1585 | else if (scanline > PPU_BOTTOM_VISIBLE_SCANLINE) |
| 1586 | 1586 | state->IRQ_status &= ~0x40; |
| 1587 | 1587 | #endif |
| 1588 | | |
| 1588 | |
| 1589 | 1589 | if (scanline == state->IRQ_count) |
| 1590 | 1590 | { |
| 1591 | 1591 | if (state->IRQ_enable) |
| 1592 | 1592 | cpu_set_input_line(state->maincpu, M6502_IRQ_LINE, HOLD_LINE); |
| 1593 | | |
| 1593 | |
| 1594 | 1594 | state->IRQ_status = 0xff; |
| 1595 | 1595 | } |
| 1596 | 1596 | } |
| r8325 | r8326 | |
| 1621 | 1621 | { |
| 1622 | 1622 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 1623 | 1623 | int retVal; |
| 1624 | | |
| 1624 | |
| 1625 | 1625 | /* $5c00 - $5fff: extended videoram attributes */ |
| 1626 | 1626 | if ((offset >= 0x1b00) && (offset <= 0x1eff)) |
| 1627 | 1627 | { |
| 1628 | 1628 | return state->mmc5_vram[offset - 0x1b00]; |
| 1629 | 1629 | } |
| 1630 | | |
| 1630 | |
| 1631 | 1631 | switch (offset) |
| 1632 | 1632 | { |
| 1633 | 1633 | case 0x1104: /* $5204 */ |
| r8325 | r8326 | |
| 1641 | 1641 | state->IRQ_status &= ~0x80; |
| 1642 | 1642 | return retVal; |
| 1643 | 1643 | #endif |
| 1644 | | |
| 1644 | |
| 1645 | 1645 | case 0x1105: /* $5205 */ |
| 1646 | 1646 | return (state->mult1 * state->mult2) & 0xff; |
| 1647 | 1647 | case 0x1106: /* $5206 */ |
| 1648 | 1648 | return ((state->mult1 * state->mult2) & 0xff00) >> 8; |
| 1649 | | |
| 1649 | |
| 1650 | 1650 | default: |
| 1651 | 1651 | logerror("** MMC5 uncaught read, offset: %04x\n", offset + 0x4100); |
| 1652 | 1652 | return 0x00; |
| r8325 | r8326 | |
| 1657 | 1657 | static WRITE8_HANDLER( exrom_l_w ) |
| 1658 | 1658 | { |
| 1659 | 1659 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 1660 | | |
| 1660 | |
| 1661 | 1661 | // LOG_MMC(("Mapper 5 write, offset: %04x, data: %02x\n", offset + 0x4100, data)); |
| 1662 | 1662 | /* Send $5000-$5015 to the sound chip */ |
| 1663 | 1663 | if ((offset >= 0xf00) && (offset <= 0xf15)) |
| r8325 | r8326 | |
| 1665 | 1665 | nes_psg_w(state->sound, offset & 0x1f, data); |
| 1666 | 1666 | return; |
| 1667 | 1667 | } |
| 1668 | | |
| 1668 | |
| 1669 | 1669 | /* $5c00 - $5fff: extended videoram attributes */ |
| 1670 | 1670 | if ((offset >= 0x1b00) && (offset <= 0x1eff)) |
| 1671 | 1671 | { |
| r8325 | r8326 | |
| 1673 | 1673 | state->mmc5_vram[offset - 0x1b00] = data; |
| 1674 | 1674 | return; |
| 1675 | 1675 | } |
| 1676 | | |
| 1676 | |
| 1677 | 1677 | switch (offset) |
| 1678 | 1678 | { |
| 1679 | 1679 | case 0x1000: /* $5100 */ |
| 1680 | 1680 | state->MMC5_rom_bank_mode = data & 0x03; |
| 1681 | 1681 | LOG_MMC(("MMC5 rom bank mode: %02x\n", data)); |
| 1682 | 1682 | break; |
| 1683 | | |
| 1683 | |
| 1684 | 1684 | case 0x1001: /* $5101 */ |
| 1685 | 1685 | state->MMC5_vrom_bank_mode = data & 0x03; |
| 1686 | 1686 | LOG_MMC(("MMC5 vrom bank mode: %02x\n", data)); |
| 1687 | 1687 | break; |
| 1688 | | |
| 1688 | |
| 1689 | 1689 | case 0x1002: /* $5102 */ |
| 1690 | 1690 | if (data == 0x02) |
| 1691 | 1691 | state->MMC5_vram_protect |= 1; |
| r8325 | r8326 | |
| 1700 | 1700 | state->MMC5_vram_protect = 0; |
| 1701 | 1701 | LOG_MMC(("MMC5 vram protect 2: %02x\n", data)); |
| 1702 | 1702 | break; |
| 1703 | | |
| 1703 | |
| 1704 | 1704 | case 0x1004: /* $5104 - Extra VRAM (EXRAM) control */ |
| 1705 | 1705 | state->mmc5_vram_control = data & 0x03; |
| 1706 | 1706 | LOG_MMC(("MMC5 exram control: %02x\n", data)); |
| 1707 | 1707 | break; |
| 1708 | | |
| 1708 | |
| 1709 | 1709 | case 0x1005: /* $5105 */ |
| 1710 | 1710 | mmc5_ppu_mirror(space->machine, 0, data & 0x03); |
| 1711 | 1711 | mmc5_ppu_mirror(space->machine, 1, (data & 0x0c) >> 2); |
| 1712 | 1712 | mmc5_ppu_mirror(space->machine, 2, (data & 0x30) >> 4); |
| 1713 | 1713 | mmc5_ppu_mirror(space->machine, 3, (data & 0xc0) >> 6); |
| 1714 | 1714 | break; |
| 1715 | | |
| 1715 | |
| 1716 | 1716 | /* tile data for MMC5 flood-fill NT mode */ |
| 1717 | 1717 | case 0x1006: |
| 1718 | 1718 | state->MMC5_floodtile = data; |
| 1719 | 1719 | break; |
| 1720 | | |
| 1720 | |
| 1721 | 1721 | /* attr data for MMC5 flood-fill NT mode */ |
| 1722 | 1722 | case 0x1007: |
| 1723 | 1723 | switch (data & 3) |
| r8325 | r8326 | |
| 1729 | 1729 | case 3: state->MMC5_floodattr = 0xff; break; |
| 1730 | 1730 | } |
| 1731 | 1731 | break; |
| 1732 | | |
| 1732 | |
| 1733 | 1733 | case 0x1013: /* $5113 */ |
| 1734 | 1734 | LOG_MMC(("MMC5 mid RAM bank select: %02x\n", data & 0x07)); |
| 1735 | 1735 | // FIXME: a few Koei games have both WRAM & BWRAM but here we don't support this (yet) |
| r8325 | r8326 | |
| 1738 | 1738 | else |
| 1739 | 1739 | wram_bank(space->machine, data, NES_WRAM); |
| 1740 | 1740 | break; |
| 1741 | | |
| 1741 | |
| 1742 | 1742 | case 0x1014: /* $5114 */ |
| 1743 | 1743 | LOG_MMC(("MMC5 $5114 bank select: %02x (mode: %d)\n", data, state->MMC5_rom_bank_mode)); |
| 1744 | 1744 | switch (state->MMC5_rom_bank_mode) |
| r8325 | r8326 | |
| 2102 | 2102 | break; |
| 2103 | 2103 | } |
| 2104 | 2104 | break; |
| 2105 | | |
| 2105 | |
| 2106 | 2106 | case 0x1030: /* $5130 */ |
| 2107 | 2107 | state->mmc5_high_chr = data & 0x03; |
| 2108 | 2108 | if (state->mmc5_vram_control == 1) |
| 2109 | 2109 | { |
| 2110 | | // in this case state->mmc5_high_chr selects which 256KB of CHR ROM |
| 2110 | // in this case state->mmc5_high_chr selects which 256KB of CHR ROM |
| 2111 | 2111 | // is to be used for all background tiles on the screen. |
| 2112 | 2112 | } |
| 2113 | 2113 | break; |
| 2114 | | |
| 2115 | | |
| 2114 | |
| 2115 | |
| 2116 | 2116 | case 0x1100: /* $5200 */ |
| 2117 | 2117 | state->mmc5_split_scr = data; |
| 2118 | 2118 | // in EX2 and EX3 modes, no split screen |
| 2119 | 2119 | if (state->mmc5_vram_control & 0x02) |
| 2120 | 2120 | state->mmc5_split_scr &= 0x7f; |
| 2121 | 2121 | break; |
| 2122 | | |
| 2122 | |
| 2123 | 2123 | case 0x1103: /* $5203 */ |
| 2124 | 2124 | state->IRQ_count = data; |
| 2125 | 2125 | state->MMC5_scanline = data; |
| r8325 | r8326 | |
| 2135 | 2135 | case 0x1106: /* $5206 */ |
| 2136 | 2136 | state->mult2 = data; |
| 2137 | 2137 | break; |
| 2138 | | |
| 2138 | |
| 2139 | 2139 | default: |
| 2140 | 2140 | logerror("** MMC5 uncaught write, offset: %04x, data: %02x\n", offset + 0x4100, data); |
| 2141 | 2141 | break; |
| r8325 | r8326 | |
| 2143 | 2143 | } |
| 2144 | 2144 | |
| 2145 | 2145 | /************************************************************* |
| 2146 | | |
| 2146 | |
| 2147 | 2147 | NTBROM & Sunsoft-4 board emulation |
| 2148 | 2148 | |
| 2149 | 2149 | Part of this can be used also for Sunsoft Double Cassette |
| 2150 | 2150 | System... which games use it? |
| 2151 | | |
| 2151 | |
| 2152 | 2152 | iNES: mapper 68 |
| 2153 | | |
| 2153 | |
| 2154 | 2154 | *************************************************************/ |
| 2155 | 2155 | |
| 2156 | 2156 | static void ntbrom_mirror( running_machine *machine, int mirror, int mirr0, int mirr1 ) |
| r8325 | r8326 | |
| 2199 | 2199 | static WRITE8_HANDLER( ntbrom_w ) |
| 2200 | 2200 | { |
| 2201 | 2201 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 2202 | | |
| 2202 | |
| 2203 | 2203 | LOG_MMC(("ntbrom_w, offset %04x, data: %02x\n", offset, data)); |
| 2204 | | |
| 2204 | |
| 2205 | 2205 | switch (offset & 0x7000) |
| 2206 | 2206 | { |
| 2207 | 2207 | case 0x0000: |
| r8325 | r8326 | |
| 2238 | 2238 | } |
| 2239 | 2239 | |
| 2240 | 2240 | /************************************************************* |
| 2241 | | |
| 2241 | |
| 2242 | 2242 | JxROM & Sunsoft 5A / 5B / FME7 board emulation |
| 2243 | | |
| 2244 | | Notice that Sunsoft-5B = FME7 + sound chip (the latter being |
| 2243 | |
| 2244 | Notice that Sunsoft-5B = FME7 + sound chip (the latter being |
| 2245 | 2245 | currently unemulated in MESS) |
| 2246 | | |
| 2246 | |
| 2247 | 2247 | iNES: mapper 69 |
| 2248 | | |
| 2248 | |
| 2249 | 2249 | *************************************************************/ |
| 2250 | 2250 | |
| 2251 | 2251 | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| r8325 | r8326 | |
| 2254 | 2254 | static void jxrom_irq( running_device *device, int scanline, int vblank, int blanked ) |
| 2255 | 2255 | { |
| 2256 | 2256 | nes_state *state = (nes_state *)device->machine->driver_data; |
| 2257 | | |
| 2257 | |
| 2258 | 2258 | /* TODO: change to reflect the actual number of cycles spent */ |
| 2259 | 2259 | if ((state->IRQ_enable & 0x80) && (state->IRQ_enable & 0x01)) |
| 2260 | 2260 | { |
| r8325 | r8326 | |
| 2279 | 2279 | { |
| 2280 | 2280 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 2281 | 2281 | LOG_MMC(("jxrom_w, offset %04x, data: %02x\n", offset, data)); |
| 2282 | | |
| 2282 | |
| 2283 | 2283 | switch (offset & 0x6000) |
| 2284 | 2284 | { |
| 2285 | 2285 | case 0x0000: |
| 2286 | 2286 | state->mmc_latch1 = data & 0x0f; |
| 2287 | 2287 | break; |
| 2288 | | |
| 2288 | |
| 2289 | 2289 | case 0x2000: |
| 2290 | 2290 | switch (state->mmc_latch1) |
| 2291 | 2291 | { |
| 2292 | 2292 | case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: |
| 2293 | 2293 | chr1_x(space->machine, state->mmc_latch1, data, CHRROM); |
| 2294 | 2294 | break; |
| 2295 | | |
| 2295 | |
| 2296 | 2296 | case 8: |
| 2297 | 2297 | if (!(data & 0x40)) |
| 2298 | 2298 | { |
| r8325 | r8326 | |
| 2308 | 2308 | memory_set_bank(space->machine, "bank5", state->prg_bank[4]); |
| 2309 | 2309 | } |
| 2310 | 2310 | break; |
| 2311 | | |
| 2311 | |
| 2312 | 2312 | case 9: |
| 2313 | 2313 | prg8_89(space->machine, data); |
| 2314 | 2314 | break; |
| r8325 | r8326 | |
| 2338 | 2338 | break; |
| 2339 | 2339 | } |
| 2340 | 2340 | break; |
| 2341 | | |
| 2341 | |
| 2342 | 2342 | /* Here we would have sound command for Sunsoft 5b variant */ |
| 2343 | 2343 | // case 0x4000: |
| 2344 | 2344 | // case 0x6000: |
| 2345 | | |
| 2345 | |
| 2346 | 2346 | case 0x4000: |
| 2347 | 2347 | LOG_MMC(("Sunsoft-5B Sound: Register select write, data: %02x\n", data)); |
| 2348 | 2348 | break; |
| r8325 | r8326 | |
| 2356 | 2356 | } |
| 2357 | 2357 | |
| 2358 | 2358 | /************************************************************* |
| 2359 | | |
| 2359 | |
| 2360 | 2360 | DxROM & Namcot 3433 - 3443 board emulation |
| 2361 | | |
| 2362 | | These are the same board, but DRROM (and Tengen 800004) have |
| 2361 | |
| 2362 | These are the same board, but DRROM (and Tengen 800004) have |
| 2363 | 2363 | 4-screen mirroring |
| 2364 | | |
| 2364 | |
| 2365 | 2365 | iNES: mappers 88, 206 (same as 88 but possibly 4-screen mirroring) |
| 2366 | | |
| 2366 | |
| 2367 | 2367 | *************************************************************/ |
| 2368 | 2368 | |
| 2369 | 2369 | static WRITE8_HANDLER( dxrom_w ) |
| r8325 | r8326 | |
| 2397 | 2397 | |
| 2398 | 2398 | |
| 2399 | 2399 | /************************************************************* |
| 2400 | | |
| 2400 | |
| 2401 | 2401 | Namcot 3453 board emulation |
| 2402 | | |
| 2402 | |
| 2403 | 2403 | These are the same as Namcot 34x3, but with additional mirroring |
| 2404 | 2404 | control |
| 2405 | | |
| 2405 | |
| 2406 | 2406 | iNES: mapper 154 |
| 2407 | | |
| 2407 | |
| 2408 | 2408 | *************************************************************/ |
| 2409 | 2409 | |
| 2410 | 2410 | static WRITE8_HANDLER( namcot3453_w ) |
| 2411 | 2411 | { |
| 2412 | 2412 | LOG_MMC(("namcot3453_w, offset: %04x, data: %02x\n", offset, data)); |
| 2413 | | |
| 2413 | |
| 2414 | 2414 | // additional mirroring control when writing to even addresses |
| 2415 | 2415 | if (!(offset & 1)) |
| 2416 | 2416 | set_nt_mirroring(space->machine, BIT(data, 6) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| r8325 | r8326 | |
| 2419 | 2419 | } |
| 2420 | 2420 | |
| 2421 | 2421 | /************************************************************* |
| 2422 | | |
| 2422 | |
| 2423 | 2423 | Namcot 3446 board emulation |
| 2424 | | |
| 2424 | |
| 2425 | 2425 | These are similar Namcot 34x3, but different bankswitch capabilities |
| 2426 | | |
| 2426 | |
| 2427 | 2427 | iNES: mapper 76 |
| 2428 | | |
| 2428 | |
| 2429 | 2429 | *************************************************************/ |
| 2430 | 2430 | |
| 2431 | 2431 | static WRITE8_HANDLER( namcot3446_w ) |
| 2432 | 2432 | { |
| 2433 | 2433 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 2434 | 2434 | LOG_MMC(("namcot3446_w, offset: %04x, data: %02x\n", offset, data)); |
| 2435 | | |
| 2435 | |
| 2436 | 2436 | // NEStopia does not have this! |
| 2437 | 2437 | if (offset >= 0x2000) |
| 2438 | 2438 | { |
| r8325 | r8326 | |
| 2440 | 2440 | set_nt_mirroring(space->machine, BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 2441 | 2441 | return; |
| 2442 | 2442 | } |
| 2443 | | |
| 2443 | |
| 2444 | 2444 | switch (offset & 1) |
| 2445 | 2445 | { |
| 2446 | 2446 | case 1: |
| r8325 | r8326 | |
| 2461 | 2461 | } |
| 2462 | 2462 | |
| 2463 | 2463 | /************************************************************* |
| 2464 | | |
| 2464 | |
| 2465 | 2465 | Namcot 3425 board emulation |
| 2466 | | |
| 2467 | | These are similar Namcot 34x3, but with NT mirroring (two |
| 2466 | |
| 2467 | These are similar Namcot 34x3, but with NT mirroring (two |
| 2468 | 2468 | different modes) |
| 2469 | | |
| 2469 | |
| 2470 | 2470 | iNES: mappers 95 |
| 2471 | | |
| 2471 | |
| 2472 | 2472 | *************************************************************/ |
| 2473 | 2473 | |
| 2474 | 2474 | static WRITE8_HANDLER( namcot3425_w ) |
| r8325 | r8326 | |
| 2478 | 2478 | LOG_MMC(("namcot3425_w, offset: %04x, data: %02x\n", offset, data)); |
| 2479 | 2479 | if (offset >= 0x2000) |
| 2480 | 2480 | return; |
| 2481 | | |
| 2481 | |
| 2482 | 2482 | switch (offset & 1) |
| 2483 | 2483 | { |
| 2484 | 2484 | case 1: |
| r8325 | r8326 | |
| 2514 | 2514 | } |
| 2515 | 2515 | |
| 2516 | 2516 | /************************************************************* |
| 2517 | | |
| 2517 | |
| 2518 | 2518 | Discrete Logic board IC 74x377 by Color Dreams / Nina-007 emulation |
| 2519 | | |
| 2519 | |
| 2520 | 2520 | iNES: mappers 11 |
| 2521 | | |
| 2521 | |
| 2522 | 2522 | *************************************************************/ |
| 2523 | 2523 | |
| 2524 | 2524 | static WRITE8_HANDLER( dis_74x377_w ) |
| 2525 | 2525 | { |
| 2526 | 2526 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 2527 | 2527 | LOG_MMC(("dis_74x377_w, offset: %04x, data: %02x\n", offset, data)); |
| 2528 | | |
| 2528 | |
| 2529 | 2529 | chr8(space->machine, data >> 4, state->mmc_chr_source); |
| 2530 | 2530 | prg32(space->machine, data & 0x0f); |
| 2531 | 2531 | } |
| 2532 | 2532 | |
| 2533 | 2533 | /************************************************************* |
| 2534 | | |
| 2534 | |
| 2535 | 2535 | Discrete Logic board IC 74x139x74 by Konami & Jaleco |
| 2536 | | |
| 2536 | |
| 2537 | 2537 | iNES: mappers 87 |
| 2538 | | |
| 2538 | |
| 2539 | 2539 | *************************************************************/ |
| 2540 | 2540 | |
| 2541 | 2541 | static WRITE8_HANDLER( dis_74x139x74_m_w ) |
| 2542 | 2542 | { |
| 2543 | 2543 | LOG_MMC(("dis_74x139x74_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 2544 | | |
| 2544 | |
| 2545 | 2545 | chr8(space->machine, ((data & 0x02) >> 1) | ((data & 0x01) << 1), CHRROM); |
| 2546 | 2546 | } |
| 2547 | 2547 | |
| 2548 | 2548 | /************************************************************* |
| 2549 | | |
| 2549 | |
| 2550 | 2550 | Discrete Logic board IC 74x161x138 |
| 2551 | | |
| 2551 | |
| 2552 | 2552 | iNES: mappers 38 |
| 2553 | | |
| 2553 | |
| 2554 | 2554 | *************************************************************/ |
| 2555 | 2555 | |
| 2556 | 2556 | static WRITE8_HANDLER( dis_74x161x138_m_w ) |
| 2557 | 2557 | { |
| 2558 | 2558 | LOG_MMC(("dis_74x161x138_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 2559 | | |
| 2559 | |
| 2560 | 2560 | chr8(space->machine, data >> 2, CHRROM); |
| 2561 | 2561 | prg32(space->machine, data); |
| 2562 | 2562 | } |
| 2563 | 2563 | |
| 2564 | 2564 | /************************************************************* |
| 2565 | | |
| 2565 | |
| 2566 | 2566 | Discrete Logic board IC 74x161x161x32 |
| 2567 | | |
| 2567 | |
| 2568 | 2568 | There are two variants (one with hardwired mirroring, the |
| 2569 | | other with a mirroring control), making necessary two distinct |
| 2569 | other with a mirroring control), making necessary two distinct |
| 2570 | 2570 | mappers & pcb_id |
| 2571 | | |
| 2571 | |
| 2572 | 2572 | iNES: mapper 70 & 152 |
| 2573 | | |
| 2573 | |
| 2574 | 2574 | *************************************************************/ |
| 2575 | 2575 | |
| 2576 | 2576 | static WRITE8_HANDLER( dis_74x161x161x32_w ) |
| 2577 | 2577 | { |
| 2578 | 2578 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 2579 | 2579 | LOG_MMC(("dis_74x161x161x32_w, offset: %04x, data: %02x\n", offset, data)); |
| 2580 | | |
| 2580 | |
| 2581 | 2581 | if (!state->hard_mirroring) // there are two 'variants' depending on hardwired or mapper ctrl mirroring |
| 2582 | 2582 | set_nt_mirroring(space->machine, BIT(data, 7) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 2583 | 2583 | chr8(space->machine, data, CHRROM); |
| r8325 | r8326 | |
| 2585 | 2585 | } |
| 2586 | 2586 | |
| 2587 | 2587 | /************************************************************* |
| 2588 | | |
| 2588 | |
| 2589 | 2589 | Bandai LZ93D50 boards emulation |
| 2590 | | |
| 2590 | |
| 2591 | 2591 | There are several variants: plain board, board + 24C01 EEPROM, |
| 2592 | | board + 24C02 EEPROM, board + Barcode Reader (DATACH). |
| 2592 | board + 24C02 EEPROM, board + Barcode Reader (DATACH). |
| 2593 | 2593 | We currently only emulate the base hardware. |
| 2594 | | |
| 2594 | |
| 2595 | 2595 | iNES: mapper 16, 153 & 157 |
| 2596 | | |
| 2596 | |
| 2597 | 2597 | *************************************************************/ |
| 2598 | 2598 | |
| 2599 | 2599 | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| r8325 | r8326 | |
| 2602 | 2602 | static void bandai_lz_irq( running_device *device, int scanline, int vblank, int blanked ) |
| 2603 | 2603 | { |
| 2604 | 2604 | nes_state *state = (nes_state *)device->machine->driver_data; |
| 2605 | | |
| 2605 | |
| 2606 | 2606 | /* 114 is the number of cycles per scanline */ |
| 2607 | 2607 | /* TODO: change to reflect the actual number of cycles spent */ |
| 2608 | 2608 | if (state->IRQ_enable) |
| r8325 | r8326 | |
| 2620 | 2620 | { |
| 2621 | 2621 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 2622 | 2622 | LOG_MMC(("lz93d50_w, offset: %04x, data: %02x\n", offset, data)); |
| 2623 | | |
| 2623 | |
| 2624 | 2624 | switch (offset & 0x000f) |
| 2625 | 2625 | { |
| 2626 | 2626 | case 0: case 1: case 2: case 3: |
| r8325 | r8326 | |
| 2672 | 2672 | nes_state *state = (nes_state *)machine->driver_data; |
| 2673 | 2673 | UINT8 mmc_helper = 0; |
| 2674 | 2674 | int i; |
| 2675 | | |
| 2675 | |
| 2676 | 2676 | for (i = 0; i < 8; i++) |
| 2677 | 2677 | mmc_helper |= ((state->mmc_reg[i] & 0x01) << 4); |
| 2678 | | |
| 2678 | |
| 2679 | 2679 | prg16_89ab(machine, mmc_helper | state->mmc_latch1); |
| 2680 | 2680 | prg16_cdef(machine, mmc_helper | 0x0f); |
| 2681 | 2681 | } |
| r8325 | r8326 | |
| 2684 | 2684 | { |
| 2685 | 2685 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 2686 | 2686 | LOG_MMC(("fjump2_w, offset: %04x, data: %02x\n", offset, data)); |
| 2687 | | |
| 2687 | |
| 2688 | 2688 | switch (offset & 0x000f) |
| 2689 | 2689 | { |
| 2690 | 2690 | case 0: case 1: case 2: case 3: |
| r8325 | r8326 | |
| 2703 | 2703 | } |
| 2704 | 2704 | |
| 2705 | 2705 | /************************************************************* |
| 2706 | | |
| 2706 | |
| 2707 | 2707 | Bandai Karaoke Studio board emulation |
| 2708 | | |
| 2708 | |
| 2709 | 2709 | Note: we currently do not emulate the mic |
| 2710 | | |
| 2710 | |
| 2711 | 2711 | iNES: mapper 188 |
| 2712 | | |
| 2712 | |
| 2713 | 2713 | *************************************************************/ |
| 2714 | 2714 | |
| 2715 | 2715 | static WRITE8_HANDLER( bandai_ks_w ) |
| 2716 | 2716 | { |
| 2717 | 2717 | LOG_MMC(("bandai_ks_w, offset: %04x, data: %02x\n", offset, data)); |
| 2718 | | |
| 2718 | |
| 2719 | 2719 | prg16_89ab(space->machine, data ^ 0x08); |
| 2720 | 2720 | } |
| 2721 | 2721 | |
| 2722 | 2722 | /************************************************************* |
| 2723 | | |
| 2723 | |
| 2724 | 2724 | Bandai Oeka Kids board emulation |
| 2725 | | |
| 2725 | |
| 2726 | 2726 | Note: we currently do support the correct mirroring |
| 2727 | | |
| 2727 | |
| 2728 | 2728 | iNES: mapper 96 |
| 2729 | | |
| 2729 | |
| 2730 | 2730 | *************************************************************/ |
| 2731 | 2731 | |
| 2732 | 2732 | static WRITE8_HANDLER( bandai_ok_w ) |
| r8325 | r8326 | |
| 2744 | 2744 | } |
| 2745 | 2745 | |
| 2746 | 2746 | /************************************************************* |
| 2747 | | |
| 2747 | |
| 2748 | 2748 | Irem Discrete board emulation (74*161/161/21/138) |
| 2749 | | |
| 2749 | |
| 2750 | 2750 | iNES: mapper 77 |
| 2751 | | |
| 2751 | |
| 2752 | 2752 | *************************************************************/ |
| 2753 | 2753 | |
| 2754 | 2754 | static WRITE8_HANDLER( lrog017_w ) |
| 2755 | 2755 | { |
| 2756 | 2756 | LOG_MMC(("lrog017_w, offset: %04x, data: %02x\n", offset, data)); |
| 2757 | | |
| 2757 | |
| 2758 | 2758 | prg32(space->machine, data); |
| 2759 | 2759 | chr2_0(space->machine, (data >> 4), CHRROM); |
| 2760 | 2760 | } |
| 2761 | 2761 | |
| 2762 | 2762 | /************************************************************* |
| 2763 | | |
| 2763 | |
| 2764 | 2764 | Irem Holy Diver board emulation |
| 2765 | | |
| 2765 | |
| 2766 | 2766 | iNES: mapper 78 (shared with JF-16) |
| 2767 | | |
| 2767 | |
| 2768 | 2768 | *************************************************************/ |
| 2769 | 2769 | |
| 2770 | 2770 | static WRITE8_HANDLER( irem_hd_w ) |
| 2771 | 2771 | { |
| 2772 | 2772 | LOG_MMC(("irem_hd_w, offset: %04x, data: %02x\n", offset, data)); |
| 2773 | | |
| 2773 | |
| 2774 | 2774 | set_nt_mirroring(space->machine, BIT(data, 3) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 2775 | 2775 | chr8(space->machine, data >> 4, CHRROM); |
| 2776 | 2776 | prg16_89ab(space->machine, data); |
| 2777 | 2777 | } |
| 2778 | 2778 | |
| 2779 | 2779 | /************************************************************* |
| 2780 | | |
| 2780 | |
| 2781 | 2781 | Irem TAM-S1 board emulation |
| 2782 | | |
| 2782 | |
| 2783 | 2783 | iNES: mapper 97 |
| 2784 | | |
| 2784 | |
| 2785 | 2785 | *************************************************************/ |
| 2786 | 2786 | |
| 2787 | 2787 | static WRITE8_HANDLER( tam_s1_w ) |
| 2788 | 2788 | { |
| 2789 | 2789 | LOG_MMC(("tam_s1_w, offset: %04x, data: %02x\n", offset, data)); |
| 2790 | | |
| 2790 | |
| 2791 | 2791 | if (offset < 0x4000) |
| 2792 | 2792 | { |
| 2793 | 2793 | set_nt_mirroring(space->machine, BIT(data, 7) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| r8325 | r8326 | |
| 2796 | 2796 | } |
| 2797 | 2797 | |
| 2798 | 2798 | /************************************************************* |
| 2799 | | |
| 2799 | |
| 2800 | 2800 | Irem G-101 board emulation |
| 2801 | | |
| 2801 | |
| 2802 | 2802 | Major League uses hardwired mirroring |
| 2803 | 2803 | |
| 2804 | 2804 | iNES: mapper 32 |
| 2805 | | |
| 2805 | |
| 2806 | 2806 | *************************************************************/ |
| 2807 | 2807 | |
| 2808 | 2808 | static WRITE8_HANDLER( g101_w ) |
| 2809 | 2809 | { |
| 2810 | 2810 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 2811 | 2811 | LOG_MMC(("g101_w, offset: %04x, data: %02x\n", offset, data)); |
| 2812 | | |
| 2812 | |
| 2813 | 2813 | switch (offset & 0x7000) |
| 2814 | 2814 | { |
| 2815 | 2815 | case 0x0000: |
| r8325 | r8326 | |
| 2831 | 2831 | } |
| 2832 | 2832 | |
| 2833 | 2833 | /************************************************************* |
| 2834 | | |
| 2834 | |
| 2835 | 2835 | Irem H-3001 board emulation |
| 2836 | | |
| 2836 | |
| 2837 | 2837 | iNES: mapper 65 |
| 2838 | | |
| 2838 | |
| 2839 | 2839 | *************************************************************/ |
| 2840 | 2840 | |
| 2841 | 2841 | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| r8325 | r8326 | |
| 2847 | 2847 | if (state->IRQ_enable) |
| 2848 | 2848 | { |
| 2849 | 2849 | state->IRQ_count -= 114; |
| 2850 | | |
| 2850 | |
| 2851 | 2851 | if (state->IRQ_count <= 114) |
| 2852 | 2852 | { |
| 2853 | 2853 | state->IRQ_enable = 0; |
| r8325 | r8326 | |
| 2860 | 2860 | { |
| 2861 | 2861 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 2862 | 2862 | LOG_MMC(("h3001_w, offset %04x, data: %02x\n", offset, data)); |
| 2863 | | |
| 2863 | |
| 2864 | 2864 | switch (offset & 0x7fff) |
| 2865 | 2865 | { |
| 2866 | 2866 | case 0x0000: |
| 2867 | 2867 | prg8_89(space->machine, data); |
| 2868 | 2868 | break; |
| 2869 | | |
| 2869 | |
| 2870 | 2870 | case 0x1001: |
| 2871 | 2871 | set_nt_mirroring(space->machine, BIT(data, 7) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 2872 | 2872 | break; |
| 2873 | | |
| 2873 | |
| 2874 | 2874 | case 0x1003: |
| 2875 | 2875 | state->IRQ_enable = data & 0x80; |
| 2876 | 2876 | break; |
| 2877 | | |
| 2877 | |
| 2878 | 2878 | case 0x1004: |
| 2879 | 2879 | state->IRQ_count = state->IRQ_count_latch; |
| 2880 | 2880 | break; |
| 2881 | | |
| 2881 | |
| 2882 | 2882 | case 0x1005: |
| 2883 | 2883 | state->IRQ_count_latch = (state->IRQ_count_latch & 0x00ff) | (data << 8); |
| 2884 | 2884 | break; |
| 2885 | | |
| 2885 | |
| 2886 | 2886 | case 0x1006: |
| 2887 | 2887 | state->IRQ_count_latch = (state->IRQ_count_latch & 0xff00) | data; |
| 2888 | 2888 | break; |
| 2889 | | |
| 2889 | |
| 2890 | 2890 | case 0x2000: |
| 2891 | 2891 | prg8_ab(space->machine, data); |
| 2892 | 2892 | break; |
| 2893 | | |
| 2893 | |
| 2894 | 2894 | case 0x3000: case 0x3001: case 0x3002: case 0x3003: |
| 2895 | 2895 | case 0x3004: case 0x3005: case 0x3006: case 0x3007: |
| 2896 | 2896 | chr1_x(space->machine, offset & 0x07, data, CHRROM); |
| 2897 | 2897 | break; |
| 2898 | | |
| 2898 | |
| 2899 | 2899 | case 0x4000: |
| 2900 | 2900 | prg8_cd(space->machine, data); |
| 2901 | 2901 | break; |
| 2902 | | |
| 2902 | |
| 2903 | 2903 | default: |
| 2904 | 2904 | break; |
| 2905 | 2905 | } |
| 2906 | 2906 | } |
| 2907 | 2907 | |
| 2908 | 2908 | /************************************************************* |
| 2909 | | |
| 2909 | |
| 2910 | 2910 | Jaleco SS88006 board emulation, aka JF-27, JF-29, JF-30, ..., |
| 2911 | 2911 | JF-38, JF-40, JF-41 |
| 2912 | | |
| 2912 | |
| 2913 | 2913 | iNES: mapper 18 |
| 2914 | | |
| 2914 | |
| 2915 | 2915 | *************************************************************/ |
| 2916 | 2916 | |
| 2917 | 2917 | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| r8325 | r8326 | |
| 2920 | 2920 | static void ss88006_irq( running_device *device, int scanline, int vblank, int blanked ) |
| 2921 | 2921 | { |
| 2922 | 2922 | nes_state *state = (nes_state *)device->machine->driver_data; |
| 2923 | | |
| 2923 | |
| 2924 | 2924 | /* Increment & check the IRQ scanline counter */ |
| 2925 | 2925 | if (state->IRQ_enable) |
| 2926 | 2926 | { |
| r8325 | r8326 | |
| 2969 | 2969 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 2970 | 2970 | UINT8 bank; |
| 2971 | 2971 | LOG_MMC(("mapper18_w, offset: %04x, data: %02x\n", offset, data)); |
| 2972 | | |
| 2972 | |
| 2973 | 2973 | switch (offset & 0x7003) |
| 2974 | 2974 | { |
| 2975 | 2975 | case 0x0000: |
| r8325 | r8326 | |
| 2996 | 2996 | state->mmc_prg_bank[2] = (state->mmc_prg_bank[2] & 0x0f) | (data << 4); |
| 2997 | 2997 | prg8_cd(space->machine, state->mmc_prg_bank[2]); |
| 2998 | 2998 | break; |
| 2999 | | |
| 2999 | |
| 3000 | 3000 | /* $9002, 3 (1002, 3) uncaught = Jaleco Baseball writes 0 */ |
| 3001 | 3001 | /* believe it's related to battery-backed ram enable/disable */ |
| 3002 | | |
| 3002 | |
| 3003 | 3003 | case 0x2000: case 0x2001: case 0x2002: case 0x2003: |
| 3004 | 3004 | case 0x3000: case 0x3001: case 0x3002: case 0x3003: |
| 3005 | 3005 | case 0x4000: case 0x4001: case 0x4002: case 0x4003: |
| r8325 | r8326 | |
| 3009 | 3009 | state->mmc_vrom_bank[bank] = (state->mmc_vrom_bank[bank] & 0x0f) | ((data & 0x0f)<< 4); |
| 3010 | 3010 | else |
| 3011 | 3011 | state->mmc_vrom_bank[bank] = (state->mmc_vrom_bank[bank] & 0xf0) | (data & 0x0f); |
| 3012 | | |
| 3012 | |
| 3013 | 3013 | chr1_x(space->machine, bank, state->mmc_vrom_bank[bank], CHRROM); |
| 3014 | 3014 | break; |
| 3015 | | |
| 3015 | |
| 3016 | 3016 | case 0x6000: |
| 3017 | 3017 | state->IRQ_count_latch = (state->IRQ_count_latch & 0xfff0) | (data & 0x0f); |
| 3018 | 3018 | break; |
| r8325 | r8326 | |
| 3025 | 3025 | case 0x6003: |
| 3026 | 3026 | state->IRQ_count_latch = (state->IRQ_count_latch & 0x0fff) | ((data & 0x0f) << 12); |
| 3027 | 3027 | break; |
| 3028 | | |
| 3028 | |
| 3029 | 3029 | case 0x7000: |
| 3030 | 3030 | state->IRQ_count = state->IRQ_count_latch; |
| 3031 | 3031 | break; |
| r8325 | r8326 | |
| 3033 | 3033 | state->IRQ_enable = data & 0x01; |
| 3034 | 3034 | state->IRQ_mode = data & 0x0e; |
| 3035 | 3035 | break; |
| 3036 | | |
| 3036 | |
| 3037 | 3037 | case 0x7002: |
| 3038 | 3038 | switch (data & 0x03) |
| 3039 | 3039 | { |
| r8325 | r8326 | |
| 3043 | 3043 | case 3: set_nt_mirroring(space->machine, PPU_MIRROR_HIGH); break; |
| 3044 | 3044 | } |
| 3045 | 3045 | break; |
| 3046 | | |
| 3046 | |
| 3047 | 3047 | default: |
| 3048 | 3048 | logerror("Jaleco SS88006 uncaught write, addr: %04x, value: %02x\n", offset + 0x8000, data); |
| 3049 | 3049 | break; |
| r8325 | r8326 | |
| 3051 | 3051 | } |
| 3052 | 3052 | |
| 3053 | 3053 | /************************************************************* |
| 3054 | | |
| 3054 | |
| 3055 | 3055 | Jaleco JF-11, JF-12 & JF-14 boards emulation |
| 3056 | | |
| 3056 | |
| 3057 | 3057 | iNES: mapper 140 |
| 3058 | | |
| 3058 | |
| 3059 | 3059 | *************************************************************/ |
| 3060 | 3060 | |
| 3061 | 3061 | static WRITE8_HANDLER( jf11_m_w ) |
| r8325 | r8326 | |
| 3066 | 3066 | } |
| 3067 | 3067 | |
| 3068 | 3068 | /************************************************************* |
| 3069 | | |
| 3069 | |
| 3070 | 3070 | Jaleco JF-13 board emulation |
| 3071 | | |
| 3071 | |
| 3072 | 3072 | Note: we don't emulate the additional sound hardware. |
| 3073 | 3073 | |
| 3074 | 3074 | iNES: mapper 86 |
| 3075 | | |
| 3075 | |
| 3076 | 3076 | *************************************************************/ |
| 3077 | 3077 | |
| 3078 | 3078 | static WRITE8_HANDLER( jf13_m_w ) |
| 3079 | 3079 | { |
| 3080 | 3080 | LOG_MMC(("jf13_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3081 | | |
| 3081 | |
| 3082 | 3082 | if (offset == 0) |
| 3083 | 3083 | { |
| 3084 | 3084 | prg32(space->machine, (data >> 4) & 0x03); |
| r8325 | r8326 | |
| 3097 | 3097 | } |
| 3098 | 3098 | |
| 3099 | 3099 | /************************************************************* |
| 3100 | | |
| 3100 | |
| 3101 | 3101 | Jaleco JF-16 board emulation |
| 3102 | | |
| 3102 | |
| 3103 | 3103 | iNES: mapper 78 (shared with a diff Irem board) |
| 3104 | | |
| 3104 | |
| 3105 | 3105 | *************************************************************/ |
| 3106 | 3106 | |
| 3107 | 3107 | static WRITE8_HANDLER( jf16_w ) |
| r8325 | r8326 | |
| 3114 | 3114 | } |
| 3115 | 3115 | |
| 3116 | 3116 | /************************************************************* |
| 3117 | | |
| 3117 | |
| 3118 | 3118 | Jaleco JF-17, JF-26 & JF-28 boards emulation |
| 3119 | | |
| 3119 | |
| 3120 | 3120 | Note: we don't emulate the additional sound hardware. |
| 3121 | 3121 | |
| 3122 | 3122 | iNES: mapper 72 |
| 3123 | | |
| 3123 | |
| 3124 | 3124 | *************************************************************/ |
| 3125 | 3125 | |
| 3126 | 3126 | static WRITE8_HANDLER( jf17_w ) |
| r8325 | r8326 | |
| 3136 | 3136 | } |
| 3137 | 3137 | |
| 3138 | 3138 | /************************************************************* |
| 3139 | | |
| 3139 | |
| 3140 | 3140 | Jaleco JF-19 & JF-21 boards emulation |
| 3141 | | |
| 3141 | |
| 3142 | 3142 | Note: we don't emulate the additional sound hardware. |
| 3143 | | |
| 3143 | |
| 3144 | 3144 | iNES: mapper 92 |
| 3145 | | |
| 3145 | |
| 3146 | 3146 | *************************************************************/ |
| 3147 | 3147 | |
| 3148 | 3148 | static WRITE8_HANDLER( jf19_w ) |
| r8325 | r8326 | |
| 3158 | 3158 | } |
| 3159 | 3159 | |
| 3160 | 3160 | /************************************************************* |
| 3161 | | |
| 3161 | |
| 3162 | 3162 | Konami VRC1 and Jaleco JF20, JF22 |
| 3163 | 3163 | |
| 3164 | 3164 | Games: Exciting Boxing, Ganbare Goemon!, Tetsuwan Atom |
| 3165 | | |
| 3165 | |
| 3166 | 3166 | iNES: mapper 75 |
| 3167 | | |
| 3167 | |
| 3168 | 3168 | In MESS: Supported. |
| 3169 | | |
| 3169 | |
| 3170 | 3170 | *************************************************************/ |
| 3171 | 3171 | |
| 3172 | 3172 | static WRITE8_HANDLER( konami_vrc1_w ) |
| 3173 | 3173 | { |
| 3174 | 3174 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 3175 | 3175 | LOG_MMC(("konami_vrc1_w, offset: %04x, data: %02x\n", offset, data)); |
| 3176 | | |
| 3176 | |
| 3177 | 3177 | switch (offset & 0x7000) |
| 3178 | 3178 | { |
| 3179 | 3179 | case 0x0000: |
| r8325 | r8326 | |
| 3204 | 3204 | } |
| 3205 | 3205 | |
| 3206 | 3206 | /************************************************************* |
| 3207 | | |
| 3208 | | Konami VRC-2 |
| 3209 | | |
| 3207 | |
| 3208 | Konami VRC-2 |
| 3209 | |
| 3210 | 3210 | In MESS: Supported. |
| 3211 | | |
| 3211 | |
| 3212 | 3212 | *************************************************************/ |
| 3213 | 3213 | |
| 3214 | 3214 | static WRITE8_HANDLER( konami_vrc2_w ) |
| r8325 | r8326 | |
| 3219 | 3219 | | ((offset << (9 - state->vrc_ls_prg_a)) & 0x200) |
| 3220 | 3220 | | ((offset << (8 - state->vrc_ls_prg_b)) & 0x100); |
| 3221 | 3221 | LOG_MMC(("konami_vrc2_w, offset: %04x, data: %02x\n", offset, data)); |
| 3222 | | |
| 3222 | |
| 3223 | 3223 | if (offset < 0x1000) |
| 3224 | 3224 | prg8_89(space->machine, data); |
| 3225 | 3225 | else if (offset < 0x2000) |
| r8325 | r8326 | |
| 3239 | 3239 | bank = ((shifted_offs & 0x7000) - 0x3000) / 0x0800 + BIT(shifted_offs, 9); |
| 3240 | 3240 | shift = BIT(shifted_offs, 8) * 4; |
| 3241 | 3241 | mask = (0xf0 >> shift); |
| 3242 | | state->mmc_vrom_bank[bank] = (state->mmc_vrom_bank[bank] & mask) |
| 3242 | state->mmc_vrom_bank[bank] = (state->mmc_vrom_bank[bank] & mask) |
| 3243 | 3243 | | (((data >> state->vrc_ls_chr) & 0x0f) << shift); |
| 3244 | 3244 | chr1_x(space->machine, bank, state->mmc_vrom_bank[bank], CHRROM); |
| 3245 | 3245 | } |
| r8325 | r8326 | |
| 3248 | 3248 | } |
| 3249 | 3249 | |
| 3250 | 3250 | /************************************************************* |
| 3251 | | |
| 3251 | |
| 3252 | 3252 | Konami VRC3 |
| 3253 | 3253 | |
| 3254 | 3254 | Games: Salamander |
| 3255 | | |
| 3255 | |
| 3256 | 3256 | iNES: mapper 73 |
| 3257 | | |
| 3257 | |
| 3258 | 3258 | In MESS: Supported. It also uses konami_irq. |
| 3259 | | |
| 3259 | |
| 3260 | 3260 | *************************************************************/ |
| 3261 | 3261 | |
| 3262 | 3262 | static WRITE8_HANDLER( konami_vrc3_w ) |
| 3263 | 3263 | { |
| 3264 | 3264 | LOG_MMC(("konami_vrc3_w, offset: %04x, data: %02x\n", offset, data)); |
| 3265 | 3265 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 3266 | | |
| 3266 | |
| 3267 | 3267 | switch (offset & 0x7000) |
| 3268 | 3268 | { |
| 3269 | 3269 | case 0x0000: |
| r8325 | r8326 | |
| 3293 | 3293 | } |
| 3294 | 3294 | |
| 3295 | 3295 | /************************************************************* |
| 3296 | | |
| 3296 | |
| 3297 | 3297 | Konami VRC-4 |
| 3298 | | |
| 3298 | |
| 3299 | 3299 | In MESS: Supported |
| 3300 | | |
| 3300 | |
| 3301 | 3301 | *************************************************************/ |
| 3302 | 3302 | |
| 3303 | 3303 | static void vrc4_set_prg( running_machine *machine ) |
| r8325 | r8326 | |
| 3335 | 3335 | | ((offset << (9 - state->vrc_ls_prg_a)) & 0x200) |
| 3336 | 3336 | | ((offset << (8 - state->vrc_ls_prg_b)) & 0x100); |
| 3337 | 3337 | LOG_MMC(("konami_vrc4_w, offset: %04x, data: %02x\n", offset, data)); |
| 3338 | | |
| 3338 | |
| 3339 | 3339 | if (offset < 0x1000) |
| 3340 | 3340 | { |
| 3341 | 3341 | state->mmc_prg_bank[0] = data; |
| r8325 | r8326 | |
| 3408 | 3408 | } |
| 3409 | 3409 | |
| 3410 | 3410 | /************************************************************* |
| 3411 | | |
| 3411 | |
| 3412 | 3412 | Konami VRC-6 |
| 3413 | | |
| 3413 | |
| 3414 | 3414 | In MESS: Supported. It also uses konami_irq (there are IRQ |
| 3415 | 3415 | issues though: see Akumajou Densetsu intro). |
| 3416 | | |
| 3416 | |
| 3417 | 3417 | *************************************************************/ |
| 3418 | 3418 | |
| 3419 | 3419 | static WRITE8_HANDLER( konami_vrc6_w ) |
| r8325 | r8326 | |
| 3424 | 3424 | | ((offset << (9 - state->vrc_ls_prg_a)) & 0x200) |
| 3425 | 3425 | | ((offset << (8 - state->vrc_ls_prg_b)) & 0x100); |
| 3426 | 3426 | LOG_MMC(("konami_vrc6_w, offset: %04x, data: %02x\n", offset, data)); |
| 3427 | | |
| 3427 | |
| 3428 | 3428 | if (offset < 0x1000) |
| 3429 | 3429 | prg16_89ab(space->machine, data); |
| 3430 | 3430 | else if (offset >= 0x4000 && offset < 0x5000) |
| r8325 | r8326 | |
| 3485 | 3485 | } |
| 3486 | 3486 | |
| 3487 | 3487 | /************************************************************* |
| 3488 | | |
| 3488 | |
| 3489 | 3489 | Konami VRC7 |
| 3490 | 3490 | |
| 3491 | 3491 | Games: Lagrange Point, Tiny Toon Adventures 2 |
| 3492 | | |
| 3492 | |
| 3493 | 3493 | iNES: mapper 85 |
| 3494 | | |
| 3494 | |
| 3495 | 3495 | In MESS: Supported. It also uses konami_irq. |
| 3496 | | |
| 3496 | |
| 3497 | 3497 | *************************************************************/ |
| 3498 | 3498 | |
| 3499 | 3499 | static WRITE8_HANDLER( konami_vrc7_w ) |
| r8325 | r8326 | |
| 3501 | 3501 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 3502 | 3502 | UINT8 bank; |
| 3503 | 3503 | LOG_MMC(("konami_vrc7_w, offset: %04x, data: %02x\n", offset, data)); |
| 3504 | | |
| 3504 | |
| 3505 | 3505 | switch (offset & 0x7018) |
| 3506 | 3506 | { |
| 3507 | 3507 | case 0x0000: |
| r8325 | r8326 | |
| 3512 | 3512 | case 0x0018: |
| 3513 | 3513 | prg8_ab(space->machine, data); |
| 3514 | 3514 | break; |
| 3515 | | |
| 3515 | |
| 3516 | 3516 | case 0x1000: |
| 3517 | 3517 | prg8_cd(space->machine, data); |
| 3518 | 3518 | break; |
| 3519 | | |
| 3519 | |
| 3520 | 3520 | /* TODO: there are sound regs in here */ |
| 3521 | | |
| 3521 | |
| 3522 | 3522 | case 0x2000: |
| 3523 | 3523 | case 0x2008: |
| 3524 | 3524 | case 0x2010: |
| r8325 | r8326 | |
| 3538 | 3538 | bank = ((offset & 0x7000) - 0x2000) / 0x0800 + ((offset & 0x0018) ? 1 : 0); |
| 3539 | 3539 | chr1_x(space->machine, bank, data, state->mmc_chr_source); |
| 3540 | 3540 | break; |
| 3541 | | |
| 3541 | |
| 3542 | 3542 | case 0x6000: |
| 3543 | 3543 | switch (data & 0x03) |
| 3544 | 3544 | { |
| r8325 | r8326 | |
| 3561 | 3561 | case 0x7008: case 0x7010: case 0x7018: |
| 3562 | 3562 | state->IRQ_enable = state->IRQ_enable_latch; |
| 3563 | 3563 | break; |
| 3564 | | |
| 3564 | |
| 3565 | 3565 | default: |
| 3566 | 3566 | logerror("konami_vrc7_w uncaught write, addr: %04x value: %02x\n", offset + 0x8000, data); |
| 3567 | 3567 | break; |
| r8325 | r8326 | |
| 3569 | 3569 | } |
| 3570 | 3570 | |
| 3571 | 3571 | /************************************************************* |
| 3572 | | |
| 3572 | |
| 3573 | 3573 | Namcot-163 board emulation |
| 3574 | | |
| 3574 | |
| 3575 | 3575 | iNES: mapper 19 |
| 3576 | | |
| 3576 | |
| 3577 | 3577 | *************************************************************/ |
| 3578 | 3578 | |
| 3579 | 3579 | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| r8325 | r8326 | |
| 3582 | 3582 | static void namcot163_irq( running_device *device, int scanline, int vblank, int blanked ) |
| 3583 | 3583 | { |
| 3584 | 3584 | nes_state *state = (nes_state *)device->machine->driver_data; |
| 3585 | | |
| 3585 | |
| 3586 | 3586 | if (state->IRQ_enable) |
| 3587 | 3587 | { |
| 3588 | 3588 | if (state->IRQ_count >= (0x7fff - 114)) |
| r8325 | r8326 | |
| 3600 | 3600 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 3601 | 3601 | LOG_MMC(("namcot163_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 3602 | 3602 | offset += 0x100; |
| 3603 | | |
| 3603 | |
| 3604 | 3604 | switch (offset & 0x1800) |
| 3605 | 3605 | { |
| 3606 | 3606 | case 0x0800: |
| r8325 | r8326 | |
| 3621 | 3621 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 3622 | 3622 | LOG_MMC(("namcot163_l_r, offset: %04x\n", offset)); |
| 3623 | 3623 | offset += 0x100; |
| 3624 | | |
| 3624 | |
| 3625 | 3625 | switch (offset & 0x1800) |
| 3626 | 3626 | { |
| 3627 | 3627 | case 0x1000: |
| r8325 | r8326 | |
| 3684 | 3684 | } |
| 3685 | 3685 | |
| 3686 | 3686 | /************************************************************* |
| 3687 | | |
| 3687 | |
| 3688 | 3688 | Sunsoft-1 board emulation |
| 3689 | | |
| 3690 | | iNES: mapper 184 (Fantasy Zone uses this board with no |
| 3689 | |
| 3690 | iNES: mapper 184 (Fantasy Zone uses this board with no |
| 3691 | 3691 | CHRROM, and the register switches PRG banks) |
| 3692 | | |
| 3692 | |
| 3693 | 3693 | *************************************************************/ |
| 3694 | 3694 | |
| 3695 | 3695 | static WRITE8_HANDLER( sunsoft1_m_w ) |
| 3696 | 3696 | { |
| 3697 | 3697 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 3698 | 3698 | LOG_MMC(("sunsoft1_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3699 | | |
| 3699 | |
| 3700 | 3700 | if (state->chr_chunks) |
| 3701 | 3701 | { |
| 3702 | 3702 | chr4_0(space->machine, data & 0x0f, CHRROM); |
| r8325 | r8326 | |
| 3707 | 3707 | } |
| 3708 | 3708 | |
| 3709 | 3709 | /************************************************************* |
| 3710 | | |
| 3710 | |
| 3711 | 3711 | Sunsoft-2 board emulation |
| 3712 | | |
| 3712 | |
| 3713 | 3713 | The two games using this board have incompatible mirroring |
| 3714 | 3714 | wiring, making necessary two distinct mappers & pcb_id |
| 3715 | | |
| 3715 | |
| 3716 | 3716 | iNES: mapper 89 & 93 |
| 3717 | | |
| 3717 | |
| 3718 | 3718 | *************************************************************/ |
| 3719 | 3719 | |
| 3720 | 3720 | static WRITE8_HANDLER( sunsoft2_w ) |
| r8325 | r8326 | |
| 3732 | 3732 | } |
| 3733 | 3733 | |
| 3734 | 3734 | /************************************************************* |
| 3735 | | |
| 3735 | |
| 3736 | 3736 | Sunsoft-3 board emulation |
| 3737 | | |
| 3737 | |
| 3738 | 3738 | The two games using this board have incompatible mirroring |
| 3739 | 3739 | wiring, making necessary two distinct mappers & pcb_id |
| 3740 | | |
| 3740 | |
| 3741 | 3741 | iNES: mapper 67 |
| 3742 | | |
| 3742 | |
| 3743 | 3743 | *************************************************************/ |
| 3744 | 3744 | |
| 3745 | 3745 | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| r8325 | r8326 | |
| 3748 | 3748 | static void sunsoft3_irq( running_device *device, int scanline, int vblank, int blanked ) |
| 3749 | 3749 | { |
| 3750 | 3750 | nes_state *state = (nes_state *)device->machine->driver_data; |
| 3751 | | |
| 3751 | |
| 3752 | 3752 | /* TODO: change to reflect the actual number of cycles spent: both using 114 or cycling 114,114,113 |
| 3753 | | produces a 1-line glitch in Fantasy Zone 2: it really requires the counter to be updated each CPU cycle! */ |
| 3753 | produces a 1-line glitch in Fantasy Zone 2: it really requires the counter to be updated each CPU cycle! */ |
| 3754 | 3754 | if (state->IRQ_enable) |
| 3755 | 3755 | { |
| 3756 | 3756 | if (state->IRQ_count <= 114) |
| r8325 | r8326 | |
| 3768 | 3768 | { |
| 3769 | 3769 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 3770 | 3770 | LOG_MMC(("sunsoft3_w, offset %04x, data: %02x\n", offset, data)); |
| 3771 | | |
| 3771 | |
| 3772 | 3772 | switch (offset & 0x7800) |
| 3773 | 3773 | { |
| 3774 | 3774 | case 0x0800: |
| r8325 | r8326 | |
| 3814 | 3814 | } |
| 3815 | 3815 | |
| 3816 | 3816 | /************************************************************* |
| 3817 | | |
| 3817 | |
| 3818 | 3818 | Taito TC0190FMC + board emulation |
| 3819 | | |
| 3819 | |
| 3820 | 3820 | iNES: mapper 33 |
| 3821 | | |
| 3821 | |
| 3822 | 3822 | *************************************************************/ |
| 3823 | 3823 | |
| 3824 | 3824 | static WRITE8_HANDLER( tc0190fmc_w ) |
| 3825 | 3825 | { |
| 3826 | 3826 | LOG_MMC(("tc0190fmc_w, offset: %04x, data: %02x\n", offset, data)); |
| 3827 | | |
| 3827 | |
| 3828 | 3828 | switch (offset & 0x7003) |
| 3829 | 3829 | { |
| 3830 | 3830 | case 0x0000: |
| r8325 | r8326 | |
| 3856 | 3856 | } |
| 3857 | 3857 | |
| 3858 | 3858 | /************************************************************* |
| 3859 | | |
| 3859 | |
| 3860 | 3860 | Taito TC0190FMC + PAL16R4 board emulation |
| 3861 | | |
| 3861 | |
| 3862 | 3862 | iNES: mapper 48 |
| 3863 | | |
| 3863 | |
| 3864 | 3864 | *************************************************************/ |
| 3865 | 3865 | |
| 3866 | 3866 | static WRITE8_HANDLER( tc0190fmc_p16_w ) |
| 3867 | 3867 | { |
| 3868 | 3868 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 3869 | 3869 | LOG_MMC(("tc0190fmc_p16_w, offset: %04x, data: %02x\n", offset, data)); |
| 3870 | | |
| 3870 | |
| 3871 | 3871 | switch (offset & 0x7003) |
| 3872 | 3872 | { |
| 3873 | 3873 | case 0x0000: |
| r8325 | r8326 | |
| 3901 | 3901 | } |
| 3902 | 3902 | |
| 3903 | 3903 | /************************************************************* |
| 3904 | | |
| 3904 | |
| 3905 | 3905 | Taito X1-005 board emulation |
| 3906 | | |
| 3906 | |
| 3907 | 3907 | Actually, Fudou Myouou Den uses a variant of the board with |
| 3908 | 3908 | CIRAM, making necessary two distinct mappers & pcb_id. |
| 3909 | | |
| 3909 | |
| 3910 | 3910 | Also, we miss to emulate the security check at 0x7ef8 / 0x7ef9 |
| 3911 | 3911 | and the 0x80 ram! |
| 3912 | | |
| 3912 | |
| 3913 | 3913 | iNES: mappers 80 & 207 |
| 3914 | | |
| 3914 | |
| 3915 | 3915 | *************************************************************/ |
| 3916 | 3916 | |
| 3917 | 3917 | static WRITE8_HANDLER( x1005_m_w ) |
| 3918 | 3918 | { |
| 3919 | 3919 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 3920 | 3920 | LOG_MMC(("x1005_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3921 | | |
| 3921 | |
| 3922 | 3922 | switch (offset) |
| 3923 | 3923 | { |
| 3924 | 3924 | case 0x1ef0: |
| r8325 | r8326 | |
| 3982 | 3982 | static WRITE8_HANDLER( x1005a_m_w ) |
| 3983 | 3983 | { |
| 3984 | 3984 | LOG_MMC(("x1005a_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3985 | | |
| 3985 | |
| 3986 | 3986 | // similar to x1005_m_w but mirroring is handled differently |
| 3987 | 3987 | if (offset == 0x1ef6 || offset == 0x1ef7) |
| 3988 | 3988 | return; |
| r8325 | r8326 | |
| 4003 | 4003 | } |
| 4004 | 4004 | |
| 4005 | 4005 | /************************************************************* |
| 4006 | | |
| 4006 | |
| 4007 | 4007 | Taito X1-017 board emulation |
| 4008 | | |
| 4008 | |
| 4009 | 4009 | We miss to emulate the security check at 0x6000-0x73ff |
| 4010 | 4010 | and the ram! |
| 4011 | | |
| 4011 | |
| 4012 | 4012 | iNES: mapper 82 |
| 4013 | | |
| 4013 | |
| 4014 | 4014 | *************************************************************/ |
| 4015 | 4015 | |
| 4016 | 4016 | static void x1017_set_chr( running_machine *machine ) |
| r8325 | r8326 | |
| 4030 | 4030 | chr1_x(machine, 5 ^ state->mmc_latch1, state->mmc_vrom_bank[3], CHRROM); |
| 4031 | 4031 | chr1_x(machine, 6 ^ state->mmc_latch1, state->mmc_vrom_bank[4], CHRROM); |
| 4032 | 4032 | chr1_x(machine, 7 ^ state->mmc_latch1, state->mmc_vrom_bank[5], CHRROM); |
| 4033 | | } |
| 4033 | } |
| 4034 | 4034 | |
| 4035 | 4035 | static WRITE8_HANDLER( x1017_m_w ) |
| 4036 | 4036 | { |
| 4037 | 4037 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 4038 | 4038 | UINT8 reg = offset & 0x07; |
| 4039 | 4039 | LOG_MMC(("x1017_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 4040 | | |
| 4040 | |
| 4041 | 4041 | switch (offset) |
| 4042 | 4042 | { |
| 4043 | 4043 | case 0x1ef0: |
| r8325 | r8326 | |
| 4095 | 4095 | return state->mapper_ram[offset & (state->mapper_ram_size - 1)]; |
| 4096 | 4096 | if (offset < 0x1800 && state->mapper_ram != NULL && state->mmc_reg[2] == 0x84) |
| 4097 | 4097 | return state->mapper_ram[offset & (state->mapper_ram_size - 1)]; |
| 4098 | | |
| 4098 | |
| 4099 | 4099 | return 0xff; |
| 4100 | 4100 | } |
| 4101 | 4101 | |
| 4102 | 4102 | /************************************************************* |
| 4103 | | |
| 4103 | |
| 4104 | 4104 | MISC UNLICENSED BOARDS |
| 4105 | | |
| 4105 | |
| 4106 | 4106 | *************************************************************/ |
| 4107 | 4107 | |
| 4108 | 4108 | /************************************************************* |
| 4109 | | |
| 4109 | |
| 4110 | 4110 | AGCI 50282 bootleg board emulation |
| 4111 | | |
| 4111 | |
| 4112 | 4112 | iNES: mapper 144 |
| 4113 | | |
| 4113 | |
| 4114 | 4114 | *************************************************************/ |
| 4115 | 4115 | |
| 4116 | 4116 | static WRITE8_HANDLER( agci_50282_w ) |
| 4117 | 4117 | { |
| 4118 | 4118 | LOG_MMC(("agci_50282_w, offset: %04x, data: %02x\n", offset, data)); |
| 4119 | | |
| 4119 | |
| 4120 | 4120 | offset += 0x8000; |
| 4121 | 4121 | data |= (memory_read_byte(space, offset) & 1); |
| 4122 | | |
| 4122 | |
| 4123 | 4123 | chr8(space->machine, data >> 4, CHRROM); |
| 4124 | 4124 | prg32(space->machine, data); |
| 4125 | 4125 | } |
| 4126 | 4126 | |
| 4127 | 4127 | /************************************************************* |
| 4128 | | |
| 4128 | |
| 4129 | 4129 | AVE NINA-001 board emulation |
| 4130 | | |
| 4130 | |
| 4131 | 4131 | iNES: mapper 34 |
| 4132 | | |
| 4132 | |
| 4133 | 4133 | *************************************************************/ |
| 4134 | 4134 | |
| 4135 | 4135 | static WRITE8_HANDLER( nina01_m_w ) |
| 4136 | 4136 | { |
| 4137 | 4137 | LOG_MMC(("nina01_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 4138 | | |
| 4138 | |
| 4139 | 4139 | switch (offset) |
| 4140 | 4140 | { |
| 4141 | 4141 | case 0x1ffd: |
| r8325 | r8326 | |
| 4151 | 4151 | } |
| 4152 | 4152 | |
| 4153 | 4153 | /************************************************************* |
| 4154 | | |
| 4154 | |
| 4155 | 4155 | AVE NINA-003, NINA-006 and MB-91 boards emulation |
| 4156 | | |
| 4156 | |
| 4157 | 4157 | iNES: mapper 79 |
| 4158 | | |
| 4158 | |
| 4159 | 4159 | *************************************************************/ |
| 4160 | 4160 | |
| 4161 | 4161 | static WRITE8_HANDLER( nina06_l_w ) |
| 4162 | 4162 | { |
| 4163 | 4163 | LOG_MMC(("nina06_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 4164 | | |
| 4164 | |
| 4165 | 4165 | if (!(offset & 0x0100)) |
| 4166 | 4166 | { |
| 4167 | 4167 | prg32(space->machine, data >> 3); |
| r8325 | r8326 | |
| 4170 | 4170 | } |
| 4171 | 4171 | |
| 4172 | 4172 | /************************************************************* |
| 4173 | | |
| 4173 | |
| 4174 | 4174 | Active Entertainment Action 52 board emulation |
| 4175 | | |
| 4175 | |
| 4176 | 4176 | iNES: mapper 228 |
| 4177 | | |
| 4177 | |
| 4178 | 4178 | *************************************************************/ |
| 4179 | 4179 | |
| 4180 | 4180 | static WRITE8_HANDLER( ae_act52_w ) |
| r8325 | r8326 | |
| 4182 | 4182 | int pbank, cbank; |
| 4183 | 4183 | UINT8 pmode; |
| 4184 | 4184 | LOG_MMC(("ae_act52_w, offset: %04x, data: %02x\n", offset, data)); |
| 4185 | | |
| 4185 | |
| 4186 | 4186 | set_nt_mirroring(space->machine, BIT(offset, 13) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4187 | | |
| 4187 | |
| 4188 | 4188 | cbank = (data & 0x03) | ((offset & 0x0f) << 2); |
| 4189 | 4189 | chr8(space->machine, cbank, CHRROM); |
| 4190 | | |
| 4190 | |
| 4191 | 4191 | pmode = offset & 0x20; |
| 4192 | 4192 | pbank = (offset & 0x1fc0) >> 6; |
| 4193 | 4193 | if (pmode) |
| r8325 | r8326 | |
| 4201 | 4201 | |
| 4202 | 4202 | |
| 4203 | 4203 | /************************************************************* |
| 4204 | | |
| 4204 | |
| 4205 | 4205 | C & E Bootleg Board for Decathlon |
| 4206 | | |
| 4206 | |
| 4207 | 4207 | Games: Decathlon |
| 4208 | | |
| 4208 | |
| 4209 | 4209 | Pretty simple mapper: writes to 0x8065-0x80a4 set prg32 to |
| 4210 | 4210 | data & 3; writes to 0x80a5-0x80e4 set chr8 to data & 7 |
| 4211 | | |
| 4211 | |
| 4212 | 4212 | iNES: mapper 244 |
| 4213 | | |
| 4213 | |
| 4214 | 4214 | In MESS: Supported. |
| 4215 | | |
| 4215 | |
| 4216 | 4216 | *************************************************************/ |
| 4217 | 4217 | |
| 4218 | 4218 | static WRITE8_HANDLER( cne_decathl_w ) |
| 4219 | 4219 | { |
| 4220 | 4220 | LOG_MMC(("cne_decathl_w, offset: %04x, data: %02x\n", offset, data)); |
| 4221 | | |
| 4221 | |
| 4222 | 4222 | if (offset < 0x0065) |
| 4223 | 4223 | return; |
| 4224 | 4224 | if (offset < 0x00a5) |
| r8325 | r8326 | |
| 4233 | 4233 | } |
| 4234 | 4234 | |
| 4235 | 4235 | /************************************************************* |
| 4236 | | |
| 4236 | |
| 4237 | 4237 | C & E Bootleg Board for Fong Shen Bang |
| 4238 | | |
| 4238 | |
| 4239 | 4239 | Games: Fong Shen Bang - Zhu Lu Zhi Zhan |
| 4240 | | |
| 4240 | |
| 4241 | 4241 | Simple mapper: writes to 0x6000-0x67ff set PRG and CHR banks. |
| 4242 | 4242 | Namely, 0x6000->0x6003 select resp. prg8_89, prg8_ab, prg8_cd |
| 4243 | 4243 | and prg8_ef. 0x6004->0x6007 select resp. crh2_0, chr2_2, |
| 4244 | 4244 | chr2_4 and chr2_6. In 0x6800-0x7fff lies WRAM. |
| 4245 | | |
| 4245 | |
| 4246 | 4246 | iNES: mapper 246 |
| 4247 | | |
| 4247 | |
| 4248 | 4248 | In MESS: Supported. |
| 4249 | | |
| 4249 | |
| 4250 | 4250 | *************************************************************/ |
| 4251 | 4251 | |
| 4252 | 4252 | static WRITE8_HANDLER( cne_fsb_m_w ) |
| 4253 | 4253 | { |
| 4254 | 4254 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 4255 | 4255 | LOG_MMC(("cne_fsb_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 4256 | | |
| 4256 | |
| 4257 | 4257 | if (offset < 0x0800) |
| 4258 | 4258 | { |
| 4259 | 4259 | switch (offset & 0x0007) |
| r8325 | r8326 | |
| 4289 | 4289 | } |
| 4290 | 4290 | |
| 4291 | 4291 | /************************************************************* |
| 4292 | | |
| 4292 | |
| 4293 | 4293 | C & E Bootleg Board for Sheng Huo Lie Zhuan |
| 4294 | | |
| 4294 | |
| 4295 | 4295 | Games: Jing Ke Xin Zhuan, Sheng Huo Lie Zhuan |
| 4296 | | |
| 4296 | |
| 4297 | 4297 | Simple Mapper: writes to 0x4020-0x5fff sets prg32 to |
| 4298 | 4298 | data>>4 and chr8 to data&f. We currently do not map |
| 4299 | 4299 | writes to 0x4020-0x40ff (to do: verify if this produces |
| 4300 | 4300 | issues) |
| 4301 | | |
| 4301 | |
| 4302 | 4302 | iNES: mapper 240 |
| 4303 | | |
| 4303 | |
| 4304 | 4304 | In MESS: Supported. |
| 4305 | | |
| 4305 | |
| 4306 | 4306 | *************************************************************/ |
| 4307 | 4307 | |
| 4308 | 4308 | static WRITE8_HANDLER( cne_shlz_l_w ) |
| 4309 | 4309 | { |
| 4310 | 4310 | LOG_MMC(("cne_shlz_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 4311 | | |
| 4311 | |
| 4312 | 4312 | prg32(space->machine, data >> 4); |
| 4313 | 4313 | chr8(space->machine, data & 0x0f, CHRROM); |
| 4314 | 4314 | } |
| 4315 | 4315 | |
| 4316 | 4316 | /************************************************************* |
| 4317 | | |
| 4317 | |
| 4318 | 4318 | Caltron 6 in 1 Board |
| 4319 | 4319 | |
| 4320 | 4320 | Games: 6 in 1 by Caltron |
| 4321 | | |
| 4321 | |
| 4322 | 4322 | iNES: mapper 41 |
| 4323 | | |
| 4323 | |
| 4324 | 4324 | In MESS: Supported. |
| 4325 | | |
| 4325 | |
| 4326 | 4326 | *************************************************************/ |
| 4327 | 4327 | |
| 4328 | 4328 | static WRITE8_HANDLER( caltron6in1_m_w ) |
| 4329 | 4329 | { |
| 4330 | 4330 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 4331 | 4331 | LOG_MMC(("caltron6in1_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 4332 | | |
| 4332 | |
| 4333 | 4333 | state->mmc_latch1 = offset & 0xff; |
| 4334 | 4334 | set_nt_mirroring(space->machine, BIT(data, 5) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4335 | 4335 | prg32(space->machine, offset & 0x07); |
| r8325 | r8326 | |
| 4339 | 4339 | { |
| 4340 | 4340 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 4341 | 4341 | LOG_MMC(("caltron6in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 4342 | | |
| 4342 | |
| 4343 | 4343 | if (state->mmc_latch1 & 0x04) |
| 4344 | 4344 | chr8(space->machine, ((state->mmc_latch1 & 0x18) >> 1) | (data & 0x03), CHRROM); |
| 4345 | 4345 | } |
| 4346 | 4346 | |
| 4347 | 4347 | /************************************************************* |
| 4348 | | |
| 4348 | |
| 4349 | 4349 | Camerica Boards (BF9093, BF9097, BF909X, ALGNV11) |
| 4350 | 4350 | |
| 4351 | 4351 | Games: Linus Spacehead's Cosmic Crusade, Micro Machines, |
| 4352 | 4352 | Mig-29, Stunt Kids |
| 4353 | | |
| 4353 | |
| 4354 | 4354 | To emulate NT mirroring for BF9097 board (missing in BF9093) |
| 4355 | 4355 | we use crc_hack, however Fire Hawk is broken (but without |
| 4356 | 4356 | mirroring there would be no helicopter graphics). |
| 4357 | | |
| 4357 | |
| 4358 | 4358 | iNES: mapper 71 |
| 4359 | | |
| 4359 | |
| 4360 | 4360 | In MESS: Partially Supported. |
| 4361 | | |
| 4361 | |
| 4362 | 4362 | *************************************************************/ |
| 4363 | 4363 | |
| 4364 | 4364 | static WRITE8_HANDLER( bf9093_w ) |
| 4365 | 4365 | { |
| 4366 | 4366 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 4367 | 4367 | LOG_MMC(("bf9093_w, offset: %04x, data: %02x\n", offset, data)); |
| 4368 | | |
| 4368 | |
| 4369 | 4369 | switch (offset & 0x7000) |
| 4370 | 4370 | { |
| 4371 | 4371 | case 0x0000: |
| r8325 | r8326 | |
| 4383 | 4383 | } |
| 4384 | 4384 | |
| 4385 | 4385 | /************************************************************* |
| 4386 | | |
| 4386 | |
| 4387 | 4387 | Camerica BF9096 & ALGQV11 Boards |
| 4388 | 4388 | |
| 4389 | 4389 | Games: Quattro Adventure, Quattro Arcade, Quattro Sports |
| 4390 | | |
| 4390 | |
| 4391 | 4391 | Writes to 0x8000-0x9fff set prg block to (data&0x18)>>1, |
| 4392 | 4392 | writes to 0xa000-0xbfff set prg page to data&3. selected |
| 4393 | 4393 | prg are: prg16_89ab = block|page, prg_cdef = 3|page. |
| 4394 | 4394 | For more info on the hardware to bypass the NES lockout, see |
| 4395 | 4395 | Kevtris' Camerica Mappers documentation. |
| 4396 | | |
| 4396 | |
| 4397 | 4397 | iNES: mapper 232 |
| 4398 | | |
| 4398 | |
| 4399 | 4399 | In MESS: Supported. |
| 4400 | | |
| 4400 | |
| 4401 | 4401 | *************************************************************/ |
| 4402 | 4402 | |
| 4403 | 4403 | static void bf9096_set_prg( running_machine *machine ) |
| r8325 | r8326 | |
| 4411 | 4411 | { |
| 4412 | 4412 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 4413 | 4413 | LOG_MMC(("bf9096_w, offset: %04x, data: %02x\n", offset, data)); |
| 4414 | | |
| 4414 | |
| 4415 | 4415 | if (offset < 0x2000) |
| 4416 | 4416 | state->mmc_latch1 = data; |
| 4417 | 4417 | else |
| 4418 | 4418 | state->mmc_latch2 = data; |
| 4419 | | |
| 4419 | |
| 4420 | 4420 | bf9096_set_prg(space->machine); |
| 4421 | 4421 | } |
| 4422 | 4422 | |
| 4423 | 4423 | /************************************************************* |
| 4424 | | |
| 4424 | |
| 4425 | 4425 | Camerica Golden Five board |
| 4426 | 4426 | |
| 4427 | 4427 | Games: Pegasus 5 in 1 |
| 4428 | | |
| 4428 | |
| 4429 | 4429 | iNES: mapper 104 |
| 4430 | | |
| 4430 | |
| 4431 | 4431 | In MESS: Supported. |
| 4432 | | |
| 4432 | |
| 4433 | 4433 | *************************************************************/ |
| 4434 | 4434 | |
| 4435 | 4435 | static WRITE8_HANDLER( golden5_w ) |
| 4436 | 4436 | { |
| 4437 | 4437 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 4438 | 4438 | LOG_MMC(("golden5_w, offset: %04x, data: %02x\n", offset, data)); |
| 4439 | | |
| 4439 | |
| 4440 | 4440 | if (offset < 0x4000) |
| 4441 | 4441 | { |
| 4442 | 4442 | if (data & 0x08) |
| r8325 | r8326 | |
| 4445 | 4445 | prg16_89ab(space->machine, state->mmc_prg_bank[0]); |
| 4446 | 4446 | prg16_cdef(space->machine, ((data & 0x07) << 4) | 0x0f); |
| 4447 | 4447 | } |
| 4448 | | |
| 4448 | |
| 4449 | 4449 | } |
| 4450 | 4450 | else |
| 4451 | 4451 | { |
| r8325 | r8326 | |
| 4455 | 4455 | } |
| 4456 | 4456 | |
| 4457 | 4457 | /************************************************************* |
| 4458 | | |
| 4458 | |
| 4459 | 4459 | Cony Bootleg Board |
| 4460 | 4460 | |
| 4461 | 4461 | Games: Dragon Ball Party, Fatal Fury 2, Street Blaster II |
| 4462 | 4462 | Pro, World Heroes 2 |
| 4463 | | |
| 4463 | |
| 4464 | 4464 | iNES: mapper 83 |
| 4465 | | |
| 4465 | |
| 4466 | 4466 | In MESS: Supported. |
| 4467 | | |
| 4467 | |
| 4468 | 4468 | *************************************************************/ |
| 4469 | 4469 | |
| 4470 | 4470 | static WRITE8_HANDLER( cony_l_w ) |
| r8325 | r8326 | |
| 4596 | 4596 | } |
| 4597 | 4597 | |
| 4598 | 4598 | /************************************************************* |
| 4599 | | |
| 4599 | |
| 4600 | 4600 | Board DREAMTECH01 |
| 4601 | | |
| 4601 | |
| 4602 | 4602 | Games: Korean Igo |
| 4603 | | |
| 4603 | |
| 4604 | 4604 | In MESS: Supported |
| 4605 | | |
| 4605 | |
| 4606 | 4606 | *************************************************************/ |
| 4607 | 4607 | |
| 4608 | 4608 | static WRITE8_HANDLER( dreamtech_l_w ) |
| 4609 | 4609 | { |
| 4610 | 4610 | LOG_MMC(("dreamtech_l_w offset: %04x, data: %02x\n", offset, data)); |
| 4611 | 4611 | offset += 0x100; |
| 4612 | | |
| 4612 | |
| 4613 | 4613 | if (offset == 0x1020) /* 0x5020 */ |
| 4614 | 4614 | prg16_89ab(space->machine, data); |
| 4615 | 4615 | } |
| 4616 | 4616 | |
| 4617 | 4617 | /************************************************************* |
| 4618 | | |
| 4618 | |
| 4619 | 4619 | Bootleg Board by Future Media |
| 4620 | 4620 | |
| 4621 | 4621 | Games: Crayon Shin-chan (C), San Guo Zhi 4 - Chi Bi Feng Yun |
| 4622 | | |
| 4622 | |
| 4623 | 4623 | iNES: mapper 117 |
| 4624 | | |
| 4624 | |
| 4625 | 4625 | In MESS: Unsupported. |
| 4626 | | |
| 4626 | |
| 4627 | 4627 | *************************************************************/ |
| 4628 | 4628 | |
| 4629 | 4629 | static void futuremedia_irq( running_device *device, int scanline, int vblank, int blanked ) |
| r8325 | r8326 | |
| 4644 | 4644 | { |
| 4645 | 4645 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 4646 | 4646 | LOG_MMC(("futuremedia_w, offset: %04x, data: %02x\n", offset, data)); |
| 4647 | | |
| 4647 | |
| 4648 | 4648 | switch (offset) |
| 4649 | 4649 | { |
| 4650 | 4650 | case 0x0000: |
| r8325 | r8326 | |
| 4669 | 4669 | case 0x2007: |
| 4670 | 4670 | chr1_x(space->machine, offset & 0x07, data, CHRROM); |
| 4671 | 4671 | break; |
| 4672 | | |
| 4672 | |
| 4673 | 4673 | case 0x5000: |
| 4674 | 4674 | set_nt_mirroring(space->machine, BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4675 | 4675 | break; |
| 4676 | | |
| 4676 | |
| 4677 | 4677 | case 0x4001: |
| 4678 | 4678 | state->IRQ_count_latch = data; |
| 4679 | 4679 | break; |
| r8325 | r8326 | |
| 4690 | 4690 | } |
| 4691 | 4691 | |
| 4692 | 4692 | /************************************************************* |
| 4693 | | |
| 4693 | |
| 4694 | 4694 | Bootleg Board 37017 (?) by Gouder |
| 4695 | 4695 | |
| 4696 | 4696 | Games: Street Fighter IV |
| 4697 | | |
| 4697 | |
| 4698 | 4698 | MMC3 clone. It also requires reads from 0x5000-0x7fff. |
| 4699 | | |
| 4699 | |
| 4700 | 4700 | iNES: mapper 208 |
| 4701 | | |
| 4701 | |
| 4702 | 4702 | In MESS: Preliminary Support. |
| 4703 | | |
| 4703 | |
| 4704 | 4704 | *************************************************************/ |
| 4705 | 4705 | |
| 4706 | 4706 | static WRITE8_HANDLER( gouder_sf4_l_w ) |
| r8325 | r8326 | |
| 4725 | 4725 | 0x01,0x11,0x41,0x51,0x01,0x11,0x41,0x51,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 4726 | 4726 | 0x09,0x19,0x49,0x59,0x09,0x19,0x49,0x59,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
| 4727 | 4727 | }; |
| 4728 | | |
| 4728 | |
| 4729 | 4729 | LOG_MMC(("gouder_sf4_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 4730 | | |
| 4730 | |
| 4731 | 4731 | if (!(offset < 0x1700)) |
| 4732 | 4732 | state->map208_reg[offset & 0x03] = data ^ conv_table[state->map208_reg[4]]; |
| 4733 | 4733 | else if (!(offset < 0xf00)) |
| r8325 | r8326 | |
| 4740 | 4740 | { |
| 4741 | 4741 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 4742 | 4742 | LOG_MMC(("gouder_sf4_l_r, offset: %04x\n", offset)); |
| 4743 | | |
| 4743 | |
| 4744 | 4744 | if (!(offset < 0x1700)) |
| 4745 | 4745 | return state->map208_reg[offset & 0x03]; |
| 4746 | | |
| 4746 | |
| 4747 | 4747 | return 0x00; |
| 4748 | 4748 | } |
| 4749 | 4749 | |
| r8325 | r8326 | |
| 4754 | 4754 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 4755 | 4755 | UINT8 MMC3_helper, cmd; |
| 4756 | 4756 | LOG_MMC(("gouder_sf4_w, offset: %04x, data: %02x\n", offset, data)); |
| 4757 | | |
| 4757 | |
| 4758 | 4758 | switch (offset & 0x6001) |
| 4759 | 4759 | { |
| 4760 | 4760 | case 0x0000: |
| 4761 | 4761 | MMC3_helper = state->mmc_latch1 ^ data; |
| 4762 | 4762 | state->mmc_latch1 = data; |
| 4763 | | |
| 4763 | |
| 4764 | 4764 | /* Has CHR Mode changed? */ |
| 4765 | 4765 | if (MMC3_helper & 0x80) |
| 4766 | 4766 | mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 4767 | 4767 | break; |
| 4768 | | |
| 4768 | |
| 4769 | 4769 | case 0x0001: |
| 4770 | 4770 | cmd = state->mmc_latch1 & 0x07; |
| 4771 | 4771 | switch (cmd) |
| r8325 | r8326 | |
| 4777 | 4777 | break; |
| 4778 | 4778 | } |
| 4779 | 4779 | break; |
| 4780 | | |
| 4780 | |
| 4781 | 4781 | default: |
| 4782 | 4782 | txrom_w(space, offset, data); |
| 4783 | 4783 | break; |
| r8325 | r8326 | |
| 4785 | 4785 | } |
| 4786 | 4786 | |
| 4787 | 4787 | /************************************************************* |
| 4788 | | |
| 4788 | |
| 4789 | 4789 | Bootleg Board by Henggedianzi |
| 4790 | 4790 | |
| 4791 | 4791 | Games: Mei Guo Fu Hao, Shang Gu Shen Jian , Wang Zi Fu |
| 4792 | 4792 | Chou Ji |
| 4793 | | |
| 4793 | |
| 4794 | 4794 | Writes to 0x8000-0xffff set prg32. Moreover, data&0x20 sets |
| 4795 | 4795 | NT mirroring. |
| 4796 | | |
| 4796 | |
| 4797 | 4797 | iNES: mapper 177 |
| 4798 | | |
| 4798 | |
| 4799 | 4799 | In MESS: Supported. |
| 4800 | | |
| 4800 | |
| 4801 | 4801 | *************************************************************/ |
| 4802 | 4802 | |
| 4803 | 4803 | static WRITE8_HANDLER( henggedianzi_w ) |
| 4804 | 4804 | { |
| 4805 | 4805 | LOG_MMC(("henggedianzi_w, offset: %04x, data: %02x\n", offset, data)); |
| 4806 | | |
| 4806 | |
| 4807 | 4807 | prg32(space->machine, data); |
| 4808 | 4808 | set_nt_mirroring(space->machine, BIT(data, 5) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4809 | 4809 | } |
| 4810 | 4810 | |
| 4811 | 4811 | /************************************************************* |
| 4812 | | |
| 4812 | |
| 4813 | 4813 | Bootleg Board by Henggedianzi |
| 4814 | | |
| 4814 | |
| 4815 | 4815 | Games: Xing He Zhan Shi |
| 4816 | | |
| 4816 | |
| 4817 | 4817 | Writes to 0x5000-0x5fff set prg32 banks, writes to 0x8000- |
| 4818 | 4818 | 0xffff set NT mirroring |
| 4819 | | |
| 4819 | |
| 4820 | 4820 | iNES: mapper 179 |
| 4821 | | |
| 4821 | |
| 4822 | 4822 | In MESS: Supported. |
| 4823 | | |
| 4823 | |
| 4824 | 4824 | *************************************************************/ |
| 4825 | 4825 | |
| 4826 | 4826 | static WRITE8_HANDLER( heng_xjzb_l_w ) |
| 4827 | 4827 | { |
| 4828 | 4828 | LOG_MMC(("heng_xjzb_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 4829 | 4829 | offset += 0x4100; |
| 4830 | | |
| 4830 | |
| 4831 | 4831 | if (offset & 0x5000) |
| 4832 | 4832 | prg32(space->machine, data >> 1); |
| 4833 | 4833 | } |
| r8325 | r8326 | |
| 4835 | 4835 | static WRITE8_HANDLER( heng_xjzb_w ) |
| 4836 | 4836 | { |
| 4837 | 4837 | LOG_MMC(("heng_xjzb_w, offset: %04x, data: %02x\n", offset, data)); |
| 4838 | | |
| 4838 | |
| 4839 | 4839 | set_nt_mirroring(space->machine, BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4840 | 4840 | } |
| 4841 | 4841 | |
| 4842 | 4842 | /************************************************************* |
| 4843 | | |
| 4843 | |
| 4844 | 4844 | Bootleg Board by HES (also used by others) |
| 4845 | 4845 | |
| 4846 | 4846 | Games: AV Hanafuda Club, AV Soccer, Papillon, Sidewinder, |
| 4847 | 4847 | Total Funpack |
| 4848 | | |
| 4848 | |
| 4849 | 4849 | Actually, two variant: one for HES 6-in-1 with mirroring control |
| 4850 | 4850 | and one for AV Soccer and others with hardwired mirroring |
| 4851 | 4851 | |
| 4852 | 4852 | iNES: mapper 113 |
| 4853 | | |
| 4853 | |
| 4854 | 4854 | In MESS: Supported. |
| 4855 | | |
| 4855 | |
| 4856 | 4856 | *************************************************************/ |
| 4857 | 4857 | |
| 4858 | 4858 | static WRITE8_HANDLER( hes6in1_l_w ) |
| 4859 | 4859 | { |
| 4860 | 4860 | LOG_MMC(("hes6in1_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 4861 | | |
| 4861 | |
| 4862 | 4862 | if (!(offset & 0x100)) |
| 4863 | 4863 | { |
| 4864 | 4864 | prg32(space->machine, (data & 0x38) >> 3); |
| r8325 | r8326 | |
| 4870 | 4870 | static WRITE8_HANDLER( hes_l_w ) |
| 4871 | 4871 | { |
| 4872 | 4872 | LOG_MMC(("hes_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 4873 | | |
| 4873 | |
| 4874 | 4874 | if (!(offset & 0x100)) |
| 4875 | 4875 | { |
| 4876 | 4876 | prg32(space->machine, (data & 0x38) >> 3); |
| r8325 | r8326 | |
| 4879 | 4879 | } |
| 4880 | 4880 | |
| 4881 | 4881 | /************************************************************* |
| 4882 | | |
| 4882 | |
| 4883 | 4883 | Bootleg Board by Hosenkan |
| 4884 | 4884 | |
| 4885 | 4885 | Games: Pocahontas, Super Donkey Kong |
| 4886 | | |
| 4886 | |
| 4887 | 4887 | iNES: mapper 182 |
| 4888 | | |
| 4888 | |
| 4889 | 4889 | In MESS: Supported. |
| 4890 | | |
| 4890 | |
| 4891 | 4891 | *************************************************************/ |
| 4892 | 4892 | |
| 4893 | 4893 | static WRITE8_HANDLER( hosenkan_w ) |
| 4894 | 4894 | { |
| 4895 | 4895 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 4896 | 4896 | LOG_MMC(("hosenkan_w, offset: %04x, data: %02x\n", offset, data)); |
| 4897 | | |
| 4897 | |
| 4898 | 4898 | switch (offset & 0x7003) |
| 4899 | 4899 | { |
| 4900 | 4900 | case 0x0001: |
| r8325 | r8326 | |
| 4945 | 4945 | } |
| 4946 | 4946 | |
| 4947 | 4947 | /************************************************************* |
| 4948 | | |
| 4948 | |
| 4949 | 4949 | Bootleg Board by Kaiser (KS7058) |
| 4950 | 4950 | |
| 4951 | 4951 | Games: Tui Do Woo Ma Jeung |
| 4952 | | |
| 4952 | |
| 4953 | 4953 | Writes to 0xf000-0xffff set 4k chr banks. Namely, if |
| 4954 | 4954 | offset&0x80 is 0 the lower 4k are set, if it is 1 the |
| 4955 | 4955 | upper 4k are set. |
| 4956 | | |
| 4956 | |
| 4957 | 4957 | iNES: mapper 171 |
| 4958 | | |
| 4958 | |
| 4959 | 4959 | In MESS: Supported. |
| 4960 | | |
| 4960 | |
| 4961 | 4961 | *************************************************************/ |
| 4962 | 4962 | |
| 4963 | 4963 | static WRITE8_HANDLER( ks7058_w ) |
| 4964 | 4964 | { |
| 4965 | 4965 | LOG_MMC(("ks7058_w, offset: %04x, data: %02x\n", offset, data)); |
| 4966 | | |
| 4966 | |
| 4967 | 4967 | switch (offset & 0x7080) |
| 4968 | 4968 | { |
| 4969 | 4969 | case 0x7000: |
| r8325 | r8326 | |
| 4976 | 4976 | } |
| 4977 | 4977 | |
| 4978 | 4978 | /************************************************************* |
| 4979 | | |
| 4979 | |
| 4980 | 4980 | Bootleg Board by Kay (for Panda Prince) |
| 4981 | 4981 | |
| 4982 | 4982 | Games: The Panda Prince |
| 4983 | | |
| 4983 | |
| 4984 | 4984 | MMC3 clone |
| 4985 | | |
| 4985 | |
| 4986 | 4986 | iNES: mapper 121 |
| 4987 | | |
| 4988 | | In MESS: Only preliminarly supported (Panda Prince works, |
| 4987 | |
| 4988 | In MESS: Only preliminarly supported (Panda Prince works, |
| 4989 | 4989 | other games require handling properly the protection). |
| 4990 | | |
| 4990 | |
| 4991 | 4991 | *************************************************************/ |
| 4992 | 4992 | |
| 4993 | 4993 | static WRITE8_HANDLER( kay_pp_l_w ) |
| r8325 | r8326 | |
| 4995 | 4995 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 4996 | 4996 | LOG_MMC(("kay_pp_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 4997 | 4997 | offset += 0x100; |
| 4998 | | |
| 4998 | |
| 4999 | 4999 | if (!(offset < 0x1000)) |
| 5000 | 5000 | { |
| 5001 | 5001 | switch (data & 0x03) |
| r8325 | r8326 | |
| 5019 | 5019 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5020 | 5020 | LOG_MMC(("kay_pp_l_r, offset: %04x\n", offset)); |
| 5021 | 5021 | offset += 0x100; |
| 5022 | | |
| 5022 | |
| 5023 | 5023 | if (!(offset < 0x1000)) |
| 5024 | 5024 | return state->mapper121_reg[2]; |
| 5025 | 5025 | else |
| r8325 | r8326 | |
| 5036 | 5036 | case 0x29: |
| 5037 | 5037 | case 0x2b: |
| 5038 | 5038 | case 0x3f: |
| 5039 | | // printf("reg (%x) %x \n", data, state->mapper121_reg[3]); |
| 5039 | // printf("reg (%x) %x \n", data, state->mapper121_reg[3]); |
| 5040 | 5040 | state->mapper121_reg[1] = state->mapper121_reg[3]; |
| 5041 | 5041 | break; |
| 5042 | 5042 | case 0x2c: |
| 5043 | | // printf("reg (%x) %x \n", data, state->mapper121_reg[3]); |
| 5043 | // printf("reg (%x) %x \n", data, state->mapper121_reg[3]); |
| 5044 | 5044 | state->mapper121_reg[1] = state->mapper121_reg[3]; |
| 5045 | 5045 | break; |
| 5046 | | |
| 5046 | |
| 5047 | 5047 | case 0x28: |
| 5048 | | // printf("reg (%x) %x \n", data, state->mapper121_reg[3]); |
| 5048 | // printf("reg (%x) %x \n", data, state->mapper121_reg[3]); |
| 5049 | 5049 | state->mapper121_reg[0] = state->mapper121_reg[3]; |
| 5050 | 5050 | break; |
| 5051 | | |
| 5051 | |
| 5052 | 5052 | case 0x2a: |
| 5053 | | // printf("reg (%x) %x \n", data, state->mapper121_reg[3]); |
| 5053 | // printf("reg (%x) %x \n", data, state->mapper121_reg[3]); |
| 5054 | 5054 | state->mapper121_reg[4] = state->mapper121_reg[3]; |
| 5055 | 5055 | break; |
| 5056 | | |
| 5056 | |
| 5057 | 5057 | case 0x2f: |
| 5058 | 5058 | break; |
| 5059 | 5059 | |
| r8325 | r8326 | |
| 5070 | 5070 | nes_state *state = (nes_state *)machine->driver_data; |
| 5071 | 5071 | UINT8 prg_flip = (state->mmc_latch1 & 0x40) ? 2 : 0; |
| 5072 | 5072 | UINT8 new_bank1, new_bank2, new_bank3; |
| 5073 | | |
| 5073 | |
| 5074 | 5074 | new_bank2 = state->mapper121_reg[0] ? state->mapper121_reg[0] : state->mmc_prg_bank[2 ^ prg_flip]; |
| 5075 | 5075 | new_bank3 = state->mapper121_reg[1] ? state->mapper121_reg[1] : state->mmc_prg_bank[3]; |
| 5076 | 5076 | new_bank1 = state->mapper121_reg[4] ? state->mapper121_reg[4] : state->mmc_prg_bank[1]; |
| 5077 | | |
| 5077 | |
| 5078 | 5078 | prg8_89(machine, prg_base | (state->mmc_prg_bank[0 ^ prg_flip] & prg_mask)); |
| 5079 | 5079 | prg8_ab(machine, prg_base | (new_bank1 & prg_mask)); |
| 5080 | 5080 | prg8_cd(machine, prg_base | (new_bank2 & prg_mask)); |
| r8325 | r8326 | |
| 5086 | 5086 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5087 | 5087 | UINT8 MMC3_helper, cmd; |
| 5088 | 5088 | LOG_MMC(("kay_pp_w, offset: %04x, data: %02x\n", offset, data)); |
| 5089 | | |
| 5089 | |
| 5090 | 5090 | if ((offset < 0x2000) && (offset & 0x03) == 0x03) |
| 5091 | 5091 | { |
| 5092 | 5092 | kay_pp_update_regs(space->machine, data); |
| r8325 | r8326 | |
| 5099 | 5099 | case 0x0000: |
| 5100 | 5100 | MMC3_helper = state->mmc_latch1 ^ data; |
| 5101 | 5101 | state->mmc_latch1 = data; |
| 5102 | | |
| 5102 | |
| 5103 | 5103 | /* Has PRG Mode changed? */ |
| 5104 | 5104 | if (MMC3_helper & 0x40) |
| 5105 | 5105 | kay_pp_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 5106 | | |
| 5106 | |
| 5107 | 5107 | /* Has CHR Mode changed? */ |
| 5108 | 5108 | if (MMC3_helper & 0x80) |
| 5109 | 5109 | mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 5110 | 5110 | break; |
| 5111 | | |
| 5111 | |
| 5112 | 5112 | case 0x0001: |
| 5113 | | state->mapper121_reg[3] = (BIT(data, 0) << 5) | (BIT(data, 1) << 4) | (BIT(data, 2) << 3) |
| 5113 | state->mapper121_reg[3] = (BIT(data, 0) << 5) | (BIT(data, 1) << 4) | (BIT(data, 2) << 3) |
| 5114 | 5114 | | (BIT(data, 3) << 2) | (BIT(data, 4) << 1) | BIT(data, 5); |
| 5115 | 5115 | cmd = state->mmc_latch1 & 0x07; |
| 5116 | 5116 | switch (cmd) |
| r8325 | r8326 | |
| 5127 | 5127 | break; |
| 5128 | 5128 | } |
| 5129 | 5129 | break; |
| 5130 | | |
| 5130 | |
| 5131 | 5131 | default: |
| 5132 | 5132 | txrom_w(space, offset, data); |
| 5133 | 5133 | break; |
| r8325 | r8326 | |
| 5137 | 5137 | |
| 5138 | 5138 | |
| 5139 | 5139 | /************************************************************* |
| 5140 | | |
| 5140 | |
| 5141 | 5141 | Bootleg Board by Kasing |
| 5142 | 5142 | |
| 5143 | 5143 | Games: AV Jiu Ji Mahjong, Bao Qing Tian, Thunderbolt 2, |
| 5144 | 5144 | Shisen Mahjong 2 |
| 5145 | | |
| 5145 | |
| 5146 | 5146 | MMC3 clone |
| 5147 | | |
| 5147 | |
| 5148 | 5148 | iNES: mapper 115 |
| 5149 | | |
| 5149 | |
| 5150 | 5150 | In MESS: Supported |
| 5151 | | |
| 5151 | |
| 5152 | 5152 | *************************************************************/ |
| 5153 | 5153 | |
| 5154 | 5154 | static void kasing_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| r8325 | r8326 | |
| 5164 | 5164 | { |
| 5165 | 5165 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5166 | 5166 | LOG_MMC(("kasing_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 5167 | | |
| 5167 | |
| 5168 | 5168 | switch (offset & 0x01) |
| 5169 | 5169 | { |
| 5170 | 5170 | case 0x00: |
| r8325 | r8326 | |
| 5183 | 5183 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5184 | 5184 | UINT8 map115_helper, cmd; |
| 5185 | 5185 | LOG_MMC(("kasing_w, offset: %04x, data: %02x\n", offset, data)); |
| 5186 | | |
| 5186 | |
| 5187 | 5187 | switch (offset & 0x6001) |
| 5188 | 5188 | { |
| 5189 | 5189 | case 0x0000: |
| 5190 | 5190 | map115_helper = state->mmc_latch1 ^ data; |
| 5191 | 5191 | state->mmc_latch1 = data; |
| 5192 | | |
| 5192 | |
| 5193 | 5193 | /* Has PRG Mode changed? */ |
| 5194 | 5194 | if (map115_helper & 0x40) |
| 5195 | 5195 | kasing_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 5196 | | |
| 5196 | |
| 5197 | 5197 | /* Has CHR Mode changed? */ |
| 5198 | 5198 | if (map115_helper & 0x80) |
| 5199 | 5199 | mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 5200 | 5200 | break; |
| 5201 | | |
| 5201 | |
| 5202 | 5202 | case 0x0001: |
| 5203 | 5203 | cmd = state->mmc_latch1 & 0x07; |
| 5204 | 5204 | switch (cmd) |
| r8325 | r8326 | |
| 5215 | 5215 | break; |
| 5216 | 5216 | } |
| 5217 | 5217 | break; |
| 5218 | | |
| 5218 | |
| 5219 | 5219 | default: |
| 5220 | 5220 | txrom_w(space, offset, data); |
| 5221 | 5221 | break; |
| r8325 | r8326 | |
| 5223 | 5223 | } |
| 5224 | 5224 | |
| 5225 | 5225 | /************************************************************* |
| 5226 | | |
| 5226 | |
| 5227 | 5227 | Bootleg Board by Magic Series |
| 5228 | 5228 | |
| 5229 | 5229 | Games: Magic Dragon |
| 5230 | | |
| 5230 | |
| 5231 | 5231 | Very simple mapper: writes to 0x8000-0xffff set prg32 and chr8 |
| 5232 | 5232 | banks |
| 5233 | | |
| 5233 | |
| 5234 | 5234 | iNES: mapper 107 |
| 5235 | | |
| 5235 | |
| 5236 | 5236 | In MESS: Supported. |
| 5237 | | |
| 5237 | |
| 5238 | 5238 | *************************************************************/ |
| 5239 | 5239 | |
| 5240 | 5240 | static WRITE8_HANDLER( magics_md_w ) |
| 5241 | 5241 | { |
| 5242 | 5242 | LOG_MMC(("magics_md_w, offset: %04x, data: %02x\n", offset, data)); |
| 5243 | | |
| 5243 | |
| 5244 | 5244 | prg32(space->machine, data >> 1); |
| 5245 | 5245 | chr8(space->machine, data, CHRROM); |
| 5246 | 5246 | } |
| 5247 | 5247 | |
| 5248 | 5248 | /************************************************************* |
| 5249 | | |
| 5249 | |
| 5250 | 5250 | Bootleg Board by Nanjing |
| 5251 | | |
| 5251 | |
| 5252 | 5252 | Games: A lot of pirate originals |
| 5253 | | |
| 5253 | |
| 5254 | 5254 | iNES: mapper 163 |
| 5255 | | |
| 5255 | |
| 5256 | 5256 | In MESS: Unsupported. |
| 5257 | | |
| 5257 | |
| 5258 | 5258 | *************************************************************/ |
| 5259 | 5259 | |
| 5260 | 5260 | static void nanjing_irq( running_device *device, int scanline, int vblank, int blanked ) |
| r8325 | r8326 | |
| 5268 | 5268 | chr4_0(device->machine, 1, CHRRAM); |
| 5269 | 5269 | chr4_4(device->machine, 1, CHRRAM); |
| 5270 | 5270 | } |
| 5271 | | |
| 5271 | |
| 5272 | 5272 | if (scanline == 239) |
| 5273 | 5273 | { |
| 5274 | 5274 | chr4_0(device->machine, 0, CHRRAM); |
| 5275 | 5275 | chr4_4(device->machine, 0, CHRRAM); |
| 5276 | 5276 | } |
| 5277 | 5277 | } |
| 5278 | | |
| 5278 | |
| 5279 | 5279 | } |
| 5280 | 5280 | |
| 5281 | 5281 | static WRITE8_HANDLER( nanjing_l_w ) |
| 5282 | 5282 | { |
| 5283 | 5283 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5284 | 5284 | LOG_MMC(("nanjing_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 5285 | | |
| 5285 | |
| 5286 | 5286 | offset += 0x100; |
| 5287 | 5287 | |
| 5288 | 5288 | if (offset < 0x1000) |
| r8325 | r8326 | |
| 5294 | 5294 | prg32(space->machine, 3); |
| 5295 | 5295 | return; |
| 5296 | 5296 | } |
| 5297 | | |
| 5297 | |
| 5298 | 5298 | if (offset == 0x1101) // 0x5101 |
| 5299 | 5299 | { |
| 5300 | 5300 | UINT8 temp = state->mmc_count; |
| 5301 | 5301 | state->mmc_count = data; |
| 5302 | | |
| 5302 | |
| 5303 | 5303 | if (temp & !data) |
| 5304 | 5304 | state->mmc_latch2 ^= 0xff; |
| 5305 | 5305 | } |
| r8325 | r8326 | |
| 5325 | 5325 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5326 | 5326 | UINT8 value = 0; |
| 5327 | 5327 | LOG_MMC(("nanjing_l_r, offset: %04x\n", offset)); |
| 5328 | | |
| 5328 | |
| 5329 | 5329 | offset += 0x100; |
| 5330 | | |
| 5330 | |
| 5331 | 5331 | if (offset < 0x1000) |
| 5332 | 5332 | return 0; |
| 5333 | | |
| 5333 | |
| 5334 | 5334 | switch (offset & 0x700) |
| 5335 | 5335 | { |
| 5336 | 5336 | case 0x100: |
| r8325 | r8326 | |
| 5352 | 5352 | } |
| 5353 | 5353 | |
| 5354 | 5354 | /************************************************************* |
| 5355 | | |
| 5355 | |
| 5356 | 5356 | Bootleg Board by Nitra |
| 5357 | 5357 | |
| 5358 | 5358 | Games: Time Diver Avenger |
| 5359 | | |
| 5359 | |
| 5360 | 5360 | This acts basically like a MMC3 with different use of write |
| 5361 | 5361 | address. |
| 5362 | | |
| 5362 | |
| 5363 | 5363 | iNES: mapper 250 |
| 5364 | | |
| 5364 | |
| 5365 | 5365 | In MESS: Supported. |
| 5366 | | |
| 5366 | |
| 5367 | 5367 | *************************************************************/ |
| 5368 | 5368 | |
| 5369 | 5369 | static WRITE8_HANDLER( nitra_w ) |
| 5370 | 5370 | { |
| 5371 | 5371 | LOG_MMC(("nitra_w, offset: %04x, data: %02x\n", offset, data)); |
| 5372 | | |
| 5372 | |
| 5373 | 5373 | txrom_w(space, (offset & 0x6000) | ((offset & 0x400) >> 10), offset & 0xff); |
| 5374 | 5374 | } |
| 5375 | 5375 | |
| 5376 | 5376 | /************************************************************* |
| 5377 | | |
| 5378 | | NTDEC ASDER Bootleg Board |
| 5379 | 5377 | |
| 5378 | NTDEC ASDER Bootleg Board |
| 5379 | |
| 5380 | 5380 | Games: Cobra Mission, Fighting Hero III, Huang Di, Master |
| 5381 | 5381 | Shooter |
| 5382 | | |
| 5382 | |
| 5383 | 5383 | iNES: mapper 112 |
| 5384 | | |
| 5384 | |
| 5385 | 5385 | In MESS: Supported. |
| 5386 | | |
| 5386 | |
| 5387 | 5387 | *************************************************************/ |
| 5388 | 5388 | |
| 5389 | 5389 | static WRITE8_HANDLER( ntdec_asder_w ) |
| 5390 | 5390 | { |
| 5391 | 5391 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5392 | 5392 | LOG_MMC(("ntdec_asder_w, offset: %04x, data: %02x\n", offset, data)); |
| 5393 | | |
| 5393 | |
| 5394 | 5394 | switch (offset) |
| 5395 | 5395 | { |
| 5396 | 5396 | case 0x0000: |
| r8325 | r8326 | |
| 5436 | 5436 | } |
| 5437 | 5437 | |
| 5438 | 5438 | /************************************************************* |
| 5439 | | |
| 5439 | |
| 5440 | 5440 | Bootleg Board by NTDEC for Fighting Hero |
| 5441 | 5441 | |
| 5442 | 5442 | Games: Fighting Hero |
| 5443 | | |
| 5443 | |
| 5444 | 5444 | Very simple mapper: writes to 0x6000-0x7fff swap PRG and |
| 5445 | 5445 | CHR banks. |
| 5446 | | |
| 5446 | |
| 5447 | 5447 | iNES: mapper 193 |
| 5448 | | |
| 5448 | |
| 5449 | 5449 | In MESS: Supported. |
| 5450 | | |
| 5450 | |
| 5451 | 5451 | *************************************************************/ |
| 5452 | 5452 | |
| 5453 | 5453 | static WRITE8_HANDLER( ntdec_fh_m_w ) |
| 5454 | 5454 | { |
| 5455 | 5455 | LOG_MMC(("ntdec_fh_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 5456 | | |
| 5456 | |
| 5457 | 5457 | switch (offset & 0x03) |
| 5458 | 5458 | { |
| 5459 | 5459 | case 0: |
| r8325 | r8326 | |
| 5472 | 5472 | } |
| 5473 | 5473 | |
| 5474 | 5474 | /************************************************************* |
| 5475 | | |
| 5475 | |
| 5476 | 5476 | Open Corp DAOU306 board |
| 5477 | 5477 | |
| 5478 | 5478 | Games: Metal Force (K) |
| 5479 | | |
| 5479 | |
| 5480 | 5480 | iNES: mapper 156 |
| 5481 | | |
| 5481 | |
| 5482 | 5482 | In MESS: Supported. |
| 5483 | | |
| 5483 | |
| 5484 | 5484 | *************************************************************/ |
| 5485 | 5485 | |
| 5486 | 5486 | static WRITE8_HANDLER( daou306_w ) |
| 5487 | 5487 | { |
| 5488 | 5488 | LOG_MMC(("daou306_w, offset: %04x, data: %02x\n", offset, data)); |
| 5489 | | |
| 5489 | |
| 5490 | 5490 | switch (offset) |
| 5491 | 5491 | { |
| 5492 | 5492 | case 0x4000: |
| r8325 | r8326 | |
| 5520 | 5520 | } |
| 5521 | 5521 | |
| 5522 | 5522 | /************************************************************* |
| 5523 | | |
| 5523 | |
| 5524 | 5524 | RCM GS2015 Board |
| 5525 | 5525 | |
| 5526 | 5526 | Games: Bonza, Magic Jewelry 2 |
| 5527 | | |
| 5527 | |
| 5528 | 5528 | Very simple mapper: writes to 0x8000-0xffff sets prg32 |
| 5529 | 5529 | to offset and chr8 to offset>>1 (when chrrom is present) |
| 5530 | | |
| 5530 | |
| 5531 | 5531 | iNES: mapper 216 |
| 5532 | | |
| 5532 | |
| 5533 | 5533 | In MESS: Supported. |
| 5534 | | |
| 5534 | |
| 5535 | 5535 | *************************************************************/ |
| 5536 | 5536 | |
| 5537 | 5537 | static WRITE8_HANDLER( gs2015_w ) |
| 5538 | 5538 | { |
| 5539 | 5539 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5540 | 5540 | LOG_MMC(("gs2015_w, offset: %04x, data: %02x\n", offset, data)); |
| 5541 | | |
| 5541 | |
| 5542 | 5542 | prg32(space->machine, offset); |
| 5543 | 5543 | chr8(space->machine, offset >> 1, state->mmc_chr_source); |
| 5544 | 5544 | } |
| 5545 | 5545 | |
| 5546 | 5546 | /************************************************************* |
| 5547 | | |
| 5547 | |
| 5548 | 5548 | Bootleg Board by RCM for Tetris Family |
| 5549 | 5549 | |
| 5550 | 5550 | Games: Tetris Family 9 in 1, 20 in 1 |
| 5551 | | |
| 5551 | |
| 5552 | 5552 | Simple Mapper: prg/chr/nt are swapped depending on the offset |
| 5553 | 5553 | of writes in 0x8000-0xffff. offset&0x80 set NT mirroring, |
| 5554 | 5554 | when (offset&0x30) is 0,3 prg32 is set; when it is 1,2 |
| 5555 | 5555 | two 16k prg banks are set. See below for the values used in |
| 5556 | 5556 | these banks. |
| 5557 | | |
| 5557 | |
| 5558 | 5558 | iNES: mapper 61 |
| 5559 | | |
| 5559 | |
| 5560 | 5560 | In MESS: Supported. |
| 5561 | | |
| 5561 | |
| 5562 | 5562 | *************************************************************/ |
| 5563 | 5563 | |
| 5564 | 5564 | static WRITE8_HANDLER( rcm_tf_w ) |
| 5565 | 5565 | { |
| 5566 | 5566 | LOG_MMC(("rcm_tf_w, offset: %04x, data: %02x\n", offset, data)); |
| 5567 | | |
| 5567 | |
| 5568 | 5568 | switch (offset & 0x30) |
| 5569 | 5569 | { |
| 5570 | 5570 | case 0x00: |
| r8325 | r8326 | |
| 5581 | 5581 | } |
| 5582 | 5582 | |
| 5583 | 5583 | /************************************************************* |
| 5584 | | |
| 5584 | |
| 5585 | 5585 | Bootleg Board by Rex Soft |
| 5586 | 5586 | |
| 5587 | 5587 | Games: Dragon Ball Z 5, Dragon Ball Z Super |
| 5588 | | |
| 5588 | |
| 5589 | 5589 | MMC3 clone |
| 5590 | | |
| 5590 | |
| 5591 | 5591 | iNES: mapper 12 |
| 5592 | | |
| 5592 | |
| 5593 | 5593 | In MESS: Partially Supported |
| 5594 | | |
| 5594 | |
| 5595 | 5595 | *************************************************************/ |
| 5596 | 5596 | |
| 5597 | 5597 | static WRITE8_HANDLER( rex_dbz_l_w ) |
| 5598 | 5598 | { |
| 5599 | 5599 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5600 | | |
| 5600 | |
| 5601 | 5601 | LOG_MMC(("rex_dbz_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 5602 | | |
| 5602 | |
| 5603 | 5603 | state->mapper12_reg = data; |
| 5604 | 5604 | } |
| 5605 | 5605 | |
| r8325 | r8326 | |
| 5614 | 5614 | { |
| 5615 | 5615 | nes_state *state = (nes_state *)machine->driver_data; |
| 5616 | 5616 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 5617 | | |
| 5617 | |
| 5618 | 5618 | chr1_x(machine, chr_page ^ 0, ((state->mapper12_reg & 0x01) << 8) | (state->mmc_vrom_bank[0] & ~0x01), CHRROM); |
| 5619 | 5619 | chr1_x(machine, chr_page ^ 1, ((state->mapper12_reg & 0x01) << 8) | (state->mmc_vrom_bank[0] | 0x01), CHRROM); |
| 5620 | 5620 | chr1_x(machine, chr_page ^ 2, ((state->mapper12_reg & 0x01) << 8) | (state->mmc_vrom_bank[1] & ~0x01), CHRROM); |
| r8325 | r8326 | |
| 5630 | 5630 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5631 | 5631 | UINT8 MMC3_helper, cmd; |
| 5632 | 5632 | LOG_MMC(("rex_dbz_w, offset: %04x, data: %02x\n", offset, data)); |
| 5633 | | |
| 5633 | |
| 5634 | 5634 | switch (offset & 0x6001) |
| 5635 | 5635 | { |
| 5636 | 5636 | case 0x0000: |
| 5637 | 5637 | MMC3_helper = state->mmc_latch1 ^ data; |
| 5638 | 5638 | state->mmc_latch1 = data; |
| 5639 | | |
| 5639 | |
| 5640 | 5640 | /* Has PRG Mode changed? */ |
| 5641 | 5641 | if (MMC3_helper & 0x40) |
| 5642 | 5642 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 5643 | | |
| 5643 | |
| 5644 | 5644 | /* Has CHR Mode changed? */ |
| 5645 | 5645 | if (MMC3_helper & 0x80) |
| 5646 | 5646 | rex_dbz_set_chr(space->machine); |
| 5647 | 5647 | break; |
| 5648 | | |
| 5648 | |
| 5649 | 5649 | case 0x0001: |
| 5650 | 5650 | cmd = state->mmc_latch1 & 0x07; |
| 5651 | 5651 | switch (cmd) |
| r8325 | r8326 | |
| 5662 | 5662 | break; |
| 5663 | 5663 | } |
| 5664 | 5664 | break; |
| 5665 | | |
| 5665 | |
| 5666 | 5666 | default: |
| 5667 | 5667 | txrom_w(space, offset, data); |
| 5668 | 5668 | break; |
| r8325 | r8326 | |
| 5670 | 5670 | } |
| 5671 | 5671 | |
| 5672 | 5672 | /************************************************************* |
| 5673 | | |
| 5673 | |
| 5674 | 5674 | Rex Soft SL1632 Board |
| 5675 | 5675 | |
| 5676 | 5676 | Games: Samurai Spirits |
| 5677 | | |
| 5677 | |
| 5678 | 5678 | MMC3 clone |
| 5679 | | |
| 5679 | |
| 5680 | 5680 | iNES: mapper 14 |
| 5681 | | |
| 5681 | |
| 5682 | 5682 | In MESS: Supported |
| 5683 | | |
| 5683 | |
| 5684 | 5684 | *************************************************************/ |
| 5685 | 5685 | |
| 5686 | 5686 | static void rex_sl1632_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 5687 | 5687 | { |
| 5688 | 5688 | nes_state *state = (nes_state *)machine->driver_data; |
| 5689 | | |
| 5689 | |
| 5690 | 5690 | if (state->map14_reg[0] & 0x02) |
| 5691 | 5691 | { |
| 5692 | 5692 | mmc3_set_prg(machine, prg_base, prg_mask); |
| r8325 | r8326 | |
| 5708 | 5708 | UINT8 bank[8]; |
| 5709 | 5709 | UINT8 chr_base2[8]; |
| 5710 | 5710 | int i; |
| 5711 | | |
| 5711 | |
| 5712 | 5712 | if (state->map14_reg[0] & 0x02) |
| 5713 | 5713 | { |
| 5714 | 5714 | for(i = 0; i < 8; i++) |
| r8325 | r8326 | |
| 5725 | 5725 | chr_base2[i] = chr_base; |
| 5726 | 5726 | } |
| 5727 | 5727 | } |
| 5728 | | |
| 5728 | |
| 5729 | 5729 | chr1_x(machine, chr_page ^ 0, chr_base2[0] | (bank[0] & chr_mask), chr); |
| 5730 | 5730 | chr1_x(machine, chr_page ^ 1, chr_base2[1] | (bank[1] & chr_mask), chr); |
| 5731 | 5731 | chr1_x(machine, chr_page ^ 2, chr_base2[2] | (bank[2] & chr_mask), chr); |
| r8325 | r8326 | |
| 5741 | 5741 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5742 | 5742 | UINT8 map14_helper1, map14_helper2, MMC3_helper, cmd; |
| 5743 | 5743 | LOG_MMC(("rex_sl1632_w, offset: %04x, data: %02x\n", offset, data)); |
| 5744 | | |
| 5744 | |
| 5745 | 5745 | if (offset == 0x2131) |
| 5746 | 5746 | { |
| 5747 | 5747 | state->map14_reg[0] = data; |
| 5748 | 5748 | rex_sl1632_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 5749 | 5749 | rex_sl1632_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 5750 | | |
| 5750 | |
| 5751 | 5751 | if (!(state->map14_reg[0] & 0x02)) |
| 5752 | 5752 | set_nt_mirroring(space->machine, BIT(state->map14_reg[1], 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 5753 | 5753 | } |
| 5754 | | |
| 5754 | |
| 5755 | 5755 | if (state->map14_reg[0] & 0x02) |
| 5756 | 5756 | { |
| 5757 | 5757 | switch (offset & 0x6001) |
| r8325 | r8326 | |
| 5759 | 5759 | case 0x0000: |
| 5760 | 5760 | MMC3_helper = state->mmc_latch1 ^ data; |
| 5761 | 5761 | state->mmc_latch1 = data; |
| 5762 | | |
| 5762 | |
| 5763 | 5763 | /* Has PRG Mode changed? */ |
| 5764 | 5764 | if (MMC3_helper & 0x40) |
| 5765 | 5765 | rex_sl1632_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 5766 | | |
| 5766 | |
| 5767 | 5767 | /* Has CHR Mode changed? */ |
| 5768 | 5768 | if (MMC3_helper & 0x80) |
| 5769 | 5769 | rex_sl1632_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 5770 | 5770 | break; |
| 5771 | | |
| 5771 | |
| 5772 | 5772 | case 0x0001: |
| 5773 | 5773 | cmd = state->mmc_latch1 & 0x07; |
| 5774 | 5774 | switch (cmd) |
| r8325 | r8326 | |
| 5789 | 5789 | break; |
| 5790 | 5790 | } |
| 5791 | 5791 | break; |
| 5792 | | |
| 5792 | |
| 5793 | 5793 | case 0x2000: |
| 5794 | 5794 | set_nt_mirroring(space->machine, BIT(state->map14_reg[1], 0) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 5795 | 5795 | break; |
| 5796 | | |
| 5796 | |
| 5797 | 5797 | default: |
| 5798 | 5798 | txrom_w(space, offset, data); |
| 5799 | 5799 | break; |
| r8325 | r8326 | |
| 5816 | 5816 | state->mmc_extra_bank[offset >> 13] = data; |
| 5817 | 5817 | rex_sl1632_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 5818 | 5818 | break; |
| 5819 | | |
| 5819 | |
| 5820 | 5820 | case 0x1000: |
| 5821 | 5821 | state->map14_reg[1] = data; |
| 5822 | 5822 | set_nt_mirroring(space->machine, BIT(state->map14_reg[1], 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| r8325 | r8326 | |
| 5826 | 5826 | } |
| 5827 | 5827 | |
| 5828 | 5828 | /************************************************************* |
| 5829 | | |
| 5829 | |
| 5830 | 5830 | Rumblestation Board |
| 5831 | 5831 | |
| 5832 | 5832 | Games: Rumblestation 15 in 1 |
| 5833 | | |
| 5833 | |
| 5834 | 5834 | iNES: mapper 46 |
| 5835 | | |
| 5835 | |
| 5836 | 5836 | In MESS: Supported. |
| 5837 | | |
| 5837 | |
| 5838 | 5838 | *************************************************************/ |
| 5839 | 5839 | |
| 5840 | 5840 | static WRITE8_HANDLER( rumblestation_m_w ) |
| 5841 | 5841 | { |
| 5842 | 5842 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5843 | 5843 | LOG_MMC(("rumblestation_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 5844 | | |
| 5844 | |
| 5845 | 5845 | state->mmc_prg_bank[0] = (state->mmc_prg_bank[0] & 0x01) | ((data & 0x0f) << 1); |
| 5846 | 5846 | state->mmc_vrom_bank[0] = (state->mmc_vrom_bank[0] & 0x07) | ((data & 0xf0) >> 1); |
| 5847 | 5847 | prg32(space->machine, state->mmc_prg_bank[0]); |
| r8325 | r8326 | |
| 5852 | 5852 | { |
| 5853 | 5853 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5854 | 5854 | LOG_MMC(("rumblestation_w, offset: %04x, data: %02x\n", offset, data)); |
| 5855 | | |
| 5855 | |
| 5856 | 5856 | state->mmc_prg_bank[0] = (state->mmc_prg_bank[0] & ~0x01) | (data & 0x01); |
| 5857 | 5857 | state->mmc_vrom_bank[0] = (state->mmc_vrom_bank[0] & ~0x07) | ((data & 0x70) >> 4); |
| 5858 | 5858 | prg32(space->machine, state->mmc_prg_bank[0]); |
| r8325 | r8326 | |
| 5860 | 5860 | } |
| 5861 | 5861 | |
| 5862 | 5862 | /************************************************************* |
| 5863 | | |
| 5863 | |
| 5864 | 5864 | Sachen 74x374 bootleg boards |
| 5865 | | |
| 5865 | |
| 5866 | 5866 | iNES: mapper 150 & 243 |
| 5867 | | |
| 5867 | |
| 5868 | 5868 | *************************************************************/ |
| 5869 | 5869 | |
| 5870 | 5870 | static void sachen_set_mirror( running_machine *machine, UINT8 nt ) // used by mappers 137, 138, 139, 141 |
| r8325 | r8326 | |
| 5894 | 5894 | { |
| 5895 | 5895 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5896 | 5896 | LOG_MMC(("sachen_74x374_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 5897 | | |
| 5897 | |
| 5898 | 5898 | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 5899 | 5899 | if (!(offset & 0x100)) |
| 5900 | 5900 | { |
| r8325 | r8326 | |
| 5934 | 5934 | { |
| 5935 | 5935 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5936 | 5936 | LOG_MMC(("sachen_74x374_l_r, offset: %04x", offset)); |
| 5937 | | |
| 5937 | |
| 5938 | 5938 | /* read happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 5939 | 5939 | if (!(offset & 0x100)) |
| 5940 | 5940 | return (~state->mmc_latch1 & 0x3f) /* ^ dips*/; // we would need to check the Dips here |
| r8325 | r8326 | |
| 5946 | 5946 | { |
| 5947 | 5947 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 5948 | 5948 | LOG_MMC(("sachen_74x374a_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 5949 | | |
| 5949 | |
| 5950 | 5950 | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 5951 | 5951 | if (!(offset & 0x100)) |
| 5952 | 5952 | { |
| r8325 | r8326 | |
| 5986 | 5986 | } |
| 5987 | 5987 | |
| 5988 | 5988 | /************************************************************* |
| 5989 | | |
| 5989 | |
| 5990 | 5990 | Sachen S8259 bootleg boards |
| 5991 | | |
| 5991 | |
| 5992 | 5992 | iNES: mapper 141 (A), 138 (B), 139 (C), 137 (D) |
| 5993 | | |
| 5993 | |
| 5994 | 5994 | *************************************************************/ |
| 5995 | 5995 | |
| 5996 | 5996 | static void common_s8259_write_handler( const address_space *space, offs_t offset, UINT8 data, int board ) |
| r8325 | r8326 | |
| 6006 | 6006 | else |
| 6007 | 6007 | { |
| 6008 | 6008 | state->sachen_reg[state->mmc_latch1] = data; |
| 6009 | | |
| 6009 | |
| 6010 | 6010 | switch (state->mmc_latch1) |
| 6011 | 6011 | { |
| 6012 | 6012 | case 0x05: |
| r8325 | r8326 | |
| 6034 | 6034 | add1 = (board == SACHEN_8259B) ? 0 : 1; |
| 6035 | 6035 | add2 = (board == SACHEN_8259C) ? 2 : 0; |
| 6036 | 6036 | add3 = (board == SACHEN_8259A) ? 1 : (board == SACHEN_8259C) ? 3 : 0; |
| 6037 | | |
| 6037 | |
| 6038 | 6038 | if (state->mmc_chr_source == CHRROM) |
| 6039 | 6039 | { |
| 6040 | 6040 | chr2_0(space->machine, ((state->sachen_reg[bank_helper1 ? 0 : 0] & 0x07) | bank_helper2) << shift, CHRROM); |
| r8325 | r8326 | |
| 6053 | 6053 | { |
| 6054 | 6054 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6055 | 6055 | LOG_MMC(("s8259_w, type: %d, offset: %04x, data: %02x\n", state->pcb_id, offset, data)); |
| 6056 | | |
| 6056 | |
| 6057 | 6057 | common_s8259_write_handler(space, offset, data, state->pcb_id); |
| 6058 | 6058 | } |
| 6059 | 6059 | |
| r8325 | r8326 | |
| 6061 | 6061 | { |
| 6062 | 6062 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6063 | 6063 | LOG_MMC(("s8259_w, type: %d, offset: %04x, data: %02x\n", state->pcb_id, offset, data)); |
| 6064 | | |
| 6064 | |
| 6065 | 6065 | common_s8259_write_handler(space, (offset + 0x100) & 0xfff, data, state->pcb_id); |
| 6066 | 6066 | } |
| 6067 | 6067 | |
| 6068 | 6068 | |
| 6069 | 6069 | /************************************************************* |
| 6070 | | |
| 6070 | |
| 6071 | 6071 | Sachen SA0036 bootleg boards |
| 6072 | | |
| 6072 | |
| 6073 | 6073 | iNES: mapper 149 |
| 6074 | | |
| 6074 | |
| 6075 | 6075 | *************************************************************/ |
| 6076 | 6076 | |
| 6077 | 6077 | static WRITE8_HANDLER( sa0036_w ) |
| 6078 | 6078 | { |
| 6079 | 6079 | LOG_MMC(("sa0036_w, offset: %04x, data: %02x\n", offset, data)); |
| 6080 | | |
| 6080 | |
| 6081 | 6081 | chr8(space->machine, data >> 7, CHRROM); |
| 6082 | 6082 | } |
| 6083 | 6083 | |
| 6084 | 6084 | /************************************************************* |
| 6085 | | |
| 6085 | |
| 6086 | 6086 | Sachen SA0037 bootleg boards |
| 6087 | | |
| 6087 | |
| 6088 | 6088 | iNES: mapper 148 |
| 6089 | | |
| 6089 | |
| 6090 | 6090 | *************************************************************/ |
| 6091 | 6091 | |
| 6092 | 6092 | static WRITE8_HANDLER( sa0037_w ) |
| 6093 | 6093 | { |
| 6094 | 6094 | LOG_MMC(("sa0037_w, offset: %04x, data: %02x\n", offset, data)); |
| 6095 | | |
| 6095 | |
| 6096 | 6096 | prg32(space->machine, data >> 3); |
| 6097 | 6097 | chr8(space->machine, data, CHRROM); |
| 6098 | 6098 | } |
| 6099 | 6099 | |
| 6100 | 6100 | /************************************************************* |
| 6101 | | |
| 6101 | |
| 6102 | 6102 | Sachen SA72007 bootleg boards |
| 6103 | | |
| 6103 | |
| 6104 | 6104 | iNES: mapper 145 |
| 6105 | | |
| 6105 | |
| 6106 | 6106 | *************************************************************/ |
| 6107 | 6107 | |
| 6108 | 6108 | static WRITE8_HANDLER( sa72007_l_w ) |
| 6109 | 6109 | { |
| 6110 | 6110 | LOG_MMC(("sa72007_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6111 | | |
| 6111 | |
| 6112 | 6112 | /* only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 6113 | 6113 | if (!(offset & 0x100)) |
| 6114 | 6114 | chr8(space->machine, data >> 7, CHRROM); |
| 6115 | 6115 | } |
| 6116 | 6116 | |
| 6117 | 6117 | /************************************************************* |
| 6118 | | |
| 6118 | |
| 6119 | 6119 | Sachen SA72008 bootleg boards |
| 6120 | | |
| 6120 | |
| 6121 | 6121 | iNES: mapper 133 |
| 6122 | | |
| 6122 | |
| 6123 | 6123 | *************************************************************/ |
| 6124 | 6124 | |
| 6125 | 6125 | static WRITE8_HANDLER( sa72008_l_w ) |
| 6126 | 6126 | { |
| 6127 | 6127 | LOG_MMC(("sa72008_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6128 | | |
| 6128 | |
| 6129 | 6129 | prg32(space->machine, data >> 2); |
| 6130 | 6130 | chr8(space->machine, data, CHRROM); |
| 6131 | 6131 | } |
| 6132 | 6132 | |
| 6133 | 6133 | /************************************************************* |
| 6134 | | |
| 6134 | |
| 6135 | 6135 | Sachen TCA-01 bootleg boards |
| 6136 | | |
| 6136 | |
| 6137 | 6137 | iNES: mapper 143 |
| 6138 | | |
| 6138 | |
| 6139 | 6139 | *************************************************************/ |
| 6140 | 6140 | |
| 6141 | 6141 | static READ8_HANDLER( tca01_l_r ) |
| 6142 | 6142 | { |
| 6143 | 6143 | LOG_MMC(("tca01_l_r, offset: %04x\n", offset)); |
| 6144 | | |
| 6144 | |
| 6145 | 6145 | /* the address is read only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 6146 | 6146 | if (!(offset & 0x100)) |
| 6147 | 6147 | return (~offset & 0x3f) | 0x40; |
| r8325 | r8326 | |
| 6150 | 6150 | } |
| 6151 | 6151 | |
| 6152 | 6152 | /************************************************************* |
| 6153 | | |
| 6153 | |
| 6154 | 6154 | Sachen TCU-01 bootleg boards |
| 6155 | | |
| 6155 | |
| 6156 | 6156 | iNES: mapper 147 |
| 6157 | | |
| 6157 | |
| 6158 | 6158 | *************************************************************/ |
| 6159 | 6159 | |
| 6160 | 6160 | static WRITE8_HANDLER( tcu01_l_w ) |
| 6161 | 6161 | { |
| 6162 | 6162 | LOG_MMC(("tcu01_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6163 | | |
| 6163 | |
| 6164 | 6164 | if ((offset & 0x103) == 0x002) |
| 6165 | 6165 | { |
| 6166 | 6166 | prg32(space->machine, ((data >> 6) & 0x02) | ((data >> 2) & 0x01)); |
| r8325 | r8326 | |
| 6171 | 6171 | static WRITE8_HANDLER( tcu01_m_w ) |
| 6172 | 6172 | { |
| 6173 | 6173 | LOG_MMC(("tcu01_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6174 | | |
| 6174 | |
| 6175 | 6175 | tcu01_l_w(space, (offset + 0x100) & 0xfff, data); |
| 6176 | 6176 | } |
| 6177 | 6177 | |
| 6178 | 6178 | static WRITE8_HANDLER( tcu01_w ) |
| 6179 | 6179 | { |
| 6180 | 6180 | LOG_MMC(("tcu01_w, offset: %04x, data: %02x\n", offset, data)); |
| 6181 | | |
| 6181 | |
| 6182 | 6182 | tcu01_l_w(space, (offset + 0x100) & 0xfff, data); |
| 6183 | 6183 | } |
| 6184 | 6184 | |
| 6185 | 6185 | /************************************************************* |
| 6186 | | |
| 6186 | |
| 6187 | 6187 | Sachen TCU-02 bootleg boards |
| 6188 | | |
| 6188 | |
| 6189 | 6189 | iNES: mapper 136 |
| 6190 | | |
| 6190 | |
| 6191 | 6191 | *************************************************************/ |
| 6192 | 6192 | |
| 6193 | 6193 | static WRITE8_HANDLER( tcu02_l_w ) |
| 6194 | 6194 | { |
| 6195 | 6195 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6196 | 6196 | LOG_MMC(("tcu02_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6197 | | |
| 6197 | |
| 6198 | 6198 | if ((offset & 0x103) == 0x002) |
| 6199 | 6199 | { |
| 6200 | 6200 | state->mmc_latch1 = (data & 0x30) | ((data + 3) & 0x0f); |
| r8325 | r8326 | |
| 6206 | 6206 | { |
| 6207 | 6207 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6208 | 6208 | LOG_MMC(("tcu02_l_r, offset: %04x\n", offset)); |
| 6209 | | |
| 6209 | |
| 6210 | 6210 | if ((offset & 0x103) == 0x000) |
| 6211 | 6211 | return state->mmc_latch1 | 0x40; |
| 6212 | 6212 | else |
| r8325 | r8326 | |
| 6215 | 6215 | |
| 6216 | 6216 | |
| 6217 | 6217 | /************************************************************* |
| 6218 | | |
| 6218 | |
| 6219 | 6219 | Subor bootleg board Type 0 |
| 6220 | | |
| 6220 | |
| 6221 | 6221 | iNES: mapper 167 |
| 6222 | | |
| 6222 | |
| 6223 | 6223 | *************************************************************/ |
| 6224 | 6224 | |
| 6225 | 6225 | static WRITE8_HANDLER( subor0_w ) |
| r8325 | r8326 | |
| 6227 | 6227 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6228 | 6228 | UINT8 subor_helper1, subor_helper2; |
| 6229 | 6229 | LOG_MMC(("subor0_w, offset: %04x, data: %02x\n", offset, data)); |
| 6230 | | |
| 6230 | |
| 6231 | 6231 | state->subor_reg[(offset >> 13) & 0x03] = data; |
| 6232 | 6232 | subor_helper1 = ((state->subor_reg[0] ^ state->subor_reg[1]) << 1) & 0x20; |
| 6233 | 6233 | subor_helper2 = ((state->subor_reg[2] ^ state->subor_reg[3]) << 0) & 0x1f; |
| 6234 | | |
| 6234 | |
| 6235 | 6235 | if (state->subor_reg[1] & 0x08) |
| 6236 | 6236 | { |
| 6237 | 6237 | subor_helper1 += subor_helper2 & 0xfe; |
| r8325 | r8326 | |
| 6248 | 6248 | subor_helper1 += subor_helper2; |
| 6249 | 6249 | subor_helper2 = 0x20; |
| 6250 | 6250 | } |
| 6251 | | |
| 6251 | |
| 6252 | 6252 | prg16_89ab(space->machine, subor_helper1); |
| 6253 | 6253 | prg16_cdef(space->machine, subor_helper2); |
| 6254 | 6254 | } |
| 6255 | 6255 | |
| 6256 | 6256 | /************************************************************* |
| 6257 | | |
| 6257 | |
| 6258 | 6258 | Subor bootleg board Type 1 |
| 6259 | | |
| 6259 | |
| 6260 | 6260 | iNES: mapper 166 |
| 6261 | | |
| 6261 | |
| 6262 | 6262 | *************************************************************/ |
| 6263 | 6263 | |
| 6264 | 6264 | static WRITE8_HANDLER( subor1_w ) |
| r8325 | r8326 | |
| 6266 | 6266 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6267 | 6267 | UINT8 subor_helper1, subor_helper2; |
| 6268 | 6268 | LOG_MMC(("subor1_w, offset: %04x, data: %02x\n", offset, data)); |
| 6269 | | |
| 6269 | |
| 6270 | 6270 | state->subor_reg[(offset >> 13) & 0x03] = data; |
| 6271 | 6271 | subor_helper1 = ((state->subor_reg[0] ^ state->subor_reg[1]) << 1) & 0x20; |
| 6272 | 6272 | subor_helper2 = ((state->subor_reg[2] ^ state->subor_reg[3]) << 0) & 0x1f; |
| 6273 | | |
| 6273 | |
| 6274 | 6274 | if (state->subor_reg[1] & 0x08) |
| 6275 | 6275 | { |
| 6276 | 6276 | subor_helper1 += subor_helper2 & 0xfe; |
| r8325 | r8326 | |
| 6287 | 6287 | subor_helper1 += subor_helper2; |
| 6288 | 6288 | subor_helper2 = 0x07; |
| 6289 | 6289 | } |
| 6290 | | |
| 6290 | |
| 6291 | 6291 | prg16_89ab(space->machine, subor_helper1); |
| 6292 | 6292 | prg16_cdef(space->machine, subor_helper2); |
| 6293 | 6293 | } |
| 6294 | 6294 | |
| 6295 | 6295 | /************************************************************* |
| 6296 | | |
| 6296 | |
| 6297 | 6297 | Bootleg Board by Super Game |
| 6298 | 6298 | |
| 6299 | 6299 | Games: Boogerman, Mortal Kombat III |
| 6300 | | |
| 6300 | |
| 6301 | 6301 | MMC3 clone. Also, it probably needs a hack to support both |
| 6302 | 6302 | variants (Boogerman & MK3). |
| 6303 | | |
| 6303 | |
| 6304 | 6304 | iNES: mapper 215 |
| 6305 | | |
| 6305 | |
| 6306 | 6306 | In MESS: Preliminary support. |
| 6307 | | |
| 6307 | |
| 6308 | 6308 | *************************************************************/ |
| 6309 | 6309 | |
| 6310 | 6310 | // remove mask & base parameters! |
| r8325 | r8326 | |
| 6320 | 6320 | { |
| 6321 | 6321 | state->mmc_prg_base = (state->map215_reg[1] & 0x08) ? 0x20 : (state->map215_reg[1] & 0x10); |
| 6322 | 6322 | state->mmc_prg_mask = (state->map215_reg[1] & 0x08) ? 0x1f : 0x0f; |
| 6323 | | |
| 6323 | |
| 6324 | 6324 | mmc3_set_prg(machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 6325 | 6325 | } |
| 6326 | 6326 | } |
| r8325 | r8326 | |
| 6331 | 6331 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 6332 | 6332 | int chr_base = (state->map215_reg[1] & 0x04) ? 0x100 : ((state->map215_reg[1] & 0x10) << 3); |
| 6333 | 6333 | int chr_mask = (state->map215_reg[1] & 0x04) ? 0xff : 0x7f; |
| 6334 | | |
| 6334 | |
| 6335 | 6335 | chr1_x(machine, chr_page ^ 0, chr_base | ((state->mmc_vrom_bank[0] & ~0x01) & chr_mask), chr); |
| 6336 | 6336 | chr1_x(machine, chr_page ^ 1, chr_base | ((state->mmc_vrom_bank[0] | 0x01) & chr_mask), chr); |
| 6337 | 6337 | chr1_x(machine, chr_page ^ 2, chr_base | ((state->mmc_vrom_bank[1] & ~0x01) & chr_mask), chr); |
| r8325 | r8326 | |
| 6347 | 6347 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6348 | 6348 | LOG_MMC(("sgame_boog_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6349 | 6349 | offset += 0x100; |
| 6350 | | |
| 6350 | |
| 6351 | 6351 | if (offset == 0x1000) |
| 6352 | 6352 | { |
| 6353 | 6353 | state->map215_reg[0] = data; |
| r8325 | r8326 | |
| 6373 | 6373 | UINT8 MMC3_helper, cmd; |
| 6374 | 6374 | static const UINT8 conv_table[8] = {0,2,5,3,6,1,7,4}; |
| 6375 | 6375 | LOG_MMC(("sgame_boog_w, offset: %04x, data: %02x\n", offset, data)); |
| 6376 | | |
| 6376 | |
| 6377 | 6377 | if (!state->map215_reg[2]) // in this case we act like MMC3, only with alt prg/chr handlers |
| 6378 | 6378 | { |
| 6379 | 6379 | switch (offset & 0x6001) |
| r8325 | r8326 | |
| 6381 | 6381 | case 0x0000: |
| 6382 | 6382 | MMC3_helper = state->mmc_latch1 ^ data; |
| 6383 | 6383 | state->mmc_latch1 = data; |
| 6384 | | |
| 6384 | |
| 6385 | 6385 | /* Has PRG Mode changed? */ |
| 6386 | 6386 | if (MMC3_helper & 0x40) |
| 6387 | 6387 | sgame_boog_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 6388 | | |
| 6388 | |
| 6389 | 6389 | /* Has CHR Mode changed? */ |
| 6390 | 6390 | if (MMC3_helper & 0x80) |
| 6391 | 6391 | sgame_boog_set_chr(space->machine, state->mmc_chr_source); |
| 6392 | 6392 | break; |
| 6393 | | |
| 6393 | |
| 6394 | 6394 | case 0x0001: |
| 6395 | 6395 | cmd = state->mmc_latch1 & 0x07; |
| 6396 | 6396 | switch (cmd) |
| r8325 | r8326 | |
| 6407 | 6407 | break; |
| 6408 | 6408 | } |
| 6409 | 6409 | break; |
| 6410 | | |
| 6410 | |
| 6411 | 6411 | default: |
| 6412 | 6412 | txrom_w(space, offset, data); |
| 6413 | 6413 | break; |
| r8325 | r8326 | |
| 6419 | 6419 | { |
| 6420 | 6420 | case 0x0000: |
| 6421 | 6421 | break; |
| 6422 | | |
| 6422 | |
| 6423 | 6423 | case 0x0001: |
| 6424 | 6424 | cmd = state->mmc_latch1 & 0x07; |
| 6425 | 6425 | if (state->map215_reg[3] && ((state->map215_reg[0] & 0x80) == 0 || cmd < 6)) // if we use the prg16 banks and cmd=6,7 DON'T enter! |
| r8325 | r8326 | |
| 6440 | 6440 | } |
| 6441 | 6441 | } |
| 6442 | 6442 | break; |
| 6443 | | |
| 6443 | |
| 6444 | 6444 | case 0x2000: |
| 6445 | 6445 | data = (data & 0xc0) | conv_table[data & 0x07]; |
| 6446 | 6446 | MMC3_helper = state->mmc_latch1 ^ data; |
| 6447 | 6447 | state->mmc_latch1 = data; |
| 6448 | | |
| 6448 | |
| 6449 | 6449 | /* Has PRG Mode changed? */ |
| 6450 | 6450 | if (MMC3_helper & 0x40) |
| 6451 | 6451 | sgame_boog_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 6452 | | |
| 6452 | |
| 6453 | 6453 | /* Has CHR Mode changed? */ |
| 6454 | 6454 | if (MMC3_helper & 0x80) |
| 6455 | 6455 | sgame_boog_set_chr(space->machine, state->mmc_chr_source); |
| 6456 | | |
| 6456 | |
| 6457 | 6457 | state->map215_reg[3] = 1; |
| 6458 | 6458 | break; |
| 6459 | | |
| 6459 | |
| 6460 | 6460 | // case 0x2001: |
| 6461 | 6461 | // txrom_w(space, 0x4001, data); |
| 6462 | 6462 | // break; |
| 6463 | | |
| 6463 | |
| 6464 | 6464 | case 0x4000: |
| 6465 | 6465 | set_nt_mirroring(space->machine, ((data >> 7) | data) & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 6466 | 6466 | break; |
| 6467 | | |
| 6467 | |
| 6468 | 6468 | case 0x4001: |
| 6469 | 6469 | txrom_w(space, 0x6001, data); |
| 6470 | 6470 | break; |
| 6471 | | |
| 6471 | |
| 6472 | 6472 | // case 0x6000: |
| 6473 | 6473 | // txrom_w(space, 0x6000, data); |
| 6474 | 6474 | // break; |
| 6475 | | |
| 6475 | |
| 6476 | 6476 | case 0x6001: |
| 6477 | 6477 | txrom_w(space, 0x4000, data); |
| 6478 | 6478 | txrom_w(space, 0x4001, data); |
| 6479 | 6479 | break; |
| 6480 | | |
| 6480 | |
| 6481 | 6481 | default: |
| 6482 | 6482 | txrom_w(space, offset, data); |
| 6483 | 6483 | break; |
| r8325 | r8326 | |
| 6486 | 6486 | } |
| 6487 | 6487 | |
| 6488 | 6488 | /************************************************************* |
| 6489 | | |
| 6489 | |
| 6490 | 6490 | Bootleg Board by Super Game |
| 6491 | | |
| 6491 | |
| 6492 | 6492 | Games: The Lion King |
| 6493 | | |
| 6493 | |
| 6494 | 6494 | MMC3 clone. |
| 6495 | | |
| 6495 | |
| 6496 | 6496 | iNES: mapper 114 |
| 6497 | | |
| 6497 | |
| 6498 | 6498 | In MESS: Supported. |
| 6499 | | |
| 6499 | |
| 6500 | 6500 | *************************************************************/ |
| 6501 | 6501 | |
| 6502 | 6502 | static WRITE8_HANDLER( sgame_lion_m_w ) |
| 6503 | 6503 | { |
| 6504 | 6504 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6505 | 6505 | LOG_MMC(("sgame_lion_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6506 | | |
| 6506 | |
| 6507 | 6507 | state->map114_reg = data; |
| 6508 | | |
| 6508 | |
| 6509 | 6509 | if (state->map114_reg & 0x80) |
| 6510 | 6510 | { |
| 6511 | 6511 | prg16_89ab(space->machine, data & 0x1f); |
| r8325 | r8326 | |
| 6513 | 6513 | } |
| 6514 | 6514 | else |
| 6515 | 6515 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 6516 | | |
| 6516 | |
| 6517 | 6517 | } |
| 6518 | 6518 | |
| 6519 | 6519 | static WRITE8_HANDLER( sgame_lion_w ) |
| r8325 | r8326 | |
| 6521 | 6521 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6522 | 6522 | static const UINT8 conv_table[8] = {0, 3, 1, 5, 6, 7, 2, 4}; |
| 6523 | 6523 | LOG_MMC(("sgame_lion_w, offset: %04x, data: %02x\n", offset, data)); |
| 6524 | | |
| 6524 | |
| 6525 | 6525 | if (offset < 0x6000) |
| 6526 | 6526 | { |
| 6527 | 6527 | switch (offset & 0x6000) |
| r8325 | r8326 | |
| 6560 | 6560 | } |
| 6561 | 6561 | |
| 6562 | 6562 | /************************************************************* |
| 6563 | | |
| 6563 | |
| 6564 | 6564 | Tengen 800008 Board |
| 6565 | | |
| 6565 | |
| 6566 | 6566 | iNES: mapper 3? |
| 6567 | | |
| 6567 | |
| 6568 | 6568 | In MESS: Supported. |
| 6569 | | |
| 6569 | |
| 6570 | 6570 | *************************************************************/ |
| 6571 | 6571 | |
| 6572 | 6572 | static WRITE8_HANDLER( tengen_800008_w ) |
| 6573 | 6573 | { |
| 6574 | 6574 | LOG_MMC(("tengen_800008_w, offset: %04x, data: %02x\n", offset, data)); |
| 6575 | | |
| 6575 | |
| 6576 | 6576 | prg32(space->machine, data >> 3); |
| 6577 | 6577 | chr8(space->machine, data, CHRROM); |
| 6578 | 6578 | } |
| 6579 | 6579 | |
| 6580 | 6580 | /************************************************************* |
| 6581 | | |
| 6581 | |
| 6582 | 6582 | Tengen 800032 Board |
| 6583 | 6583 | |
| 6584 | 6584 | Games: Klax, Road Runner, Rolling Thunder, Shinobi, Skulls |
| 6585 | 6585 | & Croosbones, Xybots |
| 6586 | | |
| 6586 | |
| 6587 | 6587 | iNES: mapper 64 |
| 6588 | | |
| 6588 | |
| 6589 | 6589 | In MESS: Partially Supported. |
| 6590 | | |
| 6590 | |
| 6591 | 6591 | *************************************************************/ |
| 6592 | 6592 | |
| 6593 | 6593 | static void tengen_800032_irq( running_device *device, int scanline, int vblank, int blanked ) |
| r8325 | r8326 | |
| 6651 | 6651 | { |
| 6652 | 6652 | nes_state *state = (nes_state *)machine->driver_data; |
| 6653 | 6653 | UINT8 prg_mode = state->mmc_latch1 & 0x40; |
| 6654 | | |
| 6654 | |
| 6655 | 6655 | prg8_89(machine, state->mmc_prg_bank[prg_mode ? 2: 0]); |
| 6656 | 6656 | prg8_ab(machine, state->mmc_prg_bank[prg_mode ? 0: 1]); |
| 6657 | 6657 | prg8_cd(machine, state->mmc_prg_bank[prg_mode ? 1: 2]); |
| r8325 | r8326 | |
| 6661 | 6661 | { |
| 6662 | 6662 | nes_state *state = (nes_state *)machine->driver_data; |
| 6663 | 6663 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 6664 | | |
| 6664 | |
| 6665 | 6665 | if (state->mmc_latch1 & 0x20) |
| 6666 | 6666 | { |
| 6667 | 6667 | chr1_x(machine, 0 ^ chr_page, state->mmc_vrom_bank[0], CHRROM); |
| r8325 | r8326 | |
| 6676 | 6676 | chr1_x(machine, 2 ^ chr_page, state->mmc_vrom_bank[1] & ~0x01, CHRROM); |
| 6677 | 6677 | chr1_x(machine, 3 ^ chr_page, state->mmc_vrom_bank[1] | 0x01, CHRROM); |
| 6678 | 6678 | } |
| 6679 | | |
| 6679 | |
| 6680 | 6680 | chr1_x(machine, 4 ^ chr_page, state->mmc_vrom_bank[2], CHRROM); |
| 6681 | 6681 | chr1_x(machine, 5 ^ chr_page, state->mmc_vrom_bank[3], CHRROM); |
| 6682 | 6682 | chr1_x(machine, 6 ^ chr_page, state->mmc_vrom_bank[4], CHRROM); |
| r8325 | r8326 | |
| 6688 | 6688 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6689 | 6689 | UINT8 map64_helper, cmd; |
| 6690 | 6690 | LOG_MMC(("tengen_800032_w, offset: %04x, data: %02x\n", offset, data)); |
| 6691 | | |
| 6691 | |
| 6692 | 6692 | switch (offset & 0x6001) |
| 6693 | 6693 | { |
| 6694 | 6694 | case 0x0000: |
| 6695 | 6695 | map64_helper = state->mmc_latch1 ^ data; |
| 6696 | 6696 | state->mmc_latch1 = data; |
| 6697 | | |
| 6697 | |
| 6698 | 6698 | /* Has PRG Mode changed? */ |
| 6699 | 6699 | if (map64_helper & 0x40) |
| 6700 | 6700 | tengen_800032_set_prg(space->machine); |
| 6701 | | |
| 6701 | |
| 6702 | 6702 | /* Has CHR Mode changed? */ |
| 6703 | 6703 | if (map64_helper & 0xa0) |
| 6704 | 6704 | tengen_800032_set_chr(space->machine); |
| 6705 | 6705 | break; |
| 6706 | | |
| 6706 | |
| 6707 | 6707 | case 0x0001: |
| 6708 | 6708 | cmd = state->mmc_latch1 & 0x0f; |
| 6709 | 6709 | switch (cmd) |
| r8325 | r8326 | |
| 6728 | 6728 | break; |
| 6729 | 6729 | } |
| 6730 | 6730 | break; |
| 6731 | | |
| 6731 | |
| 6732 | 6732 | case 0x2000: |
| 6733 | 6733 | set_nt_mirroring(space->machine, BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 6734 | 6734 | break; |
| 6735 | | |
| 6735 | |
| 6736 | 6736 | case 0x4000: |
| 6737 | 6737 | state->IRQ_count_latch = data; |
| 6738 | 6738 | break; |
| 6739 | | |
| 6739 | |
| 6740 | 6740 | case 0x4001: /* $c001 - IRQ scanline latch */ |
| 6741 | 6741 | state->IRQ_mode = data & 0x01; |
| 6742 | 6742 | state->IRQ_reset = 1; |
| 6743 | 6743 | break; |
| 6744 | | |
| 6744 | |
| 6745 | 6745 | case 0x6000: |
| 6746 | 6746 | state->IRQ_enable = 0; |
| 6747 | 6747 | break; |
| 6748 | | |
| 6748 | |
| 6749 | 6749 | case 0x6001: |
| 6750 | 6750 | state->IRQ_enable = 1; |
| 6751 | 6751 | break; |
| 6752 | | |
| 6752 | |
| 6753 | 6753 | default: |
| 6754 | 6754 | LOG_MMC(("Mapper 64 write. addr: %04x value: %02x\n", offset + 0x8000, data)); |
| 6755 | 6755 | break; |
| r8325 | r8326 | |
| 6757 | 6757 | } |
| 6758 | 6758 | |
| 6759 | 6759 | /************************************************************* |
| 6760 | | |
| 6760 | |
| 6761 | 6761 | Tengen 800037 Board |
| 6762 | | |
| 6762 | |
| 6763 | 6763 | Games: Alien Syndrome |
| 6764 | | |
| 6764 | |
| 6765 | 6765 | iNES: mapper 158 |
| 6766 | | |
| 6766 | |
| 6767 | 6767 | In MESS: Very preliminary support. |
| 6768 | | |
| 6768 | |
| 6769 | 6769 | *************************************************************/ |
| 6770 | 6770 | |
| 6771 | 6771 | // probably wrong... |
| r8325 | r8326 | |
| 6773 | 6773 | { |
| 6774 | 6774 | nes_state *state = (nes_state *)machine->driver_data; |
| 6775 | 6775 | UINT8 nt_mode = state->mmc_latch1 & 0x80; |
| 6776 | | |
| 6776 | |
| 6777 | 6777 | set_nt_page(machine, 0, ROM, state->mmc_vrom_bank[nt_mode ? 2 : 0], 0); |
| 6778 | 6778 | set_nt_page(machine, 1, ROM, state->mmc_vrom_bank[nt_mode ? 3 : 0], 0); |
| 6779 | 6779 | set_nt_page(machine, 2, ROM, state->mmc_vrom_bank[nt_mode ? 4 : 1], 0); |
| r8325 | r8326 | |
| 6785 | 6785 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6786 | 6786 | UINT8 map158_helper, cmd; |
| 6787 | 6787 | LOG_MMC(("tengen_800037_w, offset: %04x, data: %02x\n", offset, data)); |
| 6788 | | |
| 6788 | |
| 6789 | 6789 | switch (offset & 0x6001) |
| 6790 | 6790 | { |
| 6791 | 6791 | case 0x0000: |
| 6792 | 6792 | map158_helper = state->mmc_latch1 ^ data; |
| 6793 | 6793 | state->mmc_latch1 = data; |
| 6794 | | |
| 6794 | |
| 6795 | 6795 | /* Has PRG Mode changed? */ |
| 6796 | 6796 | if (map158_helper & 0x40) |
| 6797 | 6797 | tengen_800032_set_prg(space->machine); |
| 6798 | | |
| 6798 | |
| 6799 | 6799 | /* Has CHR Mode changed? */ |
| 6800 | 6800 | if (map158_helper & 0xa0) |
| 6801 | 6801 | { |
| r8325 | r8326 | |
| 6803 | 6803 | tengen_800037_set_mirror(space->machine); |
| 6804 | 6804 | } |
| 6805 | 6805 | break; |
| 6806 | | |
| 6806 | |
| 6807 | 6807 | case 0x0001: |
| 6808 | 6808 | cmd = state->mmc_latch1 & 0x0f; |
| 6809 | 6809 | switch (cmd) |
| r8325 | r8326 | |
| 6830 | 6830 | break; |
| 6831 | 6831 | } |
| 6832 | 6832 | break; |
| 6833 | | |
| 6833 | |
| 6834 | 6834 | case 0x2000: |
| 6835 | 6835 | break; |
| 6836 | | |
| 6836 | |
| 6837 | 6837 | default: |
| 6838 | 6838 | tengen_800032_w(space, offset, data); |
| 6839 | 6839 | break; |
| r8325 | r8326 | |
| 6841 | 6841 | } |
| 6842 | 6842 | |
| 6843 | 6843 | /************************************************************* |
| 6844 | | |
| 6844 | |
| 6845 | 6845 | Bootleg Board 22211 by TXC (Type A) |
| 6846 | 6846 | |
| 6847 | 6847 | Games: Creatom |
| 6848 | | |
| 6848 | |
| 6849 | 6849 | Info from NEStopia: this mapper features write to four |
| 6850 | 6850 | registers (0x4100-0x4103). The third one is used to select |
| 6851 | 6851 | PRG and CHR banks. |
| 6852 | | |
| 6852 | |
| 6853 | 6853 | iNES: mapper 132 |
| 6854 | | |
| 6854 | |
| 6855 | 6855 | In MESS: Supported. |
| 6856 | | |
| 6856 | |
| 6857 | 6857 | *************************************************************/ |
| 6858 | 6858 | |
| 6859 | 6859 | static WRITE8_HANDLER( txc_22211_l_w ) |
| 6860 | 6860 | { |
| 6861 | 6861 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6862 | 6862 | LOG_MMC(("txc_22211_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6863 | | |
| 6863 | |
| 6864 | 6864 | if (offset < 4) |
| 6865 | 6865 | state->txc_reg[offset & 0x03] = data; |
| 6866 | 6866 | } |
| r8325 | r8326 | |
| 6869 | 6869 | { |
| 6870 | 6870 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6871 | 6871 | LOG_MMC(("txc_22211_l_r, offset: %04x\n", offset)); |
| 6872 | | |
| 6872 | |
| 6873 | 6873 | if (offset == 0x0000) |
| 6874 | 6874 | return (state->txc_reg[1] ^ state->txc_reg[2]) | 0x40; |
| 6875 | 6875 | else |
| r8325 | r8326 | |
| 6880 | 6880 | { |
| 6881 | 6881 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6882 | 6882 | LOG_MMC(("txc_22211_w, offset: %04x, data: %02x\n", offset, data)); |
| 6883 | | |
| 6883 | |
| 6884 | 6884 | prg32(space->machine, state->txc_reg[2] >> 2); |
| 6885 | 6885 | chr8(space->machine, state->txc_reg[2], CHRROM); |
| 6886 | 6886 | } |
| 6887 | 6887 | |
| 6888 | 6888 | /************************************************************* |
| 6889 | | |
| 6889 | |
| 6890 | 6890 | Bootleg Board 22211 by TXC (Type B) |
| 6891 | | |
| 6891 | |
| 6892 | 6892 | Games: 1991 Du Ma Racing |
| 6893 | | |
| 6893 | |
| 6894 | 6894 | This mapper is basically the same as Type A. Only difference is |
| 6895 | 6895 | in the way CHR banks are selected (see below) |
| 6896 | | |
| 6896 | |
| 6897 | 6897 | iNES: mapper 172 |
| 6898 | | |
| 6898 | |
| 6899 | 6899 | In MESS: Supported. |
| 6900 | | |
| 6900 | |
| 6901 | 6901 | *************************************************************/ |
| 6902 | 6902 | |
| 6903 | 6903 | static WRITE8_HANDLER( txc_22211b_w ) |
| 6904 | 6904 | { |
| 6905 | 6905 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6906 | 6906 | LOG_MMC(("txc_22211b_w, offset: %04x, data: %02x\n", offset, data)); |
| 6907 | | |
| 6907 | |
| 6908 | 6908 | prg32(space->machine, state->txc_reg[2] >> 2); |
| 6909 | 6909 | chr8(space->machine, (((data ^ state->txc_reg[2]) >> 3) & 0x02) | (((data ^ state->txc_reg[2]) >> 5) & 0x01), CHRROM); |
| 6910 | 6910 | } |
| 6911 | 6911 | |
| 6912 | 6912 | /************************************************************* |
| 6913 | | |
| 6913 | |
| 6914 | 6914 | Bootleg Board 22211 by TXC (Type C) |
| 6915 | | |
| 6915 | |
| 6916 | 6916 | Games: Mahjong Block, Xiao Ma Li |
| 6917 | | |
| 6917 | |
| 6918 | 6918 | This mapper is basically the same as 132 too. Only difference is |
| 6919 | 6919 | in 0x4100 reads which expect also bit 0 to be set |
| 6920 | | |
| 6920 | |
| 6921 | 6921 | iNES: mapper 172 |
| 6922 | | |
| 6922 | |
| 6923 | 6923 | In MESS: Supported. |
| 6924 | | |
| 6924 | |
| 6925 | 6925 | *************************************************************/ |
| 6926 | 6926 | |
| 6927 | 6927 | static READ8_HANDLER( txc_22211c_l_r ) |
| 6928 | 6928 | { |
| 6929 | 6929 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6930 | 6930 | LOG_MMC(("txc_22211c_l_r, offset: %04x\n", offset)); |
| 6931 | | |
| 6931 | |
| 6932 | 6932 | if (offset == 0x0000) |
| 6933 | 6933 | return (state->txc_reg[1] ^ state->txc_reg[2]) | 0x41; |
| 6934 | 6934 | else |
| r8325 | r8326 | |
| 6936 | 6936 | } |
| 6937 | 6937 | |
| 6938 | 6938 | /************************************************************* |
| 6939 | | |
| 6939 | |
| 6940 | 6940 | Bootleg Board 'Thunder Warrior' by TXC |
| 6941 | 6941 | |
| 6942 | 6942 | Games: Master Fighter II, Master Fighter 3, Thunder Warrior |
| 6943 | | |
| 6943 | |
| 6944 | 6944 | MMC3 clone |
| 6945 | | |
| 6945 | |
| 6946 | 6946 | iNES: mapper 189 |
| 6947 | | |
| 6947 | |
| 6948 | 6948 | In MESS: Supported. |
| 6949 | | |
| 6949 | |
| 6950 | 6950 | *************************************************************/ |
| 6951 | 6951 | |
| 6952 | 6952 | static WRITE8_HANDLER( txc_tw_l_w ) |
| 6953 | 6953 | { |
| 6954 | 6954 | LOG_MMC(("txctw_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6955 | | |
| 6955 | |
| 6956 | 6956 | prg32(space->machine, (data >> 4) | data); |
| 6957 | 6957 | } |
| 6958 | 6958 | |
| 6959 | 6959 | static WRITE8_HANDLER( txc_tw_m_w ) |
| 6960 | 6960 | { |
| 6961 | 6961 | LOG_MMC(("txctw_m_w, offset: %04x, data: %04x\n", offset, data)); |
| 6962 | | |
| 6962 | |
| 6963 | 6963 | txc_tw_l_w(space, offset & 0xff, data); // offset does not really count for this mapper |
| 6964 | 6964 | } |
| 6965 | 6965 | |
| r8325 | r8326 | |
| 6969 | 6969 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 6970 | 6970 | UINT8 MMC3_helper, cmd; |
| 6971 | 6971 | LOG_MMC(("txctw_w, offset: %04x, data: %02x\n", offset, data)); |
| 6972 | | |
| 6972 | |
| 6973 | 6973 | switch (offset & 0x6001) |
| 6974 | 6974 | { |
| 6975 | 6975 | case 0x0000: |
| 6976 | 6976 | MMC3_helper = state->mmc_latch1 ^ data; |
| 6977 | 6977 | state->mmc_latch1 = data; |
| 6978 | | |
| 6978 | |
| 6979 | 6979 | /* Has CHR Mode changed? */ |
| 6980 | 6980 | if (MMC3_helper & 0x80) |
| 6981 | 6981 | mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 6982 | 6982 | break; |
| 6983 | | |
| 6983 | |
| 6984 | 6984 | case 0x0001: |
| 6985 | 6985 | cmd = state->mmc_latch1 & 0x07; |
| 6986 | 6986 | switch (cmd) |
| r8325 | r8326 | |
| 6992 | 6992 | break; |
| 6993 | 6993 | } |
| 6994 | 6994 | break; |
| 6995 | | |
| 6995 | |
| 6996 | 6996 | default: |
| 6997 | 6997 | txrom_w(space, offset, data); |
| 6998 | 6998 | break; |
| r8325 | r8326 | |
| 7000 | 7000 | } |
| 7001 | 7001 | |
| 7002 | 7002 | /************************************************************* |
| 7003 | | |
| 7003 | |
| 7004 | 7004 | Bootleg Board 'Strike Wolf' by TXC |
| 7005 | | |
| 7005 | |
| 7006 | 7006 | Games: Strike Wolf (also Policeman?? according to Nestopia) |
| 7007 | 7007 | |
| 7008 | 7008 | iNES: mapper 36 |
| 7009 | | |
| 7009 | |
| 7010 | 7010 | Known Boards: Bootleg Board by TXC |
| 7011 | | |
| 7011 | |
| 7012 | 7012 | In MESS: Supported. |
| 7013 | | |
| 7013 | |
| 7014 | 7014 | *************************************************************/ |
| 7015 | 7015 | |
| 7016 | 7016 | static WRITE8_HANDLER( txc_strikewolf_w ) |
| 7017 | 7017 | { |
| 7018 | 7018 | LOG_MMC(("txc_strikewolf_w, offset: %04x, data: %02x\n", offset, data)); |
| 7019 | | |
| 7019 | |
| 7020 | 7020 | if ((offset >= 0x400) && (offset < 0x7fff)) |
| 7021 | 7021 | { |
| 7022 | 7022 | prg32(space->machine, data >> 4); |
| r8325 | r8326 | |
| 7025 | 7025 | } |
| 7026 | 7026 | |
| 7027 | 7027 | /************************************************************* |
| 7028 | | |
| 7028 | |
| 7029 | 7029 | Bootleg Board MXMDHTWO by TXC |
| 7030 | 7030 | |
| 7031 | 7031 | Games: Commandos, Journey to the West, Ma Bu Mi Zhen & |
| 7032 | 7032 | Qu Wei Cheng Yu Wu, Si Lu Chuan Qi |
| 7033 | | |
| 7033 | |
| 7034 | 7034 | Simple Mapper: writes to 0x8000-0xffff sets the prg32 bank. |
| 7035 | 7035 | Not sure if returning 0x50 for reads in 0x4100-0x5000 is correct. |
| 7036 | | |
| 7036 | |
| 7037 | 7037 | iNES: mapper 241 |
| 7038 | | |
| 7038 | |
| 7039 | 7039 | In MESS: Supported. |
| 7040 | | |
| 7040 | |
| 7041 | 7041 | *************************************************************/ |
| 7042 | 7042 | |
| 7043 | 7043 | static READ8_HANDLER( txc_mxmdhtwo_l_r ) |
| r8325 | r8326 | |
| 7048 | 7048 | static WRITE8_HANDLER( txc_mxmdhtwo_w ) |
| 7049 | 7049 | { |
| 7050 | 7050 | LOG_MMC(("txc_mxmdhtwo_w, offset: %04x, data: %02x\n", offset, data)); |
| 7051 | | |
| 7051 | |
| 7052 | 7052 | prg32(space->machine, data); |
| 7053 | 7053 | } |
| 7054 | 7054 | |
| 7055 | 7055 | /************************************************************* |
| 7056 | | |
| 7057 | | Waixing Board Type A |
| 7058 | 7056 | |
| 7057 | Waixing Board Type A |
| 7058 | |
| 7059 | 7059 | Games: Columbus - Ougon no Yoake (C), Ji Jia Zhan Shi, |
| 7060 | 7060 | Jia A Fung Yun, Wei Luo Chuan Qi |
| 7061 | | |
| 7061 | |
| 7062 | 7062 | This mapper is quite similar to MMC3, but with two differences: |
| 7063 | 7063 | mirroring is not the same, and when VROM banks 8,9 are accessed |
| 7064 | 7064 | they point to CHRRAM and not CHRROM. |
| 7065 | | |
| 7065 | |
| 7066 | 7066 | iNES: mapper 74 |
| 7067 | | |
| 7067 | |
| 7068 | 7068 | In MESS: Supported |
| 7069 | | |
| 7069 | |
| 7070 | 7070 | *************************************************************/ |
| 7071 | 7071 | |
| 7072 | 7072 | /* MIRROR_LOW and MIRROR_HIGH are swapped! */ |
| r8325 | r8326 | |
| 7096 | 7096 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 7097 | 7097 | UINT8 chr_src[6]; |
| 7098 | 7098 | int i; |
| 7099 | | |
| 7099 | |
| 7100 | 7100 | for (i = 0; i < 6; i++) |
| 7101 | 7101 | chr_src[i] = ((state->mmc_vrom_bank[i] == 8) || (state->mmc_vrom_bank[i] == 9)) ? CHRRAM : CHRROM; |
| 7102 | | |
| 7102 | |
| 7103 | 7103 | chr1_x(machine, chr_page ^ 0, chr_base | ((state->mmc_vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 7104 | 7104 | chr1_x(machine, chr_page ^ 1, chr_base | ((state->mmc_vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 7105 | 7105 | chr1_x(machine, chr_page ^ 2, chr_base | ((state->mmc_vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| r8325 | r8326 | |
| 7115 | 7115 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 7116 | 7116 | UINT8 MMC3_helper, cmd; |
| 7117 | 7117 | LOG_MMC(("waixing_a_w, offset: %04x, data: %02x\n", offset, data)); |
| 7118 | | |
| 7118 | |
| 7119 | 7119 | switch (offset & 0x6001) |
| 7120 | 7120 | { |
| 7121 | 7121 | case 0x0000: |
| 7122 | 7122 | MMC3_helper = state->mmc_latch1 ^ data; |
| 7123 | 7123 | state->mmc_latch1 = data; |
| 7124 | | |
| 7124 | |
| 7125 | 7125 | /* Has PRG Mode changed? */ |
| 7126 | 7126 | if (MMC3_helper & 0x40) |
| 7127 | 7127 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 7128 | | |
| 7128 | |
| 7129 | 7129 | /* Has CHR Mode changed? */ |
| 7130 | 7130 | if (MMC3_helper & 0x80) |
| 7131 | 7131 | waixing_a_set_chr(space->machine, state->mmc_chr_base, state->mmc_chr_mask); |
| 7132 | 7132 | break; |
| 7133 | | |
| 7133 | |
| 7134 | 7134 | case 0x0001: |
| 7135 | 7135 | cmd = state->mmc_latch1 & 0x07; |
| 7136 | 7136 | switch (cmd) |
| r8325 | r8326 | |
| 7147 | 7147 | break; |
| 7148 | 7148 | } |
| 7149 | 7149 | break; |
| 7150 | | |
| 7150 | |
| 7151 | 7151 | case 0x2000: |
| 7152 | 7152 | waixing_set_mirror(space->machine, data); //maybe data & 0x03? |
| 7153 | 7153 | break; |
| 7154 | | |
| 7154 | |
| 7155 | 7155 | case 0x2001: |
| 7156 | 7156 | break; |
| 7157 | | |
| 7157 | |
| 7158 | 7158 | default: |
| 7159 | 7159 | txrom_w(space, offset, data); |
| 7160 | 7160 | break; |
| r8325 | r8326 | |
| 7162 | 7162 | } |
| 7163 | 7163 | |
| 7164 | 7164 | /************************************************************* |
| 7165 | | |
| 7165 | |
| 7166 | 7166 | Waixing Board Type B |
| 7167 | | |
| 7167 | |
| 7168 | 7168 | Games: Sugoro Quest (C) |
| 7169 | | |
| 7169 | |
| 7170 | 7170 | MMC3 clone. This is a minor modification of Mapper 74, |
| 7171 | 7171 | in the sense that it is the same board except for the |
| 7172 | 7172 | CHRRAM pages. |
| 7173 | | |
| 7173 | |
| 7174 | 7174 | iNES: mapper 191 |
| 7175 | | |
| 7175 | |
| 7176 | 7176 | In MESS: Supported. |
| 7177 | | |
| 7177 | |
| 7178 | 7178 | *************************************************************/ |
| 7179 | 7179 | |
| 7180 | 7180 | static void waixing_b_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| r8325 | r8326 | |
| 7183 | 7183 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 7184 | 7184 | UINT8 chr_src[6]; |
| 7185 | 7185 | int i; |
| 7186 | | |
| 7186 | |
| 7187 | 7187 | for (i = 0; i < 6; i++) |
| 7188 | 7188 | chr_src[i] = (state->mmc_vrom_bank[i] & 0x80) ? CHRRAM : CHRROM; |
| 7189 | | |
| 7189 | |
| 7190 | 7190 | chr1_x(machine, chr_page ^ 0, chr_base | ((state->mmc_vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 7191 | 7191 | chr1_x(machine, chr_page ^ 1, chr_base | ((state->mmc_vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 7192 | 7192 | chr1_x(machine, chr_page ^ 2, chr_base | ((state->mmc_vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| r8325 | r8326 | |
| 7202 | 7202 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 7203 | 7203 | UINT8 MMC3_helper, cmd; |
| 7204 | 7204 | LOG_MMC(("waixing_b_w, offset: %04x, data: %02x\n", offset, data)); |
| 7205 | | |
| 7205 | |
| 7206 | 7206 | switch (offset & 0x6001) |
| 7207 | 7207 | { |
| 7208 | 7208 | case 0x0000: |
| 7209 | 7209 | MMC3_helper = state->mmc_latch1 ^ data; |
| 7210 | 7210 | state->mmc_latch1 = data; |
| 7211 | | |
| 7211 | |
| 7212 | 7212 | /* Has PRG Mode changed? */ |
| 7213 | 7213 | if (MMC3_helper & 0x40) |
| 7214 | 7214 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 7215 | | |
| 7215 | |
| 7216 | 7216 | /* Has CHR Mode changed? */ |
| 7217 | 7217 | if (MMC3_helper & 0x80) |
| 7218 | 7218 | waixing_b_set_chr(space->machine, state->mmc_chr_base, state->mmc_chr_mask); |
| 7219 | 7219 | break; |
| 7220 | | |
| 7220 | |
| 7221 | 7221 | case 0x0001: |
| 7222 | 7222 | cmd = state->mmc_latch1 & 0x07; |
| 7223 | 7223 | switch (cmd) |
| r8325 | r8326 | |
| 7234 | 7234 | break; |
| 7235 | 7235 | } |
| 7236 | 7236 | break; |
| 7237 | | |
| 7237 | |
| 7238 | 7238 | default: |
| 7239 | 7239 | waixing_a_w(space, offset, data); |
| 7240 | 7240 | break; |
| r8325 | r8326 | |
| 7242 | 7242 | } |
| 7243 | 7243 | |
| 7244 | 7244 | /************************************************************* |
| 7245 | | |
| 7246 | | Waixing Board Type C |
| 7247 | | |
| 7245 | |
| 7246 | Waixing Board Type C |
| 7247 | |
| 7248 | 7248 | Games: Ying Lie Qun Xia Zhuan, Young Chivalry |
| 7249 | | |
| 7249 | |
| 7250 | 7250 | MMC3 clone. This is a minor modification of Mapper 74, |
| 7251 | 7251 | in the sense that it is the same board except for the |
| 7252 | 7252 | CHRRAM pages. |
| 7253 | | |
| 7253 | |
| 7254 | 7254 | iNES: mapper 192 |
| 7255 | | |
| 7255 | |
| 7256 | 7256 | In MESS: Supported. |
| 7257 | | |
| 7257 | |
| 7258 | 7258 | *************************************************************/ |
| 7259 | 7259 | |
| 7260 | 7260 | static void waixing_c_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| r8325 | r8326 | |
| 7263 | 7263 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 7264 | 7264 | UINT8 chr_src[6]; |
| 7265 | 7265 | int i; |
| 7266 | | |
| 7266 | |
| 7267 | 7267 | for (i = 0; i < 6; i++) |
| 7268 | 7268 | chr_src[i] = ((state->mmc_vrom_bank[i] == 0x08) || (state->mmc_vrom_bank[i] == 0x09) || (state->mmc_vrom_bank[i] == 0x0a) || (state->mmc_vrom_bank[i] == 0x0b)) ? CHRRAM : CHRROM; |
| 7269 | | |
| 7269 | |
| 7270 | 7270 | chr1_x(machine, chr_page ^ 0, chr_base | ((state->mmc_vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 7271 | 7271 | chr1_x(machine, chr_page ^ 1, chr_base | ((state->mmc_vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 7272 | 7272 | chr1_x(machine, chr_page ^ 2, chr_base | ((state->mmc_vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| r8325 | r8326 | |
| 7282 | 7282 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 7283 | 7283 | UINT8 MMC3_helper, cmd; |
| 7284 | 7284 | LOG_MMC(("waixing_c_w, offset: %04x, data: %02x\n", offset, data)); |
| 7285 | | |
| 7285 | |
| 7286 | 7286 | switch (offset & 0x6001) |
| 7287 | 7287 | { |
| 7288 | 7288 | case 0x0000: |
| 7289 | 7289 | MMC3_helper = state->mmc_latch1 ^ data; |
| 7290 | 7290 | state->mmc_latch1 = data; |
| 7291 | | |
| 7291 | |
| 7292 | 7292 | /* Has PRG Mode changed? */ |
| 7293 | 7293 | if (MMC3_helper & 0x40) |
| 7294 | 7294 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 7295 | | |
| 7295 | |
| 7296 | 7296 | /* Has CHR Mode changed? */ |
| 7297 | 7297 | if (MMC3_helper & 0x80) |
| 7298 | 7298 | waixing_c_set_chr(space->machine, state->mmc_chr_base, state->mmc_chr_mask); |
| 7299 | 7299 | break; |
| 7300 | | |
| 7300 | |
| 7301 | 7301 | case 0x0001: |
| 7302 | 7302 | cmd = state->mmc_latch1 & 0x07; |
| 7303 | 7303 | switch (cmd) |
| r8325 | r8326 | |
| 7314 | 7314 | break; |
| 7315 | 7315 | } |
| 7316 | 7316 | break; |
| 7317 | | |
| 7317 | |
| 7318 | 7318 | default: |
| 7319 | 7319 | waixing_a_w(space, offset, data); |
| 7320 | 7320 | break; |
| r8325 | r8326 | |
| 7322 | 7322 | } |
| 7323 | 7323 | |
| 7324 | 7324 | /************************************************************* |
| 7325 | | |
| 7326 | | Waixing Board Type D |
| 7327 | | |
| 7325 | |
| 7326 | Waixing Board Type D |
| 7327 | |
| 7328 | 7328 | Games: Super Robot Taisen (C) |
| 7329 | | |
| 7329 | |
| 7330 | 7330 | MMC3 clone. This is a minor modification of Mapper 74, |
| 7331 | 7331 | in the sense that it is the same board except for the |
| 7332 | 7332 | CHRRAM pages. |
| 7333 | | |
| 7333 | |
| 7334 | 7334 | iNES: mapper 194 |
| 7335 | | |
| 7335 | |
| 7336 | 7336 | In MESS: Supported. |
| 7337 | | |
| 7337 | |
| 7338 | 7338 | *************************************************************/ |
| 7339 | 7339 | |
| 7340 | 7340 | static void waixing_d_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| r8325 | r8326 | |
| 7343 | 7343 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 7344 | 7344 | UINT8 chr_src[6]; |
| 7345 | 7345 | int i; |
| 7346 | | |
| 7346 | |
| 7347 | 7347 | for (i = 0; i < 6; i++) |
| 7348 | 7348 | chr_src[i] = (state->mmc_vrom_bank[i] < 0x02) ? CHRRAM : CHRROM; |
| 7349 | | |
| 7349 | |
| 7350 | 7350 | chr1_x(machine, chr_page ^ 0, chr_base | ((state->mmc_vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 7351 | 7351 | chr1_x(machine, chr_page ^ 1, chr_base | ((state->mmc_vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 7352 | 7352 | chr1_x(machine, chr_page ^ 2, chr_base | ((state->mmc_vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| r8325 | r8326 | |
| 7362 | 7362 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 7363 | 7363 | UINT8 MMC3_helper, cmd; |
| 7364 | 7364 | LOG_MMC(("waixing_d_w, offset: %04x, data: %02x\n", offset, data)); |
| 7365 | | |
| 7365 | |
| 7366 | 7366 | switch (offset & 0x6001) |
| 7367 | 7367 | { |
| 7368 | 7368 | case 0x0000: |
| 7369 | 7369 | MMC3_helper = state->mmc_latch1 ^ data; |
| 7370 | 7370 | state->mmc_latch1 = data; |
| 7371 | | |
| 7371 | |
| 7372 | 7372 | /* Has PRG Mode changed? */ |
| 7373 | 7373 | if (MMC3_helper & 0x40) |
| 7374 | 7374 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 7375 | | |
| 7375 | |
| 7376 | 7376 | /* Has CHR Mode changed? */ |
| 7377 | 7377 | if (MMC3_helper & 0x80) |
| 7378 | 7378 | waixing_d_set_chr(space->machine, state->mmc_chr_base, state->mmc_chr_mask); |
| 7379 | 7379 | break; |
| 7380 | | |
| 7380 | |
| 7381 | 7381 | case 0x0001: |
| 7382 | 7382 | cmd = state->mmc_latch1 & 0x07; |
| 7383 | 7383 | switch (cmd) |
| r8325 | r8326 | |
| 7394 | 7394 | break; |
| 7395 | 7395 | } |
| 7396 | 7396 | break; |
| 7397 | | |
| 7397 | |
| 7398 | 7398 | default: |
| 7399 | 7399 | waixing_a_w(space, offset, data); |
| 7400 | 7400 | break; |
| r8325 | r8326 | |
| 7402 | 7402 | } |
| 7403 | 7403 | |
| 7404 | 7404 | /************************************************************* |
| 7405 | | |
| 7406 | | Waixing Board Type E |
| 7407 | | |
| 7405 | |
| 7406 | Waixing Board Type E |
| 7407 | |
| 7408 | 7408 | Games: Captain Tsubasa Vol. II (C), Chaos World, God |
| 7409 | 7409 | Slayer (C), Zu Qiu Xiao Jiang |
| 7410 | | |
| 7410 | |
| 7411 | 7411 | MMC3 clone. This is a minor modification of Mapper 74, |
| 7412 | 7412 | in the sense that it is the same board except for the |
| 7413 | 7413 | CHRRAM pages. |
| 7414 | | |
| 7414 | |
| 7415 | 7415 | iNES: mapper 195 |
| 7416 | | |
| 7416 | |
| 7417 | 7417 | In MESS: Supported. |
| 7418 | | |
| 7418 | |
| 7419 | 7419 | *************************************************************/ |
| 7420 | 7420 | |
| 7421 | 7421 | static void waixing_e_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| r8325 | r8326 | |
| 7424 | 7424 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 7425 | 7425 | UINT8 chr_src[6]; |
| 7426 | 7426 | int i; |
| 7427 | | |
| 7427 | |
| 7428 | 7428 | for (i = 0; i < 6; i++) |
| 7429 | 7429 | chr_src[i] = (state->mmc_vrom_bank[i] < 0x04) ? CHRRAM : CHRROM; |
| 7430 | | |
| 7430 | |
| 7431 | 7431 | chr1_x(machine, chr_page ^ 0, chr_base | ((state->mmc_vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 7432 | 7432 | chr1_x(machine, chr_page ^ 1, chr_base | ((state->mmc_vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 7433 | 7433 | chr1_x(machine, chr_page ^ 2, chr_base | ((state->mmc_vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| r8325 | r8326 | |
| 7443 | 7443 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 7444 | 7444 | UINT8 MMC3_helper, cmd; |
| 7445 | 7445 | LOG_MMC(("waixing_e_w, offset: %04x, data: %02x\n", offset, data)); |
| 7446 | | |
| 7446 | |
| 7447 | 7447 | switch (offset & 0x6001) |
| 7448 | 7448 | { |
| 7449 | 7449 | case 0x0000: |
| 7450 | 7450 | MMC3_helper = state->mmc_latch1 ^ data; |
| 7451 | 7451 | state->mmc_latch1 = data; |
| 7452 | | |
| 7452 | |
| 7453 | 7453 | /* Has PRG Mode changed? */ |
| 7454 | 7454 | if (MMC3_helper & 0x40) |
| 7455 | 7455 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 7456 | | |
| 7456 | |
| 7457 | 7457 | /* Has CHR Mode changed? */ |
| 7458 | 7458 | if (MMC3_helper & 0x80) |
| 7459 | 7459 | waixing_e_set_chr(space->machine, state->mmc_chr_base, state->mmc_chr_mask); |
| 7460 | 7460 | break; |
| 7461 | | |
| 7461 | |
| 7462 | 7462 | case 0x0001: |
| 7463 | 7463 | cmd = state->mmc_latch1 & 0x07; |
| 7464 | 7464 | switch (cmd) |
| r8325 | r8326 | |
| 7475 | 7475 | break; |
| 7476 | 7476 | } |
| 7477 | 7477 | break; |
| 7478 | | |
| 7478 | |
| 7479 | 7479 | default: |
| 7480 | 7480 | waixing_a_w(space, offset, data); |
| 7481 | 7481 | break; |
| r8325 | r8326 | |
| 7483 | 7483 | } |
| 7484 | 7484 | |
| 7485 | 7485 | /************************************************************* |
| 7486 | | |
| 7487 | | Waixing Board Type F |
| 7488 | | |
| 7486 | |
| 7487 | Waixing Board Type F |
| 7488 | |
| 7489 | 7489 | Games: Tenchi wo Kurau II (C) |
| 7490 | | |
| 7490 | |
| 7491 | 7491 | MMC3 clone. |
| 7492 | | |
| 7492 | |
| 7493 | 7493 | iNES: mapper 198 |
| 7494 | | |
| 7494 | |
| 7495 | 7495 | In MESS: Preliminary support. |
| 7496 | | |
| 7496 | |
| 7497 | 7497 | *************************************************************/ |
| 7498 | 7498 | |
| 7499 | 7499 | static void waixing_f_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 7500 | 7500 | { |
| 7501 | 7501 | nes_state *state = (nes_state *)machine->driver_data; |
| 7502 | 7502 | UINT8 prg_flip = (state->mmc_latch1 & 0x40) ? 2 : 0; |
| 7503 | | |
| 7503 | |
| 7504 | 7504 | prg8_89(machine, prg_base | (state->mmc_prg_bank[0 ^ prg_flip] & prg_mask)); |
| 7505 | 7505 | prg8_ab(machine, prg_base | (state->mmc_prg_bank[1] & prg_mask)); |
| 7506 | 7506 | prg8_cd(machine, prg_base | (state->mmc_prg_bank[2 ^ prg_flip] & prg_mask)); |
| r8325 | r8326 | |
| 7512 | 7512 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 7513 | 7513 | UINT8 MMC3_helper, cmd; |
| 7514 | 7514 | LOG_MMC(("waixing_f_w, offset: %04x, data: %02x\n", offset, data)); |
| 7515 | | |
| 7515 | |
| 7516 | 7516 | switch (offset & 0x6001) |
| 7517 | 7517 | { |
| 7518 | 7518 | case 0x0000: |
| 7519 | 7519 | MMC3_helper = state->mmc_latch1 ^ data; |
| 7520 | 7520 | state->mmc_latch1 = data; |
| 7521 | | |
| 7521 | |
| 7522 | 7522 | /* Has PRG Mode changed? */ |
| 7523 | 7523 | if (MMC3_helper & 0x40) |
| 7524 | 7524 | waixing_f_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 7525 | | |
| 7525 | |
| 7526 | 7526 | /* Has CHR Mode changed? */ |
| 7527 | 7527 | if (MMC3_helper & 0x80) |
| 7528 | 7528 | mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 7529 | 7529 | break; |
| 7530 | | |
| 7530 | |
| 7531 | 7531 | case 0x0001: |
| 7532 | 7532 | cmd = state->mmc_latch1 & 0x07; |
| 7533 | 7533 | switch (cmd) |
| r8325 | r8326 | |
| 7544 | 7544 | break; |
| 7545 | 7545 | } |
| 7546 | 7546 | break; |
| 7547 | | |
| 7547 | |
| 7548 | 7548 | default: |
| 7549 | 7549 | waixing_a_w(space, offset, data); |
| 7550 | 7550 | break; |
| r8325 | r8326 | |
| 7552 | 7552 | } |
| 7553 | 7553 | |
| 7554 | 7554 | /************************************************************* |
| 7555 | | |
| 7556 | | Waixing Board Type G |
| 7557 | | |
| 7555 | |
| 7556 | Waixing Board Type G |
| 7557 | |
| 7558 | 7558 | Games: San Guo Zhi 2, Dragon Ball Z Gaiden (C), Dragon |
| 7559 | 7559 | Ball Z II (C) |
| 7560 | | |
| 7560 | |
| 7561 | 7561 | MMC3 clone |
| 7562 | | |
| 7562 | |
| 7563 | 7563 | iNES: mapper 199 |
| 7564 | | |
| 7564 | |
| 7565 | 7565 | In MESS: Supported. |
| 7566 | | |
| 7566 | |
| 7567 | 7567 | *************************************************************/ |
| 7568 | 7568 | |
| 7569 | 7569 | static void waixing_g_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| r8325 | r8326 | |
| 7572 | 7572 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 7573 | 7573 | UINT8 chr_src[8]; |
| 7574 | 7574 | int i; |
| 7575 | | |
| 7575 | |
| 7576 | 7576 | for (i = 0; i < 8; i++) |
| 7577 | 7577 | chr_src[i] = (state->mmc_vrom_bank[i] < 0x08) ? CHRRAM : CHRROM; |
| 7578 | | |
| 7578 | |
| 7579 | 7579 | chr1_x(machine, chr_page ^ 0, chr_base | (state->mmc_vrom_bank[0] & chr_mask), chr_src[0]); |
| 7580 | 7580 | chr1_x(machine, chr_page ^ 1, chr_base | (state->mmc_vrom_bank[6] & chr_mask), chr_src[6]); |
| 7581 | 7581 | chr1_x(machine, chr_page ^ 2, chr_base | (state->mmc_vrom_bank[1] & chr_mask), chr_src[1]); |
| r8325 | r8326 | |
| 7591 | 7591 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 7592 | 7592 | UINT8 MMC3_helper, cmd; |
| 7593 | 7593 | LOG_MMC(("waixing_g_w, offset: %04x, data: %02x\n", offset, data)); |
| 7594 | | |
| 7594 | |
| 7595 | 7595 | switch (offset & 0x6001) |
| 7596 | 7596 | { |
| 7597 | 7597 | case 0x0000: |
| 7598 | 7598 | MMC3_helper = state->mmc_latch1 ^ data; |
| 7599 | 7599 | state->mmc_latch1 = data; |
| 7600 | | |
| 7600 | |
| 7601 | 7601 | /* Has PRG Mode changed? */ |
| 7602 | 7602 | if (MMC3_helper & 0x40) |
| 7603 | 7603 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 7604 | | |
| 7604 | |
| 7605 | 7605 | /* Has CHR Mode changed? */ |
| 7606 | 7606 | if (MMC3_helper & 0x80) |
| 7607 | 7607 | waixing_g_set_chr(space->machine, state->mmc_chr_base, state->mmc_chr_mask); |
| 7608 | 7608 | break; |
| 7609 | | |
| 7609 | |
| 7610 | 7610 | case 0x0001: |
| 7611 | 7611 | cmd = state->mmc_latch1 & 0x0f; |
| 7612 | 7612 | switch (cmd) |
| r8325 | r8326 | |
| 7629 | 7629 | break; |
| 7630 | 7630 | } |
| 7631 | 7631 | break; |
| 7632 | | |
| 7632 | |
| 7633 | 7633 | default: |
| 7634 | 7634 | txrom_w(space, offset, data); |
| 7635 | 7635 | break; |
| r8325 | r8326 | |
| 7637 | 7637 | } |
| 7638 | 7638 | |
| 7639 | 7639 | /************************************************************* |
| 7640 | | |
| 7641 | | Waixing Board Type H |
| 7642 | | |
| 7640 | |
| 7641 | Waixing Board Type H |
| 7642 | |
| 7643 | 7643 | Games: Ying Xiong Yuan Yi Jing Chuan Qi, Yong Zhe Dou E |
| 7644 | 7644 | Long - Dragon Quest VII |
| 7645 | | |
| 7645 | |
| 7646 | 7646 | MMC3 clone. More info to come. |
| 7647 | | |
| 7647 | |
| 7648 | 7648 | iNES: mapper 245 |
| 7649 | | |
| 7649 | |
| 7650 | 7650 | In MESS: Supported. |
| 7651 | | |
| 7651 | |
| 7652 | 7652 | *************************************************************/ |
| 7653 | 7653 | |
| 7654 | 7654 | static WRITE8_HANDLER( waixing_h_w ) |
| r8325 | r8326 | |
| 7656 | 7656 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 7657 | 7657 | UINT8 cmd, map245_helper; |
| 7658 | 7658 | LOG_MMC(("waixing_h_w, offset: %04x, data: %02x\n", offset, data)); |
| 7659 | | |
| 7659 | |
| 7660 | 7660 | switch (offset & 0x6001) |
| 7661 | 7661 | { |
| 7662 | 7662 | case 0x0001: |
| r8325 | r8326 | |
| 7685 | 7685 | break; |
| 7686 | 7686 | } |
| 7687 | 7687 | break; |
| 7688 | | |
| 7688 | |
| 7689 | 7689 | case 0x2001: |
| 7690 | 7690 | break; |
| 7691 | | |
| 7691 | |
| 7692 | 7692 | default: |
| 7693 | 7693 | txrom_w(space, offset, data); |
| 7694 | 7694 | break; |
| r8325 | r8326 | |
| 7696 | 7696 | } |
| 7697 | 7697 | |
| 7698 | 7698 | /************************************************************* |
| 7699 | | |
| 7699 | |
| 7700 | 7700 | Waixing San Guo Zhi Board |
| 7701 | | |
| 7701 | |
| 7702 | 7702 | Games: San Guo Zhi |
| 7703 | | |
| 7703 | |
| 7704 | 7704 | This board uses Konami IRQ |
| 7705 | | |
| 7705 | |
| 7706 | 7706 | iNES: mapper 252 |
| 7707 | | |
| 7707 | |
| 7708 | 7708 | In MESS: Unsupported. |
| 7709 | | |
| 7709 | |
| 7710 | 7710 | *************************************************************/ |
| 7711 | 7711 | |
| 7712 | 7712 | static WRITE8_HANDLER( waixing_sgz_w ) |
| r8325 | r8326 | |
| 7714 | 7714 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 7715 | 7715 | UINT8 mmc_helper, bank; |
| 7716 | 7716 | LOG_MMC(("waixing_sgz_w, offset: %04x, data: %02x\n", offset, data)); |
| 7717 | | |
| 7717 | |
| 7718 | 7718 | switch (offset & 0x7000) |
| 7719 | 7719 | { |
| 7720 | 7720 | case 0x0000: |
| r8325 | r8326 | |
| 7760 | 7760 | |
| 7761 | 7761 | |
| 7762 | 7762 | /************************************************************* |
| 7763 | | |
| 7763 | |
| 7764 | 7764 | Waixing San Guo Zhong Lie Zhuan Board |
| 7765 | | |
| 7765 | |
| 7766 | 7766 | Games: Fan Kong Jing Ying, San Guo Zhong Lie Zhuan, Xing |
| 7767 | 7767 | Ji Zheng Ba |
| 7768 | | |
| 7768 | |
| 7769 | 7769 | iNES: mapper 178 |
| 7770 | | |
| 7770 | |
| 7771 | 7771 | In MESS: Supported. |
| 7772 | | |
| 7772 | |
| 7773 | 7773 | *************************************************************/ |
| 7774 | 7774 | |
| 7775 | 7775 | static WRITE8_HANDLER( waixing_sgzlz_l_w ) |
| 7776 | 7776 | { |
| 7777 | 7777 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 7778 | 7778 | LOG_MMC(("waixing_sgzlz_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7779 | | |
| 7779 | |
| 7780 | 7780 | switch (offset) |
| 7781 | 7781 | { |
| 7782 | 7782 | case 0x700: |
| r8325 | r8326 | |
| 7793 | 7793 | } |
| 7794 | 7794 | |
| 7795 | 7795 | /************************************************************* |
| 7796 | | |
| 7796 | |
| 7797 | 7797 | Waixing Final Fantasy V Board |
| 7798 | | |
| 7798 | |
| 7799 | 7799 | Games: Darkseed, Digital Dragon, Final Fantasy V, Pocket |
| 7800 | 7800 | Monster Red |
| 7801 | | |
| 7801 | |
| 7802 | 7802 | iNES: mapper 164 |
| 7803 | | |
| 7803 | |
| 7804 | 7804 | In MESS: Supported. |
| 7805 | | |
| 7805 | |
| 7806 | 7806 | *************************************************************/ |
| 7807 | 7807 | |
| 7808 | 7808 | static WRITE8_HANDLER( waixing_ffv_l_w ) |
| 7809 | 7809 | { |
| 7810 | 7810 | LOG_MMC(("waixing_ffv_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7811 | 7811 | offset += 0x4100; /* the checks work better on addresses */ |
| 7812 | | |
| 7812 | |
| 7813 | 7813 | if (0x5000 == (offset & 0x7300)) |
| 7814 | 7814 | prg32(space->machine, data); |
| 7815 | 7815 | } |
| r8325 | r8326 | |
| 7822 | 7822 | } |
| 7823 | 7823 | |
| 7824 | 7824 | /************************************************************* |
| 7825 | | |
| 7825 | |
| 7826 | 7826 | Waixing Zhan Shi Board |
| 7827 | | |
| 7827 | |
| 7828 | 7828 | Games: Wai Xing Zhan Shi |
| 7829 | | |
| 7829 | |
| 7830 | 7830 | Simple mapper: writes to 0x8000-0xffff sets prg32 banks to |
| 7831 | 7831 | (offset>>3)&f. written data&3 sets the mirroring (with |
| 7832 | | switched high/low compared to the standard one). |
| 7833 | | |
| 7832 | switched high/low compared to the standard one). |
| 7833 | |
| 7834 | 7834 | A crc check is required to support Dragon Quest VIII (which |
| 7835 | 7835 | uses a slightly different board) |
| 7836 | | |
| 7836 | |
| 7837 | 7837 | iNES: mapper 242 |
| 7838 | | |
| 7838 | |
| 7839 | 7839 | In MESS: Supported. |
| 7840 | | |
| 7840 | |
| 7841 | 7841 | *************************************************************/ |
| 7842 | 7842 | |
| 7843 | 7843 | static WRITE8_HANDLER( waixing_zs_w ) |
| 7844 | 7844 | { |
| 7845 | 7845 | LOG_MMC(("waixing_zs_w, offset: %04x, data: %02x\n", offset, data)); |
| 7846 | | |
| 7846 | |
| 7847 | 7847 | prg32(space->machine, offset >> 3); |
| 7848 | | |
| 7848 | |
| 7849 | 7849 | switch (data & 0x03) |
| 7850 | 7850 | { |
| 7851 | 7851 | case 0: set_nt_mirroring(space->machine, PPU_MIRROR_VERT); break; |
| r8325 | r8326 | |
| 7856 | 7856 | } |
| 7857 | 7857 | |
| 7858 | 7858 | /************************************************************* |
| 7859 | | |
| 7859 | |
| 7860 | 7860 | Waixing Dragon Quest VIII Board |
| 7861 | | |
| 7861 | |
| 7862 | 7862 | Games: Dragon Quest VIII |
| 7863 | | |
| 7863 | |
| 7864 | 7864 | Simple mapper: writes to 0x8000-0xffff sets prg32 banks to |
| 7865 | 7865 | (offset>>3)&f. |
| 7866 | | |
| 7866 | |
| 7867 | 7867 | iNES: mapper 242 |
| 7868 | | |
| 7868 | |
| 7869 | 7869 | In MESS: Supported. |
| 7870 | | |
| 7870 | |
| 7871 | 7871 | *************************************************************/ |
| 7872 | 7872 | |
| 7873 | 7873 | static WRITE8_HANDLER( waixing_dq8_w ) |
| 7874 | 7874 | { |
| 7875 | 7875 | LOG_MMC(("waixing_dq8_w, offset: %04x, data: %02x\n", offset, data)); |
| 7876 | | |
| 7876 | |
| 7877 | 7877 | prg32(space->machine, offset >> 3); |
| 7878 | 7878 | } |
| 7879 | 7879 | |
| 7880 | 7880 | |
| 7881 | 7881 | /************************************************************* |
| 7882 | | |
| 7882 | |
| 7883 | 7883 | Waixing PS2 board |
| 7884 | 7884 | |
| 7885 | 7885 | Games: Bao Xiao Tien Guo, Bio Hazard, Pokemon Gold, Subor (R) |
| 7886 | | |
| 7886 | |
| 7887 | 7887 | iNES: mapper 15 |
| 7888 | | |
| 7888 | |
| 7889 | 7889 | In MESS: Supported |
| 7890 | | |
| 7890 | |
| 7891 | 7891 | *************************************************************/ |
| 7892 | 7892 | |
| 7893 | 7893 | static WRITE8_HANDLER( waixing_ps2_w ) |
| 7894 | 7894 | { |
| 7895 | 7895 | UINT8 map15_flip = (data & 0x80) >> 7; |
| 7896 | 7896 | UINT8 map15_helper = (data & 0x7f) << 1; |
| 7897 | | |
| 7897 | |
| 7898 | 7898 | LOG_MMC(("waixing_ps2_w, offset: %04x, data: %02x\n", offset, data)); |
| 7899 | | |
| 7899 | |
| 7900 | 7900 | set_nt_mirroring(space->machine, BIT(data, 6) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 7901 | | |
| 7901 | |
| 7902 | 7902 | switch (offset & 0x0fff) |
| 7903 | 7903 | { |
| 7904 | 7904 | case 0x000: |
| r8325 | r8326 | |
| 7932 | 7932 | } |
| 7933 | 7933 | |
| 7934 | 7934 | /************************************************************* |
| 7935 | | |
| 7935 | |
| 7936 | 7936 | Waixing Board with Security Chip |
| 7937 | | |
| 7937 | |
| 7938 | 7938 | Games: Duo Bao Xiao Ying Hao - Guang Ming yu An Hei Chuan Shuo, |
| 7939 | 7939 | Myth Struggle, San Shi Liu Ji, Shui Hu Zhuan |
| 7940 | | |
| 7940 | |
| 7941 | 7941 | MMC3 clone |
| 7942 | | |
| 7942 | |
| 7943 | 7943 | iNES: mapper 249 |
| 7944 | | |
| 7944 | |
| 7945 | 7945 | In MESS: Partially Supported. |
| 7946 | | |
| 7946 | |
| 7947 | 7947 | *************************************************************/ |
| 7948 | 7948 | |
| 7949 | 7949 | static void waixing_sec_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 7950 | 7950 | { |
| 7951 | 7951 | nes_state *state = (nes_state *)machine->driver_data; |
| 7952 | 7952 | int i; |
| 7953 | | |
| 7953 | |
| 7954 | 7954 | if (state->map249_reg) |
| 7955 | 7955 | { |
| 7956 | 7956 | for (i = 0; i < 4; i ++) // should this apply only to bank[0],bank[1]? |
| r8325 | r8326 | |
| 7959 | 7959 | ((state->mmc_prg_bank[i] >> 1) & 0x04) | ((state->mmc_prg_bank[i] << 2) & 0x18); |
| 7960 | 7960 | } |
| 7961 | 7961 | } |
| 7962 | | |
| 7962 | |
| 7963 | 7963 | mmc3_set_prg(machine, prg_base, prg_mask); |
| 7964 | 7964 | } |
| 7965 | 7965 | |
| r8325 | r8326 | |
| 7968 | 7968 | nes_state *state = (nes_state *)machine->driver_data; |
| 7969 | 7969 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 7970 | 7970 | int i; |
| 7971 | | |
| 7971 | |
| 7972 | 7972 | if (state->map249_reg) |
| 7973 | 7973 | { |
| 7974 | 7974 | for (i = 0; i < 6; i ++) |
| r8325 | r8326 | |
| 7978 | 7978 | ((state->mmc_vrom_bank[i] << 3) & 0x20) | ((state->mmc_vrom_bank[i] << 2) & 0xc0); |
| 7979 | 7979 | } |
| 7980 | 7980 | } |
| 7981 | | |
| 7981 | |
| 7982 | 7982 | chr1_x(machine, chr_page ^ 0, chr_base | ((state->mmc_vrom_bank[0] & ~0x01) & chr_mask), state->mmc_chr_source); |
| 7983 | 7983 | chr1_x(machine, chr_page ^ 1, chr_base | ((state->mmc_vrom_bank[0] | 0x01) & chr_mask), state->mmc_chr_source); |
| 7984 | 7984 | chr1_x(machine, chr_page ^ 2, chr_base | ((state->mmc_vrom_bank[1] & ~0x01) & chr_mask), state->mmc_chr_source); |
| r8325 | r8326 | |
| 7993 | 7993 | { |
| 7994 | 7994 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 7995 | 7995 | LOG_MMC(("waixing_sec_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7996 | | |
| 7996 | |
| 7997 | 7997 | offset += 0x100; |
| 7998 | | |
| 7998 | |
| 7999 | 7999 | if (offset == 0x1000) |
| 8000 | 8000 | { |
| 8001 | 8001 | state->map249_reg = data & 0x02; |
| r8325 | r8326 | |
| 8009 | 8009 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 8010 | 8010 | UINT8 MMC3_helper, cmd; |
| 8011 | 8011 | LOG_MMC(("waixing_sec_w, offset: %04x, data: %02x\n", offset, data)); |
| 8012 | | |
| 8012 | |
| 8013 | 8013 | switch (offset & 0x6001) |
| 8014 | 8014 | { |
| 8015 | 8015 | case 0x0000: |
| 8016 | 8016 | MMC3_helper = state->mmc_latch1 ^ data; |
| 8017 | 8017 | state->mmc_latch1 = data; |
| 8018 | | |
| 8018 | |
| 8019 | 8019 | /* Has PRG Mode changed? */ |
| 8020 | 8020 | if (MMC3_helper & 0x40) |
| 8021 | 8021 | waixing_sec_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 8022 | | |
| 8022 | |
| 8023 | 8023 | /* Has CHR Mode changed? */ |
| 8024 | 8024 | if (MMC3_helper & 0x80) |
| 8025 | 8025 | waixing_sec_set_chr(space->machine, state->mmc_chr_base, state->mmc_chr_mask); |
| 8026 | 8026 | break; |
| 8027 | | |
| 8027 | |
| 8028 | 8028 | case 0x0001: |
| 8029 | 8029 | cmd = state->mmc_latch1 & 0x07; |
| 8030 | 8030 | switch (cmd) |
| r8325 | r8326 | |
| 8041 | 8041 | break; |
| 8042 | 8042 | } |
| 8043 | 8043 | break; |
| 8044 | | |
| 8044 | |
| 8045 | 8045 | default: |
| 8046 | 8046 | txrom_w(space, offset, data); |
| 8047 | 8047 | break; |
| r8325 | r8326 | |
| 8049 | 8049 | } |
| 8050 | 8050 | |
| 8051 | 8051 | /************************************************************* |
| 8052 | | |
| 8052 | |
| 8053 | 8053 | Board UNL-8237 |
| 8054 | | |
| 8054 | |
| 8055 | 8055 | Games: Pochahontas 2 |
| 8056 | | |
| 8056 | |
| 8057 | 8057 | MMC3 clone |
| 8058 | | |
| 8058 | |
| 8059 | 8059 | In MESS: Not working |
| 8060 | | |
| 8060 | |
| 8061 | 8061 | *************************************************************/ |
| 8062 | 8062 | |
| 8063 | 8063 | static void unl_8237_set_prg( running_machine *machine ) |
| 8064 | 8064 | { |
| 8065 | 8065 | nes_state *state = (nes_state *)machine->driver_data; |
| 8066 | 8066 | UINT8 prg_flip = (state->mmc_latch1 & 0x40) ? 2 : 0; |
| 8067 | | |
| 8067 | |
| 8068 | 8068 | if (!(state->unl_8237_reg[0] & 0x80)) |
| 8069 | 8069 | { |
| 8070 | 8070 | prg8_89(machine, state->mmc_prg_bank[0 ^ prg_flip]); |
| r8325 | r8326 | |
| 8080 | 8080 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 8081 | 8081 | UINT8 bank[8]; |
| 8082 | 8082 | int i; |
| 8083 | | |
| 8083 | |
| 8084 | 8084 | for(i = 0; i < 6; i++) |
| 8085 | 8085 | bank[i] = state->mmc_vrom_bank[i] | ((state->unl_8237_reg[1] << 6) & 0x100); |
| 8086 | | |
| 8086 | |
| 8087 | 8087 | chr1_x(machine, chr_page ^ 0, (bank[0] & ~0x01), CHRROM); |
| 8088 | 8088 | chr1_x(machine, chr_page ^ 1, (bank[0] | 0x01), CHRROM); |
| 8089 | 8089 | chr1_x(machine, chr_page ^ 2, (bank[1] & ~0x01), CHRROM); |
| r8325 | r8326 | |
| 8099 | 8099 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 8100 | 8100 | LOG_MMC(("unl_8237_l_w offset: %04x, data: %02x\n", offset, data)); |
| 8101 | 8101 | offset += 0x100; |
| 8102 | | |
| 8102 | |
| 8103 | 8103 | if (offset == 0x1000) |
| 8104 | 8104 | { |
| 8105 | 8105 | state->unl_8237_reg[0] = data; |
| r8325 | r8326 | |
| 8116 | 8116 | else |
| 8117 | 8117 | unl_8237_set_prg(space->machine); |
| 8118 | 8118 | } |
| 8119 | | |
| 8119 | |
| 8120 | 8120 | if (offset == 0x1001) |
| 8121 | 8121 | { |
| 8122 | 8122 | state->unl_8237_reg[1] = data; |
| r8325 | r8326 | |
| 8130 | 8130 | UINT8 unl_8237_helper, cmd; |
| 8131 | 8131 | static const UINT8 conv_table[8] = {0,2,6,1,7,3,4,5}; |
| 8132 | 8132 | LOG_MMC(("unl_8237_w offset: %04x, data: %02x\n", offset, data)); |
| 8133 | | |
| 8133 | |
| 8134 | 8134 | switch (offset & 0x7000) |
| 8135 | 8135 | { |
| 8136 | 8136 | case 0x2000: |
| r8325 | r8326 | |
| 8139 | 8139 | data = (data & 0xc0) | conv_table[data & 0x07]; |
| 8140 | 8140 | unl_8237_helper = state->mmc_latch1 ^ data; |
| 8141 | 8141 | state->mmc_latch1 = data; |
| 8142 | | |
| 8142 | |
| 8143 | 8143 | /* Has PRG Mode changed? */ |
| 8144 | 8144 | if (unl_8237_helper & 0x40) |
| 8145 | 8145 | unl_8237_set_prg(space->machine); |
| 8146 | | |
| 8146 | |
| 8147 | 8147 | /* Has CHR Mode changed? */ |
| 8148 | 8148 | if (unl_8237_helper & 0x80) |
| 8149 | 8149 | unl_8237_set_chr(space->machine); |
| 8150 | 8150 | break; |
| 8151 | | |
| 8151 | |
| 8152 | 8152 | case 0x4000: |
| 8153 | 8153 | case 0x5000: |
| 8154 | 8154 | if (state->unl_8237_reg[2]) |
| r8325 | r8326 | |
| 8170 | 8170 | } |
| 8171 | 8171 | } |
| 8172 | 8172 | break; |
| 8173 | | |
| 8173 | |
| 8174 | 8174 | case 0x0000: |
| 8175 | 8175 | case 0x1000: |
| 8176 | 8176 | set_nt_mirroring(space->machine, (data | (data >> 7)) & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 8177 | 8177 | break; |
| 8178 | | |
| 8178 | |
| 8179 | 8179 | case 0x6000: |
| 8180 | 8180 | break; |
| 8181 | | |
| 8181 | |
| 8182 | 8182 | case 0x7000: |
| 8183 | 8183 | txrom_w(space, 0x6001, data); |
| 8184 | 8184 | txrom_w(space, 0x4000, data); |
| r8325 | r8326 | |
| 8188 | 8188 | } |
| 8189 | 8189 | |
| 8190 | 8190 | /************************************************************* |
| 8191 | | |
| 8191 | |
| 8192 | 8192 | Board UNL-AX5705 |
| 8193 | | |
| 8193 | |
| 8194 | 8194 | Games: Super Mario Bros. Pocker Mali (Crayon Shin-chan pirate hack) |
| 8195 | | |
| 8195 | |
| 8196 | 8196 | In MESS: Supported |
| 8197 | | |
| 8197 | |
| 8198 | 8198 | *************************************************************/ |
| 8199 | 8199 | |
| 8200 | 8200 | static void unl_ax5705_set_prg( running_machine *machine ) |
| r8325 | r8326 | |
| 8209 | 8209 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 8210 | 8210 | UINT8 bank; |
| 8211 | 8211 | LOG_MMC(("unl_ax5705_w offset: %04x, data: %02x\n", offset, data)); |
| 8212 | | |
| 8212 | |
| 8213 | 8213 | switch (offset & 0x700f) |
| 8214 | 8214 | { |
| 8215 | 8215 | case 0x0000: |
| r8325 | r8326 | |
| 8261 | 8261 | } |
| 8262 | 8262 | |
| 8263 | 8263 | /************************************************************* |
| 8264 | | |
| 8264 | |
| 8265 | 8265 | Board UNL-CC-21 |
| 8266 | | |
| 8266 | |
| 8267 | 8267 | Games: Mi Hun Che |
| 8268 | | |
| 8268 | |
| 8269 | 8269 | In MESS: Supported |
| 8270 | | |
| 8270 | |
| 8271 | 8271 | *************************************************************/ |
| 8272 | 8272 | |
| 8273 | 8273 | static WRITE8_HANDLER( unl_cc21_w ) |
| 8274 | 8274 | { |
| 8275 | 8275 | LOG_MMC(("unl_cc21_w offset: %04x, data: %02x\n", offset, data)); |
| 8276 | | |
| 8276 | |
| 8277 | 8277 | set_nt_mirroring(space->machine, BIT(data, 1) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 8278 | 8278 | chr8(space->machine, (offset & 0x01), CHRROM); |
| 8279 | 8279 | } |
| 8280 | 8280 | |
| 8281 | 8281 | /************************************************************* |
| 8282 | | |
| 8282 | |
| 8283 | 8283 | Board UNL-KOF97 |
| 8284 | | |
| 8284 | |
| 8285 | 8285 | Games: King of Fighters 97 (Rex Soft) |
| 8286 | | |
| 8286 | |
| 8287 | 8287 | MMC3 clone |
| 8288 | | |
| 8288 | |
| 8289 | 8289 | In MESS: Not working |
| 8290 | | |
| 8290 | |
| 8291 | 8291 | *************************************************************/ |
| 8292 | 8292 | |
| 8293 | 8293 | static UINT8 unl_kof97_unscramble( UINT8 data ) |
| r8325 | r8326 | |
| 8298 | 8298 | static WRITE8_HANDLER( unl_kof97_w ) |
| 8299 | 8299 | { |
| 8300 | 8300 | LOG_MMC(("unl_kof97_w offset: %04x, data: %02x\n", offset, data)); |
| 8301 | | |
| 8301 | |
| 8302 | 8302 | /* Addresses 0x9000, 0xa000, 0xd000 & 0xf000 behaves differently than MMC3 */ |
| 8303 | 8303 | if (offset == 0x1000) |
| 8304 | 8304 | { |
| r8325 | r8326 | |
| 8340 | 8340 | } |
| 8341 | 8341 | |
| 8342 | 8342 | /************************************************************* |
| 8343 | | |
| 8343 | |
| 8344 | 8344 | Board UNL-T-230 |
| 8345 | | |
| 8345 | |
| 8346 | 8346 | Games: Dragon Ball Z IV (Unl) |
| 8347 | | |
| 8347 | |
| 8348 | 8348 | In MESS: Supported |
| 8349 | | |
| 8349 | |
| 8350 | 8350 | *************************************************************/ |
| 8351 | 8351 | |
| 8352 | 8352 | static WRITE8_HANDLER( unl_t230_w ) |
| r8325 | r8326 | |
| 8354 | 8354 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 8355 | 8355 | UINT8 bank; |
| 8356 | 8356 | LOG_MMC(("unl_t230_w offset: %04x, data: %02x\n", offset, data)); |
| 8357 | | |
| 8357 | |
| 8358 | 8358 | switch (offset & 0x700c) |
| 8359 | 8359 | { |
| 8360 | 8360 | case 0x0000: |
| r8325 | r8326 | |
| 8363 | 8363 | prg16_89ab(space->machine, data); |
| 8364 | 8364 | break; |
| 8365 | 8365 | |
| 8366 | | // the part below works like VRC-2. how was the original board wired up? |
| 8366 | // the part below works like VRC-2. how was the original board wired up? |
| 8367 | 8367 | // was there a VRC2? if so, we can use VRC-2 and add proper pin settings to xml! |
| 8368 | 8368 | case 0x1000: |
| 8369 | 8369 | case 0x1004: |
| r8325 | r8326 | |
| 8399 | 8399 | state->mmc_vrom_bank[bank] = (state->mmc_vrom_bank[bank] & 0x0f) | (data << 4); |
| 8400 | 8400 | else |
| 8401 | 8401 | state->mmc_vrom_bank[bank] = (state->mmc_vrom_bank[bank] & 0xf0) | (data & 0x0f); |
| 8402 | | |
| 8402 | |
| 8403 | 8403 | chr1_x(space->machine, bank, state->mmc_vrom_bank[bank], state->mmc_chr_source); |
| 8404 | 8404 | break; |
| 8405 | 8405 | case 0x7000: |
| r8325 | r8326 | |
| 8417 | 8417 | if (data & 0x02) |
| 8418 | 8418 | state->IRQ_count = state->IRQ_count_latch; |
| 8419 | 8419 | break; |
| 8420 | | |
| 8420 | |
| 8421 | 8421 | default: |
| 8422 | 8422 | logerror("unl_t230_w uncaught offset: %04x value: %02x\n", offset, data); |
| 8423 | 8423 | break; |
| r8325 | r8326 | |
| 8425 | 8425 | } |
| 8426 | 8426 | |
| 8427 | 8427 | /************************************************************* |
| 8428 | | |
| 8428 | |
| 8429 | 8429 | Bootleg Board for KOF96 |
| 8430 | 8430 | |
| 8431 | 8431 | Games: The King of Fighters 96, Sonic 3D Blast 6, Street |
| 8432 | 8432 | Fighter Zero 2 |
| 8433 | | |
| 8433 | |
| 8434 | 8434 | MMC3 clone |
| 8435 | | |
| 8435 | |
| 8436 | 8436 | iNES: mapper 187 |
| 8437 | | |
| 8437 | |
| 8438 | 8438 | In MESS: Preliminary Support. |
| 8439 | | |
| 8439 | |
| 8440 | 8440 | *************************************************************/ |
| 8441 | 8441 | |
| 8442 | 8442 | static void kof96_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 8443 | 8443 | { |
| 8444 | 8444 | nes_state *state = (nes_state *)machine->driver_data; |
| 8445 | 8445 | UINT8 prg_flip = (state->mmc_latch1 & 0x40) ? 2 : 0; |
| 8446 | | |
| 8446 | |
| 8447 | 8447 | if (!(state->mapper187_reg[0] & 0x80)) |
| 8448 | 8448 | { |
| 8449 | 8449 | prg8_89(machine, prg_base | (state->mmc_prg_bank[0 ^ prg_flip] & prg_mask)); |
| r8325 | r8326 | |
| 8459 | 8459 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 8460 | 8460 | UINT8 new_base[8]; |
| 8461 | 8461 | int i; |
| 8462 | | |
| 8462 | |
| 8463 | 8463 | for (i = 0; i < 8; i++) |
| 8464 | 8464 | new_base[i] = ((i & 0x04) == chr_page)? (chr_base | 0x100) : chr_base; |
| 8465 | | |
| 8465 | |
| 8466 | 8466 | chr1_x(machine, chr_page ^ 0, new_base[0] | ((state->mmc_vrom_bank[0] & ~0x01) & chr_mask), chr); |
| 8467 | 8467 | chr1_x(machine, chr_page ^ 1, new_base[1] | ((state->mmc_vrom_bank[0] | 0x01) & chr_mask), chr); |
| 8468 | 8468 | chr1_x(machine, chr_page ^ 2, new_base[2] | ((state->mmc_vrom_bank[1] & ~0x01) & chr_mask), chr); |
| r8325 | r8326 | |
| 8479 | 8479 | UINT8 new_bank; |
| 8480 | 8480 | LOG_MMC(("kof96_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 8481 | 8481 | offset += 0x100; |
| 8482 | | |
| 8482 | |
| 8483 | 8483 | if (offset == 0x1000) |
| 8484 | 8484 | { |
| 8485 | 8485 | switch (data & 0x03) |
| r8325 | r8326 | |
| 8496 | 8496 | break; |
| 8497 | 8497 | } |
| 8498 | 8498 | } |
| 8499 | | |
| 8499 | |
| 8500 | 8500 | if (!(offset <= 0x1000)) |
| 8501 | 8501 | { |
| 8502 | 8502 | state->mapper187_reg[0] = data; |
| 8503 | | |
| 8503 | |
| 8504 | 8504 | if (state->mapper187_reg[0] & 0x80) |
| 8505 | 8505 | { |
| 8506 | 8506 | new_bank = (state->mapper187_reg[0] & 0x1f); |
| 8507 | | |
| 8507 | |
| 8508 | 8508 | if (state->mapper187_reg[0] & 0x20) |
| 8509 | 8509 | prg32(space->machine, new_bank >> 2); |
| 8510 | 8510 | else |
| r8325 | r8326 | |
| 8523 | 8523 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 8524 | 8524 | LOG_MMC(("kof96_l_r, offset: %04x\n", offset)); |
| 8525 | 8525 | offset += 0x100; |
| 8526 | | |
| 8526 | |
| 8527 | 8527 | if (!(offset < 0x1000)) |
| 8528 | 8528 | return state->mapper187_reg[1]; |
| 8529 | 8529 | else |
| r8325 | r8326 | |
| 8535 | 8535 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 8536 | 8536 | UINT8 MMC3_helper, cmd; |
| 8537 | 8537 | LOG_MMC(("kof96_w, offset: %04x, data: %02x\n", offset, data)); |
| 8538 | | |
| 8538 | |
| 8539 | 8539 | switch (offset & 0x6003) |
| 8540 | 8540 | { |
| 8541 | 8541 | case 0x0000: |
| 8542 | 8542 | state->mapper187_reg[2] = 1; |
| 8543 | 8543 | MMC3_helper = state->mmc_latch1 ^ data; |
| 8544 | 8544 | state->mmc_latch1 = data; |
| 8545 | | |
| 8545 | |
| 8546 | 8546 | /* Has PRG Mode changed? */ |
| 8547 | 8547 | if (MMC3_helper & 0x40) |
| 8548 | 8548 | kof96_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 8549 | | |
| 8549 | |
| 8550 | 8550 | /* Has CHR Mode changed? */ |
| 8551 | 8551 | if (MMC3_helper & 0x80) |
| 8552 | 8552 | kof96_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 8553 | 8553 | break; |
| 8554 | | |
| 8554 | |
| 8555 | 8555 | case 0x0001: |
| 8556 | 8556 | if (state->mapper187_reg[2]) |
| 8557 | 8557 | { |
| r8325 | r8326 | |
| 8571 | 8571 | } |
| 8572 | 8572 | } |
| 8573 | 8573 | break; |
| 8574 | | |
| 8574 | |
| 8575 | 8575 | case 0x0002: |
| 8576 | 8576 | break; |
| 8577 | | |
| 8577 | |
| 8578 | 8578 | case 0x0003: |
| 8579 | 8579 | state->mapper187_reg[2] = 0; |
| 8580 | | |
| 8580 | |
| 8581 | 8581 | if (data == 0x28) |
| 8582 | 8582 | prg8_cd(space->machine, 0x17); |
| 8583 | 8583 | else if (data == 0x2a) |
| 8584 | 8584 | prg8_ab(space->machine, 0x0f); |
| 8585 | 8585 | break; |
| 8586 | | |
| 8586 | |
| 8587 | 8587 | default: |
| 8588 | 8588 | txrom_w(space, offset, data); |
| 8589 | 8589 | break; |
| r8325 | r8326 | |
| 8591 | 8591 | } |
| 8592 | 8592 | |
| 8593 | 8593 | /************************************************************* |
| 8594 | | |
| 8594 | |
| 8595 | 8595 | Bootleg Board for MK2 |
| 8596 | 8596 | |
| 8597 | 8597 | Games: Mortal Kombat II, Street Fighter III, Super Mario |
| 8598 | 8598 | Kart Rider |
| 8599 | | |
| 8599 | |
| 8600 | 8600 | This board uses an IRQ system very similar to MMC3. We indeed |
| 8601 | 8601 | use mapper4_irq, but there is some small glitch! |
| 8602 | | |
| 8602 | |
| 8603 | 8603 | iNES: mapper 91 |
| 8604 | | |
| 8604 | |
| 8605 | 8605 | In MESS: Supported. |
| 8606 | | |
| 8606 | |
| 8607 | 8607 | *************************************************************/ |
| 8608 | 8608 | |
| 8609 | 8609 | static WRITE8_HANDLER( mk2_m_w ) |
| 8610 | 8610 | { |
| 8611 | 8611 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 8612 | 8612 | LOG_MMC(("mk2_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 8613 | | |
| 8613 | |
| 8614 | 8614 | switch (offset & 0x1000) |
| 8615 | 8615 | { |
| 8616 | 8616 | case 0x0000: |
| r8325 | r8326 | |
| 8638 | 8638 | } |
| 8639 | 8639 | |
| 8640 | 8640 | /************************************************************* |
| 8641 | | |
| 8641 | |
| 8642 | 8642 | Bootleg Board N625092 |
| 8643 | 8643 | |
| 8644 | 8644 | Games: 400 in 1, 700 in 1, 1000 in 1 |
| 8645 | | |
| 8645 | |
| 8646 | 8646 | iNES: mapper 221 |
| 8647 | | |
| 8647 | |
| 8648 | 8648 | In MESS: Supported. |
| 8649 | | |
| 8649 | |
| 8650 | 8650 | *************************************************************/ |
| 8651 | 8651 | |
| 8652 | 8652 | static void n625092_set_prg( running_machine *machine, UINT8 reg1, UINT8 reg2 ) |
| 8653 | 8653 | { |
| 8654 | 8654 | UINT8 map221_helper1, map221_helper2; |
| 8655 | | |
| 8655 | |
| 8656 | 8656 | map221_helper1 = !(reg1 & 0x01) ? reg2 : |
| 8657 | 8657 | (reg1 & 0x80) ? reg2 : (reg2 & 0x06) | 0x00; |
| 8658 | 8658 | map221_helper2 = !(reg1 & 0x01) ? reg2 : |
| 8659 | 8659 | (reg1 & 0x80) ? 0x07 : (reg2 & 0x06) | 0x01; |
| 8660 | | |
| 8660 | |
| 8661 | 8661 | prg16_89ab(machine, map221_helper1 | ((reg1 & 0x70) >> 1)); |
| 8662 | 8662 | prg16_cdef(machine, map221_helper2 | ((reg1 & 0x70) >> 1)); |
| 8663 | 8663 | } |
| r8325 | r8326 | |
| 8666 | 8666 | { |
| 8667 | 8667 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 8668 | 8668 | LOG_MMC(("n625092_w, offset: %04x, data: %02x\n", offset, data)); |
| 8669 | | |
| 8669 | |
| 8670 | 8670 | if (offset < 0x4000) |
| 8671 | 8671 | { |
| 8672 | 8672 | set_nt_mirroring(space->machine, BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 8673 | 8673 | offset = (offset >> 1) & 0xff; |
| 8674 | | |
| 8674 | |
| 8675 | 8675 | if (state->mmc_latch1 != offset) |
| 8676 | 8676 | { |
| 8677 | 8677 | state->mmc_latch1 = offset; |
| r8325 | r8326 | |
| 8681 | 8681 | else |
| 8682 | 8682 | { |
| 8683 | 8683 | offset &= 0x07; |
| 8684 | | |
| 8684 | |
| 8685 | 8685 | if (state->mmc_latch2 != offset) |
| 8686 | 8686 | { |
| 8687 | 8687 | state->mmc_latch2 = offset; |
| r8325 | r8326 | |
| 8691 | 8691 | } |
| 8692 | 8692 | |
| 8693 | 8693 | /************************************************************* |
| 8694 | | |
| 8694 | |
| 8695 | 8695 | SC-127 Board |
| 8696 | 8696 | |
| 8697 | 8697 | Games: Wario World II (Kirby Hack) |
| 8698 | | |
| 8698 | |
| 8699 | 8699 | iNES: mapper 35 |
| 8700 | | |
| 8700 | |
| 8701 | 8701 | In MESS: Supported |
| 8702 | | |
| 8702 | |
| 8703 | 8703 | *************************************************************/ |
| 8704 | 8704 | |
| 8705 | 8705 | static void sc127_irq( running_device *device, int scanline, int vblank, int blanked ) |
| 8706 | 8706 | { |
| 8707 | 8707 | nes_state *state = (nes_state *)device->machine->driver_data; |
| 8708 | | |
| 8708 | |
| 8709 | 8709 | if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE && state->IRQ_enable) |
| 8710 | 8710 | { |
| 8711 | 8711 | state->IRQ_count--; |
| 8712 | | |
| 8712 | |
| 8713 | 8713 | if (!blanked && (state->IRQ_count == 0)) |
| 8714 | 8714 | { |
| 8715 | 8715 | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, |
| r8325 | r8326 | |
| 8724 | 8724 | { |
| 8725 | 8725 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 8726 | 8726 | LOG_MMC(("sc127_w, offset: %04x, data: %02x\n", offset, data)); |
| 8727 | | |
| 8727 | |
| 8728 | 8728 | switch (offset) |
| 8729 | 8729 | { |
| 8730 | 8730 | case 0x0000: |
| r8325 | r8326 | |
| 8764 | 8764 | } |
| 8765 | 8765 | |
| 8766 | 8766 | /************************************************************* |
| 8767 | | |
| 8767 | |
| 8768 | 8768 | Bootleg Board SMB2J |
| 8769 | 8769 | |
| 8770 | 8770 | Games: Super Mario Bros. 2 Pirate (LF36) |
| 8771 | | |
| 8771 | |
| 8772 | 8772 | iNES: mapper 43 |
| 8773 | | |
| 8773 | |
| 8774 | 8774 | In MESS: Supported? The only image I found is not working |
| 8775 | 8775 | (not even in NEStopia). |
| 8776 | | |
| 8776 | |
| 8777 | 8777 | *************************************************************/ |
| 8778 | 8778 | |
| 8779 | 8779 | static WRITE8_HANDLER( smb2j_w ) |
| 8780 | 8780 | { |
| 8781 | 8781 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 8782 | 8782 | int bank = (((offset >> 8) & 0x03) * 0x20) + (offset & 0x1f); |
| 8783 | | |
| 8783 | |
| 8784 | 8784 | LOG_MMC(("smb2j_w, offset: %04x, data: %02x\n", offset, data)); |
| 8785 | | |
| 8785 | |
| 8786 | 8786 | set_nt_mirroring(space->machine, (offset & 0x2000) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 8787 | | |
| 8787 | |
| 8788 | 8788 | if (offset & 0x0800) |
| 8789 | 8789 | { |
| 8790 | 8790 | if (offset & 0x1000) |
| r8325 | r8326 | |
| 8832 | 8832 | } |
| 8833 | 8833 | |
| 8834 | 8834 | /************************************************************* |
| 8835 | | |
| 8835 | |
| 8836 | 8836 | BTL-SMB2B |
| 8837 | | |
| 8837 | |
| 8838 | 8838 | Games: Super Mario Bros. 2 Pirate (Jpn version of SMB2) |
| 8839 | | |
| 8839 | |
| 8840 | 8840 | This was marked as Alt. Levels. is it true? |
| 8841 | | |
| 8841 | |
| 8842 | 8842 | iNES: mapper 50 |
| 8843 | 8843 | |
| 8844 | 8844 | In MESS: Supported. |
| 8845 | | |
| 8845 | |
| 8846 | 8846 | *************************************************************/ |
| 8847 | 8847 | |
| 8848 | 8848 | static void smb2jb_irq( running_device *device, int scanline, int vblank, int blanked ) |
| r8325 | r8326 | |
| 8859 | 8859 | } |
| 8860 | 8860 | else |
| 8861 | 8861 | state->IRQ_count += 114; |
| 8862 | | |
| 8862 | |
| 8863 | 8863 | state->IRQ_count &= 0xffff; // according to docs is 16bit counter -> it wraps only after 0xffff |
| 8864 | 8864 | } |
| 8865 | 8865 | } |
| r8325 | r8326 | |
| 8870 | 8870 | UINT8 prg; |
| 8871 | 8871 | LOG_MMC(("smb2jb_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 8872 | 8872 | offset += 0x100; |
| 8873 | | |
| 8873 | |
| 8874 | 8874 | switch (offset & 0x160) |
| 8875 | 8875 | { |
| 8876 | 8876 | case 0x020: |
| r8325 | r8326 | |
| 8888 | 8888 | { |
| 8889 | 8889 | UINT8 prg; |
| 8890 | 8890 | LOG_MMC(("smb2jb_extra_w, offset: %04x, data: %02x\n", offset, data)); |
| 8891 | | |
| 8891 | |
| 8892 | 8892 | prg = (data & 0x08) | ((data & 0x06) >> 1) | ((data & 0x01) << 2); |
| 8893 | 8893 | prg8_cd(space->machine, prg); |
| 8894 | 8894 | } |
| 8895 | 8895 | |
| 8896 | 8896 | /************************************************************* |
| 8897 | | |
| 8897 | |
| 8898 | 8898 | Bootleg Board for Super Fighter III |
| 8899 | | |
| 8899 | |
| 8900 | 8900 | MMC3 clone |
| 8901 | | |
| 8901 | |
| 8902 | 8902 | In MESS: Supported. |
| 8903 | | |
| 8903 | |
| 8904 | 8904 | *************************************************************/ |
| 8905 | 8905 | |
| 8906 | 8906 | static void unl_sf3_set_chr( running_machine *machine, UINT8 chr_source, int chr_base, int chr_mask ) |
| r8325 | r8326 | |
| 8916 | 8916 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 8917 | 8917 | UINT8 MMC3_helper, cmd; |
| 8918 | 8918 | LOG_MMC(("unl_sf3_w, offset: %04x, data: %02x\n", offset, data)); |
| 8919 | | |
| 8919 | |
| 8920 | 8920 | switch (offset & 0x6001) |
| 8921 | 8921 | { |
| 8922 | 8922 | case 0x0000: |
| 8923 | 8923 | MMC3_helper = state->mmc_latch1 ^ data; |
| 8924 | 8924 | state->mmc_latch1 = data; |
| 8925 | | |
| 8925 | |
| 8926 | 8926 | /* Has PRG Mode changed? */ |
| 8927 | 8927 | if (MMC3_helper & 0x40) |
| 8928 | 8928 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 8929 | | |
| 8929 | |
| 8930 | 8930 | /* Has CHR Mode changed? */ |
| 8931 | 8931 | if (MMC3_helper & 0x80) |
| 8932 | 8932 | unl_sf3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 8933 | 8933 | break; |
| 8934 | | |
| 8934 | |
| 8935 | 8935 | case 0x0001: |
| 8936 | 8936 | cmd = state->mmc_latch1 & 0x0f; |
| 8937 | 8937 | switch (cmd) |
| r8325 | r8326 | |
| 8947 | 8947 | break; |
| 8948 | 8948 | } |
| 8949 | 8949 | break; |
| 8950 | | |
| 8950 | |
| 8951 | 8951 | default: |
| 8952 | 8952 | txrom_w(space, offset, data); |
| 8953 | 8953 | break; |
| r8325 | r8326 | |
| 8955 | 8955 | } |
| 8956 | 8956 | |
| 8957 | 8957 | /************************************************************* |
| 8958 | | |
| 8958 | |
| 8959 | 8959 | Bootleg Board for Xiao Zhuan Yuan |
| 8960 | 8960 | |
| 8961 | 8961 | Games: Shu Qi Yu - Zhi Li Xiao Zhuan Yuan |
| 8962 | | |
| 8962 | |
| 8963 | 8963 | Very simple mapper: writes to 0x5ff1 set prg32 (to data>>1), |
| 8964 | 8964 | while writes to 0x5ff2 set chr8 |
| 8965 | | |
| 8965 | |
| 8966 | 8966 | iNES: mapper 176 |
| 8967 | | |
| 8967 | |
| 8968 | 8968 | In MESS: Supported. |
| 8969 | | |
| 8969 | |
| 8970 | 8970 | *************************************************************/ |
| 8971 | 8971 | |
| 8972 | 8972 | static WRITE8_HANDLER( unl_xzy_l_w ) |
| 8973 | 8973 | { |
| 8974 | 8974 | LOG_MMC(("unl_xzy_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 8975 | | |
| 8975 | |
| 8976 | 8976 | switch (offset) |
| 8977 | 8977 | { |
| 8978 | 8978 | case 0x1ef1: /* 0x5ff1 */ |
| r8325 | r8326 | |
| 8985 | 8985 | } |
| 8986 | 8986 | |
| 8987 | 8987 | /************************************************************* |
| 8988 | | |
| 8988 | |
| 8989 | 8989 | Board UNL-RACERMATE |
| 8990 | | |
| 8990 | |
| 8991 | 8991 | In MESS: *VERY* preliminary support. Also, it seems that this |
| 8992 | 8992 | board saves to battery the CHRRAM!!! |
| 8993 | | |
| 8993 | |
| 8994 | 8994 | *************************************************************/ |
| 8995 | 8995 | |
| 8996 | 8996 | static void racmate_update_banks( running_machine *machine ) |
| r8325 | r8326 | |
| 9013 | 9013 | } |
| 9014 | 9014 | |
| 9015 | 9015 | /************************************************************* |
| 9016 | | |
| 9016 | |
| 9017 | 9017 | BOOTLEG CART VERSIONS OF FDS GAMES |
| 9018 | | |
| 9018 | |
| 9019 | 9019 | *************************************************************/ |
| 9020 | 9020 | |
| 9021 | 9021 | /************************************************************* |
| 9022 | | |
| 9022 | |
| 9023 | 9023 | BTL-SUPERBROS11 |
| 9024 | | |
| 9024 | |
| 9025 | 9025 | Known Boards: Unknown Bootleg Board |
| 9026 | 9026 | Games: Super Mario Bros. 11, Super Mario Bros. 17 |
| 9027 | | |
| 9027 | |
| 9028 | 9028 | This acts basically like a MMC3 with different use of write |
| 9029 | 9029 | address. |
| 9030 | | |
| 9030 | |
| 9031 | 9031 | iNES: mapper 196 |
| 9032 | | |
| 9032 | |
| 9033 | 9033 | In MESS: Supported. |
| 9034 | | |
| 9034 | |
| 9035 | 9035 | *************************************************************/ |
| 9036 | 9036 | |
| 9037 | 9037 | static WRITE8_HANDLER( btl_smb11_w ) |
| 9038 | 9038 | { |
| 9039 | 9039 | LOG_MMC(("btl_smb11_w, offset: %04x, data: %02x\n", offset, data)); |
| 9040 | | |
| 9040 | |
| 9041 | 9041 | txrom_w(space, (offset & 0x6000) | ((offset & 0x04) >> 2), data); |
| 9042 | 9042 | } |
| 9043 | 9043 | |
| 9044 | 9044 | /************************************************************* |
| 9045 | | |
| 9045 | |
| 9046 | 9046 | BTL-MARIOBABY |
| 9047 | | |
| 9047 | |
| 9048 | 9048 | Known Boards: Unknown Bootleg Board |
| 9049 | 9049 | Games: Mario Baby, Ai Senshi Nicol |
| 9050 | | |
| 9050 | |
| 9051 | 9051 | iNES: mapper 42 |
| 9052 | 9052 | |
| 9053 | 9053 | In MESS: Supported. |
| 9054 | | |
| 9054 | |
| 9055 | 9055 | *************************************************************/ |
| 9056 | 9056 | |
| 9057 | 9057 | // is the code fine for ai senshi nicol?!? |
| r8325 | r8326 | |
| 9059 | 9059 | { |
| 9060 | 9060 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 9061 | 9061 | LOG_MMC(("btl_mariobaby_w, offset: %04x, data: %02x\n", offset, data)); |
| 9062 | | |
| 9062 | |
| 9063 | 9063 | if (offset >= 0x7000) |
| 9064 | 9064 | { |
| 9065 | 9065 | switch(offset & 0x03) |
| r8325 | r8326 | |
| 9088 | 9088 | } |
| 9089 | 9089 | |
| 9090 | 9090 | /************************************************************* |
| 9091 | | |
| 9091 | |
| 9092 | 9092 | BTL-SMB2A |
| 9093 | | |
| 9093 | |
| 9094 | 9094 | Known Boards: Unknown Bootleg Board |
| 9095 | 9095 | Games: Super Mario Bros. 2 Pirate (Jpn version of SMB2) |
| 9096 | | |
| 9096 | |
| 9097 | 9097 | iNES: mapper 40 |
| 9098 | | |
| 9098 | |
| 9099 | 9099 | In MESS: Supported. |
| 9100 | | |
| 9100 | |
| 9101 | 9101 | *************************************************************/ |
| 9102 | 9102 | |
| 9103 | 9103 | static void btl_smb2a_irq( running_device *device, int scanline, int vblank, int blanked ) |
| 9104 | 9104 | { |
| 9105 | 9105 | nes_state *state = (nes_state *)device->machine->driver_data; |
| 9106 | | |
| 9106 | |
| 9107 | 9107 | if (state->IRQ_enable) |
| 9108 | 9108 | { |
| 9109 | 9109 | if ((0xfff - state->IRQ_count) <= 114) |
| r8325 | r8326 | |
| 9121 | 9121 | { |
| 9122 | 9122 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 9123 | 9123 | LOG_MMC(("btl_smb2a_w, offset: %04x, data: %02x\n", offset, data)); |
| 9124 | | |
| 9124 | |
| 9125 | 9125 | switch (offset & 0x6000) |
| 9126 | 9126 | { |
| 9127 | 9127 | case 0x0000: |
| r8325 | r8326 | |
| 9138 | 9138 | } |
| 9139 | 9139 | |
| 9140 | 9140 | /************************************************************* |
| 9141 | | |
| 9141 | |
| 9142 | 9142 | BTL-SMB3 |
| 9143 | | |
| 9143 | |
| 9144 | 9144 | Known Boards: Unknown Bootleg Board |
| 9145 | 9145 | Games: Super Mario Bros. 3 Pirate |
| 9146 | | |
| 9146 | |
| 9147 | 9147 | iNES: mapper 106 |
| 9148 | | |
| 9148 | |
| 9149 | 9149 | In MESS: Supported. |
| 9150 | | |
| 9150 | |
| 9151 | 9151 | *************************************************************/ |
| 9152 | 9152 | |
| 9153 | 9153 | static void btl_smb3_irq( running_device *device, int scanline, int vblank, int blanked ) |
| 9154 | 9154 | { |
| 9155 | 9155 | nes_state *state = (nes_state *)device->machine->driver_data; |
| 9156 | | |
| 9156 | |
| 9157 | 9157 | if (state->IRQ_enable) |
| 9158 | 9158 | { |
| 9159 | 9159 | if ((0xffff - state->IRQ_count) < 114) |
| r8325 | r8326 | |
| 9161 | 9161 | cpu_set_input_line(state->maincpu, M6502_IRQ_LINE, HOLD_LINE); |
| 9162 | 9162 | state->IRQ_enable = 0; |
| 9163 | 9163 | } |
| 9164 | | |
| 9164 | |
| 9165 | 9165 | state->IRQ_count = (state->IRQ_count + 114) & 0xffff; |
| 9166 | 9166 | } |
| 9167 | 9167 | } |
| r8325 | r8326 | |
| 9214 | 9214 | } |
| 9215 | 9215 | |
| 9216 | 9216 | /************************************************************* |
| 9217 | | |
| 9217 | |
| 9218 | 9218 | BTL-DRAGONNINJA |
| 9219 | | |
| 9219 | |
| 9220 | 9220 | Known Boards: Unknown Bootleg Board |
| 9221 | 9221 | Games: Dragon Ninja (Bootleg), Super Mario Bros. 8 |
| 9222 | | |
| 9222 | |
| 9223 | 9223 | iNES: mapper 222 |
| 9224 | | |
| 9224 | |
| 9225 | 9225 | In MESS: Unsupported. |
| 9226 | | |
| 9226 | |
| 9227 | 9227 | *************************************************************/ |
| 9228 | 9228 | |
| 9229 | 9229 | /* Scanline based IRQ ? */ |
| r8325 | r8326 | |
| 9234 | 9234 | { |
| 9235 | 9235 | if (!state->IRQ_count || ++state->IRQ_count < 240) |
| 9236 | 9236 | return; |
| 9237 | | |
| 9237 | |
| 9238 | 9238 | state->IRQ_count = 0; |
| 9239 | 9239 | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, |
| 9240 | 9240 | device->machine->primary_screen->vpos(), device->machine->primary_screen->hpos())); |
| r8325 | r8326 | |
| 9247 | 9247 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 9248 | 9248 | UINT8 bank; |
| 9249 | 9249 | LOG_MMC(("btl_dn_w, offset: %04x, data: %02x\n", offset, data)); |
| 9250 | | |
| 9250 | |
| 9251 | 9251 | switch (offset & 0x7003) |
| 9252 | 9252 | { |
| 9253 | 9253 | case 0x0000: |
| r8325 | r8326 | |
| 9283 | 9283 | *************************************************************/ |
| 9284 | 9284 | |
| 9285 | 9285 | /************************************************************* |
| 9286 | | |
| 9286 | |
| 9287 | 9287 | Board BMC-64IN1NOREPEAT |
| 9288 | | |
| 9288 | |
| 9289 | 9289 | Games: 64-in-1 Y2K |
| 9290 | | |
| 9290 | |
| 9291 | 9291 | In MESS: Supported |
| 9292 | | |
| 9292 | |
| 9293 | 9293 | *************************************************************/ |
| 9294 | 9294 | |
| 9295 | 9295 | static void bmc_64in1nr_set_prg( running_machine *machine ) |
| r8325 | r8326 | |
| 9297 | 9297 | nes_state *state = (nes_state *)machine->driver_data; |
| 9298 | 9298 | UINT8 helper1 = (state->bmc_64in1nr_reg[1] & 0x1f); |
| 9299 | 9299 | UINT8 helper2 = (helper1 << 1) | ((state->bmc_64in1nr_reg[1] & 0x40) >> 6); |
| 9300 | | |
| 9300 | |
| 9301 | 9301 | if (state->bmc_64in1nr_reg[0] & 0x80) |
| 9302 | 9302 | { |
| 9303 | 9303 | if (state->bmc_64in1nr_reg[1] & 0x80) |
| r8325 | r8326 | |
| 9317 | 9317 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 9318 | 9318 | LOG_MMC(("bmc_64in1nr_l_w offset: %04x, data: %02x\n", offset, data)); |
| 9319 | 9319 | offset += 0x100; |
| 9320 | | |
| 9320 | |
| 9321 | 9321 | switch (offset) |
| 9322 | 9322 | { |
| 9323 | 9323 | case 0x1000: |
| r8325 | r8326 | |
| 9337 | 9337 | { |
| 9338 | 9338 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 9339 | 9339 | LOG_MMC(("bmc_64in1nr_w offset: %04x, data: %02x\n", offset, data)); |
| 9340 | | |
| 9340 | |
| 9341 | 9341 | state->bmc_64in1nr_reg[3] = data; // reg[3] is currently unused?!? |
| 9342 | 9342 | } |
| 9343 | 9343 | |
| 9344 | 9344 | /************************************************************* |
| 9345 | | |
| 9345 | |
| 9346 | 9346 | Board BMC-190IN1 |
| 9347 | | |
| 9347 | |
| 9348 | 9348 | Games: 190-in-1 |
| 9349 | | |
| 9349 | |
| 9350 | 9350 | In MESS: Supported |
| 9351 | | |
| 9351 | |
| 9352 | 9352 | *************************************************************/ |
| 9353 | 9353 | |
| 9354 | 9354 | static WRITE8_HANDLER( bmc_190in1_w ) |
| 9355 | 9355 | { |
| 9356 | 9356 | LOG_MMC(("bmc_190in1_w offset: %04x, data: %02x\n", offset, data)); |
| 9357 | | |
| 9357 | |
| 9358 | 9358 | set_nt_mirroring(space->machine, BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9359 | 9359 | data >>= 2; |
| 9360 | 9360 | prg16_89ab(space->machine, data); |
| r8325 | r8326 | |
| 9363 | 9363 | } |
| 9364 | 9364 | |
| 9365 | 9365 | /************************************************************* |
| 9366 | | |
| 9366 | |
| 9367 | 9367 | Board BMC-A65AS |
| 9368 | | |
| 9368 | |
| 9369 | 9369 | Games: 3-in-1 (N068) |
| 9370 | | |
| 9370 | |
| 9371 | 9371 | In MESS: Supported |
| 9372 | | |
| 9372 | |
| 9373 | 9373 | *************************************************************/ |
| 9374 | 9374 | |
| 9375 | 9375 | static WRITE8_HANDLER( bmc_a65as_w ) |
| 9376 | 9376 | { |
| 9377 | 9377 | UINT8 helper = (data & 0x30) >> 1; |
| 9378 | 9378 | LOG_MMC(("bmc_a65as_w offset: %04x, data: %02x\n", offset, data)); |
| 9379 | | |
| 9379 | |
| 9380 | 9380 | if (data & 0x80) |
| 9381 | 9381 | set_nt_mirroring(space->machine, BIT(data, 5) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 9382 | 9382 | else |
| 9383 | 9383 | set_nt_mirroring(space->machine, BIT(data, 3) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9384 | | |
| 9384 | |
| 9385 | 9385 | if (data & 0x40) |
| 9386 | 9386 | prg32(space->machine, data >> 1); |
| 9387 | 9387 | else |
| r8325 | r8326 | |
| 9392 | 9392 | } |
| 9393 | 9393 | |
| 9394 | 9394 | /************************************************************* |
| 9395 | | |
| 9395 | |
| 9396 | 9396 | Board BMC-GS2004 |
| 9397 | | |
| 9397 | |
| 9398 | 9398 | Games: Tetris Family 6-in-1 |
| 9399 | | |
| 9399 | |
| 9400 | 9400 | In MESS: Preliminary Support. It also misses WRAM handling |
| 9401 | 9401 | (we need reads from 0x6000-0x7fff) |
| 9402 | | |
| 9402 | |
| 9403 | 9403 | *************************************************************/ |
| 9404 | 9404 | |
| 9405 | 9405 | static WRITE8_HANDLER( bmc_gs2004_w ) |
| 9406 | 9406 | { |
| 9407 | 9407 | LOG_MMC(("bmc_gs2004_w offset: %04x, data: %02x\n", offset, data)); |
| 9408 | | |
| 9408 | |
| 9409 | 9409 | prg32(space->machine, data); |
| 9410 | 9410 | } |
| 9411 | 9411 | |
| 9412 | 9412 | /************************************************************* |
| 9413 | | |
| 9413 | |
| 9414 | 9414 | Board BMC-GS2013 |
| 9415 | | |
| 9415 | |
| 9416 | 9416 | Games: Tetris Family 12-in-1 |
| 9417 | | |
| 9417 | |
| 9418 | 9418 | In MESS: Preliminary Support. It also misses WRAM handling |
| 9419 | 9419 | (we need reads from 0x6000-0x7fff) |
| 9420 | | |
| 9420 | |
| 9421 | 9421 | *************************************************************/ |
| 9422 | 9422 | |
| 9423 | 9423 | static WRITE8_HANDLER( bmc_gs2013_w ) |
| 9424 | 9424 | { |
| 9425 | 9425 | LOG_MMC(("bmc_gs2013_w offset: %04x, data: %02x\n", offset, data)); |
| 9426 | | |
| 9426 | |
| 9427 | 9427 | if (data & 0x08) |
| 9428 | 9428 | prg32(space->machine, data & 0x09); |
| 9429 | 9429 | else |
| r8325 | r8326 | |
| 9431 | 9431 | } |
| 9432 | 9432 | |
| 9433 | 9433 | /************************************************************* |
| 9434 | | |
| 9434 | |
| 9435 | 9435 | Board BMC-SUPER24IN1SC03 |
| 9436 | | |
| 9436 | |
| 9437 | 9437 | Games: Super 24-in-1 |
| 9438 | | |
| 9438 | |
| 9439 | 9439 | In MESS: Supported |
| 9440 | | |
| 9440 | |
| 9441 | 9441 | *************************************************************/ |
| 9442 | 9442 | |
| 9443 | 9443 | static void bmc_s24in1sc03_set_prg( running_machine *machine ) |
| r8325 | r8326 | |
| 9447 | 9447 | UINT8 prg_flip = (state->mmc_latch1 & 0x40) ? 2 : 0; |
| 9448 | 9448 | int prg_base = state->bmc_s24in1sc03_reg[1] << 1; |
| 9449 | 9449 | int prg_mask = masks[state->bmc_s24in1sc03_reg[0] & 0x07]; |
| 9450 | | |
| 9450 | |
| 9451 | 9451 | prg8_89(machine, prg_base | (state->mmc_prg_bank[0 ^ prg_flip] & prg_mask)); |
| 9452 | 9452 | prg8_ab(machine, prg_base | (state->mmc_prg_bank[1] & prg_mask)); |
| 9453 | 9453 | prg8_cd(machine, prg_base | (state->mmc_prg_bank[2 ^ prg_flip] & prg_mask)); |
| r8325 | r8326 | |
| 9460 | 9460 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 9461 | 9461 | UINT8 chr = (state->bmc_s24in1sc03_reg[0] & 0x20) ? CHRRAM : CHRROM; |
| 9462 | 9462 | int chr_base = (state->bmc_s24in1sc03_reg[2] << 3) & 0xf00; |
| 9463 | | |
| 9463 | |
| 9464 | 9464 | chr1_x(machine, chr_page ^ 0, chr_base | (state->mmc_vrom_bank[0] & ~0x01), chr); |
| 9465 | 9465 | chr1_x(machine, chr_page ^ 1, chr_base | (state->mmc_vrom_bank[0] | 0x01), chr); |
| 9466 | 9466 | chr1_x(machine, chr_page ^ 2, chr_base | (state->mmc_vrom_bank[1] & ~0x01), chr); |
| r8325 | r8326 | |
| 9476 | 9476 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 9477 | 9477 | LOG_MMC(("bmc_s24in1sc03_l_w offset: %04x, data: %02x\n", offset, data)); |
| 9478 | 9478 | offset += 0x100; |
| 9479 | | |
| 9479 | |
| 9480 | 9480 | if (offset == 0x1ff0) |
| 9481 | 9481 | { |
| 9482 | 9482 | state->bmc_s24in1sc03_reg[0] = data; |
| 9483 | 9483 | bmc_s24in1sc03_set_prg(space->machine); |
| 9484 | 9484 | bmc_s24in1sc03_set_chr(space->machine); |
| 9485 | 9485 | } |
| 9486 | | |
| 9486 | |
| 9487 | 9487 | if (offset == 0x1ff1) |
| 9488 | 9488 | { |
| 9489 | 9489 | state->bmc_s24in1sc03_reg[1] = data; |
| 9490 | 9490 | bmc_s24in1sc03_set_prg(space->machine); |
| 9491 | 9491 | } |
| 9492 | | |
| 9492 | |
| 9493 | 9493 | if (offset == 0x1ff2) |
| 9494 | 9494 | { |
| 9495 | 9495 | state->bmc_s24in1sc03_reg[2] = data; |
| r8325 | r8326 | |
| 9502 | 9502 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 9503 | 9503 | UINT8 cmd, bmc_s24in1sc03_helper; |
| 9504 | 9504 | LOG_MMC(("bmc_s24in1sc03_w offset: %04x, data: %02x\n", offset, data)); |
| 9505 | | |
| 9505 | |
| 9506 | 9506 | switch (offset & 0x6001) |
| 9507 | 9507 | { |
| 9508 | 9508 | case 0x0000: |
| 9509 | 9509 | bmc_s24in1sc03_helper = state->mmc_latch1 ^ data; |
| 9510 | 9510 | state->mmc_latch1 = data; |
| 9511 | | |
| 9511 | |
| 9512 | 9512 | /* Has PRG Mode changed? */ |
| 9513 | 9513 | if (bmc_s24in1sc03_helper & 0x40) |
| 9514 | 9514 | bmc_s24in1sc03_set_prg(space->machine); |
| 9515 | | |
| 9515 | |
| 9516 | 9516 | /* Has CHR Mode changed? */ |
| 9517 | 9517 | if (bmc_s24in1sc03_helper & 0x80) |
| 9518 | 9518 | bmc_s24in1sc03_set_chr(space->machine); |
| 9519 | 9519 | break; |
| 9520 | | |
| 9520 | |
| 9521 | 9521 | case 0x0001: |
| 9522 | 9522 | cmd = state->mmc_latch1 & 0x07; |
| 9523 | 9523 | switch (cmd) |
| r8325 | r8326 | |
| 9534 | 9534 | break; |
| 9535 | 9535 | } |
| 9536 | 9536 | break; |
| 9537 | | |
| 9537 | |
| 9538 | 9538 | default: |
| 9539 | 9539 | txrom_w(space, offset, data); |
| 9540 | 9540 | break; |
| r8325 | r8326 | |
| 9542 | 9542 | } |
| 9543 | 9543 | |
| 9544 | 9544 | /************************************************************* |
| 9545 | | |
| 9545 | |
| 9546 | 9546 | Board BMC-T-262 |
| 9547 | | |
| 9547 | |
| 9548 | 9548 | Games: 4-in-1 (D-010), 8-in-1 (A-020) |
| 9549 | | |
| 9549 | |
| 9550 | 9550 | In MESS: Supported |
| 9551 | | |
| 9551 | |
| 9552 | 9552 | *************************************************************/ |
| 9553 | 9553 | |
| 9554 | 9554 | static WRITE8_HANDLER( bmc_t262_w ) |
| r8325 | r8326 | |
| 9556 | 9556 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 9557 | 9557 | UINT8 mmc_helper; |
| 9558 | 9558 | LOG_MMC(("bmc_t262_w offset: %04x, data: %02x\n", offset, data)); |
| 9559 | | |
| 9559 | |
| 9560 | 9560 | if (state->mmc_latch2 || offset == 0) |
| 9561 | 9561 | { |
| 9562 | 9562 | state->mmc_latch1 = (state->mmc_latch1 & 0x38) | (data & 0x07); |
| r8325 | r8326 | |
| 9574 | 9574 | } |
| 9575 | 9575 | |
| 9576 | 9576 | /************************************************************* |
| 9577 | | |
| 9577 | |
| 9578 | 9578 | Board BMC-WS |
| 9579 | | |
| 9579 | |
| 9580 | 9580 | Games: Super 40-in-1 |
| 9581 | | |
| 9581 | |
| 9582 | 9582 | In MESS: Supported |
| 9583 | | |
| 9583 | |
| 9584 | 9584 | *************************************************************/ |
| 9585 | 9585 | |
| 9586 | 9586 | static WRITE8_HANDLER( bmc_ws_m_w ) |
| r8325 | r8326 | |
| 9588 | 9588 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 9589 | 9589 | UINT8 mmc_helper; |
| 9590 | 9590 | LOG_MMC(("bmc_ws_m_w offset: %04x, data: %02x\n", offset, data)); |
| 9591 | | |
| 9591 | |
| 9592 | 9592 | if (offset < 0x1000) |
| 9593 | 9593 | { |
| 9594 | 9594 | switch (offset & 0x01) |
| r8325 | r8326 | |
| 9614 | 9614 | } |
| 9615 | 9615 | |
| 9616 | 9616 | /************************************************************* |
| 9617 | | |
| 9617 | |
| 9618 | 9618 | BMC-NOVELDIAMOND and BMC-999999in1 |
| 9619 | | |
| 9619 | |
| 9620 | 9620 | Unknown Bootleg Multigame Board |
| 9621 | 9621 | Games: I only found 'Novel Diamond 999999-in-1.unf' using |
| 9622 | 9622 | this mapper (hence the code is used for BMC_NOVELDIAMOND |
| 9623 | 9623 | board). The code is included here in case a mapper 54 |
| 9624 | 9624 | dump arises. |
| 9625 | | |
| 9625 | |
| 9626 | 9626 | iNES: 54 and 213 |
| 9627 | 9627 | |
| 9628 | 9628 | In MESS: Partial Support. |
| 9629 | | |
| 9629 | |
| 9630 | 9630 | *************************************************************/ |
| 9631 | 9631 | |
| 9632 | 9632 | // Are this correct or should they work the same? |
| 9633 | 9633 | static WRITE8_HANDLER( novel1_w ) |
| 9634 | 9634 | { |
| 9635 | 9635 | LOG_MMC(("novel1_w, offset: %04x, data: %02x\n", offset, data)); |
| 9636 | | |
| 9636 | |
| 9637 | 9637 | prg32(space->machine, offset & 0x03); |
| 9638 | 9638 | chr8(space->machine, offset & 0x07, CHRROM); |
| 9639 | 9639 | } |
| r8325 | r8326 | |
| 9641 | 9641 | static WRITE8_HANDLER( novel2_w ) |
| 9642 | 9642 | { |
| 9643 | 9643 | LOG_MMC(("novel2_w, offset: %04x, data: %02x\n", offset, data)); |
| 9644 | | |
| 9644 | |
| 9645 | 9645 | prg32(space->machine, offset >> 1); |
| 9646 | 9646 | chr8(space->machine, offset >> 3, CHRROM); |
| 9647 | 9647 | } |
| 9648 | 9648 | |
| 9649 | 9649 | /************************************************************* |
| 9650 | | |
| 9650 | |
| 9651 | 9651 | Board BMC-GKA |
| 9652 | | |
| 9652 | |
| 9653 | 9653 | Unknown Bootleg Multigame Board |
| 9654 | 9654 | Games: 6 in 1, 54 in 1, 106 in 1 |
| 9655 | | |
| 9655 | |
| 9656 | 9656 | iNES: mapper 57 |
| 9657 | 9657 | |
| 9658 | 9658 | In MESS: Supported. |
| 9659 | | |
| 9659 | |
| 9660 | 9660 | *************************************************************/ |
| 9661 | 9661 | |
| 9662 | 9662 | static WRITE8_HANDLER( bmc_gka_w ) |
| 9663 | 9663 | { |
| 9664 | 9664 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 9665 | 9665 | LOG_MMC(("bmc_gka_w, offset: %04x, data: %02x\n", offset, data)); |
| 9666 | | |
| 9666 | |
| 9667 | 9667 | if (offset & 0x0800) |
| 9668 | 9668 | state->mmc_latch2 = data; |
| 9669 | 9669 | else |
| 9670 | 9670 | state->mmc_latch1 = data; |
| 9671 | | |
| 9671 | |
| 9672 | 9672 | if (state->mmc_latch2 & 0x80) |
| 9673 | 9673 | prg32(space->machine, 2 | (state->mmc_latch2 >> 6)); |
| 9674 | 9674 | else |
| r8325 | r8326 | |
| 9676 | 9676 | prg16_89ab(space->machine, (state->mmc_latch2 >> 5) & 0x03); |
| 9677 | 9677 | prg16_cdef(space->machine, (state->mmc_latch2 >> 5) & 0x03); |
| 9678 | 9678 | } |
| 9679 | | |
| 9679 | |
| 9680 | 9680 | set_nt_mirroring(space->machine, (state->mmc_latch2 & 0x08) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9681 | | |
| 9681 | |
| 9682 | 9682 | chr8(space->machine, (state->mmc_latch1 & 0x03) | (state->mmc_latch2 & 0x07) | ((state->mmc_latch2 & 0x10) >> 1), CHRROM); |
| 9683 | 9683 | } |
| 9684 | 9684 | |
| 9685 | 9685 | |
| 9686 | 9686 | /************************************************************* |
| 9687 | | |
| 9687 | |
| 9688 | 9688 | Board BMC-GKB |
| 9689 | | |
| 9689 | |
| 9690 | 9690 | Unknown Bootleg Multigame Board |
| 9691 | 9691 | Games: 68 in 1, 73 in 1, 98 in 1 |
| 9692 | | |
| 9692 | |
| 9693 | 9693 | iNES: mapper 58 |
| 9694 | 9694 | |
| 9695 | 9695 | In MESS: Supported. |
| 9696 | | |
| 9696 | |
| 9697 | 9697 | *************************************************************/ |
| 9698 | 9698 | |
| 9699 | 9699 | static WRITE8_HANDLER( bmc_gkb_w ) |
| r8325 | r8326 | |
| 9701 | 9701 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 9702 | 9702 | UINT8 bank = (offset & 0x40) ? 0 : 1; |
| 9703 | 9703 | LOG_MMC(("bmc_gkb_w, offset: %04x, data: %02x\n", offset, data)); |
| 9704 | | |
| 9704 | |
| 9705 | 9705 | prg16_89ab(space->machine, offset & ~bank); |
| 9706 | 9706 | prg16_cdef(space->machine, offset | bank); |
| 9707 | 9707 | chr8(space->machine, offset >> 3, state->mmc_chr_source); |
| r8325 | r8326 | |
| 9709 | 9709 | } |
| 9710 | 9710 | |
| 9711 | 9711 | /************************************************************* |
| 9712 | | |
| 9712 | |
| 9713 | 9713 | BMC-SUPER-700IN1 |
| 9714 | | |
| 9714 | |
| 9715 | 9715 | Unknown Bootleg Multigame Board |
| 9716 | 9716 | Games: Super 700 in 1 |
| 9717 | | |
| 9717 | |
| 9718 | 9718 | iNES: mapper 62 |
| 9719 | 9719 | |
| 9720 | 9720 | In MESS: Supported. |
| 9721 | | |
| 9721 | |
| 9722 | 9722 | *************************************************************/ |
| 9723 | 9723 | |
| 9724 | 9724 | static WRITE8_HANDLER( bmc_super700in1_w ) |
| 9725 | 9725 | { |
| 9726 | 9726 | LOG_MMC(("bmc_super700in1_w, offset :%04x, data: %02x\n", offset, data)); |
| 9727 | | |
| 9727 | |
| 9728 | 9728 | chr8(space->machine, ((offset & 0x1f) << 2) | (data & 0x03), CHRROM); |
| 9729 | | |
| 9729 | |
| 9730 | 9730 | if (offset & 0x20) |
| 9731 | 9731 | { |
| 9732 | 9732 | prg16_89ab(space->machine, (offset & 0x40) | ((offset >> 8) & 0x3f)); |
| r8325 | r8326 | |
| 9736 | 9736 | { |
| 9737 | 9737 | prg32(space->machine, ((offset & 0x40) | ((offset >> 8) & 0x3f)) >> 1); |
| 9738 | 9738 | } |
| 9739 | | |
| 9739 | |
| 9740 | 9740 | set_nt_mirroring(space->machine, BIT(data, 7) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9741 | 9741 | } |
| 9742 | 9742 | |
| 9743 | 9743 | /************************************************************* |
| 9744 | | |
| 9744 | |
| 9745 | 9745 | BMC-36IN1 |
| 9746 | | |
| 9746 | |
| 9747 | 9747 | Unknown Bootleg Multigame Board |
| 9748 | 9748 | Games: 36 in 1, 1200 in 1 |
| 9749 | | |
| 9749 | |
| 9750 | 9750 | iNES: mapper 200 |
| 9751 | | |
| 9751 | |
| 9752 | 9752 | In MESS: Supported. |
| 9753 | | |
| 9753 | |
| 9754 | 9754 | *************************************************************/ |
| 9755 | 9755 | |
| 9756 | 9756 | static WRITE8_HANDLER( bmc_36in1_w ) |
| 9757 | 9757 | { |
| 9758 | 9758 | LOG_MMC(("bmc_36in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 9759 | | |
| 9759 | |
| 9760 | 9760 | prg16_89ab(space->machine, offset & 0x07); |
| 9761 | 9761 | prg16_cdef(space->machine, offset & 0x07); |
| 9762 | 9762 | chr8(space->machine, offset & 0x07, CHRROM); |
| 9763 | | |
| 9763 | |
| 9764 | 9764 | set_nt_mirroring(space->machine, BIT(data, 3) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9765 | 9765 | } |
| 9766 | 9766 | |
| 9767 | 9767 | /************************************************************* |
| 9768 | | |
| 9768 | |
| 9769 | 9769 | BMC-21IN1 |
| 9770 | | |
| 9770 | |
| 9771 | 9771 | Unknown Bootleg Multigame Board |
| 9772 | 9772 | Games: 8 in 1, 21 in 1 |
| 9773 | | |
| 9773 | |
| 9774 | 9774 | iNES: mapper 201 |
| 9775 | | |
| 9775 | |
| 9776 | 9776 | In MESS: Supported. |
| 9777 | | |
| 9777 | |
| 9778 | 9778 | *************************************************************/ |
| 9779 | 9779 | |
| 9780 | 9780 | static WRITE8_HANDLER( bmc_21in1_w ) |
| 9781 | 9781 | { |
| 9782 | 9782 | LOG_MMC(("bmc_21in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 9783 | | |
| 9783 | |
| 9784 | 9784 | prg32(space->machine, offset & 0x03); |
| 9785 | 9785 | chr8(space->machine, offset & 0x03, CHRROM); |
| 9786 | 9786 | } |
| 9787 | 9787 | |
| 9788 | 9788 | /************************************************************* |
| 9789 | | |
| 9789 | |
| 9790 | 9790 | BMC-150IN1 |
| 9791 | | |
| 9791 | |
| 9792 | 9792 | Unknown Bootleg Multigame Board |
| 9793 | 9793 | Games: 150 in 1 |
| 9794 | | |
| 9794 | |
| 9795 | 9795 | iNES: mapper 202 |
| 9796 | | |
| 9796 | |
| 9797 | 9797 | In MESS: Supported. |
| 9798 | | |
| 9798 | |
| 9799 | 9799 | *************************************************************/ |
| 9800 | 9800 | |
| 9801 | 9801 | static WRITE8_HANDLER( bmc_150in1_w ) |
| 9802 | 9802 | { |
| 9803 | 9803 | int bank = (offset >> 1) & 0x07; |
| 9804 | | |
| 9804 | |
| 9805 | 9805 | LOG_MMC(("bmc_150in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 9806 | | |
| 9806 | |
| 9807 | 9807 | prg16_89ab(space->machine, bank); |
| 9808 | 9808 | prg16_cdef(space->machine, bank + (((bank & 0x06) == 0x06) ? 1 : 0)); |
| 9809 | 9809 | chr8(space->machine, bank, CHRROM); |
| 9810 | | |
| 9810 | |
| 9811 | 9811 | set_nt_mirroring(space->machine, BIT(data, 0) ? PPU_MIRROR_HORZ: PPU_MIRROR_VERT); |
| 9812 | 9812 | } |
| 9813 | 9813 | |
| 9814 | 9814 | /************************************************************* |
| 9815 | | |
| 9815 | |
| 9816 | 9816 | BMC-35IN1 |
| 9817 | | |
| 9817 | |
| 9818 | 9818 | Unknown Bootleg Multigame Board |
| 9819 | 9819 | Games: 35 in 1 |
| 9820 | | |
| 9820 | |
| 9821 | 9821 | iNES: mapper 203 |
| 9822 | | |
| 9822 | |
| 9823 | 9823 | In MESS: Supported. |
| 9824 | | |
| 9824 | |
| 9825 | 9825 | *************************************************************/ |
| 9826 | 9826 | |
| 9827 | 9827 | static WRITE8_HANDLER( bmc_35in1_w ) |
| 9828 | 9828 | { |
| 9829 | 9829 | LOG_MMC(("bmc_35in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 9830 | | |
| 9830 | |
| 9831 | 9831 | prg16_89ab(space->machine, (data >> 2) & 0x03); |
| 9832 | 9832 | prg16_cdef(space->machine, (data >> 2) & 0x03); |
| 9833 | 9833 | chr8(space->machine, data & 0x03, CHRROM); |
| 9834 | 9834 | } |
| 9835 | 9835 | |
| 9836 | 9836 | /************************************************************* |
| 9837 | | |
| 9837 | |
| 9838 | 9838 | BMC-64IN1 |
| 9839 | | |
| 9839 | |
| 9840 | 9840 | Unknown Bootleg Multigame Board |
| 9841 | 9841 | Games: 64 in 1 |
| 9842 | | |
| 9842 | |
| 9843 | 9843 | iNES: mapper 204 |
| 9844 | | |
| 9844 | |
| 9845 | 9845 | In MESS: Supported. |
| 9846 | | |
| 9846 | |
| 9847 | 9847 | *************************************************************/ |
| 9848 | 9848 | |
| 9849 | 9849 | static WRITE8_HANDLER( bmc_64in1_w ) |
| 9850 | 9850 | { |
| 9851 | 9851 | int bank = (offset >> 1) & (offset >> 2) & 0x01; |
| 9852 | | |
| 9852 | |
| 9853 | 9853 | LOG_MMC(("bmc_64in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 9854 | | |
| 9854 | |
| 9855 | 9855 | prg16_89ab(space->machine, offset & ~bank); |
| 9856 | 9856 | prg16_cdef(space->machine, offset | bank); |
| 9857 | 9857 | chr8(space->machine, offset & ~bank, CHRROM); |
| 9858 | | |
| 9858 | |
| 9859 | 9859 | set_nt_mirroring(space->machine, BIT(data, 4) ? PPU_MIRROR_HORZ: PPU_MIRROR_VERT); |
| 9860 | 9860 | } |
| 9861 | 9861 | |
| 9862 | 9862 | /************************************************************* |
| 9863 | | |
| 9863 | |
| 9864 | 9864 | BMC-15IN1 |
| 9865 | | |
| 9865 | |
| 9866 | 9866 | Unknown Bootleg Multigame Board |
| 9867 | 9867 | Games: 3 in 1, 15 in 1 |
| 9868 | | |
| 9868 | |
| 9869 | 9869 | iNES: mapper 205, MMC3 clone |
| 9870 | | |
| 9870 | |
| 9871 | 9871 | In MESS: Supported. |
| 9872 | | |
| 9872 | |
| 9873 | 9873 | *************************************************************/ |
| 9874 | 9874 | |
| 9875 | 9875 | static WRITE8_HANDLER( bmc_15in1_m_w ) |
| 9876 | 9876 | { |
| 9877 | 9877 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 9878 | 9878 | LOG_MMC(("bmc_15in1_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 9879 | | |
| 9879 | |
| 9880 | 9880 | if (offset & 0x0800) |
| 9881 | 9881 | { |
| 9882 | 9882 | state->mmc_prg_base = (data & 0x03) << 4; |
| r8325 | r8326 | |
| 9889 | 9889 | } |
| 9890 | 9890 | |
| 9891 | 9891 | /************************************************************* |
| 9892 | | |
| 9892 | |
| 9893 | 9893 | BMC-SUPERHIK_300IN1 |
| 9894 | | |
| 9894 | |
| 9895 | 9895 | Unknown Bootleg Multigame Board |
| 9896 | 9896 | Games: 100000 in 1, Super HIK 300 in 1, 1997 in 1 |
| 9897 | | |
| 9897 | |
| 9898 | 9898 | iNES: mapper 212 |
| 9899 | 9899 | |
| 9900 | 9900 | In MESS: Supported. |
| 9901 | | |
| 9901 | |
| 9902 | 9902 | *************************************************************/ |
| 9903 | 9903 | |
| 9904 | 9904 | static WRITE8_HANDLER( bmc_hik300_w ) |
| 9905 | 9905 | { |
| 9906 | 9906 | LOG_MMC(("bmc_hik300_w, offset: %04x, data: %02x\n", offset, data)); |
| 9907 | | |
| 9907 | |
| 9908 | 9908 | set_nt_mirroring(space->machine, BIT(data, 3) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9909 | 9909 | chr8(space->machine, offset, CHRROM); |
| 9910 | | |
| 9910 | |
| 9911 | 9911 | if (offset < 0x4000) |
| 9912 | 9912 | { |
| 9913 | 9913 | prg16_89ab(space->machine, offset); |
| r8325 | r8326 | |
| 9918 | 9918 | } |
| 9919 | 9919 | |
| 9920 | 9920 | /************************************************************* |
| 9921 | | |
| 9921 | |
| 9922 | 9922 | BMC-SUPERGUN-20IN1 |
| 9923 | | |
| 9923 | |
| 9924 | 9924 | Unknown Bootleg Multigame Board |
| 9925 | 9925 | Games: Super Gun 20 in 1 |
| 9926 | | |
| 9926 | |
| 9927 | 9927 | iNES: mapper 214 |
| 9928 | | |
| 9928 | |
| 9929 | 9929 | In MESS: Supported. |
| 9930 | | |
| 9930 | |
| 9931 | 9931 | *************************************************************/ |
| 9932 | 9932 | |
| 9933 | 9933 | static WRITE8_HANDLER( supergun20in1_w ) |
| 9934 | 9934 | { |
| 9935 | 9935 | LOG_MMC(("supergun20in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 9936 | | |
| 9936 | |
| 9937 | 9937 | prg16_89ab(space->machine, offset >> 2); |
| 9938 | 9938 | prg16_cdef(space->machine, offset >> 2); |
| 9939 | 9939 | chr8(space->machine, offset, CHRROM); |
| 9940 | 9940 | } |
| 9941 | 9941 | |
| 9942 | 9942 | /************************************************************* |
| 9943 | | |
| 9943 | |
| 9944 | 9944 | BMC-72IN1 |
| 9945 | | |
| 9945 | |
| 9946 | 9946 | Unknown Bootleg Multigame Board |
| 9947 | 9947 | Games: 72 in 1, 115 in 1 and other multigame carts |
| 9948 | | |
| 9948 | |
| 9949 | 9949 | iNES: mapper 225 |
| 9950 | | |
| 9950 | |
| 9951 | 9951 | In MESS: Supported. |
| 9952 | | |
| 9952 | |
| 9953 | 9953 | *************************************************************/ |
| 9954 | 9954 | |
| 9955 | 9955 | static WRITE8_HANDLER( bmc_72in1_w ) |
| r8325 | r8326 | |
| 9957 | 9957 | int hi_bank; |
| 9958 | 9958 | int size_16; |
| 9959 | 9959 | int bank; |
| 9960 | | |
| 9960 | |
| 9961 | 9961 | LOG_MMC(("bmc_72in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 9962 | | |
| 9962 | |
| 9963 | 9963 | chr8(space->machine, offset, CHRROM); |
| 9964 | 9964 | set_nt_mirroring(space->machine, (offset & 0x2000) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9965 | | |
| 9965 | |
| 9966 | 9966 | hi_bank = offset & 0x40; |
| 9967 | 9967 | size_16 = offset & 0x1000; |
| 9968 | 9968 | bank = (offset & 0xf80) >> 7; |
| r8325 | r8326 | |
| 9971 | 9971 | bank <<= 1; |
| 9972 | 9972 | if (hi_bank) |
| 9973 | 9973 | bank ++; |
| 9974 | | |
| 9974 | |
| 9975 | 9975 | prg16_89ab(space->machine, bank); |
| 9976 | 9976 | prg16_cdef(space->machine, bank); |
| 9977 | 9977 | } |
| r8325 | r8326 | |
| 9980 | 9980 | } |
| 9981 | 9981 | |
| 9982 | 9982 | /************************************************************* |
| 9983 | | |
| 9983 | |
| 9984 | 9984 | BMC-76IN1 |
| 9985 | | |
| 9985 | |
| 9986 | 9986 | Unknown Bootleg Multigame Board |
| 9987 | 9987 | Games: 76 in 1, Super 42 in 1 |
| 9988 | | |
| 9988 | |
| 9989 | 9989 | iNES: mapper 226 |
| 9990 | | |
| 9990 | |
| 9991 | 9991 | In MESS: Supported. |
| 9992 | | |
| 9992 | |
| 9993 | 9993 | *************************************************************/ |
| 9994 | 9994 | |
| 9995 | 9995 | // does this work for super42in1 as well?!? |
| r8325 | r8326 | |
| 9999 | 9999 | int hi_bank; |
| 10000 | 10000 | int size_16; |
| 10001 | 10001 | int bank; |
| 10002 | | |
| 10002 | |
| 10003 | 10003 | LOG_MMC(("bmc_76in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 10004 | | |
| 10004 | |
| 10005 | 10005 | if (offset & 0x01) |
| 10006 | 10006 | state->mmc_latch2 = data; |
| 10007 | 10007 | else |
| 10008 | 10008 | state->mmc_latch1 = data; |
| 10009 | | |
| 10009 | |
| 10010 | 10010 | set_nt_mirroring(space->machine, BIT(state->mmc_latch1, 6) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10011 | | |
| 10011 | |
| 10012 | 10012 | hi_bank = state->mmc_latch1 & 0x01; |
| 10013 | 10013 | size_16 = state->mmc_latch1 & 0x20; |
| 10014 | 10014 | bank = ((state->mmc_latch1 & 0x1e) >> 1) | ((state->mmc_latch1 & 0x80) >> 3) | ((state->mmc_latch2 & 0x01) << 5); |
| 10015 | | |
| 10015 | |
| 10016 | 10016 | if (size_16) |
| 10017 | 10017 | { |
| 10018 | 10018 | bank <<= 1; |
| 10019 | 10019 | if (hi_bank) |
| 10020 | 10020 | bank ++; |
| 10021 | | |
| 10021 | |
| 10022 | 10022 | prg16_89ab(space->machine, bank); |
| 10023 | 10023 | prg16_cdef(space->machine, bank); |
| 10024 | 10024 | } |
| r8325 | r8326 | |
| 10027 | 10027 | } |
| 10028 | 10028 | |
| 10029 | 10029 | /************************************************************* |
| 10030 | | |
| 10030 | |
| 10031 | 10031 | BMC-1200IN1 |
| 10032 | | |
| 10032 | |
| 10033 | 10033 | Unknown Bootleg Multigame Board |
| 10034 | 10034 | Games: 1200 in 1, 295 in 1, 76 in 1 |
| 10035 | | |
| 10035 | |
| 10036 | 10036 | iNES: mapper 227 |
| 10037 | | |
| 10037 | |
| 10038 | 10038 | In MESS: Supported. |
| 10039 | | |
| 10039 | |
| 10040 | 10040 | *************************************************************/ |
| 10041 | 10041 | |
| 10042 | 10042 | static WRITE8_HANDLER( bmc_1200in1_w ) |
| r8325 | r8326 | |
| 10044 | 10044 | int hi_bank; |
| 10045 | 10045 | int size_32; |
| 10046 | 10046 | int bank; |
| 10047 | | |
| 10047 | |
| 10048 | 10048 | LOG_MMC(("bmc_1200in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 10049 | | |
| 10049 | |
| 10050 | 10050 | hi_bank = offset & 0x04; |
| 10051 | 10051 | size_32 = offset & 0x01; |
| 10052 | 10052 | bank = ((offset & 0x78) >> 3) | ((offset & 0x0100) >> 4); |
| r8325 | r8326 | |
| 10055 | 10055 | bank <<= 1; |
| 10056 | 10056 | if (hi_bank) |
| 10057 | 10057 | bank ++; |
| 10058 | | |
| 10058 | |
| 10059 | 10059 | prg16_89ab(space->machine, bank); |
| 10060 | 10060 | prg16_cdef(space->machine, bank); |
| 10061 | 10061 | } |
| 10062 | 10062 | else |
| 10063 | 10063 | prg32(space->machine, bank); |
| 10064 | | |
| 10064 | |
| 10065 | 10065 | if (!(offset & 0x80)) |
| 10066 | 10066 | { |
| 10067 | 10067 | if (offset & 0x200) |
| r8325 | r8326 | |
| 10069 | 10069 | else |
| 10070 | 10070 | prg16_cdef(space->machine, ((bank << 1) & 0x38)); |
| 10071 | 10071 | } |
| 10072 | | |
| 10072 | |
| 10073 | 10073 | set_nt_mirroring(space->machine, BIT(data, 1) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10074 | 10074 | } |
| 10075 | 10075 | |
| 10076 | 10076 | /************************************************************* |
| 10077 | | |
| 10077 | |
| 10078 | 10078 | BMC-31IN1 |
| 10079 | | |
| 10079 | |
| 10080 | 10080 | Unknown Bootleg Multigame Board |
| 10081 | 10081 | Games: 31 in 1 |
| 10082 | | |
| 10082 | |
| 10083 | 10083 | iNES: mapper 229 |
| 10084 | | |
| 10084 | |
| 10085 | 10085 | In MESS: Supported. |
| 10086 | | |
| 10086 | |
| 10087 | 10087 | *************************************************************/ |
| 10088 | 10088 | |
| 10089 | 10089 | static WRITE8_HANDLER( bmc_31in1_w ) |
| 10090 | 10090 | { |
| 10091 | 10091 | LOG_MMC(("bmc_31in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 10092 | | |
| 10092 | |
| 10093 | 10093 | set_nt_mirroring(space->machine, BIT(data, 5) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10094 | 10094 | chr8(space->machine, offset, CHRROM); |
| 10095 | | |
| 10095 | |
| 10096 | 10096 | if ((offset & 0x1e) == 0) |
| 10097 | 10097 | { |
| 10098 | 10098 | prg16_89ab(space->machine, 0); |
| r8325 | r8326 | |
| 10106 | 10106 | } |
| 10107 | 10107 | |
| 10108 | 10108 | /************************************************************* |
| 10109 | | |
| 10109 | |
| 10110 | 10110 | BMC-22GAMES |
| 10111 | | |
| 10111 | |
| 10112 | 10112 | Unknown Bootleg Multigame Board |
| 10113 | 10113 | Games: 22 in 1 |
| 10114 | | |
| 10114 | |
| 10115 | 10115 | iNES: mapper 230 |
| 10116 | | |
| 10116 | |
| 10117 | 10117 | In MESS: Partially Supported. It would need a reset |
| 10118 | 10118 | to work (not possible yet) |
| 10119 | | |
| 10119 | |
| 10120 | 10120 | *************************************************************/ |
| 10121 | 10121 | |
| 10122 | 10122 | static WRITE8_HANDLER( bmc_22g_w ) |
| 10123 | 10123 | { |
| 10124 | 10124 | LOG_MMC(("bmc_22g_w, offset: %04x, data: %02x\n", offset, data)); |
| 10125 | | |
| 10125 | |
| 10126 | 10126 | if (1) // this should flip at reset |
| 10127 | 10127 | { |
| 10128 | 10128 | prg16_89ab(space->machine, data & 0x07); |
| r8325 | r8326 | |
| 10144 | 10144 | } |
| 10145 | 10145 | |
| 10146 | 10146 | /************************************************************* |
| 10147 | | |
| 10147 | |
| 10148 | 10148 | BMC-20IN1 |
| 10149 | | |
| 10149 | |
| 10150 | 10150 | Unknown Bootleg Multigame Board |
| 10151 | 10151 | Games: 20 in 1 |
| 10152 | | |
| 10152 | |
| 10153 | 10153 | iNES: mapper 231 |
| 10154 | | |
| 10154 | |
| 10155 | 10155 | In MESS: Supported. |
| 10156 | | |
| 10156 | |
| 10157 | 10157 | *************************************************************/ |
| 10158 | 10158 | |
| 10159 | 10159 | static WRITE8_HANDLER( bmc_20in1_w ) |
| 10160 | 10160 | { |
| 10161 | 10161 | LOG_MMC(("bmc_20in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 10162 | | |
| 10162 | |
| 10163 | 10163 | set_nt_mirroring(space->machine, BIT(data, 7) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10164 | | |
| 10164 | |
| 10165 | 10165 | prg16_89ab(space->machine, (offset & 0x1e)); |
| 10166 | 10166 | prg16_cdef(space->machine, (offset & 0x1e) | ((offset & 0x20) ? 1 : 0)); |
| 10167 | 10167 | } |
| 10168 | 10168 | |
| 10169 | 10169 | /************************************************************* |
| 10170 | | |
| 10170 | |
| 10171 | 10171 | BMC-110IN1 |
| 10172 | | |
| 10172 | |
| 10173 | 10173 | Known Boards: Unknown Bootleg Board |
| 10174 | 10174 | Games: 110 in 1 |
| 10175 | | |
| 10175 | |
| 10176 | 10176 | iNES: mapper 255 |
| 10177 | | |
| 10177 | |
| 10178 | 10178 | In MESS: Preliminary support. |
| 10179 | | |
| 10179 | |
| 10180 | 10180 | *************************************************************/ |
| 10181 | 10181 | |
| 10182 | 10182 | static WRITE8_HANDLER( bmc_110in1_w ) |
| 10183 | 10183 | { |
| 10184 | 10184 | UINT8 map255_helper1 = (offset >> 12) ? 0 : 1; |
| 10185 | 10185 | UINT8 map255_helper2 = ((offset >> 8) & 0x40) | ((offset >> 6) & 0x3f); |
| 10186 | | |
| 10186 | |
| 10187 | 10187 | LOG_MMC(("bmc_110in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 10188 | | |
| 10188 | |
| 10189 | 10189 | set_nt_mirroring(space->machine, (offset & 0x2000) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10190 | 10190 | prg16_89ab(space->machine, map255_helper1 & ~map255_helper2); |
| 10191 | 10191 | prg16_cdef(space->machine, map255_helper1 | map255_helper2); |
| r8325 | r8326 | |
| 10193 | 10193 | } |
| 10194 | 10194 | |
| 10195 | 10195 | /************************************************************* |
| 10196 | | |
| 10196 | |
| 10197 | 10197 | BMC-SUPERBIG-7IN1 |
| 10198 | | |
| 10198 | |
| 10199 | 10199 | Known Boards: Unknown Multigame Bootleg Board |
| 10200 | 10200 | Games: Kunio 8 in 1, Super Big 7 in 1 |
| 10201 | | |
| 10201 | |
| 10202 | 10202 | iNES: mapper 44 |
| 10203 | | |
| 10203 | |
| 10204 | 10204 | In MESS: Supported. It also uses mmc3_irq. |
| 10205 | | |
| 10205 | |
| 10206 | 10206 | *************************************************************/ |
| 10207 | 10207 | |
| 10208 | 10208 | static WRITE8_HANDLER( bmc_sbig7_w ) |
| r8325 | r8326 | |
| 10210 | 10210 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 10211 | 10211 | UINT8 page; |
| 10212 | 10212 | LOG_MMC(("bmc_sbig7_w, offset: %04x, data: %02x\n", offset, data)); |
| 10213 | | |
| 10213 | |
| 10214 | 10214 | switch (offset & 0x6001) |
| 10215 | 10215 | { |
| 10216 | 10216 | case 0x2001: /* $a001 - Select 128K ROM/VROM base (0..5) or last 256K ROM/VRAM base (6) */ |
| 10217 | 10217 | page = (data & 0x07); |
| 10218 | 10218 | if (page > 6) |
| 10219 | 10219 | page = 6; |
| 10220 | | |
| 10220 | |
| 10221 | 10221 | state->mmc_prg_base = page << 4; |
| 10222 | 10222 | state->mmc_prg_mask = (page > 5) ? 0x1f : 0x0f; |
| 10223 | 10223 | state->mmc_chr_base = page << 7; |
| r8325 | r8326 | |
| 10225 | 10225 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 10226 | 10226 | mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 10227 | 10227 | break; |
| 10228 | | |
| 10228 | |
| 10229 | 10229 | default: |
| 10230 | 10230 | txrom_w(space, offset, data); |
| 10231 | 10231 | break; |
| r8325 | r8326 | |
| 10233 | 10233 | } |
| 10234 | 10234 | |
| 10235 | 10235 | /************************************************************* |
| 10236 | | |
| 10236 | |
| 10237 | 10237 | BMC-HIK8IN1 |
| 10238 | | |
| 10238 | |
| 10239 | 10239 | Known Boards: Unknown Multigame Bootleg Board |
| 10240 | 10240 | Games: Street Fighter V, various multigame carts |
| 10241 | | |
| 10241 | |
| 10242 | 10242 | iNES: mapper 45 |
| 10243 | | |
| 10243 | |
| 10244 | 10244 | In MESS: Supported. It also uses mmc3_irq. |
| 10245 | | |
| 10245 | |
| 10246 | 10246 | *************************************************************/ |
| 10247 | 10247 | |
| 10248 | 10248 | static WRITE8_HANDLER( bmc_hik8_m_w ) |
| 10249 | 10249 | { |
| 10250 | 10250 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 10251 | 10251 | LOG_MMC(("bmc_hik8_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 10252 | | |
| 10252 | |
| 10253 | 10253 | /* This bit is the "register lock". Once register are locked, writes go to WRAM |
| 10254 | | and there is no way to unlock them (except by resetting the machine) */ |
| 10254 | and there is no way to unlock them (except by resetting the machine) */ |
| 10255 | 10255 | if ((state->mapper45_reg[3] & 0x40) && state->wram != NULL) |
| 10256 | 10256 | state->wram[offset] = data; |
| 10257 | 10257 | else |
| 10258 | 10258 | { |
| 10259 | 10259 | state->mapper45_reg[state->mmc_count] = data; |
| 10260 | 10260 | state->mmc_count = (state->mmc_count + 1) & 0x03; |
| 10261 | | |
| 10261 | |
| 10262 | 10262 | if (!state->mmc_count) |
| 10263 | 10263 | { |
| 10264 | 10264 | LOG_MMC(("bmc_hik8_m_w, command completed %02x %02x %02x %02x\n", state->mapper45_reg[3], |
| 10265 | 10265 | state->mapper45_reg[2], state->mapper45_reg[1], state->mapper45_reg[0])); |
| 10266 | | |
| 10266 | |
| 10267 | 10267 | state->mmc_prg_base = state->mapper45_reg[1]; |
| 10268 | 10268 | state->mmc_prg_mask = 0x3f ^ (state->mapper45_reg[3] & 0x3f); |
| 10269 | 10269 | state->mmc_chr_base = ((state->mapper45_reg[2] & 0xf0) << 4) | state->mapper45_reg[0]; |
| r8325 | r8326 | |
| 10273 | 10273 | state->mmc_chr_mask = 0; |
| 10274 | 10274 | else |
| 10275 | 10275 | state->mmc_chr_mask = 0xff; // i.e. we use the vrom_bank with no masking |
| 10276 | | |
| 10276 | |
| 10277 | 10277 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 10278 | 10278 | mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 10279 | 10279 | } |
| r8325 | r8326 | |
| 10281 | 10281 | } |
| 10282 | 10282 | |
| 10283 | 10283 | /************************************************************* |
| 10284 | | |
| 10284 | |
| 10285 | 10285 | BMC-SUPERHIK-4IN1 |
| 10286 | | |
| 10286 | |
| 10287 | 10287 | Known Boards: Unknown Multigame Bootleg Board |
| 10288 | 10288 | Games: Super HIK 4 in 1 |
| 10289 | | |
| 10289 | |
| 10290 | 10290 | iNES: mapper 49 |
| 10291 | | |
| 10291 | |
| 10292 | 10292 | In MESS: Supported. It also uses mmc3_irq. |
| 10293 | | |
| 10293 | |
| 10294 | 10294 | *************************************************************/ |
| 10295 | 10295 | |
| 10296 | 10296 | static WRITE8_HANDLER( bmc_hik4in1_m_w ) |
| 10297 | 10297 | { |
| 10298 | 10298 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 10299 | 10299 | LOG_MMC(("bmc_hik4in1_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 10300 | | |
| 10300 | |
| 10301 | 10301 | /* mid writes only work when WRAM is enabled. not sure if I should |
| 10302 | | change the condition to state->mmc_latch2==0x80 (i.e. what is the effect of |
| 10303 | | the read-only bit?) */ |
| 10302 | change the condition to state->mmc_latch2==0x80 (i.e. what is the effect of |
| 10303 | the read-only bit?) */ |
| 10304 | 10304 | if (state->mmc_latch2 & 0x80) |
| 10305 | 10305 | { |
| 10306 | 10306 | if (data & 0x01) /* if this is 0, then we have 32k PRG blocks */ |
| r8325 | r8326 | |
| 10311 | 10311 | } |
| 10312 | 10312 | else |
| 10313 | 10313 | prg32(space->machine, (data & 0x30) >> 4); |
| 10314 | | |
| 10314 | |
| 10315 | 10315 | state->mmc_chr_base = (data & 0xc0) << 1; |
| 10316 | 10316 | state->mmc_chr_mask = 0x7f; |
| 10317 | 10317 | mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| r8325 | r8326 | |
| 10319 | 10319 | } |
| 10320 | 10320 | |
| 10321 | 10321 | /************************************************************* |
| 10322 | | |
| 10322 | |
| 10323 | 10323 | BMC-BALLGAMES-11IN1 |
| 10324 | | |
| 10324 | |
| 10325 | 10325 | Known Boards: Unknown Multigame Bootleg Board |
| 10326 | 10326 | Games: 11 in 1 Ball Games |
| 10327 | | |
| 10327 | |
| 10328 | 10328 | iNES: mapper 51 |
| 10329 | | |
| 10329 | |
| 10330 | 10330 | In MESS: Partially Supported. |
| 10331 | | |
| 10331 | |
| 10332 | 10332 | *************************************************************/ |
| 10333 | 10333 | |
| 10334 | 10334 | static void bmc_ball11_set_banks( running_machine *machine ) |
| 10335 | 10335 | { |
| 10336 | 10336 | nes_state *state = (nes_state *)machine->driver_data; |
| 10337 | 10337 | set_nt_mirroring(machine, (state->mapper51_reg[0] == 3) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10338 | | |
| 10338 | |
| 10339 | 10339 | if (state->mapper51_reg[0] & 0x01) |
| 10340 | 10340 | { |
| 10341 | 10341 | prg32(machine, state->mapper51_reg[1]); |
| r8325 | r8326 | |
| 10350 | 10350 | static WRITE8_HANDLER( bmc_ball11_m_w ) |
| 10351 | 10351 | { |
| 10352 | 10352 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 10353 | | |
| 10353 | |
| 10354 | 10354 | LOG_MMC(("bmc_ball11_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 10355 | | |
| 10355 | |
| 10356 | 10356 | state->mapper51_reg[0] = ((data >> 1) & 0x01) | ((data >> 3) & 0x02); |
| 10357 | 10357 | bmc_ball11_set_banks(space->machine); |
| 10358 | 10358 | } |
| r8325 | r8326 | |
| 10360 | 10360 | static WRITE8_HANDLER( bmc_ball11_w ) |
| 10361 | 10361 | { |
| 10362 | 10362 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 10363 | | |
| 10363 | |
| 10364 | 10364 | LOG_MMC(("bmc_ball11_w, offset: %04x, data: %02x\n", offset, data)); |
| 10365 | | |
| 10365 | |
| 10366 | 10366 | switch (offset & 0x6000) |
| 10367 | 10367 | { |
| 10368 | 10368 | case 0x4000: // here we also update reg[0] upper bit |
| r8325 | r8326 | |
| 10377 | 10377 | } |
| 10378 | 10378 | |
| 10379 | 10379 | /************************************************************* |
| 10380 | | |
| 10380 | |
| 10381 | 10381 | BMC-MARIOPARTY-7IN1 |
| 10382 | | |
| 10382 | |
| 10383 | 10383 | Known Boards: Unknown Multigame Bootleg Board |
| 10384 | 10384 | Games: Mario 7 in 1 |
| 10385 | | |
| 10385 | |
| 10386 | 10386 | MMC3 clone |
| 10387 | | |
| 10387 | |
| 10388 | 10388 | iNES: mapper 52 |
| 10389 | | |
| 10389 | |
| 10390 | 10390 | In MESS: Supported. |
| 10391 | | |
| 10391 | |
| 10392 | 10392 | *************************************************************/ |
| 10393 | 10393 | |
| 10394 | 10394 | static WRITE8_HANDLER( bmc_mario7in1_m_w ) |
| r8325 | r8326 | |
| 10396 | 10396 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 10397 | 10397 | UINT8 map52_helper1, map52_helper2; |
| 10398 | 10398 | LOG_MMC(("bmc_mario7in1_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 10399 | | |
| 10399 | |
| 10400 | 10400 | /* mid writes only work when WRAM is enabled. not sure if I should |
| 10401 | | change the condition to state->mmc_latch2==0x80 (i.e. what is the effect of |
| 10402 | | the read-only bit?) and it only can happen once! */ |
| 10401 | change the condition to state->mmc_latch2==0x80 (i.e. what is the effect of |
| 10402 | the read-only bit?) and it only can happen once! */ |
| 10403 | 10403 | if ((state->mmc_latch2 & 0x80) && !state->map52_reg_written) |
| 10404 | 10404 | { |
| 10405 | 10405 | map52_helper1 = (data & 0x08); |
| 10406 | 10406 | map52_helper2 = (data & 0x40); |
| 10407 | | |
| 10407 | |
| 10408 | 10408 | state->mmc_prg_base = map52_helper1 ? ((data & 0x07) << 4) : ((data & 0x06) << 4); |
| 10409 | 10409 | state->mmc_prg_mask = map52_helper1 ? 0x0f : 0x1f; |
| 10410 | 10410 | state->mmc_chr_base = ((data & 0x20) << 4) | ((data & 0x04) << 6) | (map52_helper2 ? ((data & 0x10) << 3) : 0); |
| 10411 | 10411 | state->mmc_chr_mask = map52_helper2 ? 0x7f : 0xff; |
| 10412 | 10412 | mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 10413 | 10413 | mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask); |
| 10414 | | |
| 10414 | |
| 10415 | 10415 | state->map52_reg_written = 1; |
| 10416 | 10416 | } |
| 10417 | 10417 | else |
| r8325 | r8326 | |
| 10419 | 10419 | } |
| 10420 | 10420 | |
| 10421 | 10421 | /************************************************************* |
| 10422 | | |
| 10422 | |
| 10423 | 10423 | BMC-GOLDENCARD-6IN1 |
| 10424 | | |
| 10424 | |
| 10425 | 10425 | Known Boards: Unknown Bootleg Multigame Board |
| 10426 | 10426 | Games: Golden Card 6 in 1 |
| 10427 | | |
| 10427 | |
| 10428 | 10428 | MMC3 clone |
| 10429 | | |
| 10429 | |
| 10430 | 10430 | iNES: mapper 217 |
| 10431 | | |
| 10431 | |
| 10432 | 10432 | In MESS: Supported. |
| 10433 | | |
| 10433 | |
| 10434 | 10434 | *************************************************************/ |
| 10435 | 10435 | |
| 10436 | 10436 | // remove mask & base parameters! |
| r8325 | r8326 | |
| 10439 | 10439 | nes_state *state = (nes_state *)machine->driver_data; |
| 10440 | 10440 | state->mmc_prg_base = (state->map217_reg[1] & 0x08) ? 0 : (state->map217_reg[1] & 0x10); |
| 10441 | 10441 | state->mmc_prg_mask = (state->map217_reg[1] & 0x08) ? 0x1f : 0x0f; |
| 10442 | | |
| 10442 | |
| 10443 | 10443 | state->mmc_prg_base |= ((state->map217_reg[1] & 0x03) << 5); |
| 10444 | | |
| 10444 | |
| 10445 | 10445 | mmc3_set_prg(machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 10446 | 10446 | } |
| 10447 | 10447 | |
| r8325 | r8326 | |
| 10451 | 10451 | UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5; |
| 10452 | 10452 | int chr_base = (state->map217_reg[1] & 0x08) ? 0x00 : ((state->map217_reg[1] & 0x10) << 3); |
| 10453 | 10453 | int chr_mask = (state->map217_reg[1] & 0x08) ? 0xff : 0x7f; |
| 10454 | | |
| 10454 | |
| 10455 | 10455 | chr_base |= ((state->map217_reg[1] & 0x03) << 8); |
| 10456 | | |
| 10456 | |
| 10457 | 10457 | chr1_x(machine, chr_page ^ 0, chr_base | ((state->mmc_vrom_bank[0] & ~0x01) & chr_mask), chr); |
| 10458 | 10458 | chr1_x(machine, chr_page ^ 1, chr_base | ((state->mmc_vrom_bank[0] | 0x01) & chr_mask), chr); |
| 10459 | 10459 | chr1_x(machine, chr_page ^ 2, chr_base | ((state->mmc_vrom_bank[1] & ~0x01) & chr_mask), chr); |
| r8325 | r8326 | |
| 10470 | 10470 | UINT8 bank; |
| 10471 | 10471 | LOG_MMC(("bmc_gc6in1_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 10472 | 10472 | offset += 0x100; |
| 10473 | | |
| 10473 | |
| 10474 | 10474 | if (offset == 0x1000) |
| 10475 | 10475 | { |
| 10476 | 10476 | state->map217_reg[0] = data; |
| r8325 | r8326 | |
| 10500 | 10500 | UINT8 MMC3_helper, cmd; |
| 10501 | 10501 | static const UINT8 conv_table[8] = {0, 6, 3, 7, 5, 2, 4, 1}; |
| 10502 | 10502 | LOG_MMC(("bmc_gc6in1_w, offset: %04x, data: %02x\n", offset, data)); |
| 10503 | | |
| 10503 | |
| 10504 | 10504 | if (!state->map217_reg[2]) // in this case we act like MMC3, only with alt prg/chr handlers |
| 10505 | 10505 | { |
| 10506 | 10506 | switch (offset & 0x6001) |
| r8325 | r8326 | |
| 10508 | 10508 | case 0x0000: |
| 10509 | 10509 | MMC3_helper = state->mmc_latch1 ^ data; |
| 10510 | 10510 | state->mmc_latch1 = data; |
| 10511 | | |
| 10511 | |
| 10512 | 10512 | /* Has PRG Mode changed? */ |
| 10513 | 10513 | if (MMC3_helper & 0x40) |
| 10514 | 10514 | bmc_gc6in1_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 10515 | | |
| 10515 | |
| 10516 | 10516 | /* Has CHR Mode changed? */ |
| 10517 | 10517 | if (MMC3_helper & 0x80) |
| 10518 | 10518 | bmc_gc6in1_set_chr(space->machine, state->mmc_chr_source); |
| 10519 | 10519 | break; |
| 10520 | | |
| 10520 | |
| 10521 | 10521 | case 0x0001: |
| 10522 | 10522 | cmd = state->mmc_latch1 & 0x07; |
| 10523 | 10523 | switch (cmd) |
| r8325 | r8326 | |
| 10534 | 10534 | break; |
| 10535 | 10535 | } |
| 10536 | 10536 | break; |
| 10537 | | |
| 10537 | |
| 10538 | 10538 | default: |
| 10539 | 10539 | txrom_w(space, offset, data); |
| 10540 | 10540 | break; |
| r8325 | r8326 | |
| 10547 | 10547 | case 0x0000: |
| 10548 | 10548 | txrom_w(space, 0xc000, data); |
| 10549 | 10549 | break; |
| 10550 | | |
| 10550 | |
| 10551 | 10551 | case 0x0001: |
| 10552 | 10552 | data = (data & 0xc0) | conv_table[data & 0x07]; |
| 10553 | 10553 | MMC3_helper = state->mmc_latch1 ^ data; |
| 10554 | 10554 | state->mmc_latch1 = data; |
| 10555 | | |
| 10555 | |
| 10556 | 10556 | /* Has PRG Mode changed? */ |
| 10557 | 10557 | if (MMC3_helper & 0x40) |
| 10558 | 10558 | bmc_gc6in1_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask); |
| 10559 | | |
| 10559 | |
| 10560 | 10560 | /* Has CHR Mode changed? */ |
| 10561 | 10561 | if (MMC3_helper & 0x80) |
| 10562 | 10562 | bmc_gc6in1_set_chr(space->machine, state->mmc_chr_source); |
| 10563 | | |
| 10563 | |
| 10564 | 10564 | state->map217_reg[3] = 1; |
| 10565 | 10565 | break; |
| 10566 | | |
| 10566 | |
| 10567 | 10567 | case 0x2000: |
| 10568 | 10568 | cmd = state->mmc_latch1 & 0x07; |
| 10569 | 10569 | if (state->map217_reg[3]) |
| r8325 | r8326 | |
| 10584 | 10584 | } |
| 10585 | 10585 | } |
| 10586 | 10586 | break; |
| 10587 | | |
| 10588 | | |
| 10587 | |
| 10588 | |
| 10589 | 10589 | case 0x2001: |
| 10590 | 10590 | set_nt_mirroring(space->machine, BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10591 | 10591 | break; |
| 10592 | | |
| 10592 | |
| 10593 | 10593 | default: |
| 10594 | 10594 | txrom_w(space, offset, data); |
| 10595 | 10595 | break; |
| r8325 | r8326 | |
| 10598 | 10598 | } |
| 10599 | 10599 | |
| 10600 | 10600 | /************************************************************* |
| 10601 | | |
| 10601 | |
| 10602 | 10602 | BMC-FAMILY-4646B |
| 10603 | | |
| 10603 | |
| 10604 | 10604 | Known Boards: Unknown Multigame Bootleg Board (4646B) |
| 10605 | 10605 | Games: 2 in 1 - Family Kid & Aladdin 4 |
| 10606 | | |
| 10606 | |
| 10607 | 10607 | MMC3 clone |
| 10608 | | |
| 10608 | |
| 10609 | 10609 | iNES: mapper 134 |
| 10610 | | |
| 10610 | |
| 10611 | 10611 | In MESS: Supported. |
| 10612 | | |
| 10612 | |
| 10613 | 10613 | *************************************************************/ |
| 10614 | 10614 | |
| 10615 | 10615 | static WRITE8_HANDLER( bmc_family4646_m_w ) |
| 10616 | 10616 | { |
| 10617 | 10617 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 10618 | 10618 | LOG_MMC(("bmc_family4646_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 10619 | | |
| 10619 | |
| 10620 | 10620 | if (offset == 0x01) |
| 10621 | 10621 | { |
| 10622 | 10622 | state->mmc_prg_base = (data & 0x02) << 4; |
| r8325 | r8326 | |
| 10629 | 10629 | } |
| 10630 | 10630 | |
| 10631 | 10631 | /************************************************************* |
| 10632 | | |
| 10632 | |
| 10633 | 10633 | BMC-VT5201 |
| 10634 | | |
| 10634 | |
| 10635 | 10635 | *************************************************************/ |
| 10636 | 10636 | |
| 10637 | 10637 | static WRITE8_HANDLER( bmc_vt5201_w ) |
| 10638 | 10638 | { |
| 10639 | 10639 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 10640 | 10640 | LOG_MMC(("bmc_vt5201_w, offset: %04x, data: %02x\n", offset, data)); |
| 10641 | | |
| 10641 | |
| 10642 | 10642 | state->mmc_latch1 = BIT(offset, 8); |
| 10643 | | |
| 10644 | | // not sure about this mirroring bit!! |
| 10643 | |
| 10644 | // not sure about this mirroring bit!! |
| 10645 | 10645 | // without it TN 95 in 1 has glitches in Lunar Ball; with it TN 95 in 1 has glitches in Galaxian! |
| 10646 | 10646 | set_nt_mirroring(space->machine, BIT(data, 3) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10647 | 10647 | if (BIT(offset, 7)) |
| r8325 | r8326 | |
| 10658 | 10658 | { |
| 10659 | 10659 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 10660 | 10660 | LOG_MMC(("bmc_vt5201_r, offset: %04x\n", offset)); |
| 10661 | | // state->mmc_dipsetting = input_port_read(space->machine, "CARTDIPS"); |
| 10661 | // state->mmc_dipsetting = input_port_read(space->machine, "CARTDIPS"); |
| 10662 | 10662 | |
| 10663 | 10663 | if (state->mmc_latch1) |
| 10664 | 10664 | return state->mmc_dipsetting; // cart mode, depending on the Dip Switches (always zero atm, given we have no way to add cart-based DIPs) |
| r8325 | r8326 | |
| 10680 | 10680 | } |
| 10681 | 10681 | |
| 10682 | 10682 | /************************************************************* |
| 10683 | | |
| 10683 | |
| 10684 | 10684 | BMC-BS-5 |
| 10685 | | |
| 10685 | |
| 10686 | 10686 | Games: a few 4 in 1 multicarts |
| 10687 | | |
| 10687 | |
| 10688 | 10688 | *************************************************************/ |
| 10689 | 10689 | |
| 10690 | 10690 | static void bmc_bs5_update_banks( running_machine *machine ) |
| r8325 | r8326 | |
| 10706 | 10706 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 10707 | 10707 | UINT8 bs5_helper = (offset & 0xc00) >> 10; |
| 10708 | 10708 | LOG_MMC(("bmc_bs5_w, offset: %04x, data: %02x\n", offset, data)); |
| 10709 | | // state->mmc_dipsetting = input_port_read(space->machine, "CARTDIPS"); |
| 10710 | | |
| 10709 | // state->mmc_dipsetting = input_port_read(space->machine, "CARTDIPS"); |
| 10710 | |
| 10711 | 10711 | switch (offset & 0x7000) |
| 10712 | 10712 | { |
| 10713 | 10713 | case 0x0000: |
| r8325 | r8326 | |
| 10722 | 10722 | } |
| 10723 | 10723 | |
| 10724 | 10724 | /************************************************************* |
| 10725 | | |
| 10725 | |
| 10726 | 10726 | BMC-810544-C-A1 |
| 10727 | | |
| 10727 | |
| 10728 | 10728 | Games: 200-in-1 Elfland |
| 10729 | 10729 | |
| 10730 | 10730 | *************************************************************/ |
| r8325 | r8326 | |
| 10743 | 10743 | prg32(space->machine, bank); |
| 10744 | 10744 | |
| 10745 | 10745 | set_nt_mirroring(space->machine, BIT(data, 4) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10746 | | |
| 10746 | |
| 10747 | 10747 | chr8(space->machine, offset & 0x0f, CHRROM); |
| 10748 | 10748 | } |
| 10749 | 10749 | |
| r8325 | r8326 | |
| 10800 | 10800 | { STD_UN1ROM, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(un1rom_w), NULL, NULL, NULL }, |
| 10801 | 10801 | { STD_CPROM, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(cprom_w), NULL, NULL, NULL }, |
| 10802 | 10802 | { STD_CNROM, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(cnrom_w), NULL, NULL, NULL }, |
| 10803 | | { BANDAI_PT554, NES_NOACCESS, NES_WRITEONLY(bandai_pt554_m_w), NES_WRITEONLY(cnrom_w), NULL, NULL, NULL }, |
| 10803 | { BANDAI_PT554, NES_NOACCESS, NES_WRITEONLY(bandai_pt554_m_w), NES_WRITEONLY(cnrom_w), NULL, NULL, NULL }, |
| 10804 | 10804 | { STD_AXROM, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(axrom_w), NULL, NULL, NULL }, |
| 10805 | 10805 | { STD_PXROM, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(pxrom_w), mmc2_latch, NULL, NULL }, |
| 10806 | 10806 | { STD_FXROM, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(fxrom_w), mmc2_latch, NULL, NULL }, |
| r8325 | r8326 | |
| 10909 | 10909 | { SUBOR_TYPE0, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(subor0_w), NULL, NULL, NULL }, |
| 10910 | 10910 | { SUBOR_TYPE1, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(subor1_w), NULL, NULL, NULL }, |
| 10911 | 10911 | { MAGICSERIES_MD, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(magics_md_w), NULL, NULL, NULL }, |
| 10912 | | { NANJING_BOARD, {nanjing_l_w, nanjing_l_r}, NES_NOACCESS, NES_NOACCESS, NULL, NULL, nanjing_irq }, |
| 10912 | { NANJING_BOARD, {nanjing_l_w, nanjing_l_r}, NES_NOACCESS, NES_NOACCESS, NULL, NULL, nanjing_irq }, |
| 10913 | 10913 | { NITRA_TDA, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(nitra_w), NULL, NULL, mmc3_irq }, |
| 10914 | 10914 | { NTDEC_ASDER, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(ntdec_asder_w), NULL, NULL, NULL }, |
| 10915 | 10915 | { NTDEC_FIGHTINGHERO, NES_NOACCESS, NES_WRITEONLY(ntdec_fh_m_w), NES_NOACCESS, NULL, NULL, NULL }, |
| r8325 | r8326 | |
| 10924 | 10924 | { TENGEN_800008, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(tengen_800008_w), NULL, NULL, NULL }, |
| 10925 | 10925 | { TENGEN_800032, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(tengen_800032_w), NULL, NULL, tengen_800032_irq }, |
| 10926 | 10926 | { TENGEN_800037, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(tengen_800037_w), NULL, NULL, tengen_800032_irq }, |
| 10927 | | { TXC_22211A, {txc_22211_l_w, txc_22211_l_r}, NES_NOACCESS, NES_WRITEONLY(txc_22211_w), NULL, NULL, NULL }, |
| 10928 | | { TXC_22211B, {txc_22211_l_w, txc_22211_l_r}, NES_NOACCESS, NES_WRITEONLY(txc_22211b_w), NULL, NULL, NULL }, |
| 10929 | | { TXC_22211C, {txc_22211_l_w, txc_22211c_l_r}, NES_NOACCESS, NES_WRITEONLY(txc_22211_w), NULL, NULL, NULL }, |
| 10927 | { TXC_22211A, {txc_22211_l_w, txc_22211_l_r}, NES_NOACCESS, NES_WRITEONLY(txc_22211_w), NULL, NULL, NULL }, |
| 10928 | { TXC_22211B, {txc_22211_l_w, txc_22211_l_r}, NES_NOACCESS, NES_WRITEONLY(txc_22211b_w), NULL, NULL, NULL }, |
| 10929 | { TXC_22211C, {txc_22211_l_w, txc_22211c_l_r}, NES_NOACCESS, NES_WRITEONLY(txc_22211_w), NULL, NULL, NULL }, |
| 10930 | 10930 | { TXC_TW, NES_WRITEONLY(txc_tw_l_w), NES_WRITEONLY(txc_tw_m_w), NES_WRITEONLY(txc_tw_w), NULL, NULL, mmc3_irq }, |
| 10931 | | { TXC_STRIKEWOLF, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(txc_strikewolf_w), NULL, NULL, NULL }, |
| 10931 | { TXC_STRIKEWOLF, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(txc_strikewolf_w), NULL, NULL, NULL }, |
| 10932 | 10932 | { TXC_MXMDHTWO, NES_READONLY(txc_mxmdhtwo_l_r), NES_NOACCESS, NES_WRITEONLY(txc_mxmdhtwo_w), NULL, NULL, NULL }, |
| 10933 | 10933 | { WAIXING_TYPE_A, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(waixing_a_w), NULL, NULL, mmc3_irq }, |
| 10934 | 10934 | { WAIXING_TYPE_B, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(waixing_b_w), NULL, NULL, mmc3_irq }, |
| r8325 | r8326 | |
| 10948 | 10948 | { UNL_8237, NES_WRITEONLY(unl_8237_l_w), NES_NOACCESS, NES_WRITEONLY(unl_8237_w), NULL, NULL, mmc3_irq }, |
| 10949 | 10949 | { UNL_AX5705, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(unl_ax5705_w), NULL, NULL, NULL }, |
| 10950 | 10950 | { UNL_CC21, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(unl_cc21_w), NULL, NULL, NULL }, |
| 10951 | | { UNL_KOF97, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(unl_kof97_w), NULL, NULL, mmc3_irq }, |
| 10952 | | { UNL_T230, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(unl_t230_w), NULL, NULL, konami_irq }, |
| 10951 | { UNL_KOF97, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(unl_kof97_w), NULL, NULL, mmc3_irq }, |
| 10952 | { UNL_T230, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(unl_t230_w), NULL, NULL, konami_irq }, |
| 10953 | 10953 | { UNL_KOF96, {kof96_l_w, kof96_l_r}, NES_NOACCESS, NES_WRITEONLY(kof96_w), NULL, NULL, mmc3_irq }, |
| 10954 | 10954 | { UNL_MK2, NES_NOACCESS, NES_WRITEONLY(mk2_m_w), NES_NOACCESS, NULL, NULL, mmc3_irq }, |
| 10955 | 10955 | { UNL_N625092, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(n625092_w), NULL, NULL, NULL }, |
| r8325 | r8326 | |
| 11027 | 11027 | nes_state *state = (nes_state *)machine->driver_data; |
| 11028 | 11028 | int err = 0; |
| 11029 | 11029 | const nes_pcb_intf *intf = nes_pcb_intf_lookup(state->pcb_id); |
| 11030 | | |
| 11030 | |
| 11031 | 11031 | if (intf == NULL) |
| 11032 | 11032 | fatalerror("Missing PCB interface\n"); |
| 11033 | | |
| 11033 | |
| 11034 | 11034 | if (state->chr_chunks == 0) |
| 11035 | 11035 | chr8(machine, 0, CHRRAM); |
| 11036 | 11036 | else |
| 11037 | 11037 | chr8(machine, 0, CHRROM); |
| 11038 | | |
| 11038 | |
| 11039 | 11039 | /* Set the mapper irq callback */ |
| 11040 | 11040 | ppu2c0x_set_scanline_callback(state->ppu, intf ? intf->mmc_scanline : NULL); |
| 11041 | 11041 | ppu2c0x_set_hblank_callback(state->ppu, intf ? intf->mmc_hblank : NULL); |
| 11042 | | |
| 11042 | |
| 11043 | 11043 | err = unif_initialize(machine, state->pcb_id); |
| 11044 | | |
| 11044 | |
| 11045 | 11045 | return err; |
| 11046 | 11046 | } |
| 11047 | 11047 | |
| r8325 | r8326 | |
| 11051 | 11051 | |
| 11052 | 11052 | if (pcb == NULL) |
| 11053 | 11053 | fatalerror("Unimplemented PCB type %s\n", feature); |
| 11054 | | |
| 11054 | |
| 11055 | 11055 | return pcb->pcb_id; |
| 11056 | 11056 | } |
| 11057 | 11057 | |
| r8325 | r8326 | |
| 11059 | 11059 | { |
| 11060 | 11060 | nes_state *state = (nes_state *)machine->driver_data; |
| 11061 | 11061 | const nes_pcb_intf *intf = nes_pcb_intf_lookup(state->pcb_id); |
| 11062 | | |
| 11062 | |
| 11063 | 11063 | if (intf == NULL) |
| 11064 | 11064 | fatalerror("Missing PCB interface\n"); |
| 11065 | | |
| 11065 | |
| 11066 | 11066 | if (intf) |
| 11067 | 11067 | { |
| 11068 | 11068 | state->mmc_write_low = intf->mmc_l.write; |