src/mess/machine/nes_unif.c
| r0 | r6048 | |
| 1 | /***************************************************************************************** |
| 2 | |
| 3 | NES MMC Emulation - UNIF boards |
| 4 | |
| 5 | Very preliminary support for UNIF boards |
| 6 | |
| 7 | TODO: |
| 8 | - add more info |
| 9 | - test more images |
| 10 | - properly support mirroring, WRAM, etc. |
| 11 | |
| 12 | ****************************************************************************************/ |
| 13 | |
| 14 | /* CHRRAM sizes */ |
| 15 | enum |
| 16 | { |
| 17 | CHRRAM_0 = 0, |
| 18 | CHRRAM_1, |
| 19 | CHRRAM_2, |
| 20 | CHRRAM_4, |
| 21 | CHRRAM_6, |
| 22 | CHRRAM_8, |
| 23 | CHRRAM_16, |
| 24 | CHRRAM_32 |
| 25 | }; |
| 26 | |
| 27 | /* NT mirroring */ |
| 28 | enum |
| 29 | { |
| 30 | NT_X = 0, |
| 31 | NT_HORZ, // not hardwired, horizontal at start |
| 32 | NT_VERT, // not hardwired, vertical at start |
| 33 | NT_Y, |
| 34 | NT_1SCREEN, |
| 35 | NT_4SCR_2K, |
| 36 | NT_4SCR_4K |
| 37 | }; |
| 38 | |
| 39 | /* Boards */ |
| 40 | enum |
| 41 | { |
| 42 | STD_NROM = 0, |
| 43 | STD_AMROM, STD_ANROM, STD_AN1ROM, STD_AOROM, |
| 44 | STD_BNROM, STD_CNROM, STD_CPROM, |
| 45 | STD_DEROM, STD_DE1ROM, STD_DRROM, |
| 46 | STD_EKROM, STD_ELROM, STD_ETROM, STD_EWROM, |
| 47 | STD_FJROM, STD_FKROM, STD_GNROM, STD_HKROM, |
| 48 | STD_JLROM, STD_JSROM, STD_MHROM, STD_NTBROM, |
| 49 | STD_PEEOROM, STD_PNROM, |
| 50 | STD_SAROM, STD_SBROM, STD_SCROM, STD_SEROM, |
| 51 | STD_SFROM, STD_SGROM, STD_SHROM, STD_SJROM, |
| 52 | STD_SKROM, STD_SLROM, STD_SNROM, STD_SOROM, |
| 53 | STD_SUROM, STD_SXROM, |
| 54 | STD_TEROM, STD_TBROM, STD_TFROM, STD_TGROM, |
| 55 | STD_TKROM, STD_TLROM, STD_TNROM, STD_TR1ROM, |
| 56 | STD_TSROM, STD_TVROM, |
| 57 | STD_TKSROM, STD_TLSROM, STD_TQROM, |
| 58 | STD_UN1ROM, STD_UNROM, STD_UOROM, |
| 59 | HVC_FAMBASIC, NES_BTR, NES_QJ, NES_WH, NES_ZZ, |
| 60 | /* Active Enterprises */ |
| 61 | ACTENT_ACT52, |
| 62 | /* AGCI */ |
| 63 | AGCI_47516, AGCI_50282, |
| 64 | /* AVE */ |
| 65 | AVE_MB91, AVE_NINA01, AVE_NINA02, AVE_NINA03, |
| 66 | AVE_NINA06, AVE_NINA07, AVE_74161, |
| 67 | /* Bandai */ |
| 68 | BANDAI_74161, BANDAI_FCG1, BANDAI_FCG2, BANDAI_JUMP2, |
| 69 | BANDAI_LZ93D50_A, BANDAI_LZ93D50_B, BANDAI_PT554, |
| 70 | /* Caltron */ |
| 71 | CALTRON_6IN1, |
| 72 | /* Camerica */ |
| 73 | CAMERICA_ALGN, CAMERICA_ALGQ, |
| 74 | CAMERICA_9093, CAMERICA_9096, CAMERICA_9097, |
| 75 | /* Color Dreams */ |
| 76 | COLORDREAMS, |
| 77 | /* Irem */ |
| 78 | IREM_74161, IREM_G101, IREM_G101A, IREM_G101B, |
| 79 | IREM_HOLYDIV, |
| 80 | /* Jaleco */ |
| 81 | JALECO_JF01, JALECO_JF02, JALECO_JF03, JALECO_JF04, |
| 82 | JALECO_JF05, JALECO_JF06, JALECO_JF07, JALECO_JF08, |
| 83 | JALECO_JF09, JALECO_JF10, JALECO_JF11, JALECO_JF12, |
| 84 | JALECO_JF13, JALECO_JF14, JALECO_JF15, JALECO_JF16, |
| 85 | JALECO_JF17, JALECO_JF18, JALECO_JF19, JALECO_JF20, |
| 86 | JALECO_JF21, JALECO_JF22, JALECO_JF23, JALECO_JF24, |
| 87 | JALECO_JF25, JALECO_JF26, JALECO_JF27, JALECO_JF28, |
| 88 | JALECO_JF29, JALECO_JF30, JALECO_JF31, JALECO_JF32, |
| 89 | JALECO_JF33, JALECO_JF34, JALECO_JF35, JALECO_JF36, |
| 90 | JALECO_JF37, JALECO_JF38, JALECO_JF39, JALECO_JF40, |
| 91 | JALECO_JF41, |
| 92 | /* Konami */ |
| 93 | KONAMI_74139, |
| 94 | KONAMI_VRC1, KONAMI_VRC2, KONAMI_VRC3, |
| 95 | KONAMI_VRC4, KONAMI_VRC6, KONAMI_VRC7, |
| 96 | /* Namcot */ |
| 97 | NAMCOT_163, |
| 98 | NAMCOT_3425, NAMCOT_3433, NAMCOT_3443, NAMCOT_3446, |
| 99 | /* NTDEC */ |
| 100 | NTDEC_N715062, |
| 101 | /* Rex Soft */ |
| 102 | REXSOFT_SL1632, |
| 103 | /* Sachen */ |
| 104 | SACHEN_8259A, SACHEN_8259B, SACHEN_8259C, |
| 105 | SACHEN_8259D, SACHEN_SA0036, SACHEN_SA0037, |
| 106 | SACHEN_SA0161M, SACHEN_SA72007, SACHEN_SA72008, |
| 107 | SACHEN_TCA01, SACHEN_TCU01, SACHEN_TCU02, SACHEN_74LS374, |
| 108 | /* Sunsoft */ |
| 109 | SUNSOFT_1, SUNSOFT_2B, SUNSOFT_3, SUNSOFT_4, |
| 110 | SUNSOFT_5B, SUNSOFT_FME7, |
| 111 | /* Taito */ |
| 112 | TAITO_74139, TAITO_74161, |
| 113 | TAITO_TC0190FMC, TAITO_TC0190FMCP, TAITO_X1005, TAITO_X1017, |
| 114 | /* Tengen */ |
| 115 | TENGEN_800002, TENGEN_800004, TENGEN_800008, |
| 116 | TENGEN_800030, TENGEN_800032, TENGEN_800037, TENGEN_800042, |
| 117 | /* TXC */ |
| 118 | TXC_22211A, |
| 119 | /* Multigame Carts */ |
| 120 | BMC_HIK8IN1, |
| 121 | /* Unlicensed */ |
| 122 | UNL_N625092, UNL_SMB2J |
| 123 | }; |
| 124 | |
| 125 | |
| 126 | /************************************************************* |
| 127 | |
| 128 | unif_list |
| 129 | |
| 130 | Supported UNIF boards and corresponding handlers |
| 131 | |
| 132 | *************************************************************/ |
| 133 | |
| 134 | static const unif unif_list[] = |
| 135 | { |
| 136 | /* UNIF LOW_W, LOW_R, MED_W, HIGH_W, PPU_latch, scanline CB, hblank CB PRG CHR NVW WRAM CRAM NMT IDX*/ |
| 137 | { "ACCLAIM-AOROM", NULL, NULL, NULL, mapper7_w, NULL, NULL, NULL, 16, 0, 0, 0, CHRRAM_8, NT_Y, STD_AOROM}, |
| 138 | { "ACCLAIM-MC-ACC", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 0, CHRRAM_0, NT_X, STD_TLROM}, |
| 139 | { "ACCLAIM-TLROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 0, CHRRAM_0, NT_X, STD_TLROM}, |
| 140 | { "AGCI-47516", NULL, NULL, NULL, mapper11_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_X, AGCI_47516}, |
| 141 | { "AGCI-50282", NULL, NULL, NULL, mapper144_w, NULL, NULL, NULL, 4, 8, 0, 0, CHRRAM_0, NT_X, AGCI_50282}, |
| 142 | { "AVE-74*161", NULL, NULL, NULL, mapper3_w, NULL, NULL, NULL, 2, 256, 8, 0, CHRRAM_0, NT_X, AVE_74161}, |
| 143 | { "AVE-MB-91", mapper79_l_w, NULL, NULL, NULL, NULL, NULL, NULL, 4, 8, 0, 0, CHRRAM_0, NT_X, AVE_MB91}, |
| 144 | { "AVE-NINA-01", NULL, NULL, mapper34_m_w, mapper34_w, NULL, NULL, NULL, 4, 8, 8, 0, CHRRAM_0, NT_X, AVE_NINA01}, |
| 145 | { "AVE-NINA-02", NULL, NULL, mapper34_m_w, mapper34_w, NULL, NULL, NULL, 4, 8, 8, 0, CHRRAM_0, NT_X, AVE_NINA02}, |
| 146 | { "AVE-NINA-03", mapper79_l_w, NULL, NULL, NULL, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, AVE_NINA03}, |
| 147 | { "AVE-NINA-06", mapper79_l_w, NULL, NULL, NULL, NULL, NULL, NULL, 4, 8, 0, 0, CHRRAM_0, NT_X, AVE_NINA06}, |
| 148 | { "AVE-NINA-07", NULL, NULL, NULL, mapper11_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_X, AVE_NINA07}, |
| 149 | { "BANDAI-74*161/161/32", NULL, NULL, NULL, mapper70_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_X, BANDAI_74161}, |
| 150 | { "BANDAI-CNROM", NULL, NULL, NULL, mapper3_w, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, STD_CNROM}, |
| 151 | { "BANDAI-FCG-1", NULL, NULL, mapper153_m_w, mapper153_w, NULL,NULL, bandai_irq, 16, 32, 0, 0, CHRRAM_0, NT_VERT, BANDAI_FCG1}, |
| 152 | { "BANDAI-FCG-2", NULL, NULL, mapper153_m_w, mapper153_w, NULL,NULL, bandai_irq, 16, 32, 0, 0, CHRRAM_0, NT_VERT, BANDAI_FCG2}, |
| 153 | { "BANDAI-GNROM", NULL, NULL, NULL, mapper66_w, NULL, NULL, NULL, 8, 4, 0, 0, CHRRAM_0, NT_X, STD_GNROM}, |
| 154 | { "BANDAI-JUMP2", NULL, NULL, mapper153_m_w, mapper153_w, NULL,NULL, bandai_irq, 32, 0, 8, 0, CHRRAM_8, NT_VERT, BANDAI_JUMP2}, |
| 155 | { "BANDAI-LZ93D50+24C01", NULL, NULL, mapper16_m_w, mapper16_w, NULL,NULL, bandai_irq, 16, 32, 0, 0, CHRRAM_0, NT_VERT, BANDAI_LZ93D50_A}, |
| 156 | { "BANDAI-LZ93D50+24C02", NULL, NULL, mapper16_m_w, mapper16_w, NULL,NULL, bandai_irq, 16, 32, 0, 0, CHRRAM_0, NT_VERT, BANDAI_LZ93D50_B}, |
| 157 | { "BANDAI-NROM-128", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 158 | { "BANDAI-NROM-256", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 159 | { "BANDAI-PT-554", NULL, NULL, NULL, mapper3_w, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, BANDAI_PT554}, |
| 160 | // { "BMC-13in1JY110", } |
| 161 | // { "BMC-190IN1", [unif only!!] 8, 8, 0, 0, CHRRAM_0, NT_VERT, BMC_190IN1}, |
| 162 | // { "BMC-42IN1RESETSWITCH", [mapper 60 - unsupported]}, |
| 163 | // { "BMC-64IN1NOREPEAT", [unif only!!] 64, 64, 0, 0, CHRRAM_0, NT_VERT, BMC_64IN1NR}, |
| 164 | // { "BMC-70IN1", [mapper 236 - unsupported]}, |
| 165 | // { "BMC-70IN1B", [mapper 236 - unsupported]}, |
| 166 | // { "BMC-8157", [unif only!!] 32, 0, 0, 0, CHRRAM_8, NT_VERT, BMC_8157}, |
| 167 | // { "BMC-A65AS", [unif only!!] 32, 0, 0, 0, CHRRAM_8, NT_VERT, BMC_A65AS}, |
| 168 | // { "BMC-BS-5", [unif only!!] 8, 8, 0, 0, CHRRAM_0, NT_VERT, BENSHENG_BS5}, |
| 169 | // { "BMC-D1038", [mapper 60 - unsupported]}, |
| 170 | // { "BMC-FK23C", [unif only!!] 64, 128, 0, 0, CHRRAM_0, NT_X, BMC_FK23C}, |
| 171 | // { "BMC-FK23CA", }, |
| 172 | // { "BMC-GHOSTBUSTERS63IN1", [unif only!!] 128, 0, 0, 0, CHRRAM_8, NT_HORZ, BMC_G63IN1}, |
| 173 | // { "BMC-GK-192", } |
| 174 | // { "BMC-GS-2004", [unif only!!] 32, 0, 0, 0, CHRRAM_8, NT_X, RCM_GS2004}, |
| 175 | // { "BMC-GS-2013", [unif only!!] 32, 0, 0, 0, CHRRAM_8, NT_X, RCM_GS2013}, |
| 176 | // { "BMC-NOVELDIAMOND9999999IN1", [mapper 54 - unsupported]}, |
| 177 | // { "BMC-SUPER24IN1SC03", [unif only!!] 256, 256, 8, 0, CHRRAM_8, NT_X, BMC_S24IN1}, |
| 178 | { "BMC-SUPERHIK8IN1", NULL, NULL, mapper45_m_w, mapper4_w, NULL, NULL, mapper4_irq, 256, 256, 8, 0, CHRRAM_0, NT_X, BMC_HIK8IN1}, |
| 179 | // { "BMC-SUPERVISION16IN1", [mapper 53 - unsupported]}, |
| 180 | // { "BMC-T-262", [unif only!!] 64, 0, 0, 0, CHRRAM_8, NT_VERT, BMC_T262}, |
| 181 | // { "BMC-WS", [unif only!!] 8, 8, 0, 0, CHRRAM_0, NT_VERT, BMC_S40IN1}, |
| 182 | // { "BTL-MARIO1-MALEE2", [mapper 55 - unsupported]}, |
| 183 | { "CAMERICA-ALGN", NULL, NULL, NULL, mapper71_w, NULL, NULL, NULL, 16, 0, 0, 0, CHRRAM_8, NT_X, CAMERICA_ALGN}, |
| 184 | { "CAMERICA-ALGQ", NULL, NULL, mapper232_w, mapper232_w, NULL, NULL, NULL, 16, 0, 0, 0, CHRRAM_8, NT_X, CAMERICA_ALGQ}, |
| 185 | { "CAMERICA-BF9093", NULL, NULL, NULL, mapper71_w, NULL, NULL, NULL, 16, 0, 0, 0, CHRRAM_8, NT_X, CAMERICA_9093}, |
| 186 | { "CAMERICA-BF9096", NULL, NULL, mapper232_w, mapper232_w, NULL, NULL, NULL, 16, 0, 0, 0, CHRRAM_8, NT_X, CAMERICA_9096}, |
| 187 | { "CAMERICA-BF9097", NULL, NULL, NULL, mapper71_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_Y, CAMERICA_9097}, |
| 188 | { "CAMERICA-GAMEGENIE", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 189 | { "COLORDREAMS-74*377", NULL, NULL, NULL, mapper11_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_X, COLORDREAMS}, |
| 190 | // { "DREAMTECH01", [unif only!!] 16, 0, 0, 0, CHRRAM_8, NT_X, DREAMTECH}, |
| 191 | { "HVC-AMROM", NULL, NULL, NULL, mapper7_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_Y, STD_AMROM}, |
| 192 | { "HVC-AN1ROM", NULL, NULL, NULL, mapper7_w, NULL, NULL, NULL, 4, 0, 0, 0, CHRRAM_8, NT_Y, STD_AN1ROM}, |
| 193 | { "HVC-ANROM", NULL, NULL, NULL, mapper7_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_Y, STD_ANROM}, |
| 194 | { "HVC-AOROM", NULL, NULL, NULL, mapper7_w, NULL, NULL, NULL, 16, 0, 0, 0, CHRRAM_8, NT_Y, STD_AOROM}, |
| 195 | { "HVC-BNROM", NULL, NULL, mapper34_m_w, mapper34_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_X, STD_BNROM}, |
| 196 | { "HVC-CNROM", NULL, NULL, NULL, mapper3_w, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, STD_CNROM}, |
| 197 | { "HVC-CPROM", NULL, NULL, NULL, mapper13_w, NULL, NULL, NULL, 2, 0, 0, 0, CHRRAM_16, NT_X, STD_CPROM}, |
| 198 | { "HVC-DE1ROM", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_X, STD_DE1ROM}, |
| 199 | { "HVC-DEROM", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 4, 8, 0, 0, CHRRAM_0, NT_X, STD_DEROM}, |
| 200 | { "HVC-DRROM", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_4SCR_2K, STD_DRROM}, |
| 201 | { "HVC-EKROM", mapper5_l_w, mapper5_l_r, NULL, mapper5_w, NULL, NULL, mapper5_irq, 32, 64, 8, 0, CHRRAM_0, NT_X, STD_EKROM}, |
| 202 | { "HVC-ELROM", mapper5_l_w, mapper5_l_r, NULL, mapper5_w, NULL, NULL, mapper5_irq, 32, 64, 0, 0, CHRRAM_0, NT_X, STD_ELROM}, |
| 203 | { "HVC-ETROM", mapper5_l_w, mapper5_l_r, NULL, mapper5_w, NULL, NULL, mapper5_irq, 32, 64, 8, 8, CHRRAM_0, NT_X, STD_ETROM}, |
| 204 | { "HVC-EWROM", mapper5_l_w, mapper5_l_r, NULL, mapper5_w, NULL, NULL, mapper5_irq, 32, 64, 32, 0, CHRRAM_0, NT_X, STD_EWROM}, |
| 205 | { "HVC-FAMILYBASIC", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 2, 0, CHRRAM_0, NT_X, HVC_FAMBASIC}, |
| 206 | { "HVC-FJROM", NULL, NULL, NULL, mapper10_w, mapper9_latch, NULL, NULL, 8, 16, 8, 0, CHRRAM_0, NT_VERT, STD_FJROM}, |
| 207 | { "HVC-FKROM", NULL, NULL, NULL, mapper10_w, mapper9_latch, NULL, NULL, 16, 16, 8, 0, CHRRAM_0, NT_VERT, STD_FKROM}, |
| 208 | { "HVC-GNROM", NULL, NULL, NULL, mapper66_w, NULL, NULL, NULL, 8, 4, 0, 0, CHRRAM_0, NT_X, STD_GNROM}, |
| 209 | { "HVC-HKROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 0, CHRRAM_0, NT_VERT, STD_HKROM}, |
| 210 | { "HVC-HROM", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 211 | { "HVC-JLROM", NULL, NULL, NULL, mapper69_w, NULL, NULL, mapper69_irq, 16, 32, 0, 0, CHRRAM_0, NT_VERT, STD_JLROM}, |
| 212 | { "HVC-JSROM", NULL, NULL, NULL, mapper69_w, NULL, NULL, mapper69_irq, 16, 32, 8, 0, CHRRAM_0, NT_VERT, STD_JSROM}, |
| 213 | { "HVC-MHROM", NULL, NULL, NULL, mapper66_w, NULL, NULL, NULL, 4, 4, 0, 0, CHRRAM_0, NT_X, STD_MHROM}, |
| 214 | { "HVC-NROM", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 215 | { "HVC-NROM-128", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 216 | { "HVC-NROM-256", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 217 | { "HVC-NTBROM", NULL, NULL, NULL, mapper68_w, NULL, NULL, NULL, 16, 16, 8, 0, CHRRAM_0, NT_VERT, STD_NTBROM}, |
| 218 | { "HVC-PEEOROM", NULL, NULL, NULL, mapper9_w, mapper9_latch, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_VERT, STD_PEEOROM}, |
| 219 | { "HVC-PNROM", NULL, NULL, NULL, mapper9_w, mapper9_latch, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_VERT, STD_PNROM}, |
| 220 | { "HVC-RROM", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 221 | { "HVC-RROM-128", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 222 | { "HVC-SAROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 4, 8, 8, 0, CHRRAM_0, NT_HORZ, STD_SAROM}, |
| 223 | { "HVC-SBROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 4, 8, 0, 0, CHRRAM_0, NT_HORZ, STD_SBROM}, |
| 224 | { "HVC-SC1ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 4, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SCROM}, |
| 225 | { "HVC-SCROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 4, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SCROM}, |
| 226 | { "HVC-SEROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 2, 8, 0, 0, CHRRAM_0, NT_HORZ, STD_SEROM}, |
| 227 | { "HVC-SF1ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 8, 0, 0, CHRRAM_0, NT_HORZ, STD_SFROM}, |
| 228 | { "HVC-SFROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 8, 0, 0, CHRRAM_0, NT_HORZ, STD_SFROM}, |
| 229 | { "HVC-SGROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 0, 0, 0, CHRRAM_8, NT_HORZ, STD_SGROM}, |
| 230 | { "HVC-SH1ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 2, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SHROM}, |
| 231 | { "HVC-SHROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 2, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SHROM}, |
| 232 | { "HVC-SJROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 8, 8, 0, CHRRAM_0, NT_HORZ, STD_SJROM}, |
| 233 | { "HVC-SKROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 16, 8, 0, CHRRAM_0, NT_HORZ, STD_SKROM}, |
| 234 | { "HVC-SL1ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SLROM}, |
| 235 | { "HVC-SL2ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SLROM}, |
| 236 | { "HVC-SL3ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SLROM}, |
| 237 | { "HVC-SLROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SLROM}, |
| 238 | { "HVC-SLRROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SLROM}, |
| 239 | { "HVC-SNROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 0, 8, 0, CHRRAM_8, NT_HORZ, STD_SNROM}, |
| 240 | { "HVC-SOROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 0, 8, 8, CHRRAM_8, NT_HORZ, STD_SOROM}, |
| 241 | { "HVC-SROM", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 242 | { "HVC-STROM", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 243 | { "HVC-SUROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 32, 0, 8, 0, CHRRAM_8, NT_HORZ, STD_SUROM}, |
| 244 | { "HVC-SXROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 32, 0, 32, 0, CHRRAM_8, NT_HORZ, STD_SXROM}, |
| 245 | { "HVC-TBROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 4, 8, 0, 0, CHRRAM_0, NT_X, STD_TBROM}, |
| 246 | { "HVC-TEROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 2, 8, 0, 0, CHRRAM_0, NT_X, STD_TEROM}, |
| 247 | { "HVC-TFROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 8, 0, 0, CHRRAM_0, NT_X, STD_TFROM}, |
| 248 | { "HVC-TGROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 0, 0, 0, CHRRAM_8, NT_X, STD_TGROM}, |
| 249 | { "HVC-TKROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 8, 0, CHRRAM_0, NT_X, STD_TKROM}, |
| 250 | { "HVC-TKSROM", NULL, NULL, NULL, mapper118_w, NULL, NULL, mapper4_irq, 32, 16, 8, 0, CHRRAM_0, NT_Y, STD_TKSROM}, |
| 251 | { "HVC-TL1ROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 0, CHRRAM_0, NT_X, STD_TLROM}, |
| 252 | { "HVC-TL2ROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 0, CHRRAM_0, NT_X, STD_TLROM}, |
| 253 | { "HVC-TLROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 0, CHRRAM_0, NT_X, STD_TLROM}, |
| 254 | { "HVC-TLSROM", NULL, NULL, NULL, mapper118_w, NULL, NULL, mapper4_irq, 32, 16, 0, 0, CHRRAM_0, NT_Y, STD_TLSROM}, |
| 255 | { "HVC-TNROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 0, 8, 0, CHRRAM_8, NT_X, STD_TNROM}, |
| 256 | { "HVC-TQROM", NULL, NULL, NULL, mapper119_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_8, NT_VERT, STD_TQROM}, |
| 257 | { "HVC-TR1ROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 8, 0, 0, CHRRAM_0, NT_4SCR_4K, STD_TR1ROM}, |
| 258 | { "HVC-TSROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 8, CHRRAM_0, NT_X, STD_TSROM}, |
| 259 | { "HVC-TVROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 4, 8, 0, 0, CHRRAM_0, NT_4SCR_4K, STD_TVROM}, |
| 260 | { "HVC-UN1ROM", NULL, NULL, NULL, mapper94_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_X, STD_UN1ROM}, |
| 261 | { "HVC-UNROM", NULL, NULL, NULL, mapper2_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_X, STD_UNROM}, |
| 262 | { "HVC-UOROM", NULL, NULL, NULL, mapper2_w, NULL, NULL, NULL, 16, 0, 0, 0, CHRRAM_8, NT_X, STD_UOROM}, |
| 263 | { "IREM-74*161/161/21/138", NULL, NULL, NULL, mapper77_w, NULL, NULL, NULL, 8, 4, 0, 0, CHRRAM_6, NT_4SCR_2K, IREM_74161}, |
| 264 | { "IREM-BNROM", NULL, NULL, mapper34_m_w, mapper34_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_X, STD_BNROM}, |
| 265 | { "IREM-G101", NULL, NULL, NULL, mapper32_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_VERT, IREM_G101}, |
| 266 | { "IREM-G101-A", NULL, NULL, NULL, mapper32_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_VERT, IREM_G101A}, |
| 267 | { "IREM-G101-B", NULL, NULL, NULL, mapper32_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_Y, IREM_G101B}, |
| 268 | // there are also variants with 8K NVWRAM |
| 269 | { "IREM-HOLYDIVER", NULL, NULL, NULL, mapper78_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_HORZ, IREM_HOLYDIV}, |
| 270 | { "IREM-NROM-128", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 271 | { "IREM-NROM-256", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 272 | { "IREM-UNROM", NULL, NULL, NULL, mapper2_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_X, STD_UNROM}, |
| 273 | { "JALECO-JF-01", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, 0, 0, CHRRAM_0, NT_X, JALECO_JF01}, |
| 274 | { "JALECO-JF-02", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, 0, 0, CHRRAM_0, NT_X, JALECO_JF02}, |
| 275 | { "JALECO-JF-03", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, 0, 0, CHRRAM_0, NT_X, JALECO_JF03}, |
| 276 | { "JALECO-JF-04", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, 0, 0, CHRRAM_0, NT_X, JALECO_JF04}, |
| 277 | { "JALECO-JF-05", NULL, NULL, mapper87_m_w, NULL, NULL, NULL, NULL, 1, 2, 0, 0, CHRRAM_0, NT_X, JALECO_JF05}, |
| 278 | { "JALECO-JF-06", NULL, NULL, mapper87_m_w, NULL, NULL, NULL, NULL, 1, 2, 0, 0, CHRRAM_0, NT_X, JALECO_JF06}, |
| 279 | { "JALECO-JF-07", NULL, NULL, mapper87_m_w, NULL, NULL, NULL, NULL, 2, 2, 0, 0, CHRRAM_0, NT_X, JALECO_JF07}, |
| 280 | { "JALECO-JF-08", NULL, NULL, mapper87_m_w, NULL, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, JALECO_JF08}, |
| 281 | { "JALECO-JF-09", NULL, NULL, mapper87_m_w, NULL, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, JALECO_JF09}, |
| 282 | { "JALECO-JF-10", NULL, NULL, mapper87_m_w, NULL, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, JALECO_JF10}, |
| 283 | { "JALECO-JF-11", NULL, NULL, mapper_140_m_w, NULL, NULL, NULL, NULL, 8, 4, 0, 0, CHRRAM_0, NT_X, JALECO_JF11}, |
| 284 | { "JALECO-JF-12", NULL, NULL, mapper_140_m_w, NULL, NULL, NULL, NULL, 8, 4, 0, 0, CHRRAM_0, NT_X, JALECO_JF12}, |
| 285 | { "JALECO-JF-13", NULL, NULL, mapper86_m_w, NULL, NULL, NULL, NULL, 8, 4, 0, 0, CHRRAM_0, NT_X, JALECO_JF13}, |
| 286 | { "JALECO-JF-14", NULL, NULL, mapper_140_m_w, NULL, NULL, NULL, NULL, 8, 4, 0, 0, CHRRAM_0, NT_X, JALECO_JF14}, |
| 287 | { "JALECO-JF-15", NULL, NULL, NULL, mapper2_w, NULL, NULL, NULL, 16, 0, 0, 0, CHRRAM_8, NT_X, JALECO_JF15}, |
| 288 | { "JALECO-JF-16", NULL, NULL, NULL, mapper78_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_Y, JALECO_JF16}, |
| 289 | { "JALECO-JF-17", NULL, NULL, NULL, mapper72_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_X, JALECO_JF17}, |
| 290 | { "JALECO-JF-18", NULL, NULL, NULL, mapper2_w, NULL, NULL, NULL, 16, 0, 0, 0, CHRRAM_8, NT_X, JALECO_JF18}, |
| 291 | { "JALECO-JF-19", NULL, NULL, NULL, mapper92_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_X, JALECO_JF19}, |
| 292 | { "JALECO-JF-20", NULL, NULL, NULL, mapper75_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_VERT, JALECO_JF20}, |
| 293 | { "JALECO-JF-21", NULL, NULL, NULL, mapper92_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_X, JALECO_JF21}, |
| 294 | { "JALECO-JF-22", NULL, NULL, NULL, mapper75_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_VERT, JALECO_JF22}, |
| 295 | { "JALECO-JF-23", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF23}, |
| 296 | { "JALECO-JF-24", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 8, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF24}, |
| 297 | { "JALECO-JF-25", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 8, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF25}, |
| 298 | { "JALECO-JF-26", NULL, NULL, NULL, mapper72_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_X, JALECO_JF26}, |
| 299 | { "JALECO-JF-27", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 8, 16, 8, 0, CHRRAM_0, NT_HORZ, JALECO_JF27}, |
| 300 | { "JALECO-JF-28", NULL, NULL, NULL, mapper72_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_X, JALECO_JF28}, |
| 301 | { "JALECO-JF-29", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF29}, |
| 302 | { "JALECO-JF-30", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 8, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF30}, |
| 303 | { "JALECO-JF-31", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 8, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF31}, |
| 304 | { "JALECO-JF-32", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 8, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF32}, |
| 305 | { "JALECO-JF-33", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF33}, |
| 306 | { "JALECO-JF-34", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 8, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF34}, |
| 307 | { "JALECO-JF-35", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 8, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF35}, |
| 308 | { "JALECO-JF-36", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 8, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF36}, |
| 309 | { "JALECO-JF-37", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 8, 32, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF37}, |
| 310 | { "JALECO-JF-38", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 8, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF38}, |
| 311 | { "JALECO-JF-39", NULL, NULL, NULL, mapper2_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_X, JALECO_JF39}, |
| 312 | { "JALECO-JF-40", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 8, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF40}, |
| 313 | { "JALECO-JF-41", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, JALECO_JF41}, |
| 314 | { "KONAMI-74*139/74", NULL, NULL, mapper87_m_w, NULL, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, KONAMI_74139}, |
| 315 | { "KONAMI-CNROM", NULL, NULL, NULL, mapper3_w, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, STD_CNROM}, |
| 316 | { "KONAMI-NROM-128", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 317 | // { "KONAMI-QTAI", } |
| 318 | { "KONAMI-SLROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SLROM}, |
| 319 | { "KONAMI-TLROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 0, CHRRAM_0, NT_X, STD_TLROM}, |
| 320 | { "KONAMI-UNROM", NULL, NULL, NULL, mapper2_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_X, STD_UNROM}, |
| 321 | { "KONAMI-VRC-1", NULL, NULL, NULL, mapper75_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_VERT, KONAMI_VRC1}, |
| 322 | { "KONAMI-VRC-2", NULL, NULL, NULL, konami_vrc2a_w, NULL, NULL, NULL, 8, 32, 0, 0, CHRRAM_0, NT_VERT, KONAMI_VRC2}, |
| 323 | // variant 2b (mapper 23) exists! how to distinguish?!? NULL, NULL, NULL, konami_vrc2b_w, NULL, NULL, konami_irq |
| 324 | { "KONAMI-VRC-3", NULL, NULL, NULL, mapper73_w, NULL, NULL, konami_irq, 8, 0, 8, 0, CHRRAM_8, NT_X, KONAMI_VRC3}, |
| 325 | { "KONAMI-VRC-4", NULL, NULL, NULL, konami_vrc4_w, NULL, NULL, konami_irq, 16, 32, 0, 0, CHRRAM_0, NT_VERT, KONAMI_VRC4}, |
| 326 | // exist also variants with 2 & 8 NVWRAM! |
| 327 | { "KONAMI-VRC-6", NULL, NULL, NULL, konami_vrc6a_w, NULL, NULL, konami_irq, 16, 32, 0, 0, CHRRAM_0, NT_VERT, KONAMI_VRC6}, |
| 328 | // variant 6b (mapper 26) exists! how to distinguish?!? NULL, NULL, NULL, konami_vrc6b_w, NULL, NULL, konami_irq |
| 329 | // exist also variants with 8 NVWRAM! |
| 330 | { "KONAMI-VRC-7", NULL, NULL, NULL, konami_vrc7_w, NULL, NULL, konami_irq, 32, 32, 0, 0, CHRRAM_0, NT_VERT, KONAMI_VRC7}, |
| 331 | // exist also variants with 8 NVWRAM! |
| 332 | { "MLT-ACTION52", NULL, NULL, NULL, mapper228_w, NULL, NULL, NULL, 128, 64, 0, 0, CHRRAM_0, NT_VERT, ACTENT_ACT52}, |
| 333 | { "MLT-CALTRON6IN1", NULL, NULL, mapper41_m_w, mapper41_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_VERT, CALTRON_6IN1}, |
| 334 | // { "MLT-MAXI15", [mapper 234 - unsupported]}, |
| 335 | { "NAMCOT-163", mapper19_l_w, mapper19_l_r, NULL, mapper19_w, NULL, NULL, namcot_irq,32, 32, 0, 0, CHRRAM_0, NT_X, NAMCOT_163}, |
| 336 | // exist also variants with 8 NVWRAM |
| 337 | { "NAMCOT-3301", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 338 | { "NAMCOT-3302", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 339 | { "NAMCOT-3303", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 340 | { "NAMCOT-3305", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 341 | { "NAMCOT-3311", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 342 | { "NAMCOT-3401", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_X, STD_DE1ROM}, |
| 343 | { "NAMCOT-3405", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_X, STD_DE1ROM}, |
| 344 | { "NAMCOT-3406", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_X, STD_DE1ROM}, |
| 345 | { "NAMCOT-3407", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_X, STD_DE1ROM}, |
| 346 | { "NAMCOT-3411", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 347 | { "NAMCOT-3413", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_X, STD_DE1ROM}, |
| 348 | { "NAMCOT-3414", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_X, STD_DE1ROM}, |
| 349 | { "NAMCOT-3415", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_X, STD_DE1ROM}, |
| 350 | { "NAMCOT-3416", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_X, STD_DE1ROM}, |
| 351 | { "NAMCOT-3417", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_X, STD_DE1ROM}, |
| 352 | { "NAMCOT-3425", NULL, NULL, NULL, mapper95_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_Y, NAMCOT_3425}, |
| 353 | { "NAMCOT-3433", NULL, NULL, NULL, mapper88_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_HORZ, NAMCOT_3433}, |
| 354 | { "NAMCOT-3443", NULL, NULL, NULL, mapper88_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_VERT, NAMCOT_3443}, |
| 355 | { "NAMCOT-3446", NULL, NULL, NULL, mapper76_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_X, NAMCOT_3446}, |
| 356 | { "NAMCOT-3451", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_X, STD_DE1ROM}, |
| 357 | { "NES-AMROM", NULL, NULL, NULL, mapper7_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_Y, STD_AMROM}, |
| 358 | { "NES-AN1ROM", NULL, NULL, NULL, mapper7_w, NULL, NULL, NULL, 4, 0, 0, 0, CHRRAM_8, NT_Y, STD_AN1ROM}, |
| 359 | { "NES-ANROM", NULL, NULL, NULL, mapper7_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_Y, STD_ANROM}, |
| 360 | { "NES-AOROM", NULL, NULL, NULL, mapper7_w, NULL, NULL, NULL, 16, 0, 0, 0, CHRRAM_8, NT_Y, STD_AOROM}, |
| 361 | { "NES-B4", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 0, CHRRAM_0, NT_X, STD_TLROM}, |
| 362 | { "NES-BNROM", NULL, NULL, mapper34_m_w, mapper34_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_X, STD_BNROM}, |
| 363 | { "NES-BTR", NULL, NULL, NULL, mapper69_w, NULL, NULL, mapper69_irq, 32, 32, 8, 0, CHRRAM_0, NT_VERT, NES_BTR}, |
| 364 | { "NES-CNROM", NULL, NULL, NULL, mapper3_w, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, STD_CNROM}, |
| 365 | { "NES-CPROM", NULL, NULL, NULL, mapper13_w, NULL, NULL, NULL, 2, 0, 0, 0, CHRRAM_16, NT_X, STD_CPROM}, |
| 366 | { "NES-DE1ROM", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_X, STD_DE1ROM}, |
| 367 | { "NES-DEROM", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 4, 8, 0, 0, CHRRAM_0, NT_X, STD_DEROM}, |
| 368 | { "NES-DRROM", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_4SCR_2K, STD_DRROM}, |
| 369 | { "NES-EKROM", mapper5_l_w, mapper5_l_r, NULL, mapper5_w, NULL, NULL, mapper5_irq, 32, 64, 8, 0, CHRRAM_0, NT_X, STD_EKROM}, |
| 370 | { "NES-ELROM", mapper5_l_w, mapper5_l_r, NULL, mapper5_w, NULL, NULL, mapper5_irq, 32, 64, 0, 0, CHRRAM_0, NT_X, STD_ELROM}, |
| 371 | { "NES-ETROM", mapper5_l_w, mapper5_l_r, NULL, mapper5_w, NULL, NULL, mapper5_irq, 32, 64, 8, 8, CHRRAM_0, NT_X, STD_ETROM}, |
| 372 | // { "NES-EVENT", [mapper 105 - unsupported]}, |
| 373 | { "NES-EWROM", mapper5_l_w, mapper5_l_r, NULL, mapper5_w, NULL, NULL, mapper5_irq, 32, 64, 32, 0, CHRRAM_0, NT_X, STD_EWROM}, |
| 374 | { "NES-FJROM", NULL, NULL, NULL, mapper10_w, mapper9_latch, NULL, NULL, 8, 16, 8, 0, CHRRAM_0, NT_VERT, STD_FJROM}, |
| 375 | { "NES-FKROM", NULL, NULL, NULL, mapper10_w, mapper9_latch, NULL, NULL, 16, 16, 8, 0, CHRRAM_0, NT_VERT, STD_FKROM}, |
| 376 | { "NES-GNROM", NULL, NULL, NULL, mapper66_w, NULL, NULL, NULL, 8, 4, 0, 0, CHRRAM_0, NT_X, STD_GNROM}, |
| 377 | { "NES-HKROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 0, CHRRAM_0, NT_VERT, STD_HKROM}, |
| 378 | { "NES-HROM", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 379 | { "NES-JLROM", NULL, NULL, NULL, mapper69_w, NULL, NULL, mapper69_irq, 16, 32, 0, 0, CHRRAM_0, NT_VERT, STD_JLROM}, |
| 380 | { "NES-JSROM", NULL, NULL, NULL, mapper69_w, NULL, NULL, mapper69_irq, 16, 32, 8, 0, CHRRAM_0, NT_VERT, STD_JSROM}, |
| 381 | { "NES-MHROM", NULL, NULL, NULL, mapper66_w, NULL, NULL, NULL, 4, 4, 0, 0, CHRRAM_0, NT_X, STD_MHROM}, |
| 382 | { "NES-NROM", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 383 | { "NES-NROM-128", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 384 | { "NES-NROM-256", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 385 | { "NES-NTBROM", NULL, NULL, NULL, mapper68_w, NULL, NULL, NULL, 16, 16, 8, 0, CHRRAM_0, NT_VERT, STD_NTBROM}, |
| 386 | { "NES-PEEOROM", NULL, NULL, NULL, mapper9_w, mapper9_latch, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_VERT, STD_PEEOROM}, |
| 387 | { "NES-PNROM", NULL, NULL, NULL, mapper9_w, mapper9_latch, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_VERT, STD_PNROM}, |
| 388 | { "NES-QJ", NULL, NULL, mapper47_m_w, mapper4_w, NULL, NULL, mapper4_irq, 16, 32, 0, 0, CHRRAM_0, NT_VERT, NES_QJ}, |
| 389 | { "NES-RROM", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 390 | { "NES-RROM-128", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 391 | { "NES-SAROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 4, 8, 8, 0, CHRRAM_0, NT_HORZ, STD_SAROM}, |
| 392 | { "NES-SBROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 4, 8, 0, 0, CHRRAM_0, NT_HORZ, STD_SBROM}, |
| 393 | { "NES-SC1ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 4, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SCROM}, |
| 394 | { "NES-SCROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 4, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SCROM}, |
| 395 | { "NES-SEROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 2, 8, 0, 0, CHRRAM_0, NT_HORZ, STD_SEROM}, |
| 396 | { "NES-SF1ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 8, 0, 0, CHRRAM_0, NT_HORZ, STD_SFROM}, |
| 397 | { "NES-SFROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 8, 0, 0, CHRRAM_0, NT_HORZ, STD_SFROM}, |
| 398 | { "NES-SGROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 0, 0, 0, CHRRAM_8, NT_HORZ, STD_SGROM}, |
| 399 | { "NES-SH1ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 2, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SHROM}, |
| 400 | { "NES-SHROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 2, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SHROM}, |
| 401 | { "NES-SJROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 8, 8, 0, CHRRAM_0, NT_HORZ, STD_SJROM}, |
| 402 | { "NES-SKROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 16, 8, 0, CHRRAM_0, NT_HORZ, STD_SKROM}, |
| 403 | { "NES-SL1ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SLROM}, |
| 404 | { "NES-SL2ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SLROM}, |
| 405 | { "NES-SL3ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SLROM}, |
| 406 | { "NES-SLROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SLROM}, |
| 407 | { "NES-SLRROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 16, 0, 0, CHRRAM_0, NT_HORZ, STD_SLROM}, |
| 408 | { "NES-SNROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 0, 8, 0, CHRRAM_8, NT_HORZ, STD_SNROM}, |
| 409 | { "NES-SOROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 0, 8, 8, CHRRAM_8, NT_HORZ, STD_SOROM}, |
| 410 | { "NES-SROM", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 411 | { "NES-STROM", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 412 | { "NES-SUROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 32, 0, 8, 0, CHRRAM_8, NT_HORZ, STD_SUROM}, |
| 413 | { "NES-SXROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 32, 0, 32, 0, CHRRAM_8, NT_HORZ, STD_SXROM}, |
| 414 | { "NES-TBROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 4, 8, 0, 0, CHRRAM_0, NT_X, STD_TBROM}, |
| 415 | { "NES-TEROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 2, 8, 0, 0, CHRRAM_0, NT_X, STD_TEROM}, |
| 416 | { "NES-TFROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 8, 0, 0, CHRRAM_0, NT_X, STD_TFROM}, |
| 417 | { "NES-TGROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 0, 0, 0, CHRRAM_8, NT_X, STD_TGROM}, |
| 418 | { "NES-TKROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 8, 0, CHRRAM_0, NT_X, STD_TKROM}, |
| 419 | { "NES-TKSROM", NULL, NULL, NULL, mapper118_w, NULL, NULL, mapper4_irq, 32, 16, 8, 0, CHRRAM_0, NT_Y, STD_TKSROM}, |
| 420 | { "NES-TL1ROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 0, CHRRAM_0, NT_X, STD_TLROM}, |
| 421 | { "NES-TL2ROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 0, CHRRAM_0, NT_X, STD_TLROM}, |
| 422 | { "NES-TLROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 0, CHRRAM_0, NT_X, STD_TLROM}, |
| 423 | { "NES-TLSROM", NULL, NULL, NULL, mapper118_w, NULL, NULL, mapper4_irq, 32, 16, 0, 0, CHRRAM_0, NT_Y, STD_TLSROM}, |
| 424 | { "NES-TNROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 0, 8, 0, CHRRAM_8, NT_X, STD_TNROM}, |
| 425 | { "NES-TQROM", NULL, NULL, NULL, mapper119_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_8, NT_VERT, STD_TQROM}, |
| 426 | { "NES-TR1ROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 8, 0, 0, CHRRAM_0, NT_4SCR_4K, STD_TR1ROM}, |
| 427 | { "NES-TSROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 32, 32, 0, 8, CHRRAM_0, NT_X, STD_TSROM}, |
| 428 | { "NES-TVROM", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq, 4, 8, 0, 0, CHRRAM_0, NT_4SCR_4K, STD_TVROM}, |
| 429 | { "NES-UN1ROM", NULL, NULL, NULL, mapper94_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_X, STD_UN1ROM}, |
| 430 | { "NES-UNROM", NULL, NULL, NULL, mapper2_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_X, STD_UNROM}, |
| 431 | { "NES-UOROM", NULL, NULL, NULL, mapper2_w, NULL, NULL, NULL, 16, 0, 0, 0, CHRRAM_8, NT_X, STD_UOROM}, |
| 432 | { "NES-WH", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 8, 8, 0, 0, CHRRAM_0, NT_HORZ, NES_WH}, |
| 433 | { "NTDEC-N715062", NULL, NULL, NULL, mapper3_w, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, NTDEC_N715062}, |
| 434 | { "PAL-MH", NULL, NULL, NULL, mapper66_w, NULL, NULL, NULL, 4, 4, 0, 0, CHRRAM_0, NT_X, STD_MHROM}, |
| 435 | { "PAL-ZZ", NULL, NULL, mapper37_m_w, mapper4_w, NULL, NULL, mapper4_irq, 16, 32, 0, 0, CHRRAM_0, NT_VERT, NES_ZZ}, |
| 436 | { "SACHEN-8259A", mapper141_l_w, NULL, mapper141_m_w, NULL, NULL, NULL, NULL, 16, 32, 0, 0, CHRRAM_0, NT_X, SACHEN_8259A}, |
| 437 | { "SACHEN-8259B", mapper138_l_w, NULL, mapper138_m_w, NULL, NULL, NULL, NULL, 16, 32, 0, 0, CHRRAM_0, NT_X, SACHEN_8259B}, |
| 438 | { "SACHEN-8259C", mapper139_l_w, NULL, mapper139_m_w, NULL, NULL, NULL, NULL, 16, 32, 0, 0, CHRRAM_0, NT_X, SACHEN_8259C}, |
| 439 | { "SACHEN-8259D", mapper137_l_w, NULL, mapper137_m_w, NULL, NULL, NULL, NULL, 16, 32, 0, 0, CHRRAM_0, NT_X, SACHEN_8259D}, |
| 440 | { "SACHEN-CNROM", NULL, NULL, NULL, mapper3_w, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, STD_CNROM}, |
| 441 | { "SETA-NROM-128", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 442 | { "SUNSOFT-1", NULL, NULL, mapper184_m_w, NULL, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, SUNSOFT_1}, |
| 443 | { "SUNSOFT-2", NULL, NULL, NULL, mapper89_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_Y, SUNSOFT_2B}, |
| 444 | // 2a variant (mapper 93)? |
| 445 | { "SUNSOFT-3", NULL, NULL, NULL, mapper67_w, NULL, NULL, mapper67_irq, 8, 16, 0, 0, CHRRAM_0, NT_VERT, SUNSOFT_3}, |
| 446 | { "SUNSOFT-4", NULL, NULL, NULL, mapper68_w, NULL, NULL, NULL, 8, 32, 0, 0, CHRRAM_0, NT_VERT, SUNSOFT_4}, |
| 447 | // variant with 8 NVWRAM |
| 448 | { "SUNSOFT-5B", NULL, NULL, NULL, mapper69_w, NULL, NULL, mapper69_irq, 16, 32, 0, 0, CHRRAM_0, NT_VERT, SUNSOFT_5B}, |
| 449 | // variant with 8 NVWRAM |
| 450 | { "SUNSOFT-FME-7", NULL, NULL, NULL, mapper69_w, NULL, NULL, mapper69_irq, 16, 32, 0, 0, CHRRAM_0, NT_VERT, SUNSOFT_FME7}, |
| 451 | // variant with 8 NVWRAM |
| 452 | { "SUNSOFT-NROM-256", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 453 | { "TAITO-74*139/74", NULL, NULL, mapper87_m_w, NULL, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, TAITO_74139}, |
| 454 | { "TAITO-74*161/161/32", NULL, NULL, NULL, mapper70_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_X, TAITO_74161}, |
| 455 | { "TAITO-CNROM", NULL, NULL, NULL, mapper3_w, NULL, NULL, NULL, 2, 4, 0, 0, CHRRAM_0, NT_X, STD_CNROM}, |
| 456 | { "TAITO-NROM-128", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 457 | { "TAITO-NROM-256", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 458 | { "TAITO-TC0190FMC", NULL, NULL, NULL, mapper33_w, NULL, NULL, NULL, 16, 32, 0, 0, CHRRAM_0, NT_VERT, TAITO_TC0190FMC}, |
| 459 | { "TAITO-TC0190FMC+PAL16R4", NULL, NULL, NULL, mapper48_w, NULL, NULL, mapper4_irq, 16, 32, 0, 0, CHRRAM_0, NT_VERT, TAITO_TC0190FMCP}, |
| 460 | { "TAITO-UNROM", NULL, NULL, NULL, mapper2_w, NULL, NULL, NULL, 8, 0, 0, 0, CHRRAM_8, NT_X, STD_UNROM}, |
| 461 | { "TAITO-X1-005", NULL, NULL, mapper80_m_w, NULL, NULL, NULL, NULL, 16, 32, 0, 0, CHRRAM_0, NT_X, TAITO_X1005}, |
| 462 | { "TAITO-X1-017", NULL, NULL, mapper82_m_w, NULL, NULL, NULL, NULL, 16, 32, 0, 0, CHRRAM_0, NT_HORZ, TAITO_X1017}, |
| 463 | { "TENGEN-800002", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 4, 8, 0, 0, CHRRAM_0, NT_X, TENGEN_800002}, |
| 464 | { "TENGEN-800003", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, STD_NROM}, |
| 465 | { "TENGEN-800004", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_4SCR_2K, TENGEN_800004}, |
| 466 | { "TENGEN-800008", NULL, NULL, NULL, mapper3_w, NULL, NULL, NULL, 4, 8, 0, 0, CHRRAM_0, NT_X, TENGEN_800008}, |
| 467 | { "TENGEN-800030", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq, 8, 8, 0, 0, CHRRAM_0, NT_X, TENGEN_800030}, |
| 468 | { "TENGEN-800032", NULL, NULL, NULL, mapper64_w, NULL, NULL, mapper64_irq, 8, 16, 0, 0, CHRRAM_0, NT_VERT, TENGEN_800032}, |
| 469 | { "TENGEN-800037", NULL, NULL, NULL, mapper158_w, NULL, NULL, mapper64_irq, 8, 16, 0, 0, CHRRAM_0, NT_Y, TENGEN_800037}, |
| 470 | { "TENGEN-800042", NULL, NULL, NULL, mapper68_w, NULL, NULL, NULL, 8, 32, 0, 0, CHRRAM_0, NT_VERT, TENGEN_800042}, |
| 471 | { "UNL-22211", mapper132_l_w, mapper132_l_r, NULL, mapper132_w, NULL, NULL, NULL, 4, 4, 0, 0, CHRRAM_0, NT_X, TXC_22211A}, |
| 472 | // mapper 172 & 173 are variant of this one... no UNIF? |
| 473 | // { "UNL-3D-BLOCK", } |
| 474 | // { "UNL-603-5052", [mapper 238 - unsupported]}, |
| 475 | // { "UNL-8157", } |
| 476 | // { "UNL-8237", [unif only!!] 32, 64, 0, 0, CHRRAM_0, NT_X, UNL_8237}, |
| 477 | // { "UNL-A9746", [mapper 219 - unsupported]}, |
| 478 | // { "UNL-AX5705", [unif only!!] 8, 32, 0, 0, CHRRAM_0, NT_X, UNL_AX5705}, |
| 479 | // { "UNL-CC-21", [unif only!!] 2, 2, 0, 0, CHRRAM_0, NT_Y, UNL_CC21}, |
| 480 | // { "UNL-C-N22M", } |
| 481 | // { "UNL-DANCE", } |
| 482 | // { "UNL-EDU2000", [unif only!!] 64, 0, 32, 0, CHRRAM_8, NT_Y, UNL_EDU2K}, |
| 483 | // { "UNL-H2288", [mapper 123 - unsupported]}, |
| 484 | // { "UNL-KOF97", [unif only!!] 32, 32, 0, 0, CHRRAM_0, NT_X, UNL_KOF97}, |
| 485 | // { "UNL-KS7032", [mapper 142 - unsupported]}, |
| 486 | // { "UNL-KS7017", } |
| 487 | { "UNL-N625092", NULL, NULL, NULL, mapper221_w, NULL, NULL, NULL, 64, 1, 0, 0, CHRRAM_0, NT_VERT, UNL_N625092}, |
| 488 | // { "UNL-PEC-586", }, |
| 489 | { "UNL-SA-002", mapper136_l_w, mapper136_l_r, NULL, NULL, NULL, NULL, NULL, 2, 2, 0, 0, CHRRAM_0, NT_X, SACHEN_TCU02}, |
| 490 | // { "UNL-SA-009", }, |
| 491 | { "UNL-SA-0036", NULL, NULL, NULL, mapper149_w, NULL, NULL, NULL, 2, 2, 0, 0, CHRRAM_0, NT_X, SACHEN_SA0036}, |
| 492 | { "UNL-SA-0037", NULL, NULL, NULL, mapper148_w, NULL, NULL, NULL, 4, 8, 0, 0, CHRRAM_0, NT_X, SACHEN_SA0037}, |
| 493 | { "UNL-SA-016-1M", mapper79_l_w, NULL, NULL, NULL, NULL, NULL, NULL, 4, 8, 0, 0, CHRRAM_0, NT_X, SACHEN_SA0161M}, // actually this is Mapper 146, but works like 79! |
| 494 | { "UNL-SA-72007", mapper145_l_w, NULL, NULL, NULL, NULL, NULL, NULL, 1, 2, 0, 0, CHRRAM_0, NT_X, SACHEN_SA72007}, |
| 495 | { "UNL-SA-72008", mapper133_l_w, NULL, mapper133_m_w, NULL, NULL, NULL, NULL, 4, 4, 0, 0, CHRRAM_0, NT_X, SACHEN_SA72008}, |
| 496 | { "UNL-SA-NROM", NULL, mapper143_l_r, NULL, NULL, NULL, NULL, NULL, 2, 1, 0, 0, CHRRAM_0, NT_X, SACHEN_TCA01}, |
| 497 | { "UNL-SACHEN-74LS374N", mapper150_l_w, mapper150_l_r, mapper150_m_w, NULL, NULL, NULL, NULL,4, 16, 0, 0, CHRRAM_0, NT_X, SACHEN_74LS374}, |
| 498 | // mapper 243 variant exists! how to distinguish?!? mapper243_l_w, NULL, NULL, NULL, NULL, NULL, NULL (also uses NT_VERT!) |
| 499 | // { "UNL-SACHEN-74LS374NA", [is it mapper 243?]}, |
| 500 | { "UNL-SACHEN-8259A", mapper141_l_w, NULL, mapper141_m_w, NULL, NULL, NULL, NULL, 16, 32, 0, 0, CHRRAM_0, NT_X, SACHEN_8259A}, |
| 501 | { "UNL-SACHEN-8259B", mapper138_l_w, NULL, mapper138_m_w, NULL, NULL, NULL, NULL, 16, 32, 0, 0, CHRRAM_0, NT_X, SACHEN_8259B}, |
| 502 | { "UNL-SACHEN-8259C", mapper139_l_w, NULL, mapper139_m_w, NULL, NULL, NULL, NULL, 16, 32, 0, 0, CHRRAM_0, NT_X, SACHEN_8259C}, |
| 503 | { "UNL-SACHEN-8259D", mapper137_l_w, NULL, mapper137_m_w, NULL, NULL, NULL, NULL, 16, 32, 0, 0, CHRRAM_0, NT_X, SACHEN_8259D}, |
| 504 | // { "UNL-SHERO", [unif only!!] 32, 64, 0, 0, CHRRAM_8, NT_4SCR_2K, SACHEN_SHERO}, |
| 505 | // { "UNL-SC-127", } |
| 506 | { "UNL-SL1632", NULL, NULL, NULL, mapper14_w, NULL, NULL, mapper4_irq, 16, 64, 0, 0, CHRRAM_0, NT_VERT, REXSOFT_SL1632}, |
| 507 | { "UNL-SMB2J", NULL, NULL, NULL, mapper43_w, NULL, NULL, NULL, 8, 1, 8, 8, CHRRAM_0, NT_X, UNL_SMB2J}, |
| 508 | // { "UNL-T-230", [unif only!!] 16, 0, 0, 0, CHRRAM_8, NT_VERT, UNL_T230}, |
| 509 | { "UNL-TC-U01-1.5M", mapper147_l_w, NULL, mapper147_m_w, mapper147_w, NULL, NULL, NULL, 8, 16, 0, 0, CHRRAM_0, NT_X, SACHEN_TCU01}, |
| 510 | // mapper 136 variant exists! how to distinguish?!? |
| 511 | // { "UNL-TEK90", [mappers 90, 209, 211 - unsupported]}, |
| 512 | // { "UNL-TF1201", [unif only!!] 16, 32, 0, 0, CHRRAM_0, NT_VERT, UNL_TF1201}, |
| 513 | { "VIRGIN-SNROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL, 16, 0, 8, 0, CHRRAM_8, NT_HORZ, STD_SNROM} |
| 514 | }; |
| 515 | |
| 516 | const unif *nes_unif_lookup( const char *board ) |
| 517 | { |
| 518 | int i; |
| 519 | for (i = 0; i < sizeof(unif_list) / sizeof(unif_list[0]); i++) |
| 520 | { |
| 521 | if (!mame_stricmp(unif_list[i].board, board)) |
| 522 | return &unif_list[i]; |
| 523 | } |
| 524 | return NULL; |
| 525 | } |
src/mess/machine/nes_mmc.c
| r6047 | r6048 | |
| 720 | 720 | MIRROR_HIGH and MIRROR_LOW compared to the above) and Sachen games use sachen_set_mirror (which has |
| 721 | 721 | a slightly different MIRROR_HIGH, with page 0 set to 0) */ |
| 722 | 722 | |
| 723 | | |
| 724 | 723 | /************************************************************* |
| 725 | 724 | |
| 726 | | Mapper 0 |
| 725 | Support for .nes Files |
| 727 | 726 | |
| 728 | | 32K PRG ROM + 8K or less CHR ROM |
| 729 | | No need of additional MMC |
| 730 | | |
| 731 | | Known Boards: NROM, FB02??, FB04??, Jaleco JF01, JF02, JF03, JF04 |
| 732 | | Games: Mario Bros., Super Mario Bros., Tennis and most of |
| 733 | | the first generation games |
| 734 | | |
| 735 | | In MESS: Supported, no need of specific handlers or IRQ |
| 736 | | |
| 737 | 727 | *************************************************************/ |
| 738 | 728 | |
| 739 | | /************************************************************* |
| 729 | /* Include emulation of iNES Mappers for .nes files */ |
| 730 | #include "machine/nes_ines.c" |
| 740 | 731 | |
| 741 | | Mapper 1 |
| 742 | | |
| 743 | | Known Boards: MMC1 based Boards, i.e. SAROM, SBROM, SCROM, |
| 744 | | SEROM, SFROM, SGROM, SHROM, SJROM, SKROM, SLROM, SNROM, |
| 745 | | SOROM, SUROM, SXROM, WH?? |
| 746 | | Games: Faxanadu, Final Fantasy I & II, Kid Icarus, Legend |
| 747 | | of Zelda, Metroid |
| 748 | | |
| 749 | | In MESS: Supported |
| 750 | | |
| 751 | | *************************************************************/ |
| 752 | | |
| 753 | | static void MMC1_set_prg( running_machine *machine ) |
| 754 | | { |
| 755 | | UINT8 prg_mode, prg_offset; |
| 756 | | |
| 757 | | prg_mode = MMC1_regs[0] & 0x0c; |
| 758 | | /* prg_mode&0x8 determines bank size: 32k (if 0) or 16k (if 1)? when in 16k mode, |
| 759 | | prg_mode&0x4 determines which half of the PRG space we can swap: if it is 4, |
| 760 | | MMC1_regs[3] sets banks at 0x8000; if it is 0, MMC1_regs[3] sets banks at 0xc000. */ |
| 761 | | |
| 762 | | prg_offset = MMC1_regs[1] & 0x10; |
| 763 | | /* In principle, MMC1_regs[2]&0x10 might affect "extended" banks as well, when chr_mode=1. |
| 764 | | However, quoting Disch's docs: When in 4k CHR mode, 0x10 in both $A000 and $C000 *must* be |
| 765 | | set to the same value, or else pages will constantly be swapped as graphics render! |
| 766 | | Hence, we use only MMC1_regs[1]&0x10 for prg_offset */ |
| 767 | | |
| 768 | | switch (prg_mode) |
| 769 | | { |
| 770 | | case 0x00: |
| 771 | | case 0x04: |
| 772 | | prg32(machine, prg_offset + MMC1_regs[3]); |
| 773 | | break; |
| 774 | | case 0x08: |
| 775 | | prg16_89ab(machine, prg_offset + 0); |
| 776 | | prg16_cdef(machine, prg_offset + MMC1_regs[3]); |
| 777 | | break; |
| 778 | | case 0x0c: |
| 779 | | prg16_89ab(machine, prg_offset + MMC1_regs[3]); |
| 780 | | prg16_cdef(machine, prg_offset + 0x0f); |
| 781 | | break; |
| 782 | | } |
| 783 | | } |
| 784 | | |
| 785 | | static void MMC1_set_chr( running_machine *machine ) |
| 786 | | { |
| 787 | | UINT8 chr_mode = MMC1_regs[0] & 0x10; |
| 788 | | |
| 789 | | if (nes.chr_chunks) |
| 790 | | { |
| 791 | | if (chr_mode) |
| 792 | | { |
| 793 | | chr4_0(machine, MMC1_regs[1] & 0x1f, CHRROM); |
| 794 | | chr4_4(machine, MMC1_regs[2] & 0x1f, CHRROM); |
| 795 | | } |
| 796 | | else |
| 797 | | chr8(machine, (MMC1_regs[1] & 0x1f) >> 1, CHRROM); |
| 798 | | } |
| 799 | | } |
| 800 | | |
| 801 | | static WRITE8_HANDLER( mapper1_w ) |
| 802 | | { |
| 803 | | /* Note that there is only one latch and shift counter, shared amongst the 4 regs */ |
| 804 | | /* Space Shuttle will not work if they have independent variables. */ |
| 805 | | LOG_MMC(("mapper1_w offset: %04x, data: %02x\n", offset, data)); |
| 806 | | |
| 807 | | |
| 808 | | /* here we would need to add an if(cpu_cycles_passed>1) test, and |
| 809 | | if requirement is not met simply return without writing anything. |
| 810 | | AD&D Hillsfar and Bill & Ted rely on this behavior!! */ |
| 811 | | if (data & 0x80) |
| 812 | | { |
| 813 | | mmc_count = 0; |
| 814 | | mmc_cmd1 = 0; |
| 815 | | |
| 816 | | /* Set reg at 0x8000 to size 16k and lower half swap - needed for Robocop 3, Dynowars */ |
| 817 | | MMC1_regs[0] |= 0x0c; |
| 818 | | MMC1_set_prg(space->machine); |
| 819 | | |
| 820 | | LOG_MMC(("=== MMC1 regs reset to default\n")); |
| 821 | | return; |
| 822 | | } |
| 823 | | |
| 824 | | if (mmc_count < 5) |
| 825 | | { |
| 826 | | if (mmc_count == 0) mmc_cmd1 = 0; |
| 827 | | mmc_cmd1 >>= 1; |
| 828 | | mmc_cmd1 |= (data & 0x01) ? 0x10 : 0x00; |
| 829 | | mmc_count++; |
| 830 | | } |
| 831 | | |
| 832 | | if (mmc_count == 5) |
| 833 | | { |
| 834 | | switch (offset & 0x6000) /* Which reg shall we write to? */ |
| 835 | | { |
| 836 | | case 0x0000: |
| 837 | | MMC1_regs[0] = mmc_cmd1; |
| 838 | | |
| 839 | | switch (MMC1_regs[0] & 0x03) |
| 840 | | { |
| 841 | | case 0: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 842 | | case 1: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 843 | | case 2: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 844 | | case 3: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 845 | | } |
| 846 | | MMC1_set_chr(space->machine); |
| 847 | | MMC1_set_prg(space->machine); |
| 848 | | break; |
| 849 | | case 0x2000: |
| 850 | | MMC1_regs[1] = mmc_cmd1; |
| 851 | | MMC1_set_chr(space->machine); |
| 852 | | MMC1_set_prg(space->machine); |
| 853 | | break; |
| 854 | | case 0x4000: |
| 855 | | MMC1_regs[2] = mmc_cmd1; |
| 856 | | MMC1_set_chr(space->machine); |
| 857 | | break; |
| 858 | | case 0x6000: |
| 859 | | MMC1_regs[3] = mmc_cmd1; |
| 860 | | MMC1_set_prg(space->machine); |
| 861 | | break; |
| 862 | | } |
| 863 | | |
| 864 | | mmc_count = 0; |
| 865 | | } |
| 866 | | } |
| 867 | | |
| 868 | 732 | /************************************************************* |
| 869 | 733 | |
| 870 | | Mapper 2 |
| 734 | mapper_initialize |
| 871 | 735 | |
| 872 | | Known Boards: UNROM, UOROM, UXROM, Jaleco JF15, JF18 & JF39 |
| 873 | | Games: Castlevania, Dragon Quest II, Duck Tales, MegaMan, Metal Gear |
| 736 | Initialize various constants needed by mappers, depending |
| 737 | on the mapper number. As long as the code is mainly iNES |
| 738 | centric, also UNIF images will call this function to |
| 739 | initialize their bankswitch and registers. |
| 874 | 740 | |
| 875 | | In MESS: Supported |
| 876 | | |
| 877 | 741 | *************************************************************/ |
| 878 | 742 | |
| 879 | | static WRITE8_HANDLER( mapper2_w ) |
| 743 | static int mapper_initialize( running_machine *machine, int mmc_num ) |
| 880 | 744 | { |
| 881 | | LOG_MMC(("mapper2_w offset: %04x, data: %02x\n", offset, data)); |
| 882 | | |
| 883 | | prg16_89ab(space->machine, data); |
| 884 | | } |
| 885 | | |
| 886 | | /************************************************************* |
| 887 | | |
| 888 | | Mapper 3 |
| 889 | | |
| 890 | | Known Boards: CNROM, CXROM, X79B?, Bandai Aerobics Board, |
| 891 | | Tengen 800008, Bootleg Board by NTDEC (N715062) |
| 892 | | Games: Adventure Island, Flipull, Friday 13th, GeGeGe no |
| 893 | | Kitarou, Ghostbusters, Gradius, Hokuto no Ken, Milon's |
| 894 | | Secret Castle |
| 895 | | |
| 896 | | In MESS: Supported |
| 897 | | |
| 898 | | *************************************************************/ |
| 899 | | |
| 900 | | static WRITE8_HANDLER( mapper3_w ) |
| 901 | | { |
| 902 | | LOG_MMC(("mapper3_w offset: %04x, data: %02x\n", offset, data)); |
| 903 | | |
| 904 | | chr8(space->machine, data, CHRROM); |
| 905 | | } |
| 906 | | |
| 907 | | /************************************************************* |
| 908 | | |
| 909 | | Mapper 4 |
| 910 | | |
| 911 | | Known Boards: MMC3 based Boards, i.e. HKROM, TEROM, TBROM, |
| 912 | | TFROM, TGROM, TKROM, TLROM, TNROM, TR1ROM, TSROM, |
| 913 | | TVROM, TRXROM |
| 914 | | Games: Final Fantasy III, MegaMan 3,4,5 & 6, Startropics, |
| 915 | | Super Mario Bros. 2 & 3, |
| 916 | | |
| 917 | | In MESS: Supported |
| 918 | | |
| 919 | | *************************************************************/ |
| 920 | | |
| 921 | | /* Many multigame carts based on MMC3 works as follows: they select a |
| 922 | | block of banks by writing in the 0x6000-0x7fff range and then they |
| 923 | | operate like a common MMC3 board on that specific block. To emulate this |
| 924 | | we use the concept of bases and masks. Original MMC3 boards simply |
| 925 | | set base = 0 and mask = 0xff at start and never change them */ |
| 926 | | /* Notice that, atm, there is no way to directly handle MMC3 clone mappers |
| 927 | | which use custom routines to set PRG/CHR. For these mappers we have to |
| 928 | | re-define the 0x8000-0xffff handler at least for offsets 0 & 1 (i.e. the |
| 929 | | offsets where are used set_prg/set_chr) by using the mapper-specific routines, |
| 930 | | and then we can fall back to mapper4_w for the remaining offsets */ |
| 931 | | |
| 932 | | static void mapper4_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 933 | | { |
| 934 | | UINT8 prg_flip = (mmc_cmd1 & 0x40) ? 2 : 0; |
| 935 | | |
| 936 | | prg8_89(machine, prg_base | (prg_bank[0 ^ prg_flip] & prg_mask)); |
| 937 | | prg8_ab(machine, prg_base | (prg_bank[1] & prg_mask)); |
| 938 | | prg8_cd(machine, prg_base | (prg_bank[2 ^ prg_flip] & prg_mask)); |
| 939 | | prg8_ef(machine, prg_base | (prg_bank[3] & prg_mask)); |
| 940 | | } |
| 941 | | |
| 942 | | static void mapper4_set_chr( running_machine *machine, UINT8 chr, int chr_base, int chr_mask ) |
| 943 | | { |
| 944 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 945 | | |
| 946 | | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr); |
| 947 | | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr); |
| 948 | | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr); |
| 949 | | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr); |
| 950 | | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr); |
| 951 | | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr); |
| 952 | | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr); |
| 953 | | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr); |
| 954 | | } |
| 955 | | |
| 956 | | /* Here, IRQ counter decrements every scanline. */ |
| 957 | | static void mapper4_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 958 | | { |
| 959 | | if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE) |
| 960 | | { |
| 961 | | int priorCount = IRQ_count; |
| 962 | | if ((IRQ_count == 0)) |
| 963 | | { |
| 964 | | IRQ_count = IRQ_count_latch; |
| 965 | | } |
| 966 | | else |
| 967 | | IRQ_count--; |
| 968 | | |
| 969 | | if (IRQ_enable && !blanked && (IRQ_count == 0) && priorCount) |
| 970 | | { |
| 971 | | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, |
| 972 | | video_screen_get_vpos(device->machine->primary_screen), video_screen_get_hpos(device->machine->primary_screen))); |
| 973 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 974 | | } |
| 975 | | } |
| 976 | | } |
| 977 | | |
| 978 | | static WRITE8_HANDLER( mapper4_w ) |
| 979 | | { |
| 980 | | UINT8 MMC3_helper, cmd; |
| 981 | | |
| 982 | | LOG_MMC(("mapper4_w offset: %04x, data: %02x\n", offset, data)); |
| 983 | | |
| 984 | | switch (offset & 0x6001) |
| 985 | | { |
| 986 | | case 0x0000: |
| 987 | | MMC3_helper = mmc_cmd1 ^ data; |
| 988 | | mmc_cmd1 = data; |
| 989 | | |
| 990 | | /* Has PRG Mode changed? */ |
| 991 | | if (MMC3_helper & 0x40) |
| 992 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 993 | | |
| 994 | | /* Has CHR Mode changed? */ |
| 995 | | if (MMC3_helper & 0x80) |
| 996 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 997 | | break; |
| 998 | | |
| 999 | | case 0x0001: |
| 1000 | | cmd = mmc_cmd1 & 0x07; |
| 1001 | | switch (cmd) |
| 1002 | | { |
| 1003 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 1004 | | case 2: case 3: case 4: case 5: |
| 1005 | | vrom_bank[cmd] = data; |
| 1006 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 1007 | | break; |
| 1008 | | case 6: |
| 1009 | | case 7: |
| 1010 | | prg_bank[cmd - 6] = data; |
| 1011 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 1012 | | break; |
| 1013 | | } |
| 1014 | | break; |
| 1015 | | |
| 1016 | | case 0x2000: |
| 1017 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 1018 | | break; |
| 1019 | | |
| 1020 | | case 0x2001: /* extra RAM enable/disable */ |
| 1021 | | mmc_cmd2 = data; /* This actually is made of two parts: data&0x80 = WRAM enabled and data&0x40 = WRAM readonly! */ |
| 1022 | | /* We save this twice because we will need mmc_cmd2 in some clone mapper */ |
| 1023 | | nes.mid_ram_enable = data; |
| 1024 | | break; |
| 1025 | | |
| 1026 | | case 0x4000: |
| 1027 | | IRQ_count_latch = data; |
| 1028 | | break; |
| 1029 | | |
| 1030 | | case 0x4001: /* some sources state that here we must have IRQ_count = IRQ_count_latch */ |
| 1031 | | IRQ_count = 0; |
| 1032 | | break; |
| 1033 | | |
| 1034 | | case 0x6000: |
| 1035 | | IRQ_enable = 0; |
| 1036 | | break; |
| 1037 | | |
| 1038 | | case 0x6001: |
| 1039 | | IRQ_enable = 1; |
| 1040 | | break; |
| 1041 | | |
| 1042 | | default: |
| 1043 | | logerror("mapper4_w uncaught: %04x value: %02x\n", offset + 0x8000, data); |
| 1044 | | break; |
| 1045 | | } |
| 1046 | | } |
| 1047 | | |
| 1048 | | /************************************************************* |
| 1049 | | |
| 1050 | | Mapper 5 |
| 1051 | | |
| 1052 | | Known Boards: MMC3 based Boards, i.e. ELROM, EKROM, ETROM, |
| 1053 | | EWROM and EXROM variants |
| 1054 | | Games: Castlevania III, Just Breed, many Koei titles |
| 1055 | | |
| 1056 | | In MESS: Partially supported |
| 1057 | | |
| 1058 | | *************************************************************/ |
| 1059 | | |
| 1060 | | static void mapper5_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 1061 | | { |
| 1062 | | #if 1 |
| 1063 | | if (scanline == 0) |
| 1064 | | IRQ_status |= 0x40; |
| 1065 | | else if (scanline > PPU_BOTTOM_VISIBLE_SCANLINE) |
| 1066 | | IRQ_status &= ~0x40; |
| 1067 | | #endif |
| 1068 | | |
| 1069 | | if (scanline == IRQ_count) |
| 1070 | | { |
| 1071 | | if (IRQ_enable) |
| 1072 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 1073 | | |
| 1074 | | IRQ_status = 0xff; |
| 1075 | | } |
| 1076 | | } |
| 1077 | | |
| 1078 | | static void ppu_mirror_MMC5( int page, int src ) |
| 1079 | | { |
| 1080 | | switch (src) |
| 1081 | | { |
| 1082 | | case 0: /* CIRAM0 */ |
| 1083 | | set_nt_page(page, CIRAM, 0, 1); |
| 1084 | | break; |
| 1085 | | case 1: /* CIRAM1 */ |
| 1086 | | set_nt_page(page, CIRAM, 1, 1); |
| 1087 | | break; |
| 1088 | | case 2: /* ExRAM */ |
| 1089 | | set_nt_page(page, EXRAM, 0, 1); // actually only works during rendering. |
| 1090 | | break; |
| 1091 | | case 3: /* Fill Registers */ |
| 1092 | | set_nt_page(page, MMC5FILL, 0, 0); |
| 1093 | | break; |
| 1094 | | default: |
| 1095 | | fatalerror("This should never happen"); |
| 1096 | | break; |
| 1097 | | } |
| 1098 | | } |
| 1099 | | |
| 1100 | | static READ8_HANDLER( mapper5_l_r ) |
| 1101 | | { |
| 1102 | | int retVal; |
| 1103 | | |
| 1104 | | /* $5c00 - $5fff: extended videoram attributes */ |
| 1105 | | if ((offset >= 0x1b00) && (offset <= 0x1eff)) |
| 1106 | | { |
| 1107 | | return MMC5_vram[offset - 0x1b00]; |
| 1108 | | } |
| 1109 | | |
| 1110 | | switch (offset) |
| 1111 | | { |
| 1112 | | case 0x1104: /* $5204 */ |
| 1113 | | #if 0 |
| 1114 | | if (current_scanline == MMC5_scanline) |
| 1115 | | return 0x80; |
| 1116 | | else |
| 1117 | | return 0x00; |
| 1118 | | #else |
| 1119 | | retVal = IRQ_status; |
| 1120 | | IRQ_status &= ~0x80; |
| 1121 | | return retVal; |
| 1122 | | #endif |
| 1123 | | |
| 1124 | | case 0x1105: /* $5205 */ |
| 1125 | | return (mult1 * mult2) & 0xff; |
| 1126 | | case 0x1106: /* $5206 */ |
| 1127 | | return ((mult1 * mult2) & 0xff00) >> 8; |
| 1128 | | |
| 1129 | | default: |
| 1130 | | logerror("** MMC5 uncaught read, offset: %04x\n", offset + 0x4100); |
| 1131 | | return 0x00; |
| 1132 | | } |
| 1133 | | } |
| 1134 | | |
| 1135 | | //static void mapper5_sync_vrom (int mode) |
| 1136 | | //{ |
| 1137 | | // int i; |
| 1138 | | // |
| 1139 | | // for (i = 0; i < 8; i ++) |
| 1140 | | // nes_vram[i] = vrom_bank[0 + (mode * 8)] * 64; |
| 1141 | | //} |
| 1142 | | |
| 1143 | | static WRITE8_HANDLER( mapper5_l_w ) |
| 1144 | | { |
| 1145 | | nes_state *state = space->machine->driver_data; |
| 1146 | | |
| 1147 | | // static int vrom_next[4]; |
| 1148 | | static int vrom_page_a; |
| 1149 | | static int vrom_page_b; |
| 1150 | | |
| 1151 | | // LOG_MMC(("Mapper 5 write, offset: %04x, data: %02x\n", offset + 0x4100, data)); |
| 1152 | | /* Send $5000-$5015 to the sound chip */ |
| 1153 | | if ((offset >= 0xf00) && (offset <= 0xf15)) |
| 1154 | | { |
| 1155 | | nes_psg_w(state->sound, offset & 0x1f, data); |
| 1156 | | return; |
| 1157 | | } |
| 1158 | | |
| 1159 | | /* $5c00 - $5fff: extended videoram attributes */ |
| 1160 | | if ((offset >= 0x1b00) && (offset <= 0x1eff)) |
| 1161 | | { |
| 1162 | | if (MMC5_vram_protect == 0x03) |
| 1163 | | MMC5_vram[offset - 0x1b00] = data; |
| 1164 | | return; |
| 1165 | | } |
| 1166 | | |
| 1167 | | switch (offset) |
| 1168 | | { |
| 1169 | | case 0x1000: /* $5100 */ |
| 1170 | | MMC5_rom_bank_mode = data & 0x03; |
| 1171 | | LOG_MMC(("MMC5 rom bank mode: %02x\n", data)); |
| 1172 | | break; |
| 1173 | | |
| 1174 | | case 0x1001: /* $5101 */ |
| 1175 | | MMC5_vrom_bank_mode = data & 0x03; |
| 1176 | | LOG_MMC(("MMC5 vrom bank mode: %02x\n", data)); |
| 1177 | | break; |
| 1178 | | |
| 1179 | | case 0x1002: /* $5102 */ |
| 1180 | | if (data == 0x02) |
| 1181 | | MMC5_vram_protect |= 1; |
| 1182 | | else |
| 1183 | | MMC5_vram_protect = 0; |
| 1184 | | LOG_MMC(("MMC5 vram protect 1: %02x\n", data)); |
| 1185 | | break; |
| 1186 | | case 0x1003: /* 5103 */ |
| 1187 | | if (data == 0x01) |
| 1188 | | MMC5_vram_protect |= 2; |
| 1189 | | else |
| 1190 | | MMC5_vram_protect = 0; |
| 1191 | | LOG_MMC(("MMC5 vram protect 2: %02x\n", data)); |
| 1192 | | break; |
| 1193 | | |
| 1194 | | case 0x1004: /* $5104 - Extra VRAM (EXRAM) control */ |
| 1195 | | MMC5_vram_control = data; |
| 1196 | | LOG_MMC(("MMC5 exram control: %02x\n", data)); |
| 1197 | | break; |
| 1198 | | |
| 1199 | | case 0x1005: /* $5105 */ |
| 1200 | | ppu_mirror_MMC5(0, data & 0x03); |
| 1201 | | ppu_mirror_MMC5(1, (data & 0x0c) >> 2); |
| 1202 | | ppu_mirror_MMC5(2, (data & 0x30) >> 4); |
| 1203 | | ppu_mirror_MMC5(3, (data & 0xc0) >> 6); |
| 1204 | | break; |
| 1205 | | |
| 1206 | | /* tile data for MMC5 flood-fill NT mode */ |
| 1207 | | case 0x1006: |
| 1208 | | MMC5_floodtile = data; |
| 1209 | | break; |
| 1210 | | |
| 1211 | | /* attr data for MMC5 flood-fill NT mode */ |
| 1212 | | case 0x1007: |
| 1213 | | switch (data & 3) |
| 1214 | | { |
| 1215 | | default: |
| 1216 | | case 0: MMC5_floodattr = 0x00; break; |
| 1217 | | case 1: MMC5_floodattr = 0x55; break; |
| 1218 | | case 2: MMC5_floodattr = 0xaa; break; |
| 1219 | | case 3: MMC5_floodattr = 0xff; break; |
| 1220 | | } |
| 1221 | | break; |
| 1222 | | |
| 1223 | | case 0x1013: /* $5113 */ |
| 1224 | | LOG_MMC(("MMC5 mid RAM bank select: %02x\n", data & 0x07)); |
| 1225 | | memory_set_bankptr(space->machine, 5, &nes.wram[data * 0x2000]); |
| 1226 | | /* The & 4 is a hack that'll tide us over for now */ |
| 1227 | | nes_battery_ram = &nes.wram[(data & 4) * 0x2000]; |
| 1228 | | break; |
| 1229 | | |
| 1230 | | case 0x1014: /* $5114 */ |
| 1231 | | LOG_MMC(("MMC5 $5114 bank select: %02x (mode: %d)\n", data, MMC5_rom_bank_mode)); |
| 1232 | | switch (MMC5_rom_bank_mode) |
| 1233 | | { |
| 1234 | | case 0x03: |
| 1235 | | /* 8k switch */ |
| 1236 | | if (data & 0x80) |
| 1237 | | { |
| 1238 | | /* ROM */ |
| 1239 | | LOG_MMC(("\tROM bank select (8k, $8000): %02x\n", data)); |
| 1240 | | data &= ((nes.prg_chunks << 1) - 1); |
| 1241 | | memory_set_bankptr(space->machine, 1, &nes.rom[data * 0x2000 + 0x10000]); |
| 1242 | | } |
| 1243 | | else |
| 1244 | | { |
| 1245 | | /* RAM */ |
| 1246 | | LOG_MMC(("\tRAM bank select (8k, $8000): %02x\n", data & 0x07)); |
| 1247 | | /* The & 4 is a hack that'll tide us over for now */ |
| 1248 | | memory_set_bankptr(space->machine, 1, &nes.wram[(data & 4) * 0x2000]); |
| 1249 | | } |
| 1250 | | break; |
| 1251 | | } |
| 1252 | | break; |
| 1253 | | case 0x1015: /* $5115 */ |
| 1254 | | LOG_MMC(("MMC5 $5115 bank select: %02x (mode: %d)\n", data, MMC5_rom_bank_mode)); |
| 1255 | | switch (MMC5_rom_bank_mode) |
| 1256 | | { |
| 1257 | | case 0x01: |
| 1258 | | case 0x02: |
| 1259 | | if (data & 0x80) |
| 1260 | | { |
| 1261 | | /* 16k switch - ROM only */ |
| 1262 | | prg16_89ab(space->machine, (data & 0x7f) >> 1); |
| 1263 | | } |
| 1264 | | else |
| 1265 | | { |
| 1266 | | /* RAM */ |
| 1267 | | LOG_MMC(("\tRAM bank select (16k, $8000): %02x\n", data & 0x07)); |
| 1268 | | /* The & 4 is a hack that'll tide us over for now */ |
| 1269 | | memory_set_bankptr(space->machine, 1, &nes.wram[((data & 4) >> 1) * 0x4000]); |
| 1270 | | memory_set_bankptr(space->machine, 2, &nes.wram[((data & 4) >> 1) * 0x4000 + 0x2000]); |
| 1271 | | } |
| 1272 | | break; |
| 1273 | | case 0x03: |
| 1274 | | /* 8k switch */ |
| 1275 | | if (data & 0x80) |
| 1276 | | { |
| 1277 | | /* ROM */ |
| 1278 | | data &= ((nes.prg_chunks << 1) - 1); |
| 1279 | | memory_set_bankptr(space->machine, 2, &nes.rom[data * 0x2000 + 0x10000]); |
| 1280 | | } |
| 1281 | | else |
| 1282 | | { |
| 1283 | | /* RAM */ |
| 1284 | | LOG_MMC(("\tRAM bank select (8k, $a000): %02x\n", data & 0x07)); |
| 1285 | | /* The & 4 is a hack that'll tide us over for now */ |
| 1286 | | memory_set_bankptr(space->machine, 2, &nes.wram[(data & 4) * 0x2000]); |
| 1287 | | } |
| 1288 | | break; |
| 1289 | | } |
| 1290 | | break; |
| 1291 | | case 0x1016: /* $5116 */ |
| 1292 | | LOG_MMC(("MMC5 $5116 bank select: %02x (mode: %d)\n", data, MMC5_rom_bank_mode)); |
| 1293 | | switch (MMC5_rom_bank_mode) |
| 1294 | | { |
| 1295 | | case 0x02: |
| 1296 | | case 0x03: |
| 1297 | | /* 8k switch */ |
| 1298 | | if (data & 0x80) |
| 1299 | | { |
| 1300 | | /* ROM */ |
| 1301 | | data &= ((nes.prg_chunks << 1) - 1); |
| 1302 | | memory_set_bankptr(space->machine, 3, &nes.rom[data * 0x2000 + 0x10000]); |
| 1303 | | } |
| 1304 | | else |
| 1305 | | { |
| 1306 | | /* RAM */ |
| 1307 | | LOG_MMC(("\tRAM bank select (8k, $c000): %02x\n", data & 0x07)); |
| 1308 | | /* The & 4 is a hack that'll tide us over for now */ |
| 1309 | | memory_set_bankptr(space->machine, 3, &nes.wram[(data & 4)* 0x2000]); |
| 1310 | | } |
| 1311 | | break; |
| 1312 | | } |
| 1313 | | break; |
| 1314 | | case 0x1017: /* $5117 */ |
| 1315 | | LOG_MMC(("MMC5 $5117 bank select: %02x (mode: %d)\n", data, MMC5_rom_bank_mode)); |
| 1316 | | switch (MMC5_rom_bank_mode) |
| 1317 | | { |
| 1318 | | case 0x00: |
| 1319 | | /* 32k switch - ROM only */ |
| 1320 | | prg32(space->machine, data >> 2); |
| 1321 | | break; |
| 1322 | | case 0x01: |
| 1323 | | /* 16k switch - ROM only */ |
| 1324 | | prg16_cdef(space->machine, data >> 1); |
| 1325 | | break; |
| 1326 | | case 0x02: |
| 1327 | | case 0x03: |
| 1328 | | /* 8k switch */ |
| 1329 | | data &= ((nes.prg_chunks << 1) - 1); |
| 1330 | | memory_set_bankptr(space->machine, 4, &nes.rom[data * 0x2000 + 0x10000]); |
| 1331 | | break; |
| 1332 | | } |
| 1333 | | break; |
| 1334 | | case 0x1020: /* $5120 */ |
| 1335 | | LOG_MMC(("MMC5 $5120 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 1336 | | switch (MMC5_vrom_bank_mode) |
| 1337 | | { |
| 1338 | | case 0x03: |
| 1339 | | /* 1k switch */ |
| 1340 | | vrom_bank[0] = data; |
| 1341 | | // mapper5_sync_vrom(0); |
| 1342 | | chr1_0(space->machine, vrom_bank[0], CHRROM); |
| 1343 | | // nes_vram_sprite[0] = vrom_bank[0] * 64; |
| 1344 | | // vrom_next[0] = 4; |
| 1345 | | // vrom_page_a = 1; |
| 1346 | | // vrom_page_b = 0; |
| 1347 | | break; |
| 1348 | | } |
| 1349 | | break; |
| 1350 | | case 0x1021: /* $5121 */ |
| 1351 | | LOG_MMC(("MMC5 $5121 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 1352 | | switch (MMC5_vrom_bank_mode) |
| 1353 | | { |
| 1354 | | case 0x02: |
| 1355 | | /* 2k switch */ |
| 1356 | | chr2_0 (space->machine, data, CHRROM); |
| 1357 | | break; |
| 1358 | | case 0x03: |
| 1359 | | /* 1k switch */ |
| 1360 | | vrom_bank[1] = data; |
| 1361 | | // mapper5_sync_vrom(0); |
| 1362 | | chr1_1(space->machine, vrom_bank[1], CHRROM); |
| 1363 | | // nes_vram_sprite[1] = vrom_bank[0] * 64; |
| 1364 | | // vrom_next[1] = 5; |
| 1365 | | // vrom_page_a = 1; |
| 1366 | | // vrom_page_b = 0; |
| 1367 | | break; |
| 1368 | | } |
| 1369 | | break; |
| 1370 | | case 0x1022: /* $5122 */ |
| 1371 | | LOG_MMC(("MMC5 $5122 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 1372 | | switch (MMC5_vrom_bank_mode) |
| 1373 | | { |
| 1374 | | case 0x03: |
| 1375 | | /* 1k switch */ |
| 1376 | | vrom_bank[2] = data; |
| 1377 | | // mapper5_sync_vrom(0); |
| 1378 | | chr1_2(space->machine, vrom_bank[2], CHRROM); |
| 1379 | | // nes_vram_sprite[2] = vrom_bank[0] * 64; |
| 1380 | | // vrom_next[2] = 6; |
| 1381 | | // vrom_page_a = 1; |
| 1382 | | // vrom_page_b = 0; |
| 1383 | | break; |
| 1384 | | } |
| 1385 | | break; |
| 1386 | | case 0x1023: /* $5123 */ |
| 1387 | | LOG_MMC(("MMC5 $5123 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 1388 | | switch (MMC5_vrom_bank_mode) |
| 1389 | | { |
| 1390 | | case 0x01: |
| 1391 | | chr4_0 (space->machine, data, CHRROM); |
| 1392 | | break; |
| 1393 | | case 0x02: |
| 1394 | | /* 2k switch */ |
| 1395 | | chr2_2 (space->machine, data, CHRROM); |
| 1396 | | break; |
| 1397 | | case 0x03: |
| 1398 | | /* 1k switch */ |
| 1399 | | vrom_bank[3] = data; |
| 1400 | | // mapper5_sync_vrom(0); |
| 1401 | | chr1_3(space->machine, vrom_bank[3], CHRROM); |
| 1402 | | // nes_vram_sprite[3] = vrom_bank[0] * 64; |
| 1403 | | // vrom_next[3] = 7; |
| 1404 | | // vrom_page_a = 1; |
| 1405 | | // vrom_page_b = 0; |
| 1406 | | break; |
| 1407 | | } |
| 1408 | | break; |
| 1409 | | case 0x1024: /* $5124 */ |
| 1410 | | LOG_MMC(("MMC5 $5124 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 1411 | | switch (MMC5_vrom_bank_mode) |
| 1412 | | { |
| 1413 | | case 0x03: |
| 1414 | | /* 1k switch */ |
| 1415 | | vrom_bank[4] = data; |
| 1416 | | // mapper5_sync_vrom(0); |
| 1417 | | chr1_4(space->machine, vrom_bank[4], CHRROM); |
| 1418 | | // nes_vram_sprite[4] = vrom_bank[0] * 64; |
| 1419 | | // vrom_next[0] = 0; |
| 1420 | | // vrom_page_a = 0; |
| 1421 | | // vrom_page_b = 0; |
| 1422 | | break; |
| 1423 | | } |
| 1424 | | break; |
| 1425 | | case 0x1025: /* $5125 */ |
| 1426 | | LOG_MMC(("MMC5 $5125 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 1427 | | switch (MMC5_vrom_bank_mode) |
| 1428 | | { |
| 1429 | | case 0x02: |
| 1430 | | /* 2k switch */ |
| 1431 | | chr2_4 (space->machine, data, CHRROM); |
| 1432 | | break; |
| 1433 | | case 0x03: |
| 1434 | | /* 1k switch */ |
| 1435 | | vrom_bank[5] = data; |
| 1436 | | // mapper5_sync_vrom(0); |
| 1437 | | chr1_5(space->machine, vrom_bank[5], CHRROM); |
| 1438 | | // nes_vram_sprite[5] = vrom_bank[0] * 64; |
| 1439 | | // vrom_next[1] = 1; |
| 1440 | | // vrom_page_a = 0; |
| 1441 | | // vrom_page_b = 0; |
| 1442 | | break; |
| 1443 | | } |
| 1444 | | break; |
| 1445 | | case 0x1026: /* $5126 */ |
| 1446 | | LOG_MMC(("MMC5 $5126 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 1447 | | switch (MMC5_vrom_bank_mode) |
| 1448 | | { |
| 1449 | | case 0x03: |
| 1450 | | /* 1k switch */ |
| 1451 | | vrom_bank[6] = data; |
| 1452 | | // mapper5_sync_vrom(0); |
| 1453 | | chr1_6(space->machine, vrom_bank[6], CHRROM); |
| 1454 | | // nes_vram_sprite[6] = vrom_bank[0] * 64; |
| 1455 | | // vrom_next[2] = 2; |
| 1456 | | // vrom_page_a = 0; |
| 1457 | | // vrom_page_b = 0; |
| 1458 | | break; |
| 1459 | | } |
| 1460 | | break; |
| 1461 | | case 0x1027: /* $5127 */ |
| 1462 | | LOG_MMC(("MMC5 $5127 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 1463 | | switch (MMC5_vrom_bank_mode) |
| 1464 | | { |
| 1465 | | case 0x00: |
| 1466 | | /* 8k switch */ |
| 1467 | | chr8(space->machine, data, CHRROM); |
| 1468 | | break; |
| 1469 | | case 0x01: |
| 1470 | | /* 4k switch */ |
| 1471 | | chr4_4 (space->machine, data, CHRROM); |
| 1472 | | break; |
| 1473 | | case 0x02: |
| 1474 | | /* 2k switch */ |
| 1475 | | chr2_6 (space->machine, data, CHRROM); |
| 1476 | | break; |
| 1477 | | case 0x03: |
| 1478 | | /* 1k switch */ |
| 1479 | | vrom_bank[7] = data; |
| 1480 | | // mapper5_sync_vrom(0); |
| 1481 | | chr1_7(space->machine, vrom_bank[7], CHRROM); |
| 1482 | | // nes_vram_sprite[7] = vrom_bank[0] * 64; |
| 1483 | | // vrom_next[3] = 3; |
| 1484 | | // vrom_page_a = 0; |
| 1485 | | // vrom_page_b = 0; |
| 1486 | | break; |
| 1487 | | } |
| 1488 | | break; |
| 1489 | | case 0x1028: /* $5128 */ |
| 1490 | | LOG_MMC(("MMC5 $5128 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 1491 | | switch (MMC5_vrom_bank_mode) |
| 1492 | | { |
| 1493 | | case 0x03: |
| 1494 | | /* 1k switch */ |
| 1495 | | vrom_bank[8] = vrom_bank[12] = data; |
| 1496 | | // nes_vram[vrom_next[0]] = data * 64; |
| 1497 | | // nes_vram[0 + (vrom_page_a*4)] = data * 64; |
| 1498 | | // nes_vram[0] = data * 64; |
| 1499 | | chr1_4(space->machine, data, CHRROM); |
| 1500 | | // mapper5_sync_vrom(1); |
| 1501 | | if (!vrom_page_b) |
| 1502 | | { |
| 1503 | | vrom_page_a ^= 0x01; |
| 1504 | | vrom_page_b = 1; |
| 1505 | | } |
| 1506 | | break; |
| 1507 | | } |
| 1508 | | break; |
| 1509 | | case 0x1029: /* $5129 */ |
| 1510 | | LOG_MMC(("MMC5 $5129 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 1511 | | switch (MMC5_vrom_bank_mode) |
| 1512 | | { |
| 1513 | | case 0x02: |
| 1514 | | /* 2k switch */ |
| 1515 | | chr2_0 (space->machine, data, CHRROM); |
| 1516 | | chr2_4 (space->machine, data, CHRROM); |
| 1517 | | break; |
| 1518 | | case 0x03: |
| 1519 | | /* 1k switch */ |
| 1520 | | vrom_bank[9] = vrom_bank[13] = data; |
| 1521 | | // nes_vram[vrom_next[1]] = data * 64; |
| 1522 | | // nes_vram[1 + (vrom_page_a*4)] = data * 64; |
| 1523 | | // nes_vram[1] = data * 64; |
| 1524 | | chr1_5(space->machine, data, CHRROM); |
| 1525 | | // mapper5_sync_vrom(1); |
| 1526 | | if (!vrom_page_b) |
| 1527 | | { |
| 1528 | | vrom_page_a ^= 0x01; |
| 1529 | | vrom_page_b = 1; |
| 1530 | | } |
| 1531 | | break; |
| 1532 | | } |
| 1533 | | break; |
| 1534 | | case 0x102a: /* $512a */ |
| 1535 | | LOG_MMC(("MMC5 $512a vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 1536 | | switch (MMC5_vrom_bank_mode) |
| 1537 | | { |
| 1538 | | case 0x03: |
| 1539 | | /* 1k switch */ |
| 1540 | | vrom_bank[10] = vrom_bank[14] = data; |
| 1541 | | // nes_vram[vrom_next[2]] = data * 64; |
| 1542 | | // nes_vram[2 + (vrom_page_a*4)] = data * 64; |
| 1543 | | // nes_vram[2] = data * 64; |
| 1544 | | chr1_6(space->machine, data, CHRROM); |
| 1545 | | // mapper5_sync_vrom(1); |
| 1546 | | if (!vrom_page_b) |
| 1547 | | { |
| 1548 | | vrom_page_a ^= 0x01; |
| 1549 | | vrom_page_b = 1; |
| 1550 | | } |
| 1551 | | break; |
| 1552 | | } |
| 1553 | | break; |
| 1554 | | case 0x102b: /* $512b */ |
| 1555 | | LOG_MMC(("MMC5 $512b vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 1556 | | switch (MMC5_vrom_bank_mode) |
| 1557 | | { |
| 1558 | | case 0x00: |
| 1559 | | /* 8k switch */ |
| 1560 | | /* switches in first half of an 8K bank!) */ |
| 1561 | | chr4_0 (space->machine, data << 1, CHRROM); |
| 1562 | | chr4_4 (space->machine, data << 1, CHRROM); |
| 1563 | | break; |
| 1564 | | case 0x01: |
| 1565 | | /* 4k switch */ |
| 1566 | | chr4_0 (space->machine, data, CHRROM); |
| 1567 | | chr4_4 (space->machine, data, CHRROM); |
| 1568 | | break; |
| 1569 | | case 0x02: |
| 1570 | | /* 2k switch */ |
| 1571 | | chr2_2 (space->machine, data, CHRROM); |
| 1572 | | chr2_6 (space->machine, data, CHRROM); |
| 1573 | | break; |
| 1574 | | case 0x03: |
| 1575 | | /* 1k switch */ |
| 1576 | | vrom_bank[11] = vrom_bank[15] = data; |
| 1577 | | // nes_vram[vrom_next[3]] = data * 64; |
| 1578 | | // nes_vram[3 + (vrom_page_a*4)] = data * 64; |
| 1579 | | // nes_vram[3] = data * 64; |
| 1580 | | chr1_7(space->machine, data, CHRROM); |
| 1581 | | // mapper5_sync_vrom(1); |
| 1582 | | if (!vrom_page_b) |
| 1583 | | { |
| 1584 | | vrom_page_a ^= 0x01; |
| 1585 | | vrom_page_b = 1; |
| 1586 | | } |
| 1587 | | break; |
| 1588 | | } |
| 1589 | | break; |
| 1590 | | |
| 1591 | | case 0x1103: /* $5203 */ |
| 1592 | | IRQ_count = data; |
| 1593 | | MMC5_scanline = data; |
| 1594 | | LOG_MMC(("MMC5 irq scanline: %d\n", IRQ_count)); |
| 1595 | | break; |
| 1596 | | case 0x1104: /* $5204 */ |
| 1597 | | IRQ_enable = data & 0x80; |
| 1598 | | LOG_MMC(("MMC5 irq enable: %02x\n", data)); |
| 1599 | | break; |
| 1600 | | case 0x1105: /* $5205 */ |
| 1601 | | mult1 = data; |
| 1602 | | break; |
| 1603 | | case 0x1106: /* $5206 */ |
| 1604 | | mult2 = data; |
| 1605 | | break; |
| 1606 | | |
| 1607 | | default: |
| 1608 | | logerror("** MMC5 uncaught write, offset: %04x, data: %02x\n", offset + 0x4100, data); |
| 1609 | | break; |
| 1610 | | } |
| 1611 | | } |
| 1612 | | |
| 1613 | | static WRITE8_HANDLER( mapper5_w ) |
| 1614 | | { |
| 1615 | | logerror("MMC5 uncaught high mapper w, %04x: %02x\n", offset, data); |
| 1616 | | } |
| 1617 | | |
| 1618 | | /************************************************************* |
| 1619 | | |
| 1620 | | Mapper 6 |
| 1621 | | |
| 1622 | | Known Boards: FFE4 Copier Board |
| 1623 | | Games: Hacked versions of games |
| 1624 | | |
| 1625 | | In MESS: Supported? Not sure if we could also have ExRAM or not... |
| 1626 | | However, priority is pretty low for this mapper. |
| 1627 | | |
| 1628 | | *************************************************************/ |
| 1629 | | |
| 1630 | | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 1631 | | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 1632 | | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 1633 | | static void ffe_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 1634 | | { |
| 1635 | | /* 114 is the number of cycles per scanline */ |
| 1636 | | /* TODO: change to reflect the actual number of cycles spent */ |
| 1637 | | if (IRQ_enable) |
| 1638 | | { |
| 1639 | | if ((0xffff - IRQ_count) < 114) |
| 1640 | | { |
| 1641 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 1642 | | IRQ_count = 0xffff; |
| 1643 | | IRQ_enable = 0; |
| 1644 | | } |
| 1645 | | IRQ_count -= 114; |
| 1646 | | } |
| 1647 | | } |
| 1648 | | |
| 1649 | | static WRITE8_HANDLER( mapper6_l_w ) |
| 1650 | | { |
| 1651 | | LOG_MMC(("mapper6_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 1652 | | |
| 1653 | | switch (offset) |
| 1654 | | { |
| 1655 | | case 0x1fe: |
| 1656 | | mmc_cmd1 = data & 0x80; |
| 1657 | | set_nt_mirroring((data & 0x10) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 1658 | | break; |
| 1659 | | case 0x1ff: |
| 1660 | | set_nt_mirroring((data & 0x10) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 1661 | | break; |
| 1662 | | |
| 1663 | | case 0x401: |
| 1664 | | IRQ_enable = data & 0x01; |
| 1665 | | break; |
| 1666 | | case 0x402: |
| 1667 | | IRQ_count = (IRQ_count & 0xff00) | data; |
| 1668 | | break; |
| 1669 | | case 0x403: |
| 1670 | | IRQ_enable = 1; |
| 1671 | | IRQ_count = (IRQ_count & 0x00ff) | (data << 8); |
| 1672 | | break; |
| 1673 | | } |
| 1674 | | } |
| 1675 | | |
| 1676 | | static WRITE8_HANDLER( mapper6_w ) |
| 1677 | | { |
| 1678 | | LOG_MMC(("mapper6_w, offset: %04x, data: %02x\n", offset, data)); |
| 1679 | | |
| 1680 | | if (!mmc_cmd1) // when in "FFE mode" we are forced to use CHRRAM/EXRAM bank? |
| 1681 | | { |
| 1682 | | prg16_89ab(space->machine, data >> 2); |
| 1683 | | // chr8(space->machine, data & 0x03, ???); |
| 1684 | | // due to lack of info on the exact behavior, we simply act as if mmc_cmd=1 |
| 1685 | | if (mmc_chr_source == CHRROM) |
| 1686 | | chr8(space->machine, data & 0x03, CHRROM); |
| 1687 | | } |
| 1688 | | else if (mmc_chr_source == CHRROM) // otherwise, we can use CHRROM (when present) |
| 1689 | | chr8(space->machine, data, CHRROM); |
| 1690 | | } |
| 1691 | | |
| 1692 | | /************************************************************* |
| 1693 | | |
| 1694 | | Mapper 7 |
| 1695 | | |
| 1696 | | Known Boards: AMROM, ANROM, AN1ROM, AOROM and unlicensed |
| 1697 | | AxROM |
| 1698 | | Games: Arch Rivals, Battletoads, Cabal, Commando, Solstice |
| 1699 | | |
| 1700 | | In MESS: Supported |
| 1701 | | |
| 1702 | | *************************************************************/ |
| 1703 | | |
| 1704 | | static WRITE8_HANDLER( mapper7_w ) |
| 1705 | | { |
| 1706 | | LOG_MMC(("mapper7_w, offset: %04x, data: %02x\n", offset, data)); |
| 1707 | | |
| 1708 | | set_nt_mirroring((data & 0x10) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 1709 | | prg32(space->machine, data); |
| 1710 | | } |
| 1711 | | |
| 1712 | | /************************************************************* |
| 1713 | | |
| 1714 | | Mapper 8 |
| 1715 | | |
| 1716 | | Known Boards: FFE3 Copier Board |
| 1717 | | Games: Hacked versions of games |
| 1718 | | |
| 1719 | | In MESS: Supported? (I have no games to test this) |
| 1720 | | |
| 1721 | | *************************************************************/ |
| 1722 | | |
| 1723 | | static WRITE8_HANDLER( mapper8_w ) |
| 1724 | | { |
| 1725 | | LOG_MMC(("mapper8_w, offset: %04x, data: %02x\n", offset, data)); |
| 1726 | | |
| 1727 | | chr8(space->machine, data & 0x07, CHRROM); |
| 1728 | | prg16_89ab(space->machine, data >> 3); |
| 1729 | | } |
| 1730 | | |
| 1731 | | /************************************************************* |
| 1732 | | |
| 1733 | | Mapper 9 |
| 1734 | | |
| 1735 | | Known Boards: MMC2 based Boards, i.e. PNROM & PEEOROM |
| 1736 | | Games: Punch Out!!, Mike Tyson's Punch Out!! |
| 1737 | | |
| 1738 | | In MESS: Supported |
| 1739 | | |
| 1740 | | *************************************************************/ |
| 1741 | | |
| 1742 | | static void mapper9_latch (const device_config *device, offs_t offset) |
| 1743 | | { |
| 1744 | | if ((offset & 0x3ff0) == 0x0fd0) |
| 1745 | | { |
| 1746 | | LOG_MMC(("mapper9 vrom latch switch (bank 0 low): %02x\n", MMC2_regs[0])); |
| 1747 | | mmc_cmd1 = 0xfd; |
| 1748 | | chr4_0(device->machine, MMC2_regs[0], CHRROM); |
| 1749 | | } |
| 1750 | | else if ((offset & 0x3ff0) == 0x0fe0) |
| 1751 | | { |
| 1752 | | LOG_MMC(("mapper9 vrom latch switch (bank 0 high): %02x\n", MMC2_regs[1])); |
| 1753 | | mmc_cmd1 = 0xfe; |
| 1754 | | chr4_0(device->machine, MMC2_regs[1], CHRROM); |
| 1755 | | } |
| 1756 | | else if ((offset & 0x3ff0) == 0x1fd0) |
| 1757 | | { |
| 1758 | | LOG_MMC(("mapper9 vrom latch switch (bank 1 low): %02x\n", MMC2_regs[2])); |
| 1759 | | mmc_cmd2 = 0xfd; |
| 1760 | | chr4_4(device->machine, MMC2_regs[2], CHRROM); |
| 1761 | | } |
| 1762 | | else if ((offset & 0x3ff0) == 0x1fe0) |
| 1763 | | { |
| 1764 | | LOG_MMC(("mapper9 vrom latch switch (bank 0 high): %02x\n", MMC2_regs[3])); |
| 1765 | | mmc_cmd2 = 0xfe; |
| 1766 | | chr4_4(device->machine, MMC2_regs[3], CHRROM); |
| 1767 | | } |
| 1768 | | } |
| 1769 | | |
| 1770 | | static WRITE8_HANDLER( mapper9_w ) |
| 1771 | | { |
| 1772 | | LOG_MMC(("mapper9_w, offset: %04x, data: %02x\n", offset, data)); |
| 1773 | | switch (offset & 0x7000) |
| 1774 | | { |
| 1775 | | case 0x2000: |
| 1776 | | prg8_89(space->machine, data); |
| 1777 | | break; |
| 1778 | | case 0x3000: |
| 1779 | | MMC2_regs[0] = data; |
| 1780 | | if (mmc_cmd1 == 0xfd) |
| 1781 | | chr4_0(space->machine, MMC2_regs[0], CHRROM); |
| 1782 | | break; |
| 1783 | | case 0x4000: |
| 1784 | | MMC2_regs[1] = data; |
| 1785 | | if (mmc_cmd1 == 0xfe) |
| 1786 | | chr4_0(space->machine, MMC2_regs[1], CHRROM); |
| 1787 | | break; |
| 1788 | | case 0x5000: |
| 1789 | | MMC2_regs[2] = data; |
| 1790 | | if (mmc_cmd2 == 0xfd) |
| 1791 | | chr4_4(space->machine, MMC2_regs[2], CHRROM); |
| 1792 | | break; |
| 1793 | | case 0x6000: |
| 1794 | | MMC2_regs[3] = data; |
| 1795 | | if (mmc_cmd2 == 0xfe) |
| 1796 | | chr4_4(space->machine, MMC2_regs[3], CHRROM); |
| 1797 | | break; |
| 1798 | | case 0x7000: |
| 1799 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 1800 | | break; |
| 1801 | | default: |
| 1802 | | LOG_MMC(("MMC2 uncaught w: %04x:%02x\n", offset, data)); |
| 1803 | | break; |
| 1804 | | } |
| 1805 | | } |
| 1806 | | |
| 1807 | | |
| 1808 | | /************************************************************* |
| 1809 | | |
| 1810 | | Mapper 10 |
| 1811 | | |
| 1812 | | Known Boards: MMC4 based Boards, i.e. FJROM & FKROM |
| 1813 | | Games: Famicom Wars, Fire Emblem, Fire Emblem Gaiden |
| 1814 | | |
| 1815 | | In MESS: Supported |
| 1816 | | |
| 1817 | | *************************************************************/ |
| 1818 | | |
| 1819 | | static WRITE8_HANDLER( mapper10_w ) |
| 1820 | | { |
| 1821 | | LOG_MMC(("mapper10_w, offset: %04x, data: %02x\n", offset, data)); |
| 1822 | | switch (offset & 0x7000) |
| 1823 | | { |
| 1824 | | case 0x2000: |
| 1825 | | prg16_89ab(space->machine, data); |
| 1826 | | break; |
| 1827 | | default: |
| 1828 | | mapper9_w(space, offset, data); |
| 1829 | | break; |
| 1830 | | } |
| 1831 | | } |
| 1832 | | |
| 1833 | | /************************************************************* |
| 1834 | | |
| 1835 | | Mapper 11 |
| 1836 | | |
| 1837 | | Known Boards: Discrete Logic Board, NINA07 |
| 1838 | | Games: many Color Dreams and Wisdom Tree titles |
| 1839 | | |
| 1840 | | In MESS: Supported |
| 1841 | | |
| 1842 | | *************************************************************/ |
| 1843 | | |
| 1844 | | static WRITE8_HANDLER( mapper11_w ) |
| 1845 | | { |
| 1846 | | LOG_MMC(("mapper11_w, offset: %04x, data: %02x\n", offset, data)); |
| 1847 | | |
| 1848 | | chr8(space->machine, data >> 4, mmc_chr_source); |
| 1849 | | prg32(space->machine, data & 0x0f); |
| 1850 | | } |
| 1851 | | |
| 1852 | | /************************************************************* |
| 1853 | | |
| 1854 | | Mapper 12 |
| 1855 | | |
| 1856 | | Known Boards: Bootleg Board by Rex Soft |
| 1857 | | Games: Dragon Ball Z 5, Dragon Ball Z Super |
| 1858 | | |
| 1859 | | MMC3 clone |
| 1860 | | |
| 1861 | | In MESS: Partially Supported |
| 1862 | | |
| 1863 | | *************************************************************/ |
| 1864 | | |
| 1865 | | static WRITE8_HANDLER( mapper12_l_w ) |
| 1866 | | { |
| 1867 | | LOG_MMC(("mapper12_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 1868 | | |
| 1869 | | mapper12_reg = data; |
| 1870 | | } |
| 1871 | | |
| 1872 | | /* we would need to use this read handler in 0x6000-0x7fff as well */ |
| 1873 | | static READ8_HANDLER( mapper12_l_r ) |
| 1874 | | { |
| 1875 | | LOG_MMC(("mapper12_l_r, offset: %04x\n", offset)); |
| 1876 | | return 0x01; |
| 1877 | | } |
| 1878 | | |
| 1879 | | static void mapper12_set_chr( running_machine *machine ) |
| 1880 | | { |
| 1881 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 1882 | | |
| 1883 | | chr1_x(machine, chr_page ^ 0, ((mapper12_reg & 0x01) << 8) | (vrom_bank[0] & ~0x01), CHRROM); |
| 1884 | | chr1_x(machine, chr_page ^ 1, ((mapper12_reg & 0x01) << 8) | (vrom_bank[0] | 0x01), CHRROM); |
| 1885 | | chr1_x(machine, chr_page ^ 2, ((mapper12_reg & 0x01) << 8) | (vrom_bank[1] & ~0x01), CHRROM); |
| 1886 | | chr1_x(machine, chr_page ^ 3, ((mapper12_reg & 0x01) << 8) | (vrom_bank[1] | 0x01), CHRROM); |
| 1887 | | chr1_x(machine, chr_page ^ 4, ((mapper12_reg & 0x10) << 4) | vrom_bank[2], CHRROM); |
| 1888 | | chr1_x(machine, chr_page ^ 5, ((mapper12_reg & 0x10) << 4) | vrom_bank[3], CHRROM); |
| 1889 | | chr1_x(machine, chr_page ^ 6, ((mapper12_reg & 0x10) << 4) | vrom_bank[4], CHRROM); |
| 1890 | | chr1_x(machine, chr_page ^ 7, ((mapper12_reg & 0x10) << 4) | vrom_bank[5], CHRROM); |
| 1891 | | } |
| 1892 | | |
| 1893 | | static WRITE8_HANDLER( mapper12_w ) |
| 1894 | | { |
| 1895 | | UINT8 MMC3_helper, cmd; |
| 1896 | | LOG_MMC(("mapper12_w, offset: %04x, data: %02x\n", offset, data)); |
| 1897 | | |
| 1898 | | switch (offset & 0x6001) |
| 1899 | | { |
| 1900 | | case 0x0000: |
| 1901 | | MMC3_helper = mmc_cmd1 ^ data; |
| 1902 | | mmc_cmd1 = data; |
| 1903 | | |
| 1904 | | /* Has PRG Mode changed? */ |
| 1905 | | if (MMC3_helper & 0x40) |
| 1906 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 1907 | | |
| 1908 | | /* Has CHR Mode changed? */ |
| 1909 | | if (MMC3_helper & 0x80) |
| 1910 | | mapper12_set_chr(space->machine); |
| 1911 | | break; |
| 1912 | | |
| 1913 | | case 0x0001: |
| 1914 | | cmd = mmc_cmd1 & 0x07; |
| 1915 | | switch (cmd) |
| 1916 | | { |
| 1917 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 1918 | | case 2: case 3: case 4: case 5: |
| 1919 | | vrom_bank[cmd] = data; |
| 1920 | | mapper12_set_chr(space->machine); |
| 1921 | | break; |
| 1922 | | case 6: |
| 1923 | | case 7: |
| 1924 | | prg_bank[cmd - 6] = data; |
| 1925 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 1926 | | break; |
| 1927 | | } |
| 1928 | | break; |
| 1929 | | |
| 1930 | | default: |
| 1931 | | mapper4_w(space, offset, data); |
| 1932 | | break; |
| 1933 | | } |
| 1934 | | } |
| 1935 | | |
| 1936 | | /************************************************************* |
| 1937 | | |
| 1938 | | Mapper 13 |
| 1939 | | |
| 1940 | | Known Boards: CPROM |
| 1941 | | Games: Videomation |
| 1942 | | |
| 1943 | | In MESS: Supported |
| 1944 | | |
| 1945 | | *************************************************************/ |
| 1946 | | |
| 1947 | | static WRITE8_HANDLER( mapper13_w ) |
| 1948 | | { |
| 1949 | | LOG_MMC(("mapper13_w, offset: %04x, data: %02x\n", offset, data)); |
| 1950 | | chr4_4(space->machine, data, CHRRAM); |
| 1951 | | } |
| 1952 | | |
| 1953 | | /************************************************************* |
| 1954 | | |
| 1955 | | Mapper 14 |
| 1956 | | |
| 1957 | | Known Boards: Bootleg Board by Rex Soft (SL1632) |
| 1958 | | Games: Samurai Spirits |
| 1959 | | |
| 1960 | | MMC3 clone |
| 1961 | | |
| 1962 | | In MESS: Supported |
| 1963 | | |
| 1964 | | *************************************************************/ |
| 1965 | | |
| 1966 | | static void mapper14_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 1967 | | { |
| 1968 | | if (map14_reg[0] & 0x02) |
| 1969 | | { |
| 1970 | | mapper4_set_prg(machine, prg_base, prg_mask); |
| 1971 | | } |
| 1972 | | else |
| 1973 | | { |
| 1974 | | prg8_89(machine, extra_bank[0]); |
| 1975 | | prg8_ab(machine, extra_bank[1]); |
| 1976 | | prg8_cd(machine, extra_bank[2]); |
| 1977 | | prg8_ef(machine, extra_bank[3]); |
| 1978 | | } |
| 1979 | | } |
| 1980 | | |
| 1981 | | static void mapper14_set_chr( running_machine *machine, UINT8 chr, int chr_base, int chr_mask ) |
| 1982 | | { |
| 1983 | | static const UINT8 conv_table[8] = {5, 5, 5, 5, 3, 3, 1, 1}; |
| 1984 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 1985 | | UINT8 bank[8]; |
| 1986 | | UINT8 chr_base2[8]; |
| 1987 | | int i; |
| 1988 | | |
| 1989 | | if (map14_reg[0] & 0x02) |
| 1990 | | { |
| 1991 | | for(i = 0; i < 8; i++) |
| 1992 | | { |
| 1993 | | bank[i] = vrom_bank[i]; |
| 1994 | | chr_base2[i] = chr_base | ((map14_reg[0] << conv_table[i]) & 0x100); |
| 1995 | | } |
| 1996 | | } |
| 1997 | | else |
| 1998 | | { |
| 1999 | | for(i = 0; i < 8; i++) |
| 2000 | | { |
| 2001 | | bank[i] = extra_bank[i + 4]; // first 4 extra_banks are PRG |
| 2002 | | chr_base2[i] = chr_base; |
| 2003 | | } |
| 2004 | | } |
| 2005 | | |
| 2006 | | chr1_x(machine, chr_page ^ 0, chr_base2[0] | (bank[0] & chr_mask), chr); |
| 2007 | | chr1_x(machine, chr_page ^ 1, chr_base2[1] | (bank[1] & chr_mask), chr); |
| 2008 | | chr1_x(machine, chr_page ^ 2, chr_base2[2] | (bank[2] & chr_mask), chr); |
| 2009 | | chr1_x(machine, chr_page ^ 3, chr_base2[3] | (bank[3] & chr_mask), chr); |
| 2010 | | chr1_x(machine, chr_page ^ 4, chr_base2[4] | (bank[4] & chr_mask), chr); |
| 2011 | | chr1_x(machine, chr_page ^ 5, chr_base2[5] | (bank[5] & chr_mask), chr); |
| 2012 | | chr1_x(machine, chr_page ^ 6, chr_base2[6] | (bank[6] & chr_mask), chr); |
| 2013 | | chr1_x(machine, chr_page ^ 7, chr_base2[7] | (bank[7] & chr_mask), chr); |
| 2014 | | } |
| 2015 | | |
| 2016 | | static WRITE8_HANDLER( mapper14_w ) |
| 2017 | | { |
| 2018 | | UINT8 map14_helper1, map14_helper2, MMC3_helper, cmd; |
| 2019 | | LOG_MMC(("mapper14_w, offset: %04x, data: %02x\n", offset, data)); |
| 2020 | | |
| 2021 | | if (offset == 0x2131) |
| 2022 | | { |
| 2023 | | map14_reg[0] = data; |
| 2024 | | mapper14_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 2025 | | mapper14_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 2026 | | |
| 2027 | | if (!(map14_reg[0] & 0x02)) |
| 2028 | | set_nt_mirroring(map14_reg[1] & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 2029 | | } |
| 2030 | | |
| 2031 | | if (map14_reg[0] & 0x02) |
| 2032 | | { |
| 2033 | | switch (offset & 0x6001) |
| 2034 | | { |
| 2035 | | case 0x0000: |
| 2036 | | MMC3_helper = mmc_cmd1 ^ data; |
| 2037 | | mmc_cmd1 = data; |
| 2038 | | |
| 2039 | | /* Has PRG Mode changed? */ |
| 2040 | | if (MMC3_helper & 0x40) |
| 2041 | | mapper14_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 2042 | | |
| 2043 | | /* Has CHR Mode changed? */ |
| 2044 | | if (MMC3_helper & 0x80) |
| 2045 | | mapper14_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 2046 | | break; |
| 2047 | | |
| 2048 | | case 0x0001: |
| 2049 | | cmd = mmc_cmd1 & 0x07; |
| 2050 | | switch (cmd) |
| 2051 | | { |
| 2052 | | case 0: case 1: // these have to be changed due to the different way mapper14_set_chr works (it handles 1k banks)! |
| 2053 | | vrom_bank[2 * cmd] = data; |
| 2054 | | vrom_bank[2 * cmd + 1] = data; |
| 2055 | | mapper14_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 2056 | | break; |
| 2057 | | case 2: case 3: case 4: case 5: |
| 2058 | | vrom_bank[cmd + 2] = data; |
| 2059 | | mapper14_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 2060 | | break; |
| 2061 | | case 6: |
| 2062 | | case 7: |
| 2063 | | prg_bank[cmd - 6] = data; |
| 2064 | | mapper14_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 2065 | | break; |
| 2066 | | } |
| 2067 | | break; |
| 2068 | | |
| 2069 | | case 0x2000: |
| 2070 | | set_nt_mirroring(map14_reg[1] & 0x01 ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 2071 | | break; |
| 2072 | | |
| 2073 | | default: |
| 2074 | | mapper4_w(space, offset, data); |
| 2075 | | break; |
| 2076 | | } |
| 2077 | | } |
| 2078 | | else if (offset >= 0x3000 && offset <= 0x6003 ) |
| 2079 | | { |
| 2080 | | map14_helper1 = (offset & 0x01) << 2; |
| 2081 | | offset = ((offset & 0x02) | (offset >> 10)) >> 1; |
| 2082 | | map14_helper2 = ((offset + 2) & 0x07) + 4; // '+4' because first 4 extra_banks are for PRG! |
| 2083 | | extra_bank[map14_helper2] = (extra_bank[map14_helper2] & (0xf0 >> map14_helper1)) | ((data & 0x0f) << map14_helper1); |
| 2084 | | mapper14_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 2085 | | } |
| 2086 | | else |
| 2087 | | { |
| 2088 | | switch (offset & 0x7003) |
| 2089 | | { |
| 2090 | | case 0x0000: |
| 2091 | | case 0x2000: |
| 2092 | | extra_bank[offset >> 13] = data; |
| 2093 | | mapper14_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 2094 | | break; |
| 2095 | | |
| 2096 | | case 0x1000: |
| 2097 | | map14_reg[1] = data; |
| 2098 | | set_nt_mirroring(map14_reg[1] & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 2099 | | break; |
| 2100 | | } |
| 2101 | | } |
| 2102 | | } |
| 2103 | | |
| 2104 | | /************************************************************* |
| 2105 | | |
| 2106 | | Mapper 15 |
| 2107 | | |
| 2108 | | Known Boards: Bootleg Board by Waixing (and probably others) |
| 2109 | | Games: Bao Xiao Tien Guo, Bio Hazard, Pokemon Gold, Subor (R) |
| 2110 | | |
| 2111 | | In MESS: Supported |
| 2112 | | |
| 2113 | | *************************************************************/ |
| 2114 | | |
| 2115 | | static WRITE8_HANDLER( mapper15_w ) |
| 2116 | | { |
| 2117 | | UINT8 map15_flip = (data & 0x80) >> 7; |
| 2118 | | UINT8 map15_helper = (data & 0x7f) << 1; |
| 2119 | | |
| 2120 | | LOG_MMC(("mapper15_w, offset: %04x, data: %02x\n", offset, data)); |
| 2121 | | |
| 2122 | | set_nt_mirroring((data & 0x40) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 2123 | | |
| 2124 | | switch (offset & 0x0fff) |
| 2125 | | { |
| 2126 | | case 0x000: |
| 2127 | | prg8_89(space->machine, (map15_helper + 0) ^ map15_flip); |
| 2128 | | prg8_ab(space->machine, (map15_helper + 1) ^ map15_flip); |
| 2129 | | prg8_cd(space->machine, (map15_helper + 2) ^ map15_flip); |
| 2130 | | prg8_ef(space->machine, (map15_helper + 3) ^ map15_flip); |
| 2131 | | break; |
| 2132 | | case 0x001: |
| 2133 | | map15_helper |= map15_flip; |
| 2134 | | prg8_89(space->machine, map15_helper); |
| 2135 | | prg8_ab(space->machine, map15_helper + 1); |
| 2136 | | prg8_cd(space->machine, map15_helper + 1); |
| 2137 | | prg8_ef(space->machine, map15_helper + 1); |
| 2138 | | break; |
| 2139 | | case 0x002: |
| 2140 | | map15_helper |= map15_flip; |
| 2141 | | prg8_89(space->machine, map15_helper); |
| 2142 | | prg8_ab(space->machine, map15_helper); |
| 2143 | | prg8_cd(space->machine, map15_helper); |
| 2144 | | prg8_ef(space->machine, map15_helper); |
| 2145 | | break; |
| 2146 | | case 0x003: |
| 2147 | | map15_helper |= map15_flip; |
| 2148 | | prg8_89(space->machine, map15_helper); |
| 2149 | | prg8_ab(space->machine, map15_helper + 1); |
| 2150 | | prg8_cd(space->machine, map15_helper); |
| 2151 | | prg8_ef(space->machine, map15_helper + 1); |
| 2152 | | break; |
| 2153 | | } |
| 2154 | | } |
| 2155 | | |
| 2156 | | /************************************************************* |
| 2157 | | |
| 2158 | | Mapper 16 |
| 2159 | | |
| 2160 | | Known Boards: Bandai LZ93D50 24C02 |
| 2161 | | Games: Crayon Shin-Chan - Ora to Poi Poi, Dragon Ball Z Gaiden, |
| 2162 | | Dragon Ball Z II & III, Rokudenashi Blues, SD Gundam |
| 2163 | | Gaiden - KGM2 |
| 2164 | | |
| 2165 | | At the moment, we don't support EEPROM I/O |
| 2166 | | |
| 2167 | | In MESS: Supported |
| 2168 | | |
| 2169 | | *************************************************************/ |
| 2170 | | |
| 2171 | | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 2172 | | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 2173 | | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 2174 | | static void bandai_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 2175 | | { |
| 2176 | | /* 114 is the number of cycles per scanline */ |
| 2177 | | /* TODO: change to reflect the actual number of cycles spent */ |
| 2178 | | if (IRQ_enable) |
| 2179 | | { |
| 2180 | | if (IRQ_count <= 114) |
| 2181 | | { |
| 2182 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 2183 | | IRQ_count = (0xffff - 114 + IRQ_count); // wrap around the 16 bits counter |
| 2184 | | } |
| 2185 | | IRQ_count -= 114; |
| 2186 | | } |
| 2187 | | } |
| 2188 | | |
| 2189 | | static WRITE8_HANDLER( mapper16_m_w ) |
| 2190 | | { |
| 2191 | | LOG_MMC(("mapper16_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 2192 | | |
| 2193 | | switch (offset & 0x000f) |
| 2194 | | { |
| 2195 | | case 0: case 1: |
| 2196 | | case 2: case 3: |
| 2197 | | case 4: case 5: |
| 2198 | | case 6: case 7: |
| 2199 | | chr1_x(space->machine, offset & 0x07, data, mmc_chr_source); |
| 2200 | | break; |
| 2201 | | case 8: |
| 2202 | | prg16_89ab(space->machine, data); |
| 2203 | | break; |
| 2204 | | case 9: |
| 2205 | | switch (data & 0x03) |
| 2206 | | { |
| 2207 | | case 0: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 2208 | | case 1: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 2209 | | case 2: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 2210 | | case 3: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 2211 | | } |
| 2212 | | break; |
| 2213 | | case 0x0a: |
| 2214 | | IRQ_enable = data & 0x01; |
| 2215 | | break; |
| 2216 | | case 0x0b: |
| 2217 | | IRQ_count = (IRQ_count & 0xff00) | data; |
| 2218 | | break; |
| 2219 | | case 0x0c: |
| 2220 | | IRQ_count = (IRQ_count & 0x00ff) | (data << 8); |
| 2221 | | break; |
| 2222 | | default: |
| 2223 | | logerror("** uncaught mapper 16 write, offset: %04x, data: %02x\n", offset, data); |
| 2224 | | break; |
| 2225 | | } |
| 2226 | | } |
| 2227 | | |
| 2228 | | static WRITE8_HANDLER( mapper16_w ) |
| 2229 | | { |
| 2230 | | LOG_MMC(("mapper16_w, offset: %04x, data: %02x\n", offset, data)); |
| 2231 | | |
| 2232 | | mapper16_m_w(space, offset, data); |
| 2233 | | } |
| 2234 | | |
| 2235 | | /************************************************************* |
| 2236 | | |
| 2237 | | Mapper 17 |
| 2238 | | |
| 2239 | | Known Boards: FFE8 Copier Board |
| 2240 | | Games: Hacked versions of games |
| 2241 | | |
| 2242 | | In MESS: Supported?. IRQ support is just a guess (used to |
| 2243 | | use MMC3 IRQ but it was wrong and it never enabled it) |
| 2244 | | |
| 2245 | | *************************************************************/ |
| 2246 | | |
| 2247 | | static WRITE8_HANDLER( mapper17_l_w ) |
| 2248 | | { |
| 2249 | | LOG_MMC(("mapper17_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 2250 | | |
| 2251 | | switch (offset) |
| 2252 | | { |
| 2253 | | case 0x1fe: |
| 2254 | | set_nt_mirroring((data & 0x10) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 2255 | | break; |
| 2256 | | case 0x1ff: |
| 2257 | | set_nt_mirroring((data & 0x10) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 2258 | | break; |
| 2259 | | |
| 2260 | | case 0x401: |
| 2261 | | IRQ_enable = data & 0x01; |
| 2262 | | break; |
| 2263 | | case 0x402: |
| 2264 | | IRQ_count = (IRQ_count & 0xff00) | data; |
| 2265 | | break; |
| 2266 | | case 0x403: |
| 2267 | | IRQ_enable = 1; |
| 2268 | | IRQ_count = (IRQ_count & 0x00ff) | (data << 8); |
| 2269 | | break; |
| 2270 | | |
| 2271 | | case 0x404: |
| 2272 | | prg8_89(space->machine, data); |
| 2273 | | break; |
| 2274 | | case 0x405: |
| 2275 | | prg8_ab(space->machine, data); |
| 2276 | | break; |
| 2277 | | case 0x406: |
| 2278 | | prg8_cd(space->machine, data); |
| 2279 | | break; |
| 2280 | | case 0x407: |
| 2281 | | prg8_ef(space->machine, data); |
| 2282 | | break; |
| 2283 | | |
| 2284 | | case 0x410: |
| 2285 | | case 0x411: |
| 2286 | | case 0x412: |
| 2287 | | case 0x413: |
| 2288 | | case 0x414: |
| 2289 | | case 0x415: |
| 2290 | | case 0x416: |
| 2291 | | case 0x417: |
| 2292 | | chr1_x(space->machine, offset & 7, data, CHRROM); |
| 2293 | | break; |
| 2294 | | } |
| 2295 | | } |
| 2296 | | |
| 2297 | | /************************************************************* |
| 2298 | | |
| 2299 | | Mapper 18 |
| 2300 | | |
| 2301 | | Known Boards: Jaleco JF23, JF24, JF25, JF27, JF29, JF30, JF31, |
| 2302 | | JF32, JF33, JF34, JF35, JF36, JF37, JF38, JF40, JF41, SS88006 |
| 2303 | | Games: Lord of King, Magic John, Moe Pro '90, Ninja Jajamaru, |
| 2304 | | Pizza Pop, Plasma Ball |
| 2305 | | |
| 2306 | | In MESS: Supported |
| 2307 | | |
| 2308 | | *************************************************************/ |
| 2309 | | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 2310 | | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 2311 | | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 2312 | | static void jaleco_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 2313 | | { |
| 2314 | | /* Increment & check the IRQ scanline counter */ |
| 2315 | | if (IRQ_enable) |
| 2316 | | { |
| 2317 | | LOG_MMC(("scanline: %d, irq count: %04x\n", scanline, IRQ_count)); |
| 2318 | | if (IRQ_mode & 0x08) |
| 2319 | | { |
| 2320 | | if ((IRQ_count & 0x000f) < 114) // always true, but we only update the IRQ once per scanlines so we cannot be more precise :( |
| 2321 | | { |
| 2322 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 2323 | | IRQ_count = (IRQ_count & ~0x000f) | (0x0f - (114 & 0x0f) + (IRQ_count & 0x000f)); // sort of wrap around the counter |
| 2324 | | } |
| 2325 | | // decrements should not affect upper bits, so we don't do anything here (114 > 0x0f) |
| 2326 | | } |
| 2327 | | else if (IRQ_mode & 0x04) |
| 2328 | | { |
| 2329 | | if ((IRQ_count & 0x00ff) < 114) |
| 2330 | | { |
| 2331 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 2332 | | IRQ_count = (IRQ_count & ~0x00ff) | (0xff - 114 + (IRQ_count & 0x00ff)); // wrap around the 8 bits counter |
| 2333 | | } |
| 2334 | | else |
| 2335 | | IRQ_count -= 114; |
| 2336 | | } |
| 2337 | | else if (IRQ_mode & 0x02) |
| 2338 | | { |
| 2339 | | if ((IRQ_count & 0x0fff) < 114) |
| 2340 | | { |
| 2341 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 2342 | | IRQ_count = (IRQ_count & ~0x0fff) | (0xfff - 114 + (IRQ_count & 0x0fff)); // wrap around the 12 bits counter |
| 2343 | | } |
| 2344 | | else |
| 2345 | | IRQ_count -= 114; |
| 2346 | | } |
| 2347 | | else if (IRQ_count < 114) |
| 2348 | | { |
| 2349 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 2350 | | IRQ_count = (0xffff - 114 + IRQ_count); // wrap around the 16 bits counter |
| 2351 | | } |
| 2352 | | else |
| 2353 | | IRQ_count -= 114; |
| 2354 | | } |
| 2355 | | } |
| 2356 | | |
| 2357 | | static WRITE8_HANDLER( mapper18_w ) |
| 2358 | | { |
| 2359 | | UINT8 bank; |
| 2360 | | LOG_MMC(("mapper18_w, offset: %04x, data: %02x\n", offset, data)); |
| 2361 | | |
| 2362 | | switch (offset & 0x7003) |
| 2363 | | { |
| 2364 | | case 0x0000: |
| 2365 | | prg_bank[0] = (prg_bank[0] & 0xf0) | (data & 0x0f); |
| 2366 | | prg8_89(space->machine, prg_bank[0]); |
| 2367 | | break; |
| 2368 | | case 0x0001: |
| 2369 | | prg_bank[0] = (prg_bank[0] & 0x0f) | (data << 4); |
| 2370 | | prg8_89(space->machine, prg_bank[0]); |
| 2371 | | break; |
| 2372 | | case 0x0002: |
| 2373 | | prg_bank[1] = (prg_bank[1] & 0xf0) | (data & 0x0f); |
| 2374 | | prg8_ab(space->machine, prg_bank[1]); |
| 2375 | | break; |
| 2376 | | case 0x0003: |
| 2377 | | prg_bank[1] = (prg_bank[1] & 0x0f) | (data << 4); |
| 2378 | | prg8_ab(space->machine, prg_bank[1]); |
| 2379 | | break; |
| 2380 | | case 0x1000: |
| 2381 | | prg_bank[2] = (prg_bank[2] & 0xf0) | (data & 0x0f); |
| 2382 | | prg8_cd(space->machine, prg_bank[2]); |
| 2383 | | break; |
| 2384 | | case 0x1001: |
| 2385 | | prg_bank[2] = (prg_bank[2] & 0x0f) | (data << 4); |
| 2386 | | prg8_cd(space->machine, prg_bank[2]); |
| 2387 | | break; |
| 2388 | | |
| 2389 | | /* $9002, 3 (1002, 3) uncaught = Jaleco Baseball writes 0 */ |
| 2390 | | /* believe it's related to battery-backed ram enable/disable */ |
| 2391 | | |
| 2392 | | case 0x2000: case 0x2001: case 0x2002: case 0x2003: |
| 2393 | | case 0x3000: case 0x3001: case 0x3002: case 0x3003: |
| 2394 | | case 0x4000: case 0x4001: case 0x4002: case 0x4003: |
| 2395 | | case 0x5000: case 0x5001: case 0x5002: case 0x5003: |
| 2396 | | bank = ((offset & 0x7000) - 0x2000) / 0x0800 + ((offset & 0x0002) >> 1); |
| 2397 | | if (offset & 0x0001) |
| 2398 | | vrom_bank[bank] = (vrom_bank[bank] & 0x0f) | ((data & 0x0f)<< 4); |
| 2399 | | else |
| 2400 | | vrom_bank[bank] = (vrom_bank[bank] & 0xf0) | (data & 0x0f); |
| 2401 | | |
| 2402 | | chr1_x(space->machine, bank, vrom_bank[bank], CHRROM); |
| 2403 | | break; |
| 2404 | | |
| 2405 | | case 0x6000: |
| 2406 | | IRQ_count_latch = (IRQ_count_latch & 0xfff0) | (data & 0x0f); |
| 2407 | | break; |
| 2408 | | case 0x6001: |
| 2409 | | IRQ_count_latch = (IRQ_count_latch & 0xff0f) | ((data & 0x0f) << 4); |
| 2410 | | break; |
| 2411 | | case 0x6002: |
| 2412 | | IRQ_count_latch = (IRQ_count_latch & 0xf0ff) | ((data & 0x0f) << 8); |
| 2413 | | break; |
| 2414 | | case 0x6003: |
| 2415 | | IRQ_count_latch = (IRQ_count_latch & 0x0fff) | ((data & 0x0f) << 12); |
| 2416 | | break; |
| 2417 | | |
| 2418 | | case 0x7000: |
| 2419 | | IRQ_count = IRQ_count_latch; |
| 2420 | | break; |
| 2421 | | case 0x7001: |
| 2422 | | IRQ_enable = data & 0x01; |
| 2423 | | IRQ_mode = data & 0x0e; |
| 2424 | | break; |
| 2425 | | |
| 2426 | | case 0x7002: |
| 2427 | | switch (data & 0x03) |
| 2428 | | { |
| 2429 | | case 0: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 2430 | | case 1: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 2431 | | case 2: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 2432 | | case 3: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 2433 | | } |
| 2434 | | break; |
| 2435 | | |
| 2436 | | default: |
| 2437 | | logerror("Mapper 18 uncaught addr: %04x value: %02x\n", offset + 0x8000, data); |
| 2438 | | break; |
| 2439 | | } |
| 2440 | | } |
| 2441 | | |
| 2442 | | /************************************************************* |
| 2443 | | |
| 2444 | | Mapper 19 |
| 2445 | | |
| 2446 | | Known Boards: Namcot 163 & 163S |
| 2447 | | Games: Battle Fleet, Family Circuit '91, Famista '90, '91, |
| 2448 | | '92 & '94, Megami Tensei II, Top Striker, Wagyan Land 2 & 3 |
| 2449 | | |
| 2450 | | In MESS: Supported |
| 2451 | | |
| 2452 | | *************************************************************/ |
| 2453 | | |
| 2454 | | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 2455 | | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 2456 | | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 2457 | | static void namcot_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 2458 | | { |
| 2459 | | if (IRQ_enable) |
| 2460 | | { |
| 2461 | | if (IRQ_count >= (0x7fff - 114)) |
| 2462 | | { |
| 2463 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 2464 | | IRQ_count = 0; |
| 2465 | | } |
| 2466 | | else |
| 2467 | | IRQ_count += 114; |
| 2468 | | } |
| 2469 | | } |
| 2470 | | |
| 2471 | | static WRITE8_HANDLER( mapper19_l_w ) |
| 2472 | | { |
| 2473 | | LOG_MMC(("mapper19_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 2474 | | offset += 0x100; |
| 2475 | | |
| 2476 | | switch (offset & 0x1800) |
| 2477 | | { |
| 2478 | | case 0x0800: |
| 2479 | | LOG_MMC(("Mapper 19 sound port write, data: %02x\n", data)); |
| 2480 | | break; |
| 2481 | | case 0x1000: /* low byte of IRQ */ |
| 2482 | | IRQ_count = (IRQ_count & 0x7f00) | data; |
| 2483 | | break; |
| 2484 | | case 0x1800: /* high byte of IRQ, IRQ enable in high bit */ |
| 2485 | | IRQ_count = (IRQ_count & 0xff) | ((data & 0x7f) << 8); |
| 2486 | | IRQ_enable = data & 0x80; |
| 2487 | | break; |
| 2488 | | } |
| 2489 | | } |
| 2490 | | |
| 2491 | | static READ8_HANDLER( mapper19_l_r ) |
| 2492 | | { |
| 2493 | | LOG_MMC(("mapper19_l_r, offset: %04x\n", offset)); |
| 2494 | | offset += 0x100; |
| 2495 | | |
| 2496 | | switch (offset & 0x1800) |
| 2497 | | { |
| 2498 | | case 0x1000: |
| 2499 | | return IRQ_count & 0xff; |
| 2500 | | case 0x1800: |
| 2501 | | return (IRQ_count >> 8) & 0xff; |
| 2502 | | default: |
| 2503 | | return 0x00; |
| 2504 | | } |
| 2505 | | } |
| 2506 | | |
| 2507 | | static void mapper19_set_mirror( UINT8 page, UINT8 data ) |
| 2508 | | { |
| 2509 | | if (!(data < 0xe0)) |
| 2510 | | set_nt_page(page, CIRAM, data & 0x01, 1); |
| 2511 | | else |
| 2512 | | set_nt_page(page, ROM, data, 0); |
| 2513 | | } |
| 2514 | | |
| 2515 | | static WRITE8_HANDLER( mapper19_w ) |
| 2516 | | { |
| 2517 | | LOG_MMC(("mapper19_w, offset: %04x, data: %02x\n", offset, data)); |
| 2518 | | switch (offset & 0x7800) |
| 2519 | | { |
| 2520 | | case 0x0000: case 0x0800: |
| 2521 | | case 0x1000: case 0x1800: |
| 2522 | | case 0x2000: case 0x2800: |
| 2523 | | case 0x3000: case 0x3800: |
| 2524 | | chr1_x(space->machine, offset / 0x800, data, CHRROM); |
| 2525 | | break; |
| 2526 | | case 0x4000: |
| 2527 | | mapper19_set_mirror(0, data); |
| 2528 | | break; |
| 2529 | | case 0x4800: |
| 2530 | | mapper19_set_mirror(1, data); |
| 2531 | | break; |
| 2532 | | case 0x5000: |
| 2533 | | mapper19_set_mirror(2, data); |
| 2534 | | break; |
| 2535 | | case 0x5800: |
| 2536 | | mapper19_set_mirror(3, data); |
| 2537 | | break; |
| 2538 | | case 0x6000: |
| 2539 | | prg8_89(space->machine, data & 0x3f); |
| 2540 | | break; |
| 2541 | | case 0x6800: |
| 2542 | | mmc_cmd1 = data & 0xc0; // this should enable High CHRRAM, but we still have to properly implement it! |
| 2543 | | prg8_ab(space->machine, data & 0x3f); |
| 2544 | | break; |
| 2545 | | case 0x7000: |
| 2546 | | prg8_cd(space->machine, data & 0x3f); |
| 2547 | | break; |
| 2548 | | case 0x7800: |
| 2549 | | LOG_MMC(("Mapper 19 sound address write, data: %02x\n", data)); |
| 2550 | | break; |
| 2551 | | } |
| 2552 | | } |
| 2553 | | |
| 2554 | | /************************************************************* |
| 2555 | | |
| 2556 | | Mapper 20 |
| 2557 | | |
| 2558 | | Known Boards: Reserved for FDS |
| 2559 | | Games: any FDS disk |
| 2560 | | |
| 2561 | | In MESS: Supported |
| 2562 | | |
| 2563 | | *************************************************************/ |
| 2564 | | |
| 2565 | | static void fds_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 2566 | | { |
| 2567 | | if (IRQ_enable_latch) |
| 2568 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 2569 | | |
| 2570 | | if (IRQ_enable) |
| 2571 | | { |
| 2572 | | if (IRQ_count <= 114) |
| 2573 | | { |
| 2574 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 2575 | | IRQ_enable = 0; |
| 2576 | | nes_fds.status0 |= 0x01; |
| 2577 | | } |
| 2578 | | else |
| 2579 | | IRQ_count -= 114; |
| 2580 | | } |
| 2581 | | } |
| 2582 | | |
| 2583 | | READ8_HANDLER( fds_r ) |
| 2584 | | { |
| 2585 | | UINT8 ret = 0x00; |
| 2586 | | LOG_MMC(("fds_r, offset: %04x\n", offset)); |
| 2587 | | |
| 2588 | | switch (offset) |
| 2589 | | { |
| 2590 | | case 0x00: /* $4030 - disk status 0 */ |
| 2591 | | ret = nes_fds.status0; |
| 2592 | | /* clear the disk IRQ detect flag */ |
| 2593 | | nes_fds.status0 &= ~0x01; |
| 2594 | | break; |
| 2595 | | case 0x01: /* $4031 - data latch */ |
| 2596 | | /* don't read data if disk is unloaded */ |
| 2597 | | if (nes_fds.data == NULL) |
| 2598 | | ret = 0; |
| 2599 | | else if (nes_fds.current_side) |
| 2600 | | ret = nes_fds.data[(nes_fds.current_side-1) * 65500 + nes_fds.head_position++]; |
| 2601 | | else |
| 2602 | | ret = 0; |
| 2603 | | break; |
| 2604 | | case 0x02: /* $4032 - disk status 1 */ |
| 2605 | | /* return "no disk" status if disk is unloaded */ |
| 2606 | | if (nes_fds.data == NULL) |
| 2607 | | ret = 1; |
| 2608 | | else if (fds_last_side != nes_fds.current_side) |
| 2609 | | { |
| 2610 | | /* If we've switched disks, report "no disk" for a few reads */ |
| 2611 | | ret = 1; |
| 2612 | | fds_count ++; |
| 2613 | | if (fds_count == 50) |
| 2614 | | { |
| 2615 | | fds_last_side = nes_fds.current_side; |
| 2616 | | fds_count = 0; |
| 2617 | | } |
| 2618 | | } |
| 2619 | | else |
| 2620 | | ret = (nes_fds.current_side == 0); /* 0 if a disk is inserted */ |
| 2621 | | break; |
| 2622 | | case 0x03: /* $4033 */ |
| 2623 | | ret = 0x80; |
| 2624 | | break; |
| 2625 | | default: |
| 2626 | | ret = 0x00; |
| 2627 | | break; |
| 2628 | | } |
| 2629 | | |
| 2630 | | LOG_FDS(("fds_r, address: %04x, data: %02x\n", offset + 0x4030, ret)); |
| 2631 | | |
| 2632 | | return ret; |
| 2633 | | } |
| 2634 | | |
| 2635 | | WRITE8_HANDLER( fds_w ) |
| 2636 | | { |
| 2637 | | LOG_MMC(("fds_w, offset: %04x, data: %02x\n", offset, data)); |
| 2638 | | |
| 2639 | | switch (offset) |
| 2640 | | { |
| 2641 | | case 0x00: |
| 2642 | | IRQ_count = (IRQ_count & 0xff00) | data; |
| 2643 | | break; |
| 2644 | | case 0x01: |
| 2645 | | IRQ_count = (IRQ_count & 0x00ff) | (data << 8); |
| 2646 | | break; |
| 2647 | | case 0x02: |
| 2648 | | IRQ_count = IRQ_count_latch; |
| 2649 | | IRQ_enable = data; |
| 2650 | | break; |
| 2651 | | case 0x03: |
| 2652 | | // d0 = sound io (1 = enable) |
| 2653 | | // d1 = disk io (1 = enable) |
| 2654 | | break; |
| 2655 | | case 0x04: |
| 2656 | | /* write data out to disk */ |
| 2657 | | break; |
| 2658 | | case 0x05: |
| 2659 | | nes_fds.write_reg = data; |
| 2660 | | |
| 2661 | | nes_fds.motor_on = data & 0x01; |
| 2662 | | if (data & 0x02) |
| 2663 | | nes_fds.head_position = 0; |
| 2664 | | nes_fds.read_mode = data & 0x04; |
| 2665 | | set_nt_mirroring((data & 0x08) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 2666 | | if ((!(data & 0x40)) && (nes_fds.write_reg & 0x40)) |
| 2667 | | nes_fds.head_position -= 2; // ??? |
| 2668 | | IRQ_enable_latch = data & 0x80; |
| 2669 | | break; |
| 2670 | | } |
| 2671 | | |
| 2672 | | LOG_FDS(("fds_w, address: %04x, data: %02x\n", offset + 0x4020, data)); |
| 2673 | | } |
| 2674 | | |
| 2675 | | /************************************************************* |
| 2676 | | |
| 2677 | | Mapper 21 & 25 |
| 2678 | | |
| 2679 | | Known Boards: Konami VRC4A & VRC4C (21), VRC4B & VRC4D (25) |
| 2680 | | Games: Ganbare Goemon Gaiden 2, Wai Wai World 2 (21), Bio |
| 2681 | | Miracle Bokutte Upa, Ganbare Goemon Gaiden, TMNT 1 & 2 Jpn (25) |
| 2682 | | |
| 2683 | | In MESS: Supported |
| 2684 | | |
| 2685 | | *************************************************************/ |
| 2686 | | |
| 2687 | | static void konami_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 2688 | | { |
| 2689 | | /* Increment & check the IRQ scanline counter */ |
| 2690 | | if (IRQ_enable && (++IRQ_count == 0x100)) |
| 2691 | | { |
| 2692 | | IRQ_count = IRQ_count_latch; |
| 2693 | | IRQ_enable = IRQ_enable_latch; |
| 2694 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 2695 | | } |
| 2696 | | } |
| 2697 | | |
| 2698 | | static WRITE8_HANDLER( konami_vrc4_w ) |
| 2699 | | { |
| 2700 | | LOG_MMC(("konami_vrc4_w, offset: %04x, data: %02x\n", offset, data)); |
| 2701 | | |
| 2702 | | switch (offset & 0x7007) |
| 2703 | | { |
| 2704 | | case 0x0000: |
| 2705 | | prg8_89(space->machine, data); |
| 2706 | | break; |
| 2707 | | case 0x1000: |
| 2708 | | switch (data & 0x03) |
| 2709 | | { |
| 2710 | | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 2711 | | case 0x01: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 2712 | | case 0x02: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 2713 | | case 0x03: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 2714 | | } |
| 2715 | | break; |
| 2716 | | |
| 2717 | | /* $1001 is uncaught */ |
| 2718 | | |
| 2719 | | case 0x2000: |
| 2720 | | prg8_ab(space->machine, data); |
| 2721 | | break; |
| 2722 | | case 0x3000: |
| 2723 | | vrom_bank[0] = (vrom_bank[0] & 0xf0) | (data & 0x0f); |
| 2724 | | chr1_0(space->machine, vrom_bank[0], CHRROM); |
| 2725 | | break; |
| 2726 | | case 0x3002: |
| 2727 | | vrom_bank[0] = (vrom_bank[0] & 0x0f) | (data << 4); |
| 2728 | | chr1_0(space->machine, vrom_bank[0], CHRROM); |
| 2729 | | break; |
| 2730 | | case 0x3001: |
| 2731 | | case 0x3004: |
| 2732 | | vrom_bank[1] = (vrom_bank[1] & 0xf0) | (data & 0x0f); |
| 2733 | | chr1_1(space->machine, vrom_bank[1], CHRROM); |
| 2734 | | break; |
| 2735 | | case 0x3003: |
| 2736 | | case 0x3006: |
| 2737 | | vrom_bank[1] = (vrom_bank[1] & 0x0f) | (data << 4); |
| 2738 | | chr1_1(space->machine, vrom_bank[1], CHRROM); |
| 2739 | | break; |
| 2740 | | case 0x4000: |
| 2741 | | vrom_bank[2] = (vrom_bank[2] & 0xf0) | (data & 0x0f); |
| 2742 | | chr1_2(space->machine, vrom_bank[2], CHRROM); |
| 2743 | | break; |
| 2744 | | case 0x4002: |
| 2745 | | vrom_bank[2] = (vrom_bank[2] & 0x0f) | (data << 4); |
| 2746 | | chr1_2(space->machine, vrom_bank[2], CHRROM); |
| 2747 | | break; |
| 2748 | | case 0x4001: |
| 2749 | | case 0x4004: |
| 2750 | | vrom_bank[3] = (vrom_bank[3] & 0xf0) | (data & 0x0f); |
| 2751 | | chr1_3(space->machine, vrom_bank[3], CHRROM); |
| 2752 | | break; |
| 2753 | | case 0x4003: |
| 2754 | | case 0x4006: |
| 2755 | | vrom_bank[3] = (vrom_bank[3] & 0x0f) | (data << 4); |
| 2756 | | chr1_3(space->machine, vrom_bank[3], CHRROM); |
| 2757 | | break; |
| 2758 | | case 0x5000: |
| 2759 | | vrom_bank[4] = (vrom_bank[4] & 0xf0) | (data & 0x0f); |
| 2760 | | chr1_4(space->machine, vrom_bank[4], CHRROM); |
| 2761 | | break; |
| 2762 | | case 0x5002: |
| 2763 | | vrom_bank[4] = (vrom_bank[4] & 0x0f) | (data << 4); |
| 2764 | | chr1_4(space->machine, vrom_bank[4], CHRROM); |
| 2765 | | break; |
| 2766 | | case 0x5001: |
| 2767 | | case 0x5004: |
| 2768 | | vrom_bank[5] = (vrom_bank[5] & 0xf0) | (data & 0x0f); |
| 2769 | | chr1_5(space->machine, vrom_bank[5], CHRROM); |
| 2770 | | break; |
| 2771 | | case 0x5003: |
| 2772 | | case 0x5006: |
| 2773 | | vrom_bank[5] = (vrom_bank[5] & 0x0f) | (data << 4); |
| 2774 | | chr1_5(space->machine, vrom_bank[5], CHRROM); |
| 2775 | | break; |
| 2776 | | case 0x6000: |
| 2777 | | vrom_bank[6] = (vrom_bank[6] & 0xf0) | (data & 0x0f); |
| 2778 | | chr1_6(space->machine, vrom_bank[6], CHRROM); |
| 2779 | | break; |
| 2780 | | case 0x6002: |
| 2781 | | vrom_bank[6] = (vrom_bank[6] & 0x0f) | (data << 4); |
| 2782 | | chr1_6(space->machine, vrom_bank[6], CHRROM); |
| 2783 | | break; |
| 2784 | | case 0x6001: |
| 2785 | | case 0x6004: |
| 2786 | | vrom_bank[7] = (vrom_bank[7] & 0xf0) | (data & 0x0f); |
| 2787 | | chr1_7(space->machine, vrom_bank[7], CHRROM); |
| 2788 | | break; |
| 2789 | | case 0x6003: |
| 2790 | | case 0x6006: |
| 2791 | | vrom_bank[7] = (vrom_bank[7] & 0x0f) | (data << 4); |
| 2792 | | chr1_7(space->machine, vrom_bank[7], CHRROM); |
| 2793 | | break; |
| 2794 | | |
| 2795 | | case 0x7000: |
| 2796 | | IRQ_count_latch = (IRQ_count_latch & 0xf0) | (data & 0x0f); |
| 2797 | | break; |
| 2798 | | case 0x7002: |
| 2799 | | case 0x7040: |
| 2800 | | IRQ_count_latch = (IRQ_count_latch & 0x0f) | ((data & 0x0f) << 4 ); |
| 2801 | | break; |
| 2802 | | case 0x7004: |
| 2803 | | case 0x7001: |
| 2804 | | case 0x7080: |
| 2805 | | IRQ_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 2806 | | IRQ_enable = data & 0x02; |
| 2807 | | IRQ_enable_latch = data & 0x01; |
| 2808 | | if (data & 0x02) |
| 2809 | | IRQ_count = IRQ_count_latch; |
| 2810 | | break; |
| 2811 | | case 0x7006: |
| 2812 | | case 0x7003: |
| 2813 | | case 0x70c0: |
| 2814 | | IRQ_enable = IRQ_enable_latch; |
| 2815 | | break; |
| 2816 | | default: |
| 2817 | | LOG_MMC(("konami_vrc4_w uncaught offset: %04x value: %02x\n", offset, data)); |
| 2818 | | break; |
| 2819 | | } |
| 2820 | | } |
| 2821 | | |
| 2822 | | /************************************************************* |
| 2823 | | |
| 2824 | | Mapper 22 |
| 2825 | | |
| 2826 | | Known Boards: Konami VRC2A |
| 2827 | | Games: Ganbare Pennant Race, Twin Bee 3 |
| 2828 | | |
| 2829 | | In MESS: Supported. |
| 2830 | | |
| 2831 | | *************************************************************/ |
| 2832 | | |
| 2833 | | static WRITE8_HANDLER( konami_vrc2a_w ) |
| 2834 | | { |
| 2835 | | UINT8 bank; |
| 2836 | | LOG_MMC(("konami_vrc2a_w, offset: %04x, data: %02x\n", offset, data)); |
| 2837 | | |
| 2838 | | switch (offset & 0x7000) |
| 2839 | | { |
| 2840 | | case 0x0000: |
| 2841 | | prg8_89(space->machine, data); |
| 2842 | | break; |
| 2843 | | case 0x1000: |
| 2844 | | switch (data & 0x03) |
| 2845 | | { |
| 2846 | | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 2847 | | case 0x01: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 2848 | | case 0x02: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 2849 | | case 0x03: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 2850 | | } |
| 2851 | | break; |
| 2852 | | case 0x2000: |
| 2853 | | prg8_ab(space->machine, data); |
| 2854 | | break; |
| 2855 | | case 0x3000: |
| 2856 | | case 0x4000: |
| 2857 | | case 0x5000: |
| 2858 | | case 0x6000: |
| 2859 | | bank = ((offset & 0x7000) - 0x3000) / 0x0800 + (offset & 0x0001); |
| 2860 | | /* Notice that we store the banks as in other VRC, but then we take vrom_bank>>1 because it's VRC2A!*/ |
| 2861 | | if (offset & 0x0002) |
| 2862 | | vrom_bank[bank] = (vrom_bank[bank] & 0x0f) | (data << 4); |
| 2863 | | else |
| 2864 | | vrom_bank[bank] = (vrom_bank[bank] & 0xf0) | (data & 0x0f); |
| 2865 | | |
| 2866 | | chr1_x(space->machine, bank, vrom_bank[bank] >> 1, CHRROM); |
| 2867 | | break; |
| 2868 | | |
| 2869 | | default: |
| 2870 | | LOG_MMC(("konami_vrc2a_w uncaught offset: %04x value: %02x\n", offset, data)); |
| 2871 | | break; |
| 2872 | | } |
| 2873 | | } |
| 2874 | | |
| 2875 | | /************************************************************* |
| 2876 | | |
| 2877 | | Mapper 23 |
| 2878 | | |
| 2879 | | Known Boards: Konami VRC2B & VRC4E |
| 2880 | | Games: Getsufuu Maden, Parodius Da! |
| 2881 | | |
| 2882 | | In MESS: Supported. It also uses konami_irq. |
| 2883 | | |
| 2884 | | *************************************************************/ |
| 2885 | | |
| 2886 | | static WRITE8_HANDLER( konami_vrc2b_w ) |
| 2887 | | { |
| 2888 | | UINT16 select; |
| 2889 | | UINT8 bank; |
| 2890 | | |
| 2891 | | LOG_MMC(("konami_vrc2b_w, offset: %04x, data: %02x\n", offset, data)); |
| 2892 | | |
| 2893 | | if (offset < 0x3000) |
| 2894 | | { |
| 2895 | | switch (offset & 0x3000) |
| 2896 | | { |
| 2897 | | case 0: |
| 2898 | | prg8_89(space->machine, data); |
| 2899 | | break; |
| 2900 | | case 0x1000: |
| 2901 | | switch (data & 0x03) |
| 2902 | | { |
| 2903 | | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 2904 | | case 0x01: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 2905 | | case 0x02: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 2906 | | case 0x03: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 2907 | | } |
| 2908 | | break; |
| 2909 | | case 0x2000: |
| 2910 | | prg8_ab(space->machine, data); |
| 2911 | | break; |
| 2912 | | default: |
| 2913 | | LOG_MMC(("konami_vrc2b_w offset: %04x value: %02x\n", offset, data)); |
| 2914 | | break; |
| 2915 | | } |
| 2916 | | return; |
| 2917 | | } |
| 2918 | | |
| 2919 | | /* The low 2 select bits vary from cart to cart */ |
| 2920 | | select = (offset & 0x7000) | (offset & 0x03) | ((offset & 0x0c) >> 2); |
| 2921 | | |
| 2922 | | switch (select) |
| 2923 | | { |
| 2924 | | case 0x3000: |
| 2925 | | case 0x3001: |
| 2926 | | case 0x3002: |
| 2927 | | case 0x3003: |
| 2928 | | case 0x4000: |
| 2929 | | case 0x4001: |
| 2930 | | case 0x4002: |
| 2931 | | case 0x4003: |
| 2932 | | case 0x5000: |
| 2933 | | case 0x5001: |
| 2934 | | case 0x5002: |
| 2935 | | case 0x5003: |
| 2936 | | case 0x6000: |
| 2937 | | case 0x6001: |
| 2938 | | case 0x6002: |
| 2939 | | case 0x6003: |
| 2940 | | bank = ((select & 0x7000) - 0x3000) / 0x0800 + ((select & 0x0002) >> 1); |
| 2941 | | if (select & 0x0001) |
| 2942 | | vrom_bank[bank] = (vrom_bank[bank] & 0x0f) | (data << 4); |
| 2943 | | else |
| 2944 | | vrom_bank[bank] = (vrom_bank[bank] & 0xf0) | (data & 0x0f); |
| 2945 | | |
| 2946 | | chr1_x(space->machine, bank, vrom_bank[bank], mmc_chr_source); |
| 2947 | | break; |
| 2948 | | case 0x7000: |
| 2949 | | IRQ_count_latch &= ~0x0f; |
| 2950 | | IRQ_count_latch |= data & 0x0f; |
| 2951 | | break; |
| 2952 | | case 0x7001: |
| 2953 | | IRQ_count_latch &= ~0xf0; |
| 2954 | | IRQ_count_latch |= (data << 4) & 0xf0; |
| 2955 | | break; |
| 2956 | | case 0x7002: |
| 2957 | | IRQ_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 2958 | | IRQ_enable = data & 0x02; |
| 2959 | | IRQ_enable_latch = data & 0x01; |
| 2960 | | if (data & 0x02) |
| 2961 | | IRQ_count = IRQ_count_latch; |
| 2962 | | break; |
| 2963 | | |
| 2964 | | default: |
| 2965 | | logerror("konami_vrc2b_w uncaught offset: %04x value: %02x\n", offset, data); |
| 2966 | | break; |
| 2967 | | } |
| 2968 | | } |
| 2969 | | |
| 2970 | | /************************************************************* |
| 2971 | | |
| 2972 | | Mapper 24 |
| 2973 | | |
| 2974 | | Known Boards: Konami VRC6 |
| 2975 | | Games: Akumajou Densetsu |
| 2976 | | |
| 2977 | | In MESS: Supported. It also uses konami_irq. |
| 2978 | | |
| 2979 | | *************************************************************/ |
| 2980 | | |
| 2981 | | static WRITE8_HANDLER( konami_vrc6a_w ) |
| 2982 | | { |
| 2983 | | UINT8 bank; |
| 2984 | | LOG_MMC(("konami_vrc6a_w, offset: %04x, data: %02x\n", offset, data)); |
| 2985 | | |
| 2986 | | switch (offset & 0x7003) |
| 2987 | | { |
| 2988 | | case 0x0000: |
| 2989 | | case 0x0001: |
| 2990 | | case 0x0002: |
| 2991 | | case 0x0003: |
| 2992 | | prg16_89ab(space->machine, data); |
| 2993 | | break; |
| 2994 | | |
| 2995 | | /* $1000-$1002 = sound regs */ |
| 2996 | | /* $2000-$2002 = sound regs */ |
| 2997 | | /* $3000-$3002 = sound regs */ |
| 2998 | | |
| 2999 | | case 0x3003: |
| 3000 | | switch (data & 0x0c) |
| 3001 | | { |
| 3002 | | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 3003 | | case 0x04: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 3004 | | case 0x08: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 3005 | | case 0x0c: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 3006 | | } |
| 3007 | | break; |
| 3008 | | case 0x4000: |
| 3009 | | case 0x4001: |
| 3010 | | case 0x4002: |
| 3011 | | case 0x4003: |
| 3012 | | prg8_cd(space->machine, data); |
| 3013 | | break; |
| 3014 | | case 0x5000: |
| 3015 | | case 0x5001: |
| 3016 | | case 0x5002: |
| 3017 | | case 0x5003: |
| 3018 | | case 0x6000: |
| 3019 | | case 0x6001: |
| 3020 | | case 0x6002: |
| 3021 | | case 0x6003: |
| 3022 | | bank = ((offset & 0x7000) - 0x5000) / 0x0400 + (offset & 0x0003); |
| 3023 | | chr1_x(space->machine, bank, data, CHRROM); |
| 3024 | | break; |
| 3025 | | |
| 3026 | | case 0x7000: |
| 3027 | | IRQ_count_latch = data; |
| 3028 | | break; |
| 3029 | | case 0x7001: |
| 3030 | | IRQ_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 3031 | | IRQ_enable = data & 0x02; |
| 3032 | | IRQ_enable_latch = data & 0x01; |
| 3033 | | if (data & 0x02) |
| 3034 | | IRQ_count = IRQ_count_latch; |
| 3035 | | break; |
| 3036 | | case 0x7002: |
| 3037 | | IRQ_enable = IRQ_enable_latch; |
| 3038 | | break; |
| 3039 | | |
| 3040 | | default: |
| 3041 | | logerror("konami_vrc6_w uncaught addr: %04x value: %02x\n", offset + 0x8000, data); |
| 3042 | | break; |
| 3043 | | } |
| 3044 | | } |
| 3045 | | |
| 3046 | | /************************************************************* |
| 3047 | | |
| 3048 | | Mapper 26 |
| 3049 | | |
| 3050 | | Known Boards: Konami VRC6 variant |
| 3051 | | Games: Esper Dream 2, Mouryou Senki Madara |
| 3052 | | |
| 3053 | | In MESS: Supported. It also uses konami_irq. |
| 3054 | | |
| 3055 | | *************************************************************/ |
| 3056 | | |
| 3057 | | static WRITE8_HANDLER( konami_vrc6b_w ) |
| 3058 | | { |
| 3059 | | UINT8 bank; |
| 3060 | | |
| 3061 | | LOG_MMC(("konami_vrc6b_w, offset: %04x, data: %02x\n", offset, data)); |
| 3062 | | |
| 3063 | | switch (offset & 0x7003) |
| 3064 | | { |
| 3065 | | case 0: case 1: case 2: case 3: |
| 3066 | | prg16_89ab(space->machine, data); |
| 3067 | | break; |
| 3068 | | |
| 3069 | | /* $1000-$1002 = sound regs */ |
| 3070 | | /* $2000-$2002 = sound regs */ |
| 3071 | | /* $3000-$3002 = sound regs */ |
| 3072 | | |
| 3073 | | case 0x3003: |
| 3074 | | switch (data & 0x0c) |
| 3075 | | { |
| 3076 | | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 3077 | | case 0x04: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 3078 | | case 0x08: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 3079 | | case 0x0c: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 3080 | | } |
| 3081 | | break; |
| 3082 | | case 0x4000: case 0x4001: case 0x4002: case 0x4003: |
| 3083 | | prg8_cd(space->machine, data); |
| 3084 | | break; |
| 3085 | | case 0x5000: |
| 3086 | | case 0x5001: |
| 3087 | | case 0x5002: |
| 3088 | | case 0x5003: |
| 3089 | | case 0x6000: |
| 3090 | | case 0x6001: |
| 3091 | | case 0x6002: |
| 3092 | | case 0x6003: |
| 3093 | | bank = ((offset & 0x7000) - 0x5000) / 0x0400 + ((offset & 0x0001) << 1) + ((offset & 0x0002) >> 1); |
| 3094 | | chr1_x(space->machine, bank, data, CHRROM); |
| 3095 | | break; |
| 3096 | | case 0x7000: |
| 3097 | | IRQ_count_latch = data; |
| 3098 | | break; |
| 3099 | | case 0x7001: |
| 3100 | | IRQ_enable = IRQ_enable_latch; |
| 3101 | | break; |
| 3102 | | case 0x7002: |
| 3103 | | IRQ_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 3104 | | IRQ_enable = data & 0x02; |
| 3105 | | IRQ_enable_latch = data & 0x01; |
| 3106 | | if (data & 0x02) |
| 3107 | | IRQ_count = IRQ_count_latch; |
| 3108 | | break; |
| 3109 | | |
| 3110 | | default: |
| 3111 | | logerror("konami_vrc6_w uncaught addr: %04x value: %02x\n", offset + 0x8000, data); |
| 3112 | | break; |
| 3113 | | } |
| 3114 | | } |
| 3115 | | |
| 3116 | | /************************************************************* |
| 3117 | | |
| 3118 | | Mapper 27 |
| 3119 | | |
| 3120 | | Known Boards: Unknown Bootleg Board |
| 3121 | | Games: World Hero |
| 3122 | | |
| 3123 | | In MESS: Unsupported. |
| 3124 | | |
| 3125 | | *************************************************************/ |
| 3126 | | |
| 3127 | | /************************************************************* |
| 3128 | | |
| 3129 | | Mapper 28 |
| 3130 | | |
| 3131 | | Known Boards: Undocumented / Unused ?!? |
| 3132 | | Games: ---------- |
| 3133 | | |
| 3134 | | In MESS: ---------- |
| 3135 | | |
| 3136 | | *************************************************************/ |
| 3137 | | |
| 3138 | | /************************************************************* |
| 3139 | | |
| 3140 | | Mapper 29 |
| 3141 | | |
| 3142 | | Known Boards: Undocumented / Unused ?!? |
| 3143 | | Games: ---------- |
| 3144 | | |
| 3145 | | In MESS: ---------- |
| 3146 | | |
| 3147 | | *************************************************************/ |
| 3148 | | |
| 3149 | | /************************************************************* |
| 3150 | | |
| 3151 | | Mapper 30 |
| 3152 | | |
| 3153 | | Known Boards: Undocumented / Unused ?!? |
| 3154 | | Games: ---------- |
| 3155 | | |
| 3156 | | In MESS: ---------- |
| 3157 | | |
| 3158 | | *************************************************************/ |
| 3159 | | |
| 3160 | | /************************************************************* |
| 3161 | | |
| 3162 | | Mapper 31 |
| 3163 | | |
| 3164 | | Known Boards: Undocumented / Unused ?!? |
| 3165 | | Games: ---------- |
| 3166 | | |
| 3167 | | In MESS: ---------- |
| 3168 | | |
| 3169 | | *************************************************************/ |
| 3170 | | |
| 3171 | | /************************************************************* |
| 3172 | | |
| 3173 | | Mapper 32 |
| 3174 | | |
| 3175 | | Known Boards: Irem G101A & G101B |
| 3176 | | Games: Ai Sensei no Oshiete, Image Fight, Kaiketsu |
| 3177 | | Yanchamaru 2, Maikyuu Shima, Paaman, Paaman 2 |
| 3178 | | |
| 3179 | | A crc check is required to support Major League (which uses |
| 3180 | | a slightly different board) |
| 3181 | | |
| 3182 | | In MESS: Supported. |
| 3183 | | |
| 3184 | | *************************************************************/ |
| 3185 | | |
| 3186 | | static WRITE8_HANDLER( mapper32_w ) |
| 3187 | | { |
| 3188 | | LOG_MMC(("mapper32_w, offset: %04x, data: %02x\n", offset, data)); |
| 3189 | | |
| 3190 | | switch (offset & 0x7000) |
| 3191 | | { |
| 3192 | | case 0x0000: |
| 3193 | | mmc_cmd1 ? prg8_cd(space->machine, data) : prg8_89(space->machine, data); |
| 3194 | | break; |
| 3195 | | case 0x1000: |
| 3196 | | mmc_cmd1 = data & 0x02; |
| 3197 | | if (!nes.crc_hack) // Major League has hardwired mirroring (it would have required a separate mapper) |
| 3198 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3199 | | break; |
| 3200 | | case 0x2000: |
| 3201 | | prg8_ab(space->machine, data); |
| 3202 | | break; |
| 3203 | | case 0x3000: |
| 3204 | | chr1_x(space->machine, offset & 0x07, data, CHRROM); |
| 3205 | | break; |
| 3206 | | default: |
| 3207 | | logerror("Uncaught mapper 32 write, addr: %04x value: %02x\n", offset + 0x8000, data); |
| 3208 | | break; |
| 3209 | | } |
| 3210 | | } |
| 3211 | | |
| 3212 | | /************************************************************* |
| 3213 | | |
| 3214 | | Mapper 33 |
| 3215 | | |
| 3216 | | Known Boards: Taito TC0190FMC |
| 3217 | | Games: Akira, Bakushou!! Jinsei Gekijou, Don Doko Don, |
| 3218 | | Insector X, Operation Wolf, Power Blazer, Takeshi no |
| 3219 | | Sengoku Fuuunji |
| 3220 | | |
| 3221 | | In MESS: Supported. |
| 3222 | | |
| 3223 | | *************************************************************/ |
| 3224 | | |
| 3225 | | static WRITE8_HANDLER( mapper33_w ) |
| 3226 | | { |
| 3227 | | LOG_MMC(("mapper33_w, offset: %04x, data: %02x\n", offset, data)); |
| 3228 | | |
| 3229 | | switch (offset & 0x6003) |
| 3230 | | { |
| 3231 | | case 0x0000: |
| 3232 | | set_nt_mirroring((data & 0x40) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3233 | | prg8_89(space->machine, data); |
| 3234 | | break; |
| 3235 | | case 0x0001: |
| 3236 | | prg8_ab(space->machine, data); |
| 3237 | | break; |
| 3238 | | case 0x0002: |
| 3239 | | chr2_0(space->machine, data, CHRROM); |
| 3240 | | break; |
| 3241 | | case 0x0003: |
| 3242 | | chr2_2(space->machine, data, CHRROM); |
| 3243 | | break; |
| 3244 | | case 0x2000: |
| 3245 | | chr1_4(space->machine, data, CHRROM); |
| 3246 | | break; |
| 3247 | | case 0x2001: |
| 3248 | | chr1_5(space->machine, data, CHRROM); |
| 3249 | | break; |
| 3250 | | case 0x2002: |
| 3251 | | chr1_6(space->machine, data, CHRROM); |
| 3252 | | break; |
| 3253 | | case 0x2003: |
| 3254 | | chr1_7(space->machine, data, CHRROM); |
| 3255 | | break; |
| 3256 | | } |
| 3257 | | } |
| 3258 | | |
| 3259 | | /************************************************************* |
| 3260 | | |
| 3261 | | Mapper 34 |
| 3262 | | |
| 3263 | | Known Boards: BNROM, Unlicensed BxROM, NINA001, NINA002 |
| 3264 | | Games: Deadly Tower, Impossible Mission II, Titanic 1912, |
| 3265 | | Dance Xtreme |
| 3266 | | |
| 3267 | | There actually exist TWO different kind of boards using |
| 3268 | | this mapper. NINA-001 is not compatible with the other |
| 3269 | | kind of board, so Impossible Mission II requires a crc check |
| 3270 | | to be supported. |
| 3271 | | |
| 3272 | | In MESS: Supported. |
| 3273 | | |
| 3274 | | *************************************************************/ |
| 3275 | | |
| 3276 | | static WRITE8_HANDLER( mapper34_m_w ) |
| 3277 | | { |
| 3278 | | LOG_MMC(("mapper34_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3279 | | |
| 3280 | | if (nes.crc_hack) // is it AVE Nina-01? |
| 3281 | | { |
| 3282 | | switch (offset) |
| 3283 | | { |
| 3284 | | case 0x1ffd: |
| 3285 | | prg32(space->machine, data); |
| 3286 | | break; |
| 3287 | | case 0x1ffe: |
| 3288 | | chr4_0(space->machine, data, CHRROM); |
| 3289 | | break; |
| 3290 | | case 0x1fff: |
| 3291 | | chr4_4(space->machine, data, CHRROM); |
| 3292 | | break; |
| 3293 | | } |
| 3294 | | } |
| 3295 | | } |
| 3296 | | |
| 3297 | | static WRITE8_HANDLER( mapper34_w ) |
| 3298 | | { |
| 3299 | | /* This portion of the mapper is nearly identical to Mapper 7, except no one-screen mirroring */ |
| 3300 | | /* Deadly Towers is really a Mapper 34 game - the demo screens look wrong using mapper 7. */ |
| 3301 | | LOG_MMC(("mapper34_w, offset: %04x, data: %02x\n", offset, data)); |
| 3302 | | |
| 3303 | | if (!nes.crc_hack) // is it plain BxROM? |
| 3304 | | prg32(space->machine, data); |
| 3305 | | } |
| 3306 | | |
| 3307 | | /************************************************************* |
| 3308 | | |
| 3309 | | Mapper 35 |
| 3310 | | |
| 3311 | | Known Boards: Undocumented / Unused ?!? |
| 3312 | | Games: ---------- |
| 3313 | | |
| 3314 | | In MESS: ---------- |
| 3315 | | |
| 3316 | | *************************************************************/ |
| 3317 | | |
| 3318 | | /************************************************************* |
| 3319 | | |
| 3320 | | Mapper 36 |
| 3321 | | |
| 3322 | | Known Boards: Bootleg Board by TXC |
| 3323 | | Games: Strike Wolf (also Policeman?? according to Nestopia) |
| 3324 | | |
| 3325 | | In MESS: Supported. |
| 3326 | | |
| 3327 | | *************************************************************/ |
| 3328 | | |
| 3329 | | static WRITE8_HANDLER( mapper36_w ) |
| 3330 | | { |
| 3331 | | LOG_MMC(("mapper36_w, offset: %04x, data: %02x\n", offset, data)); |
| 3332 | | |
| 3333 | | if ((offset >= 0x400) && (offset < 0x7fff)) |
| 3334 | | { |
| 3335 | | prg32(space->machine, data >> 4); |
| 3336 | | chr8(space->machine, data & 0x0f, CHRROM); |
| 3337 | | } |
| 3338 | | } |
| 3339 | | |
| 3340 | | /************************************************************* |
| 3341 | | |
| 3342 | | Mapper 37 |
| 3343 | | |
| 3344 | | Known Boards: Custom ZZ?? |
| 3345 | | Games: Super Mario Bros. + Tetris + Nintendo World Cup (E) |
| 3346 | | |
| 3347 | | MMC3 clone |
| 3348 | | |
| 3349 | | In MESS: Supported. |
| 3350 | | |
| 3351 | | *************************************************************/ |
| 3352 | | |
| 3353 | | static WRITE8_HANDLER( mapper37_m_w ) |
| 3354 | | { |
| 3355 | | UINT8 map37_helper; |
| 3356 | | LOG_MMC(("mapper37_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3357 | | |
| 3358 | | map37_helper = (data & 0x06) >> 1; |
| 3359 | | |
| 3360 | | mmc_prg_base = map37_helper << 3; |
| 3361 | | mmc_prg_mask = (map37_helper == 2) ? 0x0f : 0x07; |
| 3362 | | mmc_chr_base = map37_helper << 6; |
| 3363 | | mmc_chr_mask = 0x7f; |
| 3364 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 3365 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 3366 | | } |
| 3367 | | |
| 3368 | | /************************************************************* |
| 3369 | | |
| 3370 | | Mapper 38 |
| 3371 | | |
| 3372 | | Known Boards: Discrete Logic Board |
| 3373 | | Games: Crime Busters |
| 3374 | | |
| 3375 | | In MESS: Supported. |
| 3376 | | |
| 3377 | | *************************************************************/ |
| 3378 | | |
| 3379 | | static WRITE8_HANDLER( mapper38_m_w ) |
| 3380 | | { |
| 3381 | | LOG_MMC(("mapper38_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3382 | | |
| 3383 | | prg32(space->machine, data); |
| 3384 | | chr8(space->machine, data >> 4, CHRROM); |
| 3385 | | } |
| 3386 | | |
| 3387 | | /************************************************************* |
| 3388 | | |
| 3389 | | Mapper 39 |
| 3390 | | |
| 3391 | | Known Boards: Bootleg Board by Subor |
| 3392 | | Games: Study n Game 32 in 1 |
| 3393 | | |
| 3394 | | In MESS: Partially Supported. |
| 3395 | | |
| 3396 | | *************************************************************/ |
| 3397 | | |
| 3398 | | static WRITE8_HANDLER( mapper39_w ) |
| 3399 | | { |
| 3400 | | LOG_MMC(("mapper39_w, offset: %04x, data: %02x\n", offset, data)); |
| 3401 | | |
| 3402 | | prg32(space->machine, data); |
| 3403 | | } |
| 3404 | | |
| 3405 | | /************************************************************* |
| 3406 | | |
| 3407 | | Mapper 40 |
| 3408 | | |
| 3409 | | Known Boards: Unknown Bootleg Board |
| 3410 | | Games: Super Mario Bros. 2 Pirate (Jpn version of SMB2) |
| 3411 | | |
| 3412 | | In MESS: Supported. |
| 3413 | | |
| 3414 | | *************************************************************/ |
| 3415 | | |
| 3416 | | static void mapper40_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 3417 | | { |
| 3418 | | if (IRQ_enable) |
| 3419 | | { |
| 3420 | | if ((0xfff - IRQ_count) <= 114) |
| 3421 | | { |
| 3422 | | IRQ_count = (IRQ_count + 1) & 0xfff; |
| 3423 | | IRQ_enable = 0; |
| 3424 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 3425 | | } |
| 3426 | | else |
| 3427 | | IRQ_count += 114; |
| 3428 | | } |
| 3429 | | } |
| 3430 | | |
| 3431 | | static WRITE8_HANDLER( mapper40_w ) |
| 3432 | | { |
| 3433 | | LOG_MMC(("mapper40_w, offset: %04x, data: %02x\n", offset, data)); |
| 3434 | | |
| 3435 | | switch (offset & 0x6000) |
| 3436 | | { |
| 3437 | | case 0x0000: |
| 3438 | | IRQ_enable = 0; |
| 3439 | | IRQ_count = 0; |
| 3440 | | break; |
| 3441 | | case 0x2000: |
| 3442 | | IRQ_enable = 1; |
| 3443 | | break; |
| 3444 | | case 0x6000: |
| 3445 | | prg8_cd(space->machine, data); |
| 3446 | | break; |
| 3447 | | } |
| 3448 | | } |
| 3449 | | |
| 3450 | | /************************************************************* |
| 3451 | | |
| 3452 | | Mapper 41 |
| 3453 | | |
| 3454 | | Known Boards: Caltron Board |
| 3455 | | Games: 6 in 1 by Caltron |
| 3456 | | |
| 3457 | | In MESS: Supported. |
| 3458 | | |
| 3459 | | *************************************************************/ |
| 3460 | | |
| 3461 | | static WRITE8_HANDLER( mapper41_m_w ) |
| 3462 | | { |
| 3463 | | LOG_MMC(("mapper41_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3464 | | |
| 3465 | | mmc_cmd1 = offset & 0xff; |
| 3466 | | set_nt_mirroring((offset & 0x20) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3467 | | prg32(space->machine, offset & 0x07); |
| 3468 | | } |
| 3469 | | |
| 3470 | | static WRITE8_HANDLER( mapper41_w ) |
| 3471 | | { |
| 3472 | | LOG_MMC(("mapper41_w, offset: %04x, data: %02x\n", offset, data)); |
| 3473 | | |
| 3474 | | if (mmc_cmd1 & 0x04) |
| 3475 | | chr8(space->machine, ((mmc_cmd1 & 0x18) >> 1) | (data & 0x03), CHRROM); |
| 3476 | | } |
| 3477 | | |
| 3478 | | /************************************************************* |
| 3479 | | |
| 3480 | | Mapper 42 |
| 3481 | | |
| 3482 | | Known Boards: Unknown Bootleg Board |
| 3483 | | Games: Mario Baby, Ai Senshi Nicol |
| 3484 | | |
| 3485 | | In MESS: Supported. |
| 3486 | | |
| 3487 | | *************************************************************/ |
| 3488 | | |
| 3489 | | static WRITE8_HANDLER( mapper42_w ) |
| 3490 | | { |
| 3491 | | LOG_MMC(("mapper42_w, offset: %04x, data: %02x\n", offset, data)); |
| 3492 | | |
| 3493 | | if (offset >= 0x7000) |
| 3494 | | { |
| 3495 | | switch(offset & 0x03) |
| 3496 | | { |
| 3497 | | case 0x00: |
| 3498 | | prg8_67(space->machine, data); |
| 3499 | | break; |
| 3500 | | case 0x01: |
| 3501 | | set_nt_mirroring((data & 0x08) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3502 | | break; |
| 3503 | | case 0x02: |
| 3504 | | /* Check if IRQ is being enabled */ |
| 3505 | | if (!IRQ_enable && (data & 0x02)) |
| 3506 | | { |
| 3507 | | IRQ_enable = 1; |
| 3508 | | timer_adjust_oneshot(nes_irq_timer, cputag_clocks_to_attotime(space->machine, "maincpu", 24576), 0); |
| 3509 | | } |
| 3510 | | if (!(data & 0x02)) |
| 3511 | | { |
| 3512 | | IRQ_enable = 0; |
| 3513 | | timer_adjust_oneshot(nes_irq_timer, attotime_never, 0); |
| 3514 | | } |
| 3515 | | break; |
| 3516 | | } |
| 3517 | | } |
| 3518 | | } |
| 3519 | | |
| 3520 | | /************************************************************* |
| 3521 | | |
| 3522 | | Mapper 43 |
| 3523 | | |
| 3524 | | Known Boards: Unknown Bootleg Board |
| 3525 | | Games: Super Mario Bros. 2 Pirate (LF36) |
| 3526 | | |
| 3527 | | In MESS: Supported? The only image I found is not working |
| 3528 | | (not even in NEStopia). |
| 3529 | | |
| 3530 | | *************************************************************/ |
| 3531 | | |
| 3532 | | static WRITE8_HANDLER( mapper43_w ) |
| 3533 | | { |
| 3534 | | int bank = (((offset >> 8) & 0x03) * 0x20) + (offset & 0x1f); |
| 3535 | | |
| 3536 | | LOG_MMC(("mapper43_w, offset: %04x, data: %02x\n", offset, data)); |
| 3537 | | |
| 3538 | | set_nt_mirroring((offset& 0x2000) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3539 | | |
| 3540 | | if (offset & 0x0800) |
| 3541 | | { |
| 3542 | | if (offset & 0x1000) |
| 3543 | | { |
| 3544 | | if (bank * 2 >= nes.prg_chunks) |
| 3545 | | { |
| 3546 | | memory_set_bankptr(space->machine, 3, nes.wram); |
| 3547 | | memory_set_bankptr(space->machine, 4, nes.wram); |
| 3548 | | } |
| 3549 | | else |
| 3550 | | { |
| 3551 | | LOG_MMC(("mapper43_w, selecting upper 16KB bank of #%02x\n", bank)); |
| 3552 | | prg16_cdef(space->machine, 2 * bank + 1); |
| 3553 | | } |
| 3554 | | } |
| 3555 | | else |
| 3556 | | { |
| 3557 | | if (bank * 2 >= nes.prg_chunks) |
| 3558 | | { |
| 3559 | | memory_set_bankptr(space->machine, 1, nes.wram); |
| 3560 | | memory_set_bankptr(space->machine, 2, nes.wram); |
| 3561 | | } |
| 3562 | | else |
| 3563 | | { |
| 3564 | | LOG_MMC(("mapper43_w, selecting lower 16KB bank of #%02x\n", bank)); |
| 3565 | | prg16_89ab(space->machine, 2 * bank); |
| 3566 | | } |
| 3567 | | } |
| 3568 | | } |
| 3569 | | else |
| 3570 | | { |
| 3571 | | if (bank * 2 >= nes.prg_chunks) |
| 3572 | | { |
| 3573 | | memory_set_bankptr(space->machine, 1, nes.wram); |
| 3574 | | memory_set_bankptr(space->machine, 2, nes.wram); |
| 3575 | | memory_set_bankptr(space->machine, 3, nes.wram); |
| 3576 | | memory_set_bankptr(space->machine, 4, nes.wram); |
| 3577 | | } |
| 3578 | | else |
| 3579 | | { |
| 3580 | | LOG_MMC(("mapper43_w, selecting 32KB bank #%02x\n", bank)); |
| 3581 | | prg32(space->machine, bank); |
| 3582 | | } |
| 3583 | | } |
| 3584 | | } |
| 3585 | | |
| 3586 | | /************************************************************* |
| 3587 | | |
| 3588 | | Mapper 44 |
| 3589 | | |
| 3590 | | Known Boards: Unknown Multigame Bootleg Board |
| 3591 | | Games: Kunio 8 in 1, Super Big 7 in 1 |
| 3592 | | |
| 3593 | | In MESS: Supported. It also uses mapper4_irq. |
| 3594 | | |
| 3595 | | *************************************************************/ |
| 3596 | | |
| 3597 | | static WRITE8_HANDLER( mapper44_w ) |
| 3598 | | { |
| 3599 | | UINT8 page; |
| 3600 | | LOG_MMC(("mapper44_w offset: %04x, data: %02x\n", offset, data)); |
| 3601 | | |
| 3602 | | switch (offset & 0x6001) |
| 3603 | | { |
| 3604 | | case 0x2001: /* $a001 - Select 128K ROM/VROM base (0..5) or last 256K ROM/VRAM base (6) */ |
| 3605 | | page = (data & 0x07); |
| 3606 | | if (page > 6) |
| 3607 | | page = 6; |
| 3608 | | |
| 3609 | | mmc_prg_base = page << 4; |
| 3610 | | mmc_prg_mask = (page > 5) ? 0x1f : 0x0f; |
| 3611 | | mmc_chr_base = page << 7; |
| 3612 | | mmc_chr_mask = (page > 5) ? 0xff : 0x7f; |
| 3613 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 3614 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 3615 | | break; |
| 3616 | | |
| 3617 | | default: |
| 3618 | | mapper4_w(space, offset, data); |
| 3619 | | break; |
| 3620 | | } |
| 3621 | | } |
| 3622 | | |
| 3623 | | /************************************************************* |
| 3624 | | |
| 3625 | | Mapper 45 |
| 3626 | | |
| 3627 | | Known Boards: Unknown Multigame Bootleg Board |
| 3628 | | Games: Street Fighter V, various multigame carts |
| 3629 | | |
| 3630 | | In MESS: Supported. It also uses mapper4_irq. |
| 3631 | | |
| 3632 | | *************************************************************/ |
| 3633 | | |
| 3634 | | static WRITE8_HANDLER( mapper45_m_w ) |
| 3635 | | { |
| 3636 | | LOG_MMC(("mapper45_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3637 | | |
| 3638 | | /* This bit is the "register lock". Once register are locked, writes go to WRAM |
| 3639 | | and there is no way to unlock them (except by resetting the machine) */ |
| 3640 | | if (mapper45_reg[3] & 0x40) |
| 3641 | | nes.wram[offset] = data; |
| 3642 | | else |
| 3643 | | { |
| 3644 | | mapper45_reg[mmc_count] = data; |
| 3645 | | mmc_count = (mmc_count + 1) & 0x03; |
| 3646 | | |
| 3647 | | if (!mmc_count) |
| 3648 | | { |
| 3649 | | LOG_MMC(("mapper45_m_w, command completed %02x %02x %02x %02x\n", mapper45_reg[3], |
| 3650 | | mapper45_reg[2], mapper45_reg[1], mapper45_reg[0])); |
| 3651 | | |
| 3652 | | mmc_prg_base = mapper45_reg[1]; |
| 3653 | | mmc_prg_mask = 0x3f ^ (mapper45_reg[3] & 0x3f); |
| 3654 | | mmc_chr_base = ((mapper45_reg[2] & 0xf0) << 4) + mapper45_reg[0]; |
| 3655 | | mmc_chr_mask = 0xff >> (~mapper45_reg[2] & 0x0f); |
| 3656 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 3657 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 3658 | | } |
| 3659 | | } |
| 3660 | | } |
| 3661 | | |
| 3662 | | /************************************************************* |
| 3663 | | |
| 3664 | | Mapper 46 |
| 3665 | | |
| 3666 | | Known Boards: Rumblestation Board |
| 3667 | | Games: Rumblestation 15 in 1 |
| 3668 | | |
| 3669 | | In MESS: Supported. |
| 3670 | | |
| 3671 | | *************************************************************/ |
| 3672 | | |
| 3673 | | static WRITE8_HANDLER( mapper46_m_w ) |
| 3674 | | { |
| 3675 | | LOG_MMC(("mapper46_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3676 | | |
| 3677 | | prg_bank[0] = (prg_bank[0] & 0x01) | ((data & 0x0f) << 1); |
| 3678 | | vrom_bank[0] = (vrom_bank[0] & 0x07) | ((data & 0xf0) >> 1); |
| 3679 | | prg32(space->machine, prg_bank[0]); |
| 3680 | | chr8(space->machine, vrom_bank[0], CHRROM); |
| 3681 | | } |
| 3682 | | |
| 3683 | | static WRITE8_HANDLER( mapper46_w ) |
| 3684 | | { |
| 3685 | | LOG_MMC(("mapper46_w, offset: %04x, data: %02x\n", offset, data)); |
| 3686 | | |
| 3687 | | prg_bank[0] = (prg_bank[0] & ~0x01) | (data & 0x01); |
| 3688 | | vrom_bank[0] = (vrom_bank[0] & ~0x07) | ((data & 0x70) >> 4); |
| 3689 | | prg32(space->machine, prg_bank[0]); |
| 3690 | | chr8(space->machine, vrom_bank[0], CHRROM); |
| 3691 | | } |
| 3692 | | |
| 3693 | | /************************************************************* |
| 3694 | | |
| 3695 | | Mapper 47 |
| 3696 | | |
| 3697 | | Known Boards: Custom QJ?? |
| 3698 | | Games: Super Spike V'Ball + Nintendo World Cup |
| 3699 | | |
| 3700 | | In MESS: Supported. It also uses mapper4_irq. |
| 3701 | | |
| 3702 | | *************************************************************/ |
| 3703 | | |
| 3704 | | static WRITE8_HANDLER( mapper47_m_w ) |
| 3705 | | { |
| 3706 | | LOG_MMC(("mapper47_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3707 | | |
| 3708 | | mmc_prg_base = (data & 0x01) << 4; |
| 3709 | | mmc_prg_mask = 0x0f; |
| 3710 | | mmc_chr_base = (data & 0x01) << 7; |
| 3711 | | mmc_chr_mask = 0x7f; |
| 3712 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 3713 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 3714 | | } |
| 3715 | | |
| 3716 | | /************************************************************* |
| 3717 | | |
| 3718 | | Mapper 48 |
| 3719 | | |
| 3720 | | Known Boards: Taito TC0190FMC PAL16R4 |
| 3721 | | Games: Bakushou!! Jinsei Gekijou 3, Bubble Bobble 2, |
| 3722 | | Captain Saver, Don Doko Don 2, Flintstones, Jetsons |
| 3723 | | |
| 3724 | | This is basically Mapper 33 + IRQ. Notably, IRQ works the |
| 3725 | | same as MMC3 irq, BUT latch values are "inverted" (XOR'ed |
| 3726 | | with 0xff) and there is a little delay (not implemented yet) |
| 3727 | | We simply use MMC3 IRQ and XOR the value written in the |
| 3728 | | register 0xc000 below |
| 3729 | | |
| 3730 | | In MESS: Supported. |
| 3731 | | |
| 3732 | | *************************************************************/ |
| 3733 | | |
| 3734 | | static WRITE8_HANDLER( mapper48_w ) |
| 3735 | | { |
| 3736 | | LOG_MMC(("mapper48_w, offset: %04x, data: %02x\n", offset, data)); |
| 3737 | | |
| 3738 | | switch (offset & 0x6003) |
| 3739 | | { |
| 3740 | | case 0x0000: |
| 3741 | | prg8_89(space->machine, data); |
| 3742 | | break; |
| 3743 | | case 0x0001: |
| 3744 | | prg8_ab(space->machine, data); |
| 3745 | | break; |
| 3746 | | case 0x0002: |
| 3747 | | chr2_0(space->machine, data, CHRROM); |
| 3748 | | break; |
| 3749 | | case 0x0003: |
| 3750 | | chr2_2(space->machine, data, CHRROM); |
| 3751 | | break; |
| 3752 | | case 0x2000: |
| 3753 | | chr1_4(space->machine, data, CHRROM); |
| 3754 | | break; |
| 3755 | | case 0x2001: |
| 3756 | | chr1_5(space->machine, data, CHRROM); |
| 3757 | | break; |
| 3758 | | case 0x2002: |
| 3759 | | chr1_6(space->machine, data, CHRROM); |
| 3760 | | break; |
| 3761 | | case 0x2003: |
| 3762 | | chr1_7(space->machine, data, CHRROM); |
| 3763 | | break; |
| 3764 | | case 0x4000: |
| 3765 | | IRQ_count_latch = (0x100 - data) & 0xff; |
| 3766 | | break; |
| 3767 | | case 0x4001: |
| 3768 | | IRQ_count = IRQ_count_latch; |
| 3769 | | break; |
| 3770 | | case 0x4002: |
| 3771 | | IRQ_enable = 1; |
| 3772 | | break; |
| 3773 | | case 0x4003: |
| 3774 | | IRQ_enable = 0; |
| 3775 | | break; |
| 3776 | | case 0x6000: |
| 3777 | | set_nt_mirroring((data & 0x40) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3778 | | break; |
| 3779 | | } |
| 3780 | | } |
| 3781 | | |
| 3782 | | /************************************************************* |
| 3783 | | |
| 3784 | | Mapper 49 |
| 3785 | | |
| 3786 | | Known Boards: Unknown Multigame Bootleg Board |
| 3787 | | Games: Super HIK 4 in 1 |
| 3788 | | |
| 3789 | | In MESS: Supported. It also uses mapper4_irq. |
| 3790 | | |
| 3791 | | *************************************************************/ |
| 3792 | | |
| 3793 | | static WRITE8_HANDLER( mapper49_m_w ) |
| 3794 | | { |
| 3795 | | LOG_MMC(("mapper49_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3796 | | |
| 3797 | | /* mid writes only work when WRAM is enabled. not sure if I should |
| 3798 | | change the condition to mmc_cmd2==0x80 (i.e. what is the effect of |
| 3799 | | the read-only bit?) */ |
| 3800 | | if (mmc_cmd2 & 0x80) |
| 3801 | | { |
| 3802 | | if (data & 0x01) /* if this is 0, then we have 32k PRG blocks */ |
| 3803 | | { |
| 3804 | | mmc_prg_base = (data & 0xc0) >> 2; |
| 3805 | | mmc_prg_mask = 0x0f; |
| 3806 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 3807 | | } |
| 3808 | | else |
| 3809 | | prg32(space->machine, (data & 0x30) >> 4); |
| 3810 | | |
| 3811 | | mmc_chr_base = (data & 0xc0) << 1; |
| 3812 | | mmc_chr_mask = 0x7f; |
| 3813 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 3814 | | } |
| 3815 | | } |
| 3816 | | |
| 3817 | | /************************************************************* |
| 3818 | | |
| 3819 | | Mapper 50 |
| 3820 | | |
| 3821 | | Known Boards: Unknown Bootleg Board |
| 3822 | | Games: Super Mario Bros. 2 Pirate (Jpn version of SMB2) |
| 3823 | | |
| 3824 | | This was marked as Alt. Levels. is it true? |
| 3825 | | |
| 3826 | | In MESS: Supported. |
| 3827 | | |
| 3828 | | *************************************************************/ |
| 3829 | | |
| 3830 | | static void mapper50_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 3831 | | { |
| 3832 | | if (IRQ_enable) |
| 3833 | | { |
| 3834 | | if (IRQ_count < 0x1000) |
| 3835 | | { |
| 3836 | | if ((0x1000 - IRQ_count) <= 114) |
| 3837 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 3838 | | else |
| 3839 | | IRQ_count += 114; |
| 3840 | | } |
| 3841 | | else |
| 3842 | | IRQ_count += 114; |
| 3843 | | |
| 3844 | | IRQ_count &= 0xffff; // according to docs is 16bit counter -> it wraps only after 0xffff |
| 3845 | | } |
| 3846 | | } |
| 3847 | | |
| 3848 | | static WRITE8_HANDLER( mapper50_l_w ) |
| 3849 | | { |
| 3850 | | UINT8 prg; |
| 3851 | | LOG_MMC(("mapper50_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 3852 | | offset += 0x100; |
| 3853 | | |
| 3854 | | switch (offset & 0x160) |
| 3855 | | { |
| 3856 | | case 0x020: |
| 3857 | | prg = (data & 0x08) | ((data & 0x06) >> 1) | ((data & 0x01) << 2); |
| 3858 | | prg8_cd(space->machine, prg); |
| 3859 | | break; |
| 3860 | | case 0x120: |
| 3861 | | IRQ_enable = data & 0x01; |
| 3862 | | break; |
| 3863 | | } |
| 3864 | | } |
| 3865 | | |
| 3866 | | /* This goes to 0x4020-0x403f */ |
| 3867 | | WRITE8_HANDLER( mapper50_add_w ) |
| 3868 | | { |
| 3869 | | UINT8 prg; |
| 3870 | | LOG_MMC(("mapper50_add_w, offset: %04x, data: %02x\n", offset, data)); |
| 3871 | | |
| 3872 | | prg = (data & 0x08) | ((data & 0x06) >> 1) | ((data & 0x01) << 2); |
| 3873 | | prg8_cd(space->machine, prg); |
| 3874 | | } |
| 3875 | | |
| 3876 | | /************************************************************* |
| 3877 | | |
| 3878 | | Mapper 51 |
| 3879 | | |
| 3880 | | Known Boards: Unknown Multigame Bootleg Board |
| 3881 | | Games: 11 in 1 Ball Games |
| 3882 | | |
| 3883 | | In MESS: Partially Supported. |
| 3884 | | |
| 3885 | | *************************************************************/ |
| 3886 | | |
| 3887 | | static void mapper51_set_banks( running_machine *machine ) |
| 3888 | | { |
| 3889 | | set_nt_mirroring((mapper51_reg[0] == 3) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3890 | | |
| 3891 | | if (mapper51_reg[0] & 0x01) |
| 3892 | | { |
| 3893 | | prg32(machine, mapper51_reg[1]); |
| 3894 | | } |
| 3895 | | else |
| 3896 | | { |
| 3897 | | prg16_89ab(machine, (mapper51_reg[1] << 1) | (mapper51_reg[0] >> 1)); |
| 3898 | | prg16_cdef(machine, (mapper51_reg[1] << 1) | 0x07); |
| 3899 | | } |
| 3900 | | } |
| 3901 | | |
| 3902 | | static WRITE8_HANDLER( mapper51_m_w ) |
| 3903 | | { |
| 3904 | | LOG_MMC(("mapper51_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3905 | | |
| 3906 | | mapper51_reg[0] = ((data >> 1) & 0x01) | ((data >> 3) & 0x02); |
| 3907 | | mapper51_set_banks(space->machine); |
| 3908 | | } |
| 3909 | | |
| 3910 | | static WRITE8_HANDLER( mapper51_w ) |
| 3911 | | { |
| 3912 | | LOG_MMC(("mapper51_w, offset: %04x, data: %02x\n", offset, data)); |
| 3913 | | |
| 3914 | | switch (offset & 0x6000) |
| 3915 | | { |
| 3916 | | case 0x4000: // here we also update reg[0] upper bit |
| 3917 | | mapper51_reg[0] = (mapper51_reg[0] & 0x01) | ((data >> 3) & 0x02); |
| 3918 | | case 0x0000: |
| 3919 | | case 0x2000: |
| 3920 | | case 0x6000: |
| 3921 | | mapper51_reg[1] = data & 0x0f; |
| 3922 | | mapper51_set_banks(space->machine); |
| 3923 | | break; |
| 3924 | | } |
| 3925 | | } |
| 3926 | | |
| 3927 | | /************************************************************* |
| 3928 | | |
| 3929 | | Mapper 52 |
| 3930 | | |
| 3931 | | Known Boards: Unknown Multigame Bootleg Board |
| 3932 | | Games: Mario 7 in 1 |
| 3933 | | |
| 3934 | | MMC3 clone |
| 3935 | | |
| 3936 | | In MESS: Supported. |
| 3937 | | |
| 3938 | | *************************************************************/ |
| 3939 | | |
| 3940 | | static WRITE8_HANDLER( mapper52_m_w ) |
| 3941 | | { |
| 3942 | | UINT8 map52_helper1, map52_helper2; |
| 3943 | | LOG_MMC(("mapper52_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3944 | | |
| 3945 | | /* mid writes only work when WRAM is enabled. not sure if I should |
| 3946 | | change the condition to mmc_cmd2==0x80 (i.e. what is the effect of |
| 3947 | | the read-only bit?) and it only can happen once! */ |
| 3948 | | if ((mmc_cmd2 & 0x80) && !map52_reg_written) |
| 3949 | | { |
| 3950 | | map52_helper1 = (data & 0x08); |
| 3951 | | map52_helper2 = (data & 0x40); |
| 3952 | | |
| 3953 | | mmc_prg_base = map52_helper1 ? ((data & 0x07) << 4) : ((data & 0x06) << 4); |
| 3954 | | mmc_prg_mask = map52_helper1 ? 0x0f : 0x1f; |
| 3955 | | mmc_chr_base = ((data & 0x20) << 4) | ((data & 0x04) << 6) | (map52_helper2 ? ((data & 0x10) << 3) : 0); |
| 3956 | | mmc_chr_mask = map52_helper2 ? 0x7f : 0xff; |
| 3957 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 3958 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 3959 | | |
| 3960 | | map52_reg_written = 1; |
| 3961 | | } |
| 3962 | | else |
| 3963 | | nes.wram[offset] = data; |
| 3964 | | } |
| 3965 | | |
| 3966 | | /************************************************************* |
| 3967 | | |
| 3968 | | Mapper 53 |
| 3969 | | |
| 3970 | | Known Boards: Unknown Multigame Bootleg Board |
| 3971 | | Games: Supervision 16 in 1 |
| 3972 | | |
| 3973 | | In MESS: Unsupported (SRAM banks can go in mid-regions). |
| 3974 | | |
| 3975 | | *************************************************************/ |
| 3976 | | |
| 3977 | | /************************************************************* |
| 3978 | | |
| 3979 | | Mapper 54 |
| 3980 | | |
| 3981 | | Known Boards: Unknown Multigame Bootleg Board |
| 3982 | | Games: [no games in nes.hsi] |
| 3983 | | |
| 3984 | | In MESS: Unsupported. |
| 3985 | | |
| 3986 | | *************************************************************/ |
| 3987 | | |
| 3988 | | /************************************************************* |
| 3989 | | |
| 3990 | | Mapper 55 |
| 3991 | | |
| 3992 | | Known Boards: Unknown Bootleg Board |
| 3993 | | Games: [no games in nes.hsi] |
| 3994 | | |
| 3995 | | In MESS: Unsupported. |
| 3996 | | |
| 3997 | | *************************************************************/ |
| 3998 | | |
| 3999 | | /************************************************************* |
| 4000 | | |
| 4001 | | Mapper 56 |
| 4002 | | |
| 4003 | | Known Boards: Bootleg Board by Kaiser (KS202) |
| 4004 | | Games: Super Mario Bros. 3 Pirate |
| 4005 | | |
| 4006 | | In MESS: Unsupported. |
| 4007 | | |
| 4008 | | *************************************************************/ |
| 4009 | | |
| 4010 | | /************************************************************* |
| 4011 | | |
| 4012 | | Mapper 57 |
| 4013 | | |
| 4014 | | Known Boards: Unknown Multigame Bootleg Board |
| 4015 | | Games: 6 in 1, 54 in 1, 106 in 1 |
| 4016 | | |
| 4017 | | In MESS: Supported. |
| 4018 | | |
| 4019 | | *************************************************************/ |
| 4020 | | |
| 4021 | | static WRITE8_HANDLER( mapper57_w ) |
| 4022 | | { |
| 4023 | | LOG_MMC(("mapper57_w, offset: %04x, data: %02x\n", offset, data)); |
| 4024 | | |
| 4025 | | if (offset & 0x0800) |
| 4026 | | { |
| 4027 | | mmc_cmd2 = data; |
| 4028 | | } |
| 4029 | | else |
| 4030 | | { |
| 4031 | | mmc_cmd1 = data; |
| 4032 | | } |
| 4033 | | |
| 4034 | | if (mmc_cmd2 & 0x80) |
| 4035 | | { |
| 4036 | | prg32(space->machine, 2 | (mmc_cmd2 >> 6)); |
| 4037 | | } |
| 4038 | | else |
| 4039 | | { |
| 4040 | | prg16_89ab(space->machine, (mmc_cmd2 >> 5) & 0x03); |
| 4041 | | prg16_cdef(space->machine, (mmc_cmd2 >> 5) & 0x03); |
| 4042 | | } |
| 4043 | | |
| 4044 | | set_nt_mirroring((mmc_cmd2 & 0x08) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4045 | | |
| 4046 | | chr8(space->machine, (mmc_cmd1 & 0x03) | (mmc_cmd2 & 0x07) | ((mmc_cmd2 & 0x10) >> 1), CHRROM); |
| 4047 | | } |
| 4048 | | |
| 4049 | | /************************************************************* |
| 4050 | | |
| 4051 | | Mapper 58 |
| 4052 | | |
| 4053 | | Known Boards: Unknown Multigame Bootleg Board |
| 4054 | | Games: 68 in 1, 73 in 1, 98 in 1 |
| 4055 | | |
| 4056 | | In MESS: Supported. |
| 4057 | | |
| 4058 | | *************************************************************/ |
| 4059 | | |
| 4060 | | static WRITE8_HANDLER( mapper58_w ) |
| 4061 | | { |
| 4062 | | UINT8 bank = (offset & 0x40) ? 0 : 1; |
| 4063 | | LOG_MMC(("mapper58_w, offset: %04x, data: %02x\n", offset, data)); |
| 4064 | | |
| 4065 | | prg16_89ab(space->machine, offset & ~bank); |
| 4066 | | prg16_cdef(space->machine, offset | bank); |
| 4067 | | chr8(space->machine, offset >> 3, CHRROM); |
| 4068 | | set_nt_mirroring((data & 0x80) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4069 | | } |
| 4070 | | |
| 4071 | | /************************************************************* |
| 4072 | | |
| 4073 | | Mapper 59 |
| 4074 | | |
| 4075 | | Known Boards: Undocumented / Unused ?!? |
| 4076 | | Games: ---------- |
| 4077 | | |
| 4078 | | In MESS: ---------- |
| 4079 | | |
| 4080 | | *************************************************************/ |
| 4081 | | |
| 4082 | | /************************************************************* |
| 4083 | | |
| 4084 | | Mapper 60 |
| 4085 | | |
| 4086 | | Known Boards: Unknown Multigame Bootleg Board |
| 4087 | | Games: 4 in 1, 35 in 1 |
| 4088 | | |
| 4089 | | In MESS: Unsupported (these are reset-based and have dips). |
| 4090 | | |
| 4091 | | *************************************************************/ |
| 4092 | | |
| 4093 | | /************************************************************* |
| 4094 | | |
| 4095 | | Mapper 61 |
| 4096 | | |
| 4097 | | Known Boards: Bootleg Board by RCM |
| 4098 | | Games: Tetris Family 9 in 1, 20 in 1 |
| 4099 | | |
| 4100 | | Simple Mapper: prg/chr/nt are swapped depending on the offset |
| 4101 | | of writes in 0x8000-0xffff. offset&0x80 set NT mirroring, |
| 4102 | | when (offset&0x30) is 0,3 prg32 is set; when it is 1,2 |
| 4103 | | two 16k prg banks are set. See below for the values used in |
| 4104 | | these banks. |
| 4105 | | |
| 4106 | | In MESS: Supported. |
| 4107 | | |
| 4108 | | *************************************************************/ |
| 4109 | | |
| 4110 | | static WRITE8_HANDLER( mapper61_w ) |
| 4111 | | { |
| 4112 | | LOG_MMC(("mapper61_w, offset: %04x, data: %02x\n", offset, data)); |
| 4113 | | |
| 4114 | | switch (offset & 0x30) |
| 4115 | | { |
| 4116 | | case 0x00: |
| 4117 | | case 0x30: |
| 4118 | | prg32(space->machine, offset & 0x0f); |
| 4119 | | break; |
| 4120 | | case 0x10: |
| 4121 | | case 0x20: |
| 4122 | | prg16_89ab(space->machine, ((offset & 0x0f) << 1) | ((offset & 0x20) >> 4)); |
| 4123 | | prg16_cdef(space->machine, ((offset & 0x0f) << 1) | ((offset & 0x20) >> 4)); |
| 4124 | | break; |
| 4125 | | } |
| 4126 | | set_nt_mirroring((offset & 0x80) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4127 | | } |
| 4128 | | |
| 4129 | | /************************************************************* |
| 4130 | | |
| 4131 | | Mapper 62 |
| 4132 | | |
| 4133 | | Known Boards: Unknown Multigame Bootleg Board |
| 4134 | | Games: Super 700 in 1 |
| 4135 | | |
| 4136 | | In MESS: Supported. |
| 4137 | | |
| 4138 | | *************************************************************/ |
| 4139 | | |
| 4140 | | static WRITE8_HANDLER( mapper62_w ) |
| 4141 | | { |
| 4142 | | LOG_MMC(("mapper62_w, offset :%04x, data: %02x\n", offset, data)); |
| 4143 | | |
| 4144 | | chr8(space->machine, ((offset & 0x1f) << 2) | (data & 0x03), CHRROM); |
| 4145 | | |
| 4146 | | if (offset & 0x20) |
| 4147 | | { |
| 4148 | | prg16_89ab(space->machine, (offset & 0x40) | ((offset >> 8) & 0x3f)); |
| 4149 | | prg16_cdef(space->machine, (offset & 0x40) | ((offset >> 8) & 0x3f)); |
| 4150 | | } |
| 4151 | | else |
| 4152 | | { |
| 4153 | | prg32(space->machine, ((offset & 0x40) | ((offset >> 8) & 0x3f)) >> 1); |
| 4154 | | } |
| 4155 | | |
| 4156 | | set_nt_mirroring((offset & 0x80) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4157 | | } |
| 4158 | | |
| 4159 | | /************************************************************* |
| 4160 | | |
| 4161 | | Mapper 63 |
| 4162 | | |
| 4163 | | Known Boards: Unknown Multigame Bootleg Board |
| 4164 | | Games: [no games in nes.hsi] |
| 4165 | | |
| 4166 | | In MESS: Unsupported. |
| 4167 | | |
| 4168 | | *************************************************************/ |
| 4169 | | |
| 4170 | | /************************************************************* |
| 4171 | | |
| 4172 | | Mapper 64 |
| 4173 | | |
| 4174 | | Known Boards: Tengen 800032 |
| 4175 | | Games: Klax, Road Runner, Rolling Thunder, Shinobi, Skulls |
| 4176 | | & Croosbones, Xybots |
| 4177 | | |
| 4178 | | In MESS: Partially Supported. It also uses mapper4_irq. |
| 4179 | | |
| 4180 | | *************************************************************/ |
| 4181 | | |
| 4182 | | static void mapper64_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 4183 | | { |
| 4184 | | if (!IRQ_mode) // we are in scanline mode! |
| 4185 | | { |
| 4186 | | if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE) |
| 4187 | | { |
| 4188 | | if (!IRQ_reset) |
| 4189 | | { |
| 4190 | | if (!IRQ_count) |
| 4191 | | IRQ_count = IRQ_count_latch; |
| 4192 | | else |
| 4193 | | { |
| 4194 | | IRQ_count--; |
| 4195 | | if (IRQ_enable && !blanked && !IRQ_count) |
| 4196 | | { |
| 4197 | | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, |
| 4198 | | video_screen_get_vpos(device->machine->primary_screen), video_screen_get_hpos(device->machine->primary_screen))); |
| 4199 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 4200 | | } |
| 4201 | | } |
| 4202 | | } |
| 4203 | | else |
| 4204 | | { |
| 4205 | | IRQ_reset = 0; |
| 4206 | | IRQ_count = IRQ_count_latch + 1; |
| 4207 | | } |
| 4208 | | } |
| 4209 | | } |
| 4210 | | /* otherwise, we are in CPU cycles mode --> decrement count of 114 every scanline |
| 4211 | | --> in the meanwhile anything can have happened to IRQ_reset and we would not know |
| 4212 | | --> Skulls and Crossbones does not show anything!! */ |
| 4213 | | else |
| 4214 | | { |
| 4215 | | // if (!IRQ_reset) |
| 4216 | | { |
| 4217 | | if (IRQ_count <= 114) |
| 4218 | | IRQ_count = IRQ_count_latch; |
| 4219 | | else |
| 4220 | | { |
| 4221 | | IRQ_count -= 114; |
| 4222 | | if (IRQ_enable && !blanked && (IRQ_count <= 114)) |
| 4223 | | { |
| 4224 | | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, |
| 4225 | | video_screen_get_vpos(device->machine->primary_screen), video_screen_get_hpos(device->machine->primary_screen))); |
| 4226 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 4227 | | } |
| 4228 | | } |
| 4229 | | } |
| 4230 | | // else |
| 4231 | | // { |
| 4232 | | // IRQ_reset = 0; |
| 4233 | | // IRQ_count = IRQ_count_latch + 1; |
| 4234 | | // } |
| 4235 | | } |
| 4236 | | } |
| 4237 | | |
| 4238 | | static void mapper64_set_prg( running_machine *machine ) |
| 4239 | | { |
| 4240 | | UINT8 prg_mode = mmc_cmd1 & 0x40; |
| 4241 | | |
| 4242 | | prg8_89(machine, prg_bank[prg_mode ? 2: 0]); |
| 4243 | | prg8_ab(machine, prg_bank[prg_mode ? 0: 1]); |
| 4244 | | prg8_cd(machine, prg_bank[prg_mode ? 1: 2]); |
| 4245 | | } |
| 4246 | | |
| 4247 | | static void mapper64_set_chr( running_machine *machine ) |
| 4248 | | { |
| 4249 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 4250 | | |
| 4251 | | if (mmc_cmd1 & 0x20) |
| 4252 | | { |
| 4253 | | chr1_x(machine, 0 ^ chr_page, vrom_bank[0], CHRROM); |
| 4254 | | chr1_x(machine, 1 ^ chr_page, vrom_bank[8], CHRROM); |
| 4255 | | chr1_x(machine, 2 ^ chr_page, vrom_bank[1], CHRROM); |
| 4256 | | chr1_x(machine, 3 ^ chr_page, vrom_bank[9], CHRROM); |
| 4257 | | } |
| 4258 | | else |
| 4259 | | { |
| 4260 | | chr1_x(machine, 0 ^ chr_page, vrom_bank[0] & ~0x01, CHRROM); |
| 4261 | | chr1_x(machine, 1 ^ chr_page, vrom_bank[0] | 0x01, CHRROM); |
| 4262 | | chr1_x(machine, 2 ^ chr_page, vrom_bank[1] & ~0x01, CHRROM); |
| 4263 | | chr1_x(machine, 3 ^ chr_page, vrom_bank[1] | 0x01, CHRROM); |
| 4264 | | } |
| 4265 | | |
| 4266 | | chr1_x(machine, 4 ^ chr_page, vrom_bank[2], CHRROM); |
| 4267 | | chr1_x(machine, 5 ^ chr_page, vrom_bank[3], CHRROM); |
| 4268 | | chr1_x(machine, 6 ^ chr_page, vrom_bank[4], CHRROM); |
| 4269 | | chr1_x(machine, 7 ^ chr_page, vrom_bank[5], CHRROM); |
| 4270 | | } |
| 4271 | | |
| 4272 | | static WRITE8_HANDLER( mapper64_w ) |
| 4273 | | { |
| 4274 | | UINT8 map64_helper, cmd; |
| 4275 | | LOG_MMC(("mapper64_w offset: %04x, data: %02x\n", offset, data)); |
| 4276 | | |
| 4277 | | switch (offset & 0x6001) |
| 4278 | | { |
| 4279 | | case 0x0000: |
| 4280 | | map64_helper = mmc_cmd1 ^ data; |
| 4281 | | mmc_cmd1 = data; |
| 4282 | | |
| 4283 | | /* Has PRG Mode changed? */ |
| 4284 | | if (map64_helper & 0x40) |
| 4285 | | mapper64_set_prg(space->machine); |
| 4286 | | |
| 4287 | | /* Has CHR Mode changed? */ |
| 4288 | | if (map64_helper & 0xa0) |
| 4289 | | mapper64_set_chr(space->machine); |
| 4290 | | break; |
| 4291 | | |
| 4292 | | case 0x0001: |
| 4293 | | cmd = mmc_cmd1 & 0x0f; |
| 4294 | | switch (cmd) |
| 4295 | | { |
| 4296 | | case 0: case 1: |
| 4297 | | case 2: case 3: |
| 4298 | | case 4: case 5: |
| 4299 | | vrom_bank[cmd] = data; |
| 4300 | | mapper64_set_chr(space->machine); |
| 4301 | | break; |
| 4302 | | case 6: case 7: |
| 4303 | | prg_bank[cmd - 6] = data; |
| 4304 | | mapper64_set_prg(space->machine); |
| 4305 | | break; |
| 4306 | | case 8: case 9: |
| 4307 | | vrom_bank[cmd - 2] = data; |
| 4308 | | mapper64_set_chr(space->machine); |
| 4309 | | break; |
| 4310 | | case 0x0f: |
| 4311 | | prg_bank[2] = data; |
| 4312 | | mapper64_set_prg(space->machine); |
| 4313 | | break; |
| 4314 | | } |
| 4315 | | break; |
| 4316 | | |
| 4317 | | case 0x2000: |
| 4318 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4319 | | break; |
| 4320 | | |
| 4321 | | case 0x4000: |
| 4322 | | IRQ_count_latch = data; |
| 4323 | | break; |
| 4324 | | |
| 4325 | | case 0x4001: /* $c001 - IRQ scanline latch */ |
| 4326 | | IRQ_mode = data & 0x01; |
| 4327 | | IRQ_reset = 1; |
| 4328 | | break; |
| 4329 | | |
| 4330 | | case 0x6000: |
| 4331 | | IRQ_enable = 0; |
| 4332 | | break; |
| 4333 | | |
| 4334 | | case 0x6001: |
| 4335 | | IRQ_enable = 1; |
| 4336 | | break; |
| 4337 | | |
| 4338 | | default: |
| 4339 | | LOG_MMC(("Mapper 64 write. addr: %04x value: %02x\n", offset + 0x8000, data)); |
| 4340 | | break; |
| 4341 | | } |
| 4342 | | } |
| 4343 | | |
| 4344 | | /************************************************************* |
| 4345 | | |
| 4346 | | Mapper 65 |
| 4347 | | |
| 4348 | | Known Boards: Irem H3001 |
| 4349 | | Games: Daiku no Gen San 2 - Akage no Dan no Gyakushuu, |
| 4350 | | Kaiketsu Yanchamaru 3, Spartan X 2 |
| 4351 | | |
| 4352 | | In MESS: Supported. |
| 4353 | | |
| 4354 | | *************************************************************/ |
| 4355 | | |
| 4356 | | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 4357 | | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 4358 | | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 4359 | | static void irem_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 4360 | | { |
| 4361 | | if (IRQ_enable) |
| 4362 | | { |
| 4363 | | IRQ_count -= 114; |
| 4364 | | |
| 4365 | | if (IRQ_count <= 114) |
| 4366 | | { |
| 4367 | | IRQ_enable = 0; |
| 4368 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 4369 | | } |
| 4370 | | } |
| 4371 | | } |
| 4372 | | |
| 4373 | | static WRITE8_HANDLER( mapper65_w ) |
| 4374 | | { |
| 4375 | | LOG_MMC(("mapper65_w, offset %04x, data: %02x\n", offset, data)); |
| 4376 | | |
| 4377 | | switch (offset & 0x7fff) |
| 4378 | | { |
| 4379 | | case 0x0000: |
| 4380 | | prg8_89(space->machine, data); |
| 4381 | | break; |
| 4382 | | |
| 4383 | | case 0x1001: |
| 4384 | | set_nt_mirroring((data & 0x80) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4385 | | break; |
| 4386 | | |
| 4387 | | case 0x1003: |
| 4388 | | IRQ_enable = data & 0x80; |
| 4389 | | break; |
| 4390 | | |
| 4391 | | case 0x1004: |
| 4392 | | IRQ_count = IRQ_count_latch; |
| 4393 | | break; |
| 4394 | | |
| 4395 | | case 0x1005: |
| 4396 | | IRQ_count_latch = (IRQ_count_latch & 0x00ff) | (data << 8); |
| 4397 | | break; |
| 4398 | | |
| 4399 | | case 0x1006: |
| 4400 | | IRQ_count_latch = (IRQ_count_latch & 0xff00) | data; |
| 4401 | | break; |
| 4402 | | |
| 4403 | | case 0x2000: |
| 4404 | | prg8_ab(space->machine, data); |
| 4405 | | break; |
| 4406 | | |
| 4407 | | case 0x3000: |
| 4408 | | case 0x3001: |
| 4409 | | case 0x3002: |
| 4410 | | case 0x3003: |
| 4411 | | case 0x3004: |
| 4412 | | case 0x3005: |
| 4413 | | case 0x3006: |
| 4414 | | case 0x3007: |
| 4415 | | chr1_x(space->machine, offset & 0x07, data, CHRROM); |
| 4416 | | break; |
| 4417 | | |
| 4418 | | case 0x4000: |
| 4419 | | prg8_cd(space->machine, data); |
| 4420 | | break; |
| 4421 | | |
| 4422 | | default: |
| 4423 | | break; |
| 4424 | | } |
| 4425 | | } |
| 4426 | | |
| 4427 | | /************************************************************* |
| 4428 | | |
| 4429 | | Mapper 66 |
| 4430 | | |
| 4431 | | Known Boards: GNROM, GXROM, MHROM |
| 4432 | | Games: Mobile Suit Z Gundam, Paris-Dakar Rally Special, |
| 4433 | | Takahashi Meijin no Bugutte Honey |
| 4434 | | |
| 4435 | | In MESS: Supported. |
| 4436 | | |
| 4437 | | *************************************************************/ |
| 4438 | | |
| 4439 | | static WRITE8_HANDLER( mapper66_w ) |
| 4440 | | { |
| 4441 | | LOG_MMC(("mapper66_w, offset %04x, data: %02x\n", offset, data)); |
| 4442 | | |
| 4443 | | prg32(space->machine, (data & 0x30) >> 4); |
| 4444 | | chr8(space->machine, data & 0x03, CHRROM); |
| 4445 | | } |
| 4446 | | |
| 4447 | | /************************************************************* |
| 4448 | | |
| 4449 | | Mapper 67 |
| 4450 | | |
| 4451 | | Known Boards: Sunsoft 3 |
| 4452 | | Games: Fantasy Zone 2, Mito Koumon |
| 4453 | | |
| 4454 | | In MESS: Supported. |
| 4455 | | |
| 4456 | | *************************************************************/ |
| 4457 | | |
| 4458 | | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 4459 | | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 4460 | | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 4461 | | static void mapper67_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 4462 | | { |
| 4463 | | /* TODO: change to reflect the actual number of cycles spent: both using 114 or cycling 114,114,113 |
| 4464 | | produces a 1-line glitch in Fantasy Zone 2: it really requires the counter to be updated each CPU cycle! */ |
| 4465 | | if (IRQ_enable) |
| 4466 | | { |
| 4467 | | if (IRQ_count <= 114) |
| 4468 | | { |
| 4469 | | IRQ_enable = 0; |
| 4470 | | IRQ_count = 0xffff; |
| 4471 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 4472 | | } |
| 4473 | | else |
| 4474 | | IRQ_count -= 114; |
| 4475 | | } |
| 4476 | | } |
| 4477 | | |
| 4478 | | static WRITE8_HANDLER( mapper67_w ) |
| 4479 | | { |
| 4480 | | LOG_MMC(("mapper67_w, offset %04x, data: %02x\n", offset, data)); |
| 4481 | | switch (offset & 0x7800) |
| 4482 | | { |
| 4483 | | case 0x0800: |
| 4484 | | chr2_0(space->machine, data, CHRROM); |
| 4485 | | break; |
| 4486 | | case 0x1800: |
| 4487 | | chr2_2(space->machine, data, CHRROM); |
| 4488 | | break; |
| 4489 | | case 0x2800: |
| 4490 | | chr2_4(space->machine, data, CHRROM); |
| 4491 | | break; |
| 4492 | | case 0x3800: |
| 4493 | | chr2_6(space->machine, data, CHRROM); |
| 4494 | | break; |
| 4495 | | case 0x4000: |
| 4496 | | case 0x4800: |
| 4497 | | IRQ_toggle ^= 1; |
| 4498 | | if (IRQ_toggle) |
| 4499 | | IRQ_count = (IRQ_count & 0x00ff) | (data << 8); |
| 4500 | | else |
| 4501 | | IRQ_count = (IRQ_count & 0xff00) | data; |
| 4502 | | break; |
| 4503 | | case 0x5800: |
| 4504 | | IRQ_enable = data & 0x10; |
| 4505 | | IRQ_toggle = 0; |
| 4506 | | break; |
| 4507 | | case 0x6800: |
| 4508 | | switch (data & 3) |
| 4509 | | { |
| 4510 | | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 4511 | | case 0x01: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 4512 | | case 0x02: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 4513 | | case 0x03: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 4514 | | } |
| 4515 | | break; |
| 4516 | | case 0x7800: |
| 4517 | | prg16_89ab(space->machine, data); |
| 4518 | | break; |
| 4519 | | default: |
| 4520 | | LOG_MMC(("mapper67_w uncaught offset: %04x, data: %02x\n", offset, data)); |
| 4521 | | break; |
| 4522 | | } |
| 4523 | | } |
| 4524 | | |
| 4525 | | /************************************************************* |
| 4526 | | |
| 4527 | | Mapper 68 |
| 4528 | | |
| 4529 | | Known Boards: Sunsoft 4, Sunsoft with DCS, NTBROM, Tengen 800042 |
| 4530 | | Games: After Burner, After Burner II, Maharaja |
| 4531 | | |
| 4532 | | In MESS: Supported. |
| 4533 | | |
| 4534 | | *************************************************************/ |
| 4535 | | |
| 4536 | | static void mapper68_mirror( running_machine *machine, int m68_mirror, int m0, int m1 ) |
| 4537 | | { |
| 4538 | | switch (m68_mirror) |
| 4539 | | { |
| 4540 | | case 0x00: |
| 4541 | | set_nt_mirroring(PPU_MIRROR_HORZ); |
| 4542 | | break; |
| 4543 | | case 0x01: |
| 4544 | | set_nt_mirroring(PPU_MIRROR_VERT); |
| 4545 | | break; |
| 4546 | | case 0x02: |
| 4547 | | set_nt_mirroring(PPU_MIRROR_LOW); |
| 4548 | | break; |
| 4549 | | case 0x03: |
| 4550 | | set_nt_mirroring(PPU_MIRROR_HIGH); |
| 4551 | | break; |
| 4552 | | case 0x10: |
| 4553 | | set_nt_page(0, ROM, m0 | 0x80, 0); |
| 4554 | | set_nt_page(1, ROM, m1 | 0x80, 0); |
| 4555 | | set_nt_page(2, ROM, m0 | 0x80, 0); |
| 4556 | | set_nt_page(3, ROM, m1 | 0x80, 0); |
| 4557 | | break; |
| 4558 | | case 0x11: |
| 4559 | | set_nt_page(0, ROM, m0 | 0x80, 0); |
| 4560 | | set_nt_page(1, ROM, m0 | 0x80, 0); |
| 4561 | | set_nt_page(2, ROM, m1 | 0x80, 0); |
| 4562 | | set_nt_page(3, ROM, m1 | 0x80, 0); |
| 4563 | | break; |
| 4564 | | case 0x12: |
| 4565 | | set_nt_page(0, ROM, m0 | 0x80, 0); |
| 4566 | | set_nt_page(1, ROM, m0 | 0x80, 0); |
| 4567 | | set_nt_page(2, ROM, m0 | 0x80, 0); |
| 4568 | | set_nt_page(3, ROM, m0 | 0x80, 0); |
| 4569 | | break; |
| 4570 | | case 0x13: |
| 4571 | | set_nt_page(0, ROM, m1 | 0x80, 0); |
| 4572 | | set_nt_page(1, ROM, m1 | 0x80, 0); |
| 4573 | | set_nt_page(2, ROM, m1 | 0x80, 0); |
| 4574 | | set_nt_page(3, ROM, m1 | 0x80, 0); |
| 4575 | | break; |
| 4576 | | } |
| 4577 | | } |
| 4578 | | |
| 4579 | | static WRITE8_HANDLER( mapper68_w ) |
| 4580 | | { |
| 4581 | | LOG_MMC(("mapper68_w, offset %04x, data: %02x\n", offset, data)); |
| 4582 | | |
| 4583 | | switch (offset & 0x7000) |
| 4584 | | { |
| 4585 | | case 0x0000: |
| 4586 | | chr2_0(space->machine, data, CHRROM); |
| 4587 | | break; |
| 4588 | | case 0x1000: |
| 4589 | | chr2_2(space->machine, data, CHRROM); |
| 4590 | | break; |
| 4591 | | case 0x2000: |
| 4592 | | chr2_4(space->machine, data, CHRROM); |
| 4593 | | break; |
| 4594 | | case 0x3000: |
| 4595 | | chr2_6(space->machine, data, CHRROM); |
| 4596 | | break; |
| 4597 | | case 0x4000: |
| 4598 | | m0 = data & 0x7f; |
| 4599 | | mapper68_mirror(space->machine, m68_mirror, m0, m1); |
| 4600 | | break; |
| 4601 | | case 0x5000: |
| 4602 | | m1 = data & 0x7f; |
| 4603 | | mapper68_mirror(space->machine, m68_mirror, m0, m1); |
| 4604 | | break; |
| 4605 | | case 0x6000: |
| 4606 | | m68_mirror = data & 0x13; |
| 4607 | | mapper68_mirror(space->machine, m68_mirror, m0, m1); |
| 4608 | | break; |
| 4609 | | case 0x7000: |
| 4610 | | prg16_89ab(space->machine, data); |
| 4611 | | break; |
| 4612 | | default: |
| 4613 | | LOG_MMC(("mapper68_w uncaught offset: %04x, data: %02x\n", offset, data)); |
| 4614 | | break; |
| 4615 | | } |
| 4616 | | } |
| 4617 | | |
| 4618 | | /************************************************************* |
| 4619 | | |
| 4620 | | Mapper 69 |
| 4621 | | |
| 4622 | | Known Boards: JLROM, JSROM, Sunsoft 5B, Sunsoft FME7 and |
| 4623 | | Custom |
| 4624 | | Games: Barcode World, Batman - Return of the Joker, Gimmick! |
| 4625 | | |
| 4626 | | In MESS: Supported. |
| 4627 | | |
| 4628 | | *************************************************************/ |
| 4629 | | |
| 4630 | | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 4631 | | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 4632 | | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 4633 | | static void mapper69_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 4634 | | { |
| 4635 | | /* TODO: change to reflect the actual number of cycles spent */ |
| 4636 | | if ((IRQ_enable & 0x80) && (IRQ_enable & 0x01)) |
| 4637 | | { |
| 4638 | | if (IRQ_count <= 114) |
| 4639 | | { |
| 4640 | | IRQ_count = 0xffff; |
| 4641 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 4642 | | } |
| 4643 | | else |
| 4644 | | IRQ_count -= 114; |
| 4645 | | } |
| 4646 | | else if (IRQ_enable & 0x01) // if enable bit is not set, only decrement the counter! |
| 4647 | | { |
| 4648 | | if (IRQ_count <= 114) |
| 4649 | | IRQ_count = 0xffff; |
| 4650 | | else |
| 4651 | | IRQ_count -= 114; |
| 4652 | | } |
| 4653 | | } |
| 4654 | | |
| 4655 | | static WRITE8_HANDLER( mapper69_w ) |
| 4656 | | { |
| 4657 | | LOG_MMC(("mapper69_w, offset %04x, data: %02x\n", offset, data)); |
| 4658 | | |
| 4659 | | switch (offset & 0x6000) |
| 4660 | | { |
| 4661 | | case 0x0000: |
| 4662 | | mmc_cmd1 = data & 0x0f; |
| 4663 | | break; |
| 4664 | | |
| 4665 | | case 0x2000: |
| 4666 | | switch (mmc_cmd1) |
| 4667 | | { |
| 4668 | | case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: |
| 4669 | | chr1_x(space->machine, mmc_cmd1, data, CHRROM); |
| 4670 | | break; |
| 4671 | | |
| 4672 | | /* TODO: deal properly with bankswitching/write-protecting the mid-mapper area */ |
| 4673 | | case 8: |
| 4674 | | if (!(data & 0x40)) |
| 4675 | | prg8_67(space->machine, data & 0x3f); |
| 4676 | | else if (data & 0x80) |
| 4677 | | memory_set_bankptr(space->machine, 5, &nes.wram[(data & 0x3f) * 0x2000]); |
| 4678 | | break; |
| 4679 | | |
| 4680 | | case 9: |
| 4681 | | prg8_89(space->machine, data); |
| 4682 | | break; |
| 4683 | | case 0x0a: |
| 4684 | | prg8_ab(space->machine, data); |
| 4685 | | break; |
| 4686 | | case 0x0b: |
| 4687 | | prg8_cd(space->machine, data); |
| 4688 | | break; |
| 4689 | | case 0x0c: |
| 4690 | | switch (data & 0x03) |
| 4691 | | { |
| 4692 | | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 4693 | | case 0x01: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 4694 | | case 0x02: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 4695 | | case 0x03: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 4696 | | } |
| 4697 | | break; |
| 4698 | | case 0x0d: |
| 4699 | | IRQ_enable = data; |
| 4700 | | break; |
| 4701 | | case 0x0e: |
| 4702 | | IRQ_count = (IRQ_count & 0xff00) | data; |
| 4703 | | break; |
| 4704 | | case 0x0f: |
| 4705 | | IRQ_count = (IRQ_count & 0x00ff) | (data << 8); |
| 4706 | | break; |
| 4707 | | } |
| 4708 | | break; |
| 4709 | | |
| 4710 | | /* Here we would have sound command for Sunsoft 5b variant */ |
| 4711 | | // case 0x4000: |
| 4712 | | // case 0x6000: |
| 4713 | | |
| 4714 | | default: |
| 4715 | | logerror("mapper69_w uncaught %04x value: %02x\n", offset + 0x8000, data); |
| 4716 | | break; |
| 4717 | | } |
| 4718 | | } |
| 4719 | | |
| 4720 | | /************************************************************* |
| 4721 | | |
| 4722 | | Mapper 70 |
| 4723 | | |
| 4724 | | Known Boards: Discrete Logic Board |
| 4725 | | Games: Space Shadow, Family Trainer Manhattan Police, |
| 4726 | | Kamen Rider Club |
| 4727 | | |
| 4728 | | Same board as mapper 152, but no NT mirroring |
| 4729 | | |
| 4730 | | In MESS: Supported. |
| 4731 | | |
| 4732 | | *************************************************************/ |
| 4733 | | |
| 4734 | | |
| 4735 | | static WRITE8_HANDLER( mapper70_w ) |
| 4736 | | { |
| 4737 | | LOG_MMC(("mapper70_w, offset: %04x, data: %02x\n", offset, data)); |
| 4738 | | |
| 4739 | | // we lack bus emulation |
| 4740 | | prg16_89ab(space->machine, (data >> 4) & 0x07); |
| 4741 | | chr8(space->machine, data, CHRROM); |
| 4742 | | } |
| 4743 | | |
| 4744 | | /************************************************************* |
| 4745 | | |
| 4746 | | Mapper 71 |
| 4747 | | |
| 4748 | | Known Boards: Camerica Boards (BF9093, BF9097, BF909X, ALGNV11) |
| 4749 | | Games: Linus Spacehead's Cosmic Crusade, Micro Machines, |
| 4750 | | Mig-29, Stunt Kids |
| 4751 | | |
| 4752 | | We currently do not emulate NT mirroring for BF9097 board |
| 4753 | | (missing in BF9093). As a result Fire Hawk is broken. |
| 4754 | | |
| 4755 | | In MESS: Partially Supported. |
| 4756 | | |
| 4757 | | *************************************************************/ |
| 4758 | | |
| 4759 | | static WRITE8_HANDLER( mapper71_w ) |
| 4760 | | { |
| 4761 | | LOG_MMC(("mapper71_w offset: %04x, data: %02x\n", offset, data)); |
| 4762 | | |
| 4763 | | switch (offset & 0x7000) |
| 4764 | | { |
| 4765 | | case 0x0000: |
| 4766 | | case 0x1000: |
| 4767 | | if (nes.crc_hack) |
| 4768 | | set_nt_mirroring((data & 0x10) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 4769 | | break; |
| 4770 | | case 0x4000: |
| 4771 | | case 0x5000: |
| 4772 | | case 0x6000: |
| 4773 | | case 0x7000: |
| 4774 | | prg16_89ab(space->machine, data); |
| 4775 | | break; |
| 4776 | | } |
| 4777 | | } |
| 4778 | | |
| 4779 | | /************************************************************* |
| 4780 | | |
| 4781 | | Mapper 72 |
| 4782 | | |
| 4783 | | Known Boards: Jaleco JF17, JF26 and JF28 |
| 4784 | | Games: Moero!! Juudou Warriors, Moero!! Pro Tennis, Pinball |
| 4785 | | Quest Jpn |
| 4786 | | |
| 4787 | | In MESS: Supported. |
| 4788 | | |
| 4789 | | *************************************************************/ |
| 4790 | | |
| 4791 | | static WRITE8_HANDLER( mapper72_w ) |
| 4792 | | { |
| 4793 | | LOG_MMC(("mapper72_w, offset %04x, data: %02x\n", offset, data)); |
| 4794 | | |
| 4795 | | if (data & 0x80) |
| 4796 | | prg16_89ab(space->machine, data & 0x0f); |
| 4797 | | if (data & 0x40) |
| 4798 | | chr8(space->machine, data & 0x0f, CHRROM); |
| 4799 | | |
| 4800 | | } |
| 4801 | | |
| 4802 | | /************************************************************* |
| 4803 | | |
| 4804 | | Mapper 73 |
| 4805 | | |
| 4806 | | Known Boards: Konami VRC3 |
| 4807 | | Games: Salamander |
| 4808 | | |
| 4809 | | In MESS: Supported. It also uses konami_irq. |
| 4810 | | |
| 4811 | | *************************************************************/ |
| 4812 | | |
| 4813 | | static WRITE8_HANDLER( mapper73_w ) |
| 4814 | | { |
| 4815 | | switch (offset & 0x7000) |
| 4816 | | { |
| 4817 | | case 0x0000: |
| 4818 | | case 0x1000: |
| 4819 | | /* dunno which address controls these */ |
| 4820 | | IRQ_count_latch = data; |
| 4821 | | IRQ_enable_latch = data; |
| 4822 | | break; |
| 4823 | | case 0x2000: |
| 4824 | | IRQ_enable = data; |
| 4825 | | break; |
| 4826 | | case 0x3000: |
| 4827 | | IRQ_count &= ~0x0f; |
| 4828 | | IRQ_count |= data & 0x0f; |
| 4829 | | break; |
| 4830 | | case 0x4000: |
| 4831 | | IRQ_count &= ~0xf0; |
| 4832 | | IRQ_count |= (data & 0x0f) << 4; |
| 4833 | | break; |
| 4834 | | case 0x7000: |
| 4835 | | prg16_89ab(space->machine, data); |
| 4836 | | break; |
| 4837 | | default: |
| 4838 | | logerror("mapper73_w uncaught, offset %04x, data: %02x\n", offset, data); |
| 4839 | | break; |
| 4840 | | } |
| 4841 | | } |
| 4842 | | |
| 4843 | | |
| 4844 | | /************************************************************* |
| 4845 | | |
| 4846 | | Mapper 74 |
| 4847 | | |
| 4848 | | Known Boards: Type A by Waixing |
| 4849 | | Games: Columbus - Ougon no Yoake (C), Ji Jia Zhan Shi, |
| 4850 | | Jia A Fung Yun, Wei Luo Chuan Qi |
| 4851 | | |
| 4852 | | This mapper is quite similar to MMC3, but with two differences: |
| 4853 | | mirroring is not the same, and when VROM banks 8,9 are accessed |
| 4854 | | they point to CHRRAM and not CHRROM. |
| 4855 | | |
| 4856 | | In MESS: Supported |
| 4857 | | |
| 4858 | | *************************************************************/ |
| 4859 | | |
| 4860 | | /* MIRROR_LOW and MIRROR_HIGH are swapped! */ |
| 4861 | | static void waixing_set_mirror( UINT8 nt ) |
| 4862 | | { |
| 4863 | | switch (nt) |
| 4864 | | { |
| 4865 | | case 0: |
| 4866 | | case 1: |
| 4867 | | set_nt_mirroring(nt ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4868 | | break; |
| 4869 | | case 2: |
| 4870 | | set_nt_mirroring(PPU_MIRROR_LOW); |
| 4871 | | break; |
| 4872 | | case 3: |
| 4873 | | set_nt_mirroring(PPU_MIRROR_HIGH); |
| 4874 | | break; |
| 4875 | | default: |
| 4876 | | LOG_MMC(("Mapper set NT to invalid value %02x", nt)); |
| 4877 | | break; |
| 4878 | | } |
| 4879 | | } |
| 4880 | | |
| 4881 | | static void mapper74_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 4882 | | { |
| 4883 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 4884 | | UINT8 chr_src[6]; |
| 4885 | | int i; |
| 4886 | | |
| 4887 | | for (i = 0; i < 6; i++) |
| 4888 | | chr_src[i] = ((vrom_bank[i] == 8) || (vrom_bank[i] == 9)) ? CHRRAM : CHRROM; |
| 4889 | | |
| 4890 | | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 4891 | | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 4892 | | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| 4893 | | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr_src[1]); |
| 4894 | | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr_src[2]); |
| 4895 | | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr_src[3]); |
| 4896 | | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr_src[4]); |
| 4897 | | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr_src[5]); |
| 4898 | | } |
| 4899 | | |
| 4900 | | static WRITE8_HANDLER( mapper74_w ) |
| 4901 | | { |
| 4902 | | UINT8 MMC3_helper, cmd; |
| 4903 | | LOG_MMC(("mapper74_w, offset: %04x, data: %02x\n", offset, data)); |
| 4904 | | |
| 4905 | | switch (offset & 0x6001) |
| 4906 | | { |
| 4907 | | case 0x0000: |
| 4908 | | MMC3_helper = mmc_cmd1 ^ data; |
| 4909 | | mmc_cmd1 = data; |
| 4910 | | |
| 4911 | | /* Has PRG Mode changed? */ |
| 4912 | | if (MMC3_helper & 0x40) |
| 4913 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 4914 | | |
| 4915 | | /* Has CHR Mode changed? */ |
| 4916 | | if (MMC3_helper & 0x80) |
| 4917 | | mapper74_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 4918 | | break; |
| 4919 | | |
| 4920 | | case 0x0001: |
| 4921 | | cmd = mmc_cmd1 & 0x07; |
| 4922 | | switch (cmd) |
| 4923 | | { |
| 4924 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 4925 | | case 2: case 3: case 4: case 5: |
| 4926 | | vrom_bank[cmd] = data; |
| 4927 | | mapper74_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 4928 | | break; |
| 4929 | | case 6: |
| 4930 | | case 7: |
| 4931 | | prg_bank[cmd - 6] = data; |
| 4932 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 4933 | | break; |
| 4934 | | } |
| 4935 | | break; |
| 4936 | | |
| 4937 | | case 0x2000: |
| 4938 | | waixing_set_mirror(data); //maybe data & 0x03? |
| 4939 | | break; |
| 4940 | | |
| 4941 | | case 0x2001: |
| 4942 | | break; |
| 4943 | | |
| 4944 | | default: |
| 4945 | | mapper4_w(space, offset, data); |
| 4946 | | break; |
| 4947 | | } |
| 4948 | | } |
| 4949 | | |
| 4950 | | /************************************************************* |
| 4951 | | |
| 4952 | | Mapper 75 |
| 4953 | | |
| 4954 | | Known Boards: Komani VRC1 and Jaleco JF20, JF22 |
| 4955 | | Games: Exciting Boxing, Ganbare Goemon!, Tetsuwan Atom |
| 4956 | | |
| 4957 | | In MESS: Supported. |
| 4958 | | |
| 4959 | | *************************************************************/ |
| 4960 | | |
| 4961 | | static WRITE8_HANDLER( mapper75_w ) |
| 4962 | | { |
| 4963 | | LOG_MMC(("mapper75_w, offset: %04x, data: %02x\n", offset, data)); |
| 4964 | | |
| 4965 | | switch (offset & 0x7000) |
| 4966 | | { |
| 4967 | | case 0x0000: |
| 4968 | | prg8_89(space->machine, data); |
| 4969 | | break; |
| 4970 | | case 0x1000: |
| 4971 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4972 | | vrom_bank[0] = (vrom_bank[0] & 0x0f) | ((data & 0x02) << 3); |
| 4973 | | vrom_bank[1] = (vrom_bank[1] & 0x0f) | ((data & 0x04) << 2); |
| 4974 | | chr4_0(space->machine, vrom_bank[0], CHRROM); |
| 4975 | | chr4_4(space->machine, vrom_bank[1], CHRROM); |
| 4976 | | break; |
| 4977 | | case 0x2000: |
| 4978 | | prg8_ab(space->machine, data); |
| 4979 | | break; |
| 4980 | | case 0x4000: |
| 4981 | | prg8_cd(space->machine, data); |
| 4982 | | break; |
| 4983 | | case 0x6000: |
| 4984 | | vrom_bank[0] = (vrom_bank[0] & 0x10) | (data & 0x0f); |
| 4985 | | chr4_0(space->machine, vrom_bank[0], CHRROM); |
| 4986 | | break; |
| 4987 | | case 0x7000: |
| 4988 | | vrom_bank[1] = (vrom_bank[1] & 0x10) | (data & 0x0f); |
| 4989 | | chr4_4(space->machine, vrom_bank[1], CHRROM); |
| 4990 | | break; |
| 4991 | | } |
| 4992 | | } |
| 4993 | | |
| 4994 | | /************************************************************* |
| 4995 | | |
| 4996 | | Mapper 76 |
| 4997 | | |
| 4998 | | Known Boards: Namcot 3446 |
| 4999 | | Games: Digital Devil Monogatari - Megami Tensei |
| 5000 | | |
| 5001 | | In MESS: Supported. |
| 5002 | | |
| 5003 | | *************************************************************/ |
| 5004 | | |
| 5005 | | static WRITE8_HANDLER( mapper76_w ) |
| 5006 | | { |
| 5007 | | LOG_MMC(("mapper76_w, offset: %04x, data: %02x\n", offset, data)); |
| 5008 | | |
| 5009 | | switch (offset & 0x7001) |
| 5010 | | { |
| 5011 | | case 0: |
| 5012 | | mmc_cmd1 = data; |
| 5013 | | break; |
| 5014 | | case 1: |
| 5015 | | { |
| 5016 | | switch (mmc_cmd1 & 0x07) |
| 5017 | | { |
| 5018 | | case 2: chr2_0(space->machine, data, CHRROM); break; |
| 5019 | | case 3: chr2_2(space->machine, data, CHRROM); break; |
| 5020 | | case 4: chr2_4(space->machine, data, CHRROM); break; |
| 5021 | | case 5: chr2_6(space->machine, data, CHRROM); break; |
| 5022 | | case 6: |
| 5023 | | (mmc_cmd1 & 0x40) ? prg8_cd(space->machine, data) : prg8_89(space->machine, data); |
| 5024 | | break; |
| 5025 | | case 7: prg8_ab(space->machine, data); break; |
| 5026 | | default: logerror("mapper76 unsupported command: %02x, data: %02x\n", mmc_cmd1, data); break; |
| 5027 | | } |
| 5028 | | } |
| 5029 | | case 0x2000: |
| 5030 | | set_nt_mirroring((data & 1) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 5031 | | break; |
| 5032 | | default: |
| 5033 | | logerror("mapper76 unmapped write, offset: %04x, data: %02x\n", offset, data); |
| 5034 | | break; |
| 5035 | | } |
| 5036 | | } |
| 5037 | | |
| 5038 | | /************************************************************* |
| 5039 | | |
| 5040 | | Mapper 77 |
| 5041 | | |
| 5042 | | Known Boards: Irem LROG017 |
| 5043 | | Games: Napoleon Senki |
| 5044 | | |
| 5045 | | In MESS: Partially Supported (it needs 4-screen mirroring). |
| 5046 | | |
| 5047 | | *************************************************************/ |
| 5048 | | |
| 5049 | | static WRITE8_HANDLER( mapper77_w ) |
| 5050 | | { |
| 5051 | | LOG_MMC(("mapper77_w, offset: %04x, data: %02x\n", offset, data)); |
| 5052 | | |
| 5053 | | prg32(space->machine, data & 0x0f); |
| 5054 | | chr2_0(space->machine, (data >> 4), CHRROM); |
| 5055 | | } |
| 5056 | | |
| 5057 | | /************************************************************* |
| 5058 | | |
| 5059 | | Mapper 78 |
| 5060 | | |
| 5061 | | Known Boards: Jaleco JF16 and Irem |
| 5062 | | Games: Holy Diver, Portopia Renzoku Satsujin Jiken, |
| 5063 | | Uchuusen - Cosmo Carrier |
| 5064 | | |
| 5065 | | A crc check is required to support Cosmo Carrier (which uses |
| 5066 | | a slightly different board) |
| 5067 | | |
| 5068 | | In MESS: Supported. |
| 5069 | | |
| 5070 | | *************************************************************/ |
| 5071 | | |
| 5072 | | static WRITE8_HANDLER( mapper78_w ) |
| 5073 | | { |
| 5074 | | LOG_MMC(("mapper78_w, offset: %04x, data: %02x\n", offset, data)); |
| 5075 | | |
| 5076 | | if (nes.crc_hack) // Jaleco JF16 board has different mirroring even if uses same mapper number :( |
| 5077 | | set_nt_mirroring((data & 0x08) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 5078 | | else |
| 5079 | | set_nt_mirroring((data & 0x08) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 5080 | | |
| 5081 | | chr8(space->machine, (data & 0xf0) >> 4, CHRROM); |
| 5082 | | prg16_89ab(space->machine, data & 0x07); |
| 5083 | | } |
| 5084 | | |
| 5085 | | /************************************************************* |
| 5086 | | |
| 5087 | | Mapper 79 |
| 5088 | | |
| 5089 | | Known Boards: NINA03, NINA06 by AVE |
| 5090 | | Games: Krazy Kreatures, Poke Block, Puzzle, Pyramid, |
| 5091 | | Solitaire, Ultimate League Soccer |
| 5092 | | |
| 5093 | | In MESS: Supported. |
| 5094 | | |
| 5095 | | *************************************************************/ |
| 5096 | | |
| 5097 | | static WRITE8_HANDLER( mapper79_l_w ) |
| 5098 | | { |
| 5099 | | LOG_MMC(("mapper79_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 5100 | | |
| 5101 | | if (!(offset & 0x0100)) |
| 5102 | | { |
| 5103 | | prg32(space->machine, data >> 3); |
| 5104 | | chr8(space->machine, data, CHRROM); |
| 5105 | | } |
| 5106 | | } |
| 5107 | | |
| 5108 | | /************************************************************* |
| 5109 | | |
| 5110 | | Mapper 80 |
| 5111 | | |
| 5112 | | Known Boards: Taito X1-005 Ver. A |
| 5113 | | Games: Bakushou!! Jinsei Gekijou 2, Kyonshiizu 2, Minelvaton |
| 5114 | | Saga, Taito Grand Prix |
| 5115 | | |
| 5116 | | Registers are at 0x7ef0-0x7eff. first six ones choose chr |
| 5117 | | (2x2k + 4x1k) banks, the seventh sets NT mirroring, the |
| 5118 | | remaining ones chose prg banks. |
| 5119 | | |
| 5120 | | In MESS: Supported. |
| 5121 | | |
| 5122 | | *************************************************************/ |
| 5123 | | |
| 5124 | | static WRITE8_HANDLER( mapper80_m_w ) |
| 5125 | | { |
| 5126 | | LOG_MMC(("mapper80_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 5127 | | |
| 5128 | | switch (offset) |
| 5129 | | { |
| 5130 | | case 0x1ef0: |
| 5131 | | chr2_0(space->machine, (data & 0x7f) >> 1, CHRROM); |
| 5132 | | break; |
| 5133 | | case 0x1ef1: |
| 5134 | | chr2_2(space->machine, (data & 0x7f) >> 1, CHRROM); |
| 5135 | | break; |
| 5136 | | case 0x1ef2: |
| 5137 | | chr1_4(space->machine, data, CHRROM); |
| 5138 | | break; |
| 5139 | | case 0x1ef3: |
| 5140 | | chr1_5(space->machine, data, CHRROM); |
| 5141 | | break; |
| 5142 | | case 0x1ef4: |
| 5143 | | chr1_6(space->machine, data, CHRROM); |
| 5144 | | break; |
| 5145 | | case 0x1ef5: |
| 5146 | | chr1_7(space->machine, data, CHRROM); |
| 5147 | | break; |
| 5148 | | case 0x1ef6: |
| 5149 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 5150 | | break; |
| 5151 | | case 0x1efa: |
| 5152 | | case 0x1efb: |
| 5153 | | prg8_89(space->machine, data); |
| 5154 | | break; |
| 5155 | | case 0x1efc: |
| 5156 | | case 0x1efd: |
| 5157 | | prg8_ab(space->machine, data); |
| 5158 | | break; |
| 5159 | | case 0x1efe: |
| 5160 | | case 0x1eff: |
| 5161 | | prg8_cd(space->machine, data); |
| 5162 | | break; |
| 5163 | | default: |
| 5164 | | logerror("mapper80_m_w uncaught addr: %04x, value: %02x\n", offset + 0x6000, data); |
| 5165 | | break; |
| 5166 | | } |
| 5167 | | } |
| 5168 | | |
| 5169 | | /************************************************************* |
| 5170 | | |
| 5171 | | Mapper 81 |
| 5172 | | |
| 5173 | | Known Boards: Undocumented / Unused ?!? |
| 5174 | | Games: ---------- |
| 5175 | | |
| 5176 | | In MESS: ---------- |
| 5177 | | |
| 5178 | | *************************************************************/ |
| 5179 | | |
| 5180 | | /************************************************************* |
| 5181 | | |
| 5182 | | Mapper 82 |
| 5183 | | |
| 5184 | | Known Boards: Taito X1-017 |
| 5185 | | Games: Kyuukyoku Harikiri Koushien, Kyuukyoku Harikiri |
| 5186 | | Stadium, SD Keiji - Blader |
| 5187 | | |
| 5188 | | In MESS: Supported. |
| 5189 | | |
| 5190 | | *************************************************************/ |
| 5191 | | |
| 5192 | | static WRITE8_HANDLER( mapper82_m_w ) |
| 5193 | | { |
| 5194 | | LOG_MMC(("mapper82_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 5195 | | |
| 5196 | | switch (offset) |
| 5197 | | { |
| 5198 | | case 0x1ef0: |
| 5199 | | if (mmc_cmd1) |
| 5200 | | chr2_4(space->machine, data >> 1, CHRROM); |
| 5201 | | else |
| 5202 | | chr2_0(space->machine, data >> 1, CHRROM); |
| 5203 | | break; |
| 5204 | | case 0x1ef1: |
| 5205 | | if (mmc_cmd1) |
| 5206 | | chr2_6(space->machine, data, CHRROM); |
| 5207 | | else |
| 5208 | | chr2_2(space->machine, data, CHRROM); |
| 5209 | | break; |
| 5210 | | case 0x1ef2: |
| 5211 | | chr1_x(space->machine, 4 ^ mmc_cmd1, data, CHRROM); |
| 5212 | | break; |
| 5213 | | case 0x1ef3: |
| 5214 | | chr1_x(space->machine, 5 ^ mmc_cmd1, data, CHRROM); |
| 5215 | | break; |
| 5216 | | case 0x1ef4: |
| 5217 | | chr1_x(space->machine, 6 ^ mmc_cmd1, data, CHRROM); |
| 5218 | | break; |
| 5219 | | case 0x1ef5: |
| 5220 | | chr1_x(space->machine, 7 ^ mmc_cmd1, data, CHRROM); |
| 5221 | | break; |
| 5222 | | case 0x1ef6: |
| 5223 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 5224 | | mmc_cmd1 = ((data & 0x02) << 1); |
| 5225 | | break; |
| 5226 | | |
| 5227 | | case 0x1efa: |
| 5228 | | prg8_89(space->machine, data >> 2); |
| 5229 | | break; |
| 5230 | | case 0x1efb: |
| 5231 | | prg8_ab(space->machine, data >> 2); |
| 5232 | | break; |
| 5233 | | case 0x1efc: |
| 5234 | | prg8_cd(space->machine, data >> 2); |
| 5235 | | break; |
| 5236 | | default: |
| 5237 | | logerror("mapper82_m_w uncaught addr: %04x, value: %02x\n", offset + 0x6000, data); |
| 5238 | | break; |
| 5239 | | } |
| 5240 | | } |
| 5241 | | |
| 5242 | | /************************************************************* |
| 5243 | | |
| 5244 | | Mapper 83 |
| 5245 | | |
| 5246 | | Known Boards: Unknown Multigame Bootleg Board |
| 5247 | | Games: Dragon Ball Party, Fatal Fury 2, Street Blaster II |
| 5248 | | Pro, World Heroes 2 |
| 5249 | | |
| 5250 | | In MESS: Supported. |
| 5251 | | |
| 5252 | | *************************************************************/ |
| 5253 | | |
| 5254 | | static WRITE8_HANDLER( mapper83_l_w ) |
| 5255 | | { |
| 5256 | | mapper83_low_reg[offset & 0x03] = data; |
| 5257 | | } |
| 5258 | | |
| 5259 | | static READ8_HANDLER( mapper83_l_r ) |
| 5260 | | { |
| 5261 | | return mapper83_low_reg[offset & 0x03]; |
| 5262 | | } |
| 5263 | | |
| 5264 | | static void mapper83_set_prg( running_machine *machine ) |
| 5265 | | { |
| 5266 | | prg16_89ab(machine, mapper83_reg[8] & 0x3f); |
| 5267 | | prg16_cdef(machine, (mapper83_reg[8] & 0x30) | 0x0f); |
| 5268 | | } |
| 5269 | | |
| 5270 | | static void mapper83_set_chr( running_machine *machine ) |
| 5271 | | { |
| 5272 | | chr1_0(machine, mapper83_reg[0] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 5273 | | chr1_1(machine, mapper83_reg[1] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 5274 | | chr1_2(machine, mapper83_reg[2] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 5275 | | chr1_3(machine, mapper83_reg[3] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 5276 | | chr1_4(machine, mapper83_reg[4] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 5277 | | chr1_5(machine, mapper83_reg[5] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 5278 | | chr1_6(machine, mapper83_reg[6] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 5279 | | chr1_7(machine, mapper83_reg[7] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 5280 | | } |
| 5281 | | |
| 5282 | | static WRITE8_HANDLER( mapper83_w ) |
| 5283 | | { |
| 5284 | | LOG_MMC(("mapper83_w, offset: %04x, data: %02x\n", offset, data)); |
| 5285 | | |
| 5286 | | switch (offset) |
| 5287 | | { |
| 5288 | | case 0x0000: |
| 5289 | | case 0x3000: |
| 5290 | | case 0x30ff: |
| 5291 | | case 0x31ff: |
| 5292 | | mapper83_reg[8] = data; |
| 5293 | | mapper83_set_prg(space->machine); |
| 5294 | | mapper83_set_chr(space->machine); |
| 5295 | | break; |
| 5296 | | case 0x0100: |
| 5297 | | switch (data & 0x03) |
| 5298 | | { |
| 5299 | | case 0: |
| 5300 | | set_nt_mirroring(PPU_MIRROR_VERT); |
| 5301 | | break; |
| 5302 | | case 1: |
| 5303 | | set_nt_mirroring(PPU_MIRROR_HORZ); |
| 5304 | | break; |
| 5305 | | case 2: |
| 5306 | | set_nt_mirroring(PPU_MIRROR_LOW); |
| 5307 | | break; |
| 5308 | | case 3: |
| 5309 | | set_nt_mirroring(PPU_MIRROR_HIGH); |
| 5310 | | break; |
| 5311 | | } |
| 5312 | | break; |
| 5313 | | case 0x0200: |
| 5314 | | IRQ_count = (IRQ_count & 0xff00) | data; |
| 5315 | | break; |
| 5316 | | case 0x0201: |
| 5317 | | IRQ_enable = 1; |
| 5318 | | IRQ_count = (data << 8) | (IRQ_count & 0xff); |
| 5319 | | break; |
| 5320 | | case 0x0300: |
| 5321 | | prg8_89(space->machine, data); |
| 5322 | | break; |
| 5323 | | case 0x0301: |
| 5324 | | prg8_ab(space->machine, data); |
| 5325 | | break; |
| 5326 | | case 0x0302: |
| 5327 | | prg8_cd(space->machine, data); |
| 5328 | | break; |
| 5329 | | case 0x0310: |
| 5330 | | case 0x0311: |
| 5331 | | case 0x0312: |
| 5332 | | case 0x0313: |
| 5333 | | case 0x0314: |
| 5334 | | case 0x0315: |
| 5335 | | case 0x0316: |
| 5336 | | case 0x0317: |
| 5337 | | mapper83_reg[offset - 0x0310] = data; |
| 5338 | | mapper83_set_chr(space->machine); |
| 5339 | | break; |
| 5340 | | case 0x0318: |
| 5341 | | mapper83_reg[9] = data; |
| 5342 | | mapper83_set_prg(space->machine); |
| 5343 | | break; |
| 5344 | | } |
| 5345 | | } |
| 5346 | | |
| 5347 | | /************************************************************* |
| 5348 | | |
| 5349 | | Mapper 84 |
| 5350 | | |
| 5351 | | Known Boards: Undocumented / Unused ?!? |
| 5352 | | Games: ---------- |
| 5353 | | |
| 5354 | | In MESS: ---------- |
| 5355 | | |
| 5356 | | *************************************************************/ |
| 5357 | | |
| 5358 | | /************************************************************* |
| 5359 | | |
| 5360 | | Mapper 85 |
| 5361 | | |
| 5362 | | Known Boards: Konami VRC7 |
| 5363 | | Games: Lagrange Point, Tiny Toon Adventures 2 |
| 5364 | | |
| 5365 | | In MESS: Supported. It also uses konami_irq. |
| 5366 | | |
| 5367 | | *************************************************************/ |
| 5368 | | |
| 5369 | | static WRITE8_HANDLER( konami_vrc7_w ) |
| 5370 | | { |
| 5371 | | UINT8 bank; |
| 5372 | | LOG_MMC(("konami_vrc7_w, offset: %04x, data: %02x\n", offset, data)); |
| 5373 | | |
| 5374 | | switch (offset & 0x7018) |
| 5375 | | { |
| 5376 | | case 0x0000: |
| 5377 | | prg8_89(space->machine, data); |
| 5378 | | break; |
| 5379 | | case 0x0008: |
| 5380 | | case 0x0010: |
| 5381 | | case 0x0018: |
| 5382 | | prg8_ab(space->machine, data); |
| 5383 | | break; |
| 5384 | | |
| 5385 | | case 0x1000: |
| 5386 | | prg8_cd(space->machine, data); |
| 5387 | | break; |
| 5388 | | |
| 5389 | | /* TODO: there are sound regs in here */ |
| 5390 | | |
| 5391 | | case 0x2000: |
| 5392 | | case 0x2008: |
| 5393 | | case 0x2010: |
| 5394 | | case 0x2018: |
| 5395 | | case 0x3000: |
| 5396 | | case 0x3008: |
| 5397 | | case 0x3010: |
| 5398 | | case 0x3018: |
| 5399 | | case 0x4000: |
| 5400 | | case 0x4008: |
| 5401 | | case 0x4010: |
| 5402 | | case 0x4018: |
| 5403 | | case 0x5000: |
| 5404 | | case 0x5008: |
| 5405 | | case 0x5010: |
| 5406 | | case 0x5018: |
| 5407 | | bank = ((offset & 0x7000) - 0x2000) / 0x0800 + ((offset & 0x0018) ? 1 : 0); |
| 5408 | | chr1_x(space->machine, bank, data, mmc_chr_source); |
| 5409 | | break; |
| 5410 | | |
| 5411 | | case 0x6000: |
| 5412 | | switch (data & 0x03) |
| 5413 | | { |
| 5414 | | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 5415 | | case 0x01: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 5416 | | case 0x02: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 5417 | | case 0x03: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 5418 | | } |
| 5419 | | break; |
| 5420 | | case 0x6008: case 0x6010: case 0x6018: |
| 5421 | | IRQ_count_latch = data; |
| 5422 | | break; |
| 5423 | | case 0x7000: |
| 5424 | | IRQ_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 5425 | | IRQ_enable = data & 0x02; |
| 5426 | | IRQ_enable_latch = data & 0x01; |
| 5427 | | if (data & 0x02) |
| 5428 | | IRQ_count = IRQ_count_latch; |
| 5429 | | break; |
| 5430 | | case 0x7008: case 0x7010: case 0x7018: |
| 5431 | | IRQ_enable = IRQ_enable_latch; |
| 5432 | | break; |
| 5433 | | |
| 5434 | | default: |
| 5435 | | logerror("konami_vrc7_w uncaught addr: %04x value: %02x\n", offset + 0x8000, data); |
| 5436 | | break; |
| 5437 | | } |
| 5438 | | } |
| 5439 | | |
| 5440 | | /************************************************************* |
| 5441 | | |
| 5442 | | Mapper 86 |
| 5443 | | |
| 5444 | | Known Boards: Jaleco JF13 |
| 5445 | | Games: Moero Pro Yakyuu |
| 5446 | | |
| 5447 | | In MESS: Supported. |
| 5448 | | |
| 5449 | | *************************************************************/ |
| 5450 | | |
| 5451 | | static WRITE8_HANDLER( mapper86_m_w ) |
| 5452 | | { |
| 5453 | | LOG_MMC(("mapper86_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 5454 | | |
| 5455 | | if (offset == 0) |
| 5456 | | { |
| 5457 | | prg32(space->machine, (data >> 4) & 0x03); |
| 5458 | | chr8(space->machine, ((data >> 4) & 0x04) | (data & 0x03), CHRROM); |
| 5459 | | } |
| 5460 | | } |
| 5461 | | |
| 5462 | | /************************************************************* |
| 5463 | | |
| 5464 | | Mapper 87 |
| 5465 | | |
| 5466 | | Known Boards: Jaleco JF05, JF06, JF07, JF08, JF09, JF10 and |
| 5467 | | Discrete Logic Board |
| 5468 | | Games: The Goonies, Hyper Olympics, Jajamaru no Daibouken, |
| 5469 | | Legend of Kage, Twin Bee |
| 5470 | | |
| 5471 | | In MESS: Supported. |
| 5472 | | |
| 5473 | | *************************************************************/ |
| 5474 | | |
| 5475 | | static WRITE8_HANDLER( mapper87_m_w ) |
| 5476 | | { |
| 5477 | | LOG_MMC(("mapper87_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 5478 | | |
| 5479 | | chr8(space->machine, ((data & 0x02) >> 1) | ((data & 0x01) << 1), CHRROM); |
| 5480 | | } |
| 5481 | | |
| 5482 | | /************************************************************* |
| 5483 | | |
| 5484 | | Mapper 88 |
| 5485 | | |
| 5486 | | Known Boards: Namcot 3433 & 3443 |
| 5487 | | Games: Dragon Spirit - Aratanaru Densetsu, Namcot Mahjong, Quinty |
| 5488 | | |
| 5489 | | In MESS: Supported. |
| 5490 | | |
| 5491 | | *************************************************************/ |
| 5492 | | |
| 5493 | | static WRITE8_HANDLER( mapper88_w ) |
| 5494 | | { |
| 5495 | | LOG_MMC(("mapper88_w, offset: %04x, data: %02x\n", offset, data)); |
| 5496 | | |
| 5497 | | switch (offset & 1) |
| 5498 | | { |
| 5499 | | case 0: |
| 5500 | | mmc_cmd1 = data & 7; |
| 5501 | | break; |
| 5502 | | case 1: |
| 5503 | | switch (mmc_cmd1) |
| 5504 | | { |
| 5505 | | case 0: chr2_0(space->machine, data >> 1, CHRROM); break; |
| 5506 | | case 1: chr2_2(space->machine, data >> 1, CHRROM); break; |
| 5507 | | case 2: chr1_4(space->machine, data | 0x40, CHRROM); break; |
| 5508 | | case 3: chr1_5(space->machine, data | 0x40, CHRROM); break; |
| 5509 | | case 4: chr1_6(space->machine, data | 0x40, CHRROM); break; |
| 5510 | | case 5: chr1_7(space->machine, data | 0x40, CHRROM); break; |
| 5511 | | case 6: prg8_89(space->machine,data); break; |
| 5512 | | case 7: prg8_ab(space->machine,data); break; |
| 5513 | | } |
| 5514 | | break; |
| 5515 | | } |
| 5516 | | } |
| 5517 | | |
| 5518 | | /************************************************************* |
| 5519 | | |
| 5520 | | Mapper 89 |
| 5521 | | |
| 5522 | | Known Boards: Sunsoft 2B |
| 5523 | | Games: Tenka no Goikenban - Mito Koumon |
| 5524 | | |
| 5525 | | In MESS: Supported. |
| 5526 | | |
| 5527 | | *************************************************************/ |
| 5528 | | |
| 5529 | | static WRITE8_HANDLER( mapper89_w ) |
| 5530 | | { |
| 5531 | | UINT8 map89_helper; |
| 5532 | | LOG_MMC(("mapper89_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 5533 | | |
| 5534 | | map89_helper = (data & 0x07) | ((data & 0x80) ? 0x08 : 0x00); |
| 5535 | | |
| 5536 | | prg16_89ab(space->machine, (data >> 4) & 0x07); |
| 5537 | | chr8(space->machine, map89_helper, CHRROM); |
| 5538 | | set_nt_mirroring((data & 0x08) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 5539 | | } |
| 5540 | | |
| 5541 | | /************************************************************* |
| 5542 | | |
| 5543 | | Mapper 90 |
| 5544 | | |
| 5545 | | Known Boards: Type A by J.Y. Company |
| 5546 | | Games: Aladdin, Final Fight 3, Super Mario World, Tekken 2 |
| 5547 | | |
| 5548 | | In MESS: Unsupported. |
| 5549 | | |
| 5550 | | *************************************************************/ |
| 5551 | | |
| 5552 | | /************************************************************* |
| 5553 | | |
| 5554 | | Mapper 91 |
| 5555 | | |
| 5556 | | Known Boards: Unknown Bootleg Board |
| 5557 | | Games: Mortal Kombat II, Street Fighter III, Super Mario |
| 5558 | | Kart Rider |
| 5559 | | |
| 5560 | | This board uses an IRQ system very similar to MMC3. We indeed |
| 5561 | | use mapper4_irq, but there is some small glitch! |
| 5562 | | |
| 5563 | | In MESS: Supported. |
| 5564 | | |
| 5565 | | *************************************************************/ |
| 5566 | | |
| 5567 | | static WRITE8_HANDLER( mapper91_m_w ) |
| 5568 | | { |
| 5569 | | LOG_MMC(("mapper91_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 5570 | | |
| 5571 | | switch (offset & 0x1000) |
| 5572 | | { |
| 5573 | | case 0x0000: |
| 5574 | | switch (offset & 0x03) |
| 5575 | | { |
| 5576 | | case 0x00: chr2_0(space->machine, data, CHRROM); break; |
| 5577 | | case 0x01: chr2_2(space->machine, data, CHRROM); break; |
| 5578 | | case 0x02: chr2_4(space->machine, data, CHRROM); break; |
| 5579 | | case 0x03: chr2_6(space->machine, data, CHRROM); break; |
| 5580 | | } |
| 5581 | | break; |
| 5582 | | case 0x1000: |
| 5583 | | switch (offset & 0x03) |
| 5584 | | { |
| 5585 | | case 0x00: prg8_89(space->machine, data); break; |
| 5586 | | case 0x01: prg8_ab(space->machine, data); break; |
| 5587 | | case 0x02: IRQ_enable = 0; IRQ_count = 0; break; |
| 5588 | | case 0x03: IRQ_enable = 1; IRQ_count = 7; break; |
| 5589 | | } |
| 5590 | | break; |
| 5591 | | default: |
| 5592 | | logerror("mapper91_m_w uncaught addr: %04x value: %02x\n", offset + 0x6000, data); |
| 5593 | | break; |
| 5594 | | } |
| 5595 | | } |
| 5596 | | |
| 5597 | | /************************************************************* |
| 5598 | | |
| 5599 | | Mapper 92 |
| 5600 | | |
| 5601 | | Known Boards: Jaleco JF19 & JF21 |
| 5602 | | Games: Moero Pro Soccer, Moero Pro Yakyuu '88 |
| 5603 | | |
| 5604 | | In MESS: Supported (no samples). |
| 5605 | | |
| 5606 | | *************************************************************/ |
| 5607 | | |
| 5608 | | static WRITE8_HANDLER( mapper92_w ) |
| 5609 | | { |
| 5610 | | LOG_MMC(("mapper92_w, offset %04x, data: %02x\n", offset, data)); |
| 5611 | | |
| 5612 | | if(data & 0x80) |
| 5613 | | prg16_cdef(space->machine, data & 0x0f); |
| 5614 | | if(data & 0x40) |
| 5615 | | chr8(space->machine, data & 0x0f, CHRROM); |
| 5616 | | } |
| 5617 | | |
| 5618 | | /************************************************************* |
| 5619 | | |
| 5620 | | Mapper 93 |
| 5621 | | |
| 5622 | | Known Boards: Sunsoft 2A |
| 5623 | | Games: Shanghai, Fantasy Zone |
| 5624 | | |
| 5625 | | Very similar to mapper 89, but no NT mirroring for data&8 |
| 5626 | | and only CHRRAM present |
| 5627 | | |
| 5628 | | In MESS: Supported. |
| 5629 | | |
| 5630 | | *************************************************************/ |
| 5631 | | |
| 5632 | | static WRITE8_HANDLER( mapper93_w ) |
| 5633 | | { |
| 5634 | | LOG_MMC(("mapper93_w %04x:%02x\n", offset, data)); |
| 5635 | | |
| 5636 | | prg16_89ab(space->machine, data >> 4); |
| 5637 | | } |
| 5638 | | |
| 5639 | | /************************************************************* |
| 5640 | | |
| 5641 | | Mapper 94 |
| 5642 | | |
| 5643 | | Known Boards: UN1ROM |
| 5644 | | Games: Senjou no Okami |
| 5645 | | |
| 5646 | | Writes to 0x8000-0xffff set 16k prg bank at 0x8000. The |
| 5647 | | bank at 0xc000 is always set to the last one. |
| 5648 | | |
| 5649 | | In MESS: Supported. |
| 5650 | | |
| 5651 | | *************************************************************/ |
| 5652 | | |
| 5653 | | static WRITE8_HANDLER( mapper94_w ) |
| 5654 | | { |
| 5655 | | LOG_MMC(("mapper94_w %04x:%02x\n", offset, data)); |
| 5656 | | |
| 5657 | | prg16_89ab(space->machine, data >> 2); |
| 5658 | | } |
| 5659 | | |
| 5660 | | /************************************************************* |
| 5661 | | |
| 5662 | | Mapper 95 |
| 5663 | | |
| 5664 | | Known Boards: Namcot 3425 |
| 5665 | | Games: Dragon Buster |
| 5666 | | |
| 5667 | | Quite similar to other Namco boards, but with a peculiar |
| 5668 | | NT mirroring. |
| 5669 | | |
| 5670 | | In MESS: Supported. |
| 5671 | | |
| 5672 | | *************************************************************/ |
| 5673 | | |
| 5674 | | static WRITE8_HANDLER( mapper95_w ) |
| 5675 | | { |
| 5676 | | LOG_MMC(("mapper95_w, offset: %04x, data: %02x\n", offset, data)); |
| 5677 | | |
| 5678 | | switch (offset & 1) |
| 5679 | | { |
| 5680 | | case 0: |
| 5681 | | { |
| 5682 | | mmc_cmd1 = data; |
| 5683 | | break; |
| 5684 | | } |
| 5685 | | case 1: |
| 5686 | | { |
| 5687 | | switch (mmc_cmd1 & 0x07) |
| 5688 | | { |
| 5689 | | case 0: |
| 5690 | | case 1: |
| 5691 | | chr2_x(space->machine, mmc_cmd1 ? 2 : 0, (data >> 1) & 0x1f, CHRROM); |
| 5692 | | break; |
| 5693 | | case 2: |
| 5694 | | case 3: |
| 5695 | | case 4: |
| 5696 | | case 5: |
| 5697 | | chr1_x(space->machine, 2 + mmc_cmd1, data & 0x1f, CHRROM); |
| 5698 | | mapper95_reg[mmc_cmd1 - 2] = data & 0x20; |
| 5699 | | if (!(mmc_cmd1 & 0x80)) |
| 5700 | | { |
| 5701 | | set_nt_page(0, CIRAM, mapper95_reg[0] ? 1 : 0, 1); |
| 5702 | | set_nt_page(1, CIRAM, mapper95_reg[1] ? 1 : 0, 1); |
| 5703 | | set_nt_page(2, CIRAM, mapper95_reg[2] ? 1 : 0, 1); |
| 5704 | | set_nt_page(3, CIRAM, mapper95_reg[3] ? 1 : 0, 1); |
| 5705 | | } |
| 5706 | | else |
| 5707 | | set_nt_mirroring(PPU_MIRROR_HORZ); |
| 5708 | | break; |
| 5709 | | case 6: |
| 5710 | | prg8_89(space->machine,data & 0x1f); |
| 5711 | | break; |
| 5712 | | case 7: |
| 5713 | | prg8_ab(space->machine,data & 0x1f); |
| 5714 | | break; |
| 5715 | | } |
| 5716 | | break; |
| 5717 | | } |
| 5718 | | } |
| 5719 | | } |
| 5720 | | |
| 5721 | | /************************************************************* |
| 5722 | | |
| 5723 | | Mapper 96 |
| 5724 | | |
| 5725 | | Known Boards: Bandai Oeka Kids Board |
| 5726 | | Games: Oeka Kids - Anpanman no Hiragana Daisuki, Oeka |
| 5727 | | Kids - Anpanman to Oekaki Shiyou!! |
| 5728 | | |
| 5729 | | In MESS: Preliminary Support. |
| 5730 | | |
| 5731 | | *************************************************************/ |
| 5732 | | |
| 5733 | | static WRITE8_HANDLER( mapper96_w ) |
| 5734 | | { |
| 5735 | | LOG_MMC(("mapper96_w, offset: %04x, data: %02x\n", offset, data)); |
| 5736 | | |
| 5737 | | prg32(space->machine, data); |
| 5738 | | } |
| 5739 | | |
| 5740 | | /************************************************************* |
| 5741 | | |
| 5742 | | Mapper 97 |
| 5743 | | |
| 5744 | | Known Boards: Irem Board |
| 5745 | | Games: Kaiketsu Yanchamaru |
| 5746 | | |
| 5747 | | In MESS: Supported. |
| 5748 | | |
| 5749 | | *************************************************************/ |
| 5750 | | |
| 5751 | | static WRITE8_HANDLER( mapper97_w ) |
| 5752 | | { |
| 5753 | | LOG_MMC(("mapper97_w, offset: %04x, data: %02x\n", offset, data)); |
| 5754 | | |
| 5755 | | if (offset < 0x4000) |
| 5756 | | { |
| 5757 | | set_nt_mirroring((data & 0x80) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 5758 | | prg16_cdef(space->machine, data & 0x0f); |
| 5759 | | } |
| 5760 | | } |
| 5761 | | |
| 5762 | | /************************************************************* |
| 5763 | | |
| 5764 | | Mapper 98 |
| 5765 | | |
| 5766 | | Known Boards: Undocumented / Unused ?!? |
| 5767 | | Games: ---------- |
| 5768 | | |
| 5769 | | In MESS: ---------- |
| 5770 | | |
| 5771 | | *************************************************************/ |
| 5772 | | |
| 5773 | | /************************************************************* |
| 5774 | | |
| 5775 | | Mapper 99 |
| 5776 | | |
| 5777 | | Known Boards: VS. System |
| 5778 | | Games: most Vs. games |
| 5779 | | |
| 5780 | | In MESS: Unsupported, low priority (you should use MAME) |
| 5781 | | |
| 5782 | | *************************************************************/ |
| 5783 | | |
| 5784 | | /************************************************************* |
| 5785 | | |
| 5786 | | Mapper 100 |
| 5787 | | |
| 5788 | | Known Boards: Undocumented / Unused ?!? |
| 5789 | | Games: ---------- |
| 5790 | | |
| 5791 | | In MESS: ---------- |
| 5792 | | |
| 5793 | | *************************************************************/ |
| 5794 | | |
| 5795 | | /************************************************************* |
| 5796 | | |
| 5797 | | Mapper 101 |
| 5798 | | |
| 5799 | | Known Boards: ??? |
| 5800 | | Games: Urusei Yatsura Alt |
| 5801 | | |
| 5802 | | In MESS: Supported. |
| 5803 | | |
| 5804 | | *************************************************************/ |
| 5805 | | |
| 5806 | | static WRITE8_HANDLER( mapper101_m_w ) |
| 5807 | | { |
| 5808 | | LOG_MMC(("mapper101_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 5809 | | |
| 5810 | | chr8(space->machine, data, CHRROM); |
| 5811 | | } |
| 5812 | | |
| 5813 | | static WRITE8_HANDLER( mapper101_w ) |
| 5814 | | { |
| 5815 | | LOG_MMC(("mapper101_w, offset: %04x, data: %02x\n", offset, data)); |
| 5816 | | |
| 5817 | | /* ??? */ |
| 5818 | | } |
| 5819 | | |
| 5820 | | /************************************************************* |
| 5821 | | |
| 5822 | | Mapper 102 |
| 5823 | | |
| 5824 | | Known Boards: Undocumented / Unused ?!? |
| 5825 | | Games: ---------- |
| 5826 | | |
| 5827 | | In MESS: ---------- |
| 5828 | | |
| 5829 | | *************************************************************/ |
| 5830 | | |
| 5831 | | /************************************************************* |
| 5832 | | |
| 5833 | | Mapper 103 |
| 5834 | | |
| 5835 | | Known Boards: Unknown Bootleg Board (2708) |
| 5836 | | Games: Doki Doki Panic (FDS Conversion) |
| 5837 | | |
| 5838 | | In MESS: Unsupported. Need reads from 0x6000 |
| 5839 | | |
| 5840 | | *************************************************************/ |
| 5841 | | |
| 5842 | | /************************************************************* |
| 5843 | | |
| 5844 | | Mapper 104 |
| 5845 | | |
| 5846 | | Known Boards: Camerica Golden Five |
| 5847 | | Games: Pegasus 5 in 1 |
| 5848 | | |
| 5849 | | In MESS: Supported. |
| 5850 | | |
| 5851 | | *************************************************************/ |
| 5852 | | |
| 5853 | | static WRITE8_HANDLER( mapper104_w ) |
| 5854 | | { |
| 5855 | | LOG_MMC(("mapper104_w, offset: %04x, data: %02x\n", offset, data)); |
| 5856 | | |
| 5857 | | if (offset < 0x4000) |
| 5858 | | { |
| 5859 | | if (data & 0x08) |
| 5860 | | { |
| 5861 | | prg_bank[0] = ((data & 0x07) << 4) | (prg_bank[0] & 0x0f); |
| 5862 | | prg16_89ab(space->machine, prg_bank[0]); |
| 5863 | | prg16_cdef(space->machine, ((data & 0x07) << 4) | 0x0f); |
| 5864 | | } |
| 5865 | | |
| 5866 | | } |
| 5867 | | else |
| 5868 | | { |
| 5869 | | prg_bank[0] = (prg_bank[0] & 0x70) | (data & 0x0f); |
| 5870 | | prg16_89ab(space->machine, prg_bank[0]); |
| 5871 | | } |
| 5872 | | } |
| 5873 | | |
| 5874 | | /************************************************************* |
| 5875 | | |
| 5876 | | Mapper 105 |
| 5877 | | |
| 5878 | | Known Boards: Custom Board |
| 5879 | | Games: Nintendo World Championships 1990 |
| 5880 | | |
| 5881 | | In MESS: Unsupported. |
| 5882 | | |
| 5883 | | *************************************************************/ |
| 5884 | | |
| 5885 | | /************************************************************* |
| 5886 | | |
| 5887 | | Mapper 106 |
| 5888 | | |
| 5889 | | Known Boards: Unknown Bootleg Board |
| 5890 | | Games: Super Mario Bros. 3 Pirate |
| 5891 | | |
| 5892 | | In MESS: Supported. |
| 5893 | | |
| 5894 | | *************************************************************/ |
| 5895 | | |
| 5896 | | static void mapper106_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 5897 | | { |
| 5898 | | if (IRQ_enable) |
| 5899 | | { |
| 5900 | | if ((0xffff - IRQ_count) < 114) |
| 5901 | | { |
| 5902 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 5903 | | IRQ_enable = 0; |
| 5904 | | } |
| 5905 | | |
| 5906 | | IRQ_count = (IRQ_count + 114) & 0xffff; |
| 5907 | | } |
| 5908 | | } |
| 5909 | | |
| 5910 | | static WRITE8_HANDLER( mapper106_w ) |
| 5911 | | { |
| 5912 | | LOG_MMC(("mapper106_w, offset: %04x, data: %02x\n", offset, data)); |
| 5913 | | switch (offset & 0x0f) |
| 5914 | | { |
| 5915 | | case 0x00: |
| 5916 | | case 0x02: |
| 5917 | | chr1_x(space->machine, offset & 0x07, data & 0xfe, CHRROM); |
| 5918 | | break; |
| 5919 | | case 0x01: |
| 5920 | | case 0x03: |
| 5921 | | chr1_x(space->machine, offset & 0x07, data | 0x01, CHRROM); |
| 5922 | | break; |
| 5923 | | case 0x04: case 0x05: |
| 5924 | | case 0x06: case 0x07: |
| 5925 | | chr1_x(space->machine, offset & 0x07, data, CHRROM); |
| 5926 | | break; |
| 5927 | | case 0x08: |
| 5928 | | prg8_89(space->machine, data | 0x10); |
| 5929 | | break; |
| 5930 | | case 0x09: |
| 5931 | | prg8_ab(space->machine, data); |
| 5932 | | break; |
| 5933 | | case 0x0a: |
| 5934 | | prg8_cd(space->machine, data); |
| 5935 | | break; |
| 5936 | | case 0x0b: |
| 5937 | | prg8_ef(space->machine, data | 0x10); |
| 5938 | | break; |
| 5939 | | case 0x0c: |
| 5940 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 5941 | | break; |
| 5942 | | case 0x0d: |
| 5943 | | IRQ_count = 0; |
| 5944 | | IRQ_enable = 0; |
| 5945 | | break; |
| 5946 | | case 0x0e: |
| 5947 | | IRQ_count = (IRQ_count & 0xff00) | data; |
| 5948 | | break; |
| 5949 | | case 0x0f: |
| 5950 | | IRQ_count = (IRQ_count & 0x00ff) | (data << 8); |
| 5951 | | IRQ_enable = 1; |
| 5952 | | break; |
| 5953 | | } |
| 5954 | | } |
| 5955 | | |
| 5956 | | /************************************************************* |
| 5957 | | |
| 5958 | | Mapper 107 |
| 5959 | | |
| 5960 | | Known Boards: Bootleg Board by Magic Series |
| 5961 | | Games: Magic Dragon |
| 5962 | | |
| 5963 | | Very simple mapper: writes to 0x8000-0xffff set prg32 and chr8 |
| 5964 | | banks |
| 5965 | | |
| 5966 | | In MESS: Supported. |
| 5967 | | |
| 5968 | | *************************************************************/ |
| 5969 | | |
| 5970 | | static WRITE8_HANDLER( mapper107_w ) |
| 5971 | | { |
| 5972 | | LOG_MMC(("mapper107_w, offset: %04x, data: %02x\n", offset, data)); |
| 5973 | | |
| 5974 | | prg32(space->machine, data >> 1); |
| 5975 | | chr8(space->machine, data, CHRROM); |
| 5976 | | } |
| 5977 | | |
| 5978 | | /************************************************************* |
| 5979 | | |
| 5980 | | Mapper 108 |
| 5981 | | |
| 5982 | | Known Boards: Bootleg Board by Whirlwind |
| 5983 | | Games: Meikyuu Jiin Dababa (FDS Conversion) |
| 5984 | | |
| 5985 | | Simple mapper: reads in 0x6000-0x7fff return wram, writes to |
| 5986 | | 0x8fff set prg8_89 to the bank corresponding to data |
| 5987 | | |
| 5988 | | In MESS: Unsupported. Needs to read from 0x6000. |
| 5989 | | |
| 5990 | | *************************************************************/ |
| 5991 | | |
| 5992 | | /************************************************************* |
| 5993 | | |
| 5994 | | Mapper 109 |
| 5995 | | |
| 5996 | | Known Boards: Undocumented / Unused ?!? |
| 5997 | | Games: ---------- |
| 5998 | | |
| 5999 | | In MESS: ---------- |
| 6000 | | |
| 6001 | | *************************************************************/ |
| 6002 | | |
| 6003 | | /************************************************************* |
| 6004 | | |
| 6005 | | Mapper 110 |
| 6006 | | |
| 6007 | | Known Boards: Undocumented / Unused ?!? |
| 6008 | | Games: ---------- |
| 6009 | | |
| 6010 | | In MESS: ---------- |
| 6011 | | |
| 6012 | | *************************************************************/ |
| 6013 | | |
| 6014 | | /************************************************************* |
| 6015 | | |
| 6016 | | Mapper 111 |
| 6017 | | |
| 6018 | | Known Boards: ??? |
| 6019 | | Games: Ninja Ryukenden (C) |
| 6020 | | |
| 6021 | | No info avaliable |
| 6022 | | |
| 6023 | | In MESS: Unsupported. |
| 6024 | | |
| 6025 | | *************************************************************/ |
| 6026 | | |
| 6027 | | /************************************************************* |
| 6028 | | |
| 6029 | | Mapper 112 |
| 6030 | | |
| 6031 | | Known Boards: Bootleg Board NTDEC ASDER |
| 6032 | | Games: Cobra Mission, Fighting Hero III, Huang Di, Master |
| 6033 | | Shooter |
| 6034 | | |
| 6035 | | In MESS: Supported. |
| 6036 | | |
| 6037 | | *************************************************************/ |
| 6038 | | |
| 6039 | | static WRITE8_HANDLER( mapper112_w ) |
| 6040 | | { |
| 6041 | | LOG_MMC(("mapper112_w, offset: %04x, data: %02x\n", offset, data)); |
| 6042 | | |
| 6043 | | switch (offset) |
| 6044 | | { |
| 6045 | | case 0x0000: |
| 6046 | | mmc_cmd1 = data & 0x07; |
| 6047 | | break; |
| 6048 | | case 0x2000: |
| 6049 | | switch (mmc_cmd1) |
| 6050 | | { |
| 6051 | | case 0: |
| 6052 | | prg8_89(space->machine, data); |
| 6053 | | break; |
| 6054 | | case 1: |
| 6055 | | prg8_ab(space->machine, data); |
| 6056 | | break; |
| 6057 | | case 2: |
| 6058 | | data &= 0xfe; |
| 6059 | | chr1_0(space->machine, data, CHRROM); |
| 6060 | | chr1_1(space->machine, data + 1, CHRROM); |
| 6061 | | break; |
| 6062 | | case 3: |
| 6063 | | data &= 0xfe; |
| 6064 | | chr1_2(space->machine, data, CHRROM); |
| 6065 | | chr1_3(space->machine, data + 1, CHRROM); |
| 6066 | | break; |
| 6067 | | case 4: |
| 6068 | | chr1_4(space->machine, data, CHRROM); |
| 6069 | | break; |
| 6070 | | case 5: |
| 6071 | | chr1_5(space->machine, data, CHRROM); |
| 6072 | | break; |
| 6073 | | case 6: |
| 6074 | | chr1_6(space->machine, data, CHRROM); |
| 6075 | | break; |
| 6076 | | case 7: |
| 6077 | | chr1_7(space->machine, data, CHRROM); |
| 6078 | | break; |
| 6079 | | } |
| 6080 | | break; |
| 6081 | | case 0x6000: |
| 6082 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 6083 | | break; |
| 6084 | | } |
| 6085 | | } |
| 6086 | | |
| 6087 | | /************************************************************* |
| 6088 | | |
| 6089 | | Mapper 113 |
| 6090 | | |
| 6091 | | Known Boards: Bootleg Board by HES (also used by others) |
| 6092 | | Games: AV Hanafuda Club, AV Soccer, Papillon, Sidewinder, |
| 6093 | | Total Funpack |
| 6094 | | |
| 6095 | | In MESS: Supported. |
| 6096 | | |
| 6097 | | *************************************************************/ |
| 6098 | | |
| 6099 | | static WRITE8_HANDLER( mapper113_l_w ) |
| 6100 | | { |
| 6101 | | LOG_MMC(("mapper113_w, offset: %04x, data: %02x\n", offset, data)); |
| 6102 | | |
| 6103 | | if (!(offset & 0x100)) |
| 6104 | | { |
| 6105 | | prg32(space->machine, (data & 0x38) >> 3); |
| 6106 | | chr8(space->machine, (data & 0x07) | ((data & 0x40) >> 3), CHRROM); |
| 6107 | | if (nes.crc_hack) // this breaks AV Soccer but it is needed by HES 6-in-1! |
| 6108 | | set_nt_mirroring((data & 0x80) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 6109 | | } |
| 6110 | | } |
| 6111 | | |
| 6112 | | /************************************************************* |
| 6113 | | |
| 6114 | | Mapper 114 |
| 6115 | | |
| 6116 | | Known Boards: Unknown Bootleg Board |
| 6117 | | Games: The Lion King |
| 6118 | | |
| 6119 | | MMC3 clone. |
| 6120 | | |
| 6121 | | In MESS: Supported. |
| 6122 | | |
| 6123 | | *************************************************************/ |
| 6124 | | |
| 6125 | | static WRITE8_HANDLER( mapper114_m_w ) |
| 6126 | | { |
| 6127 | | LOG_MMC(("mapper114_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6128 | | |
| 6129 | | map114_reg = data; |
| 6130 | | |
| 6131 | | if (map114_reg & 0x80) |
| 6132 | | { |
| 6133 | | prg16_89ab(space->machine, data & 0x1f); |
| 6134 | | prg16_cdef(space->machine, data & 0x1f); |
| 6135 | | } |
| 6136 | | else |
| 6137 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 6138 | | |
| 6139 | | } |
| 6140 | | |
| 6141 | | static WRITE8_HANDLER( mapper114_w ) |
| 6142 | | { |
| 6143 | | static const UINT8 conv_table[8] = {0, 3, 1, 5, 6, 7, 2, 4}; |
| 6144 | | LOG_MMC(("mapper114_w, offset: %04x, data: %02x\n", offset, data)); |
| 6145 | | |
| 6146 | | if (offset < 0x6000) |
| 6147 | | { |
| 6148 | | switch (offset & 0x6000) |
| 6149 | | { |
| 6150 | | case 0x0000: |
| 6151 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 6152 | | break; |
| 6153 | | case 0x2000: |
| 6154 | | map114_reg_enabled = 1; |
| 6155 | | data = (data & 0xc0) | conv_table[data & 0x07]; |
| 6156 | | mapper4_w(space, 0x8000, data); |
| 6157 | | break; |
| 6158 | | case 0x4000: |
| 6159 | | if (map114_reg_enabled && (map114_reg & 0x80) == 0) |
| 6160 | | { |
| 6161 | | map114_reg_enabled = 0; |
| 6162 | | mapper4_w(space, 0x8001, data); |
| 6163 | | } |
| 6164 | | break; |
| 6165 | | } |
| 6166 | | } |
| 6167 | | else |
| 6168 | | { |
| 6169 | | switch (offset & 0x03) |
| 6170 | | { |
| 6171 | | case 0x02: |
| 6172 | | mapper4_w(space, 0xe000, data); |
| 6173 | | break; |
| 6174 | | case 0x03: |
| 6175 | | mapper4_w(space, 0xe001, data); |
| 6176 | | mapper4_w(space, 0xc000, data); |
| 6177 | | mapper4_w(space, 0xc001, data); |
| 6178 | | break; |
| 6179 | | } |
| 6180 | | } |
| 6181 | | } |
| 6182 | | |
| 6183 | | /************************************************************* |
| 6184 | | |
| 6185 | | Mapper 115 (formerly 248) |
| 6186 | | |
| 6187 | | Known Boards: Unknown Bootleg Board by Kasing |
| 6188 | | Games: AV Jiu Ji Mahjong, Bao Qing Tian, Thunderbolt 2, |
| 6189 | | Shisen Mahjong 2 |
| 6190 | | |
| 6191 | | MMC3 clone |
| 6192 | | |
| 6193 | | In MESS: Supported |
| 6194 | | |
| 6195 | | *************************************************************/ |
| 6196 | | |
| 6197 | | static void mapper115_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 6198 | | { |
| 6199 | | if (mapper115_reg[0] & 0x80) |
| 6200 | | prg32(machine, mapper115_reg[0] >> 1); |
| 6201 | | else |
| 6202 | | mapper4_set_prg(machine, prg_base, prg_mask); |
| 6203 | | } |
| 6204 | | |
| 6205 | | static WRITE8_HANDLER( mapper115_m_w ) |
| 6206 | | { |
| 6207 | | LOG_MMC(("mapper115_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6208 | | |
| 6209 | | switch (offset & 0x01) |
| 6210 | | { |
| 6211 | | case 0x00: |
| 6212 | | mapper115_reg[0] = data; |
| 6213 | | mapper115_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 6214 | | break; |
| 6215 | | case 0x01: |
| 6216 | | mmc_chr_base = (data & 0x01) ? 0x100 : 0x000; |
| 6217 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 6218 | | break; |
| 6219 | | } |
| 6220 | | } |
| 6221 | | |
| 6222 | | static WRITE8_HANDLER( mapper115_w ) |
| 6223 | | { |
| 6224 | | UINT8 map115_helper, cmd; |
| 6225 | | LOG_MMC(("mapper115_w, offset: %04x, data: %02x\n", offset, data)); |
| 6226 | | |
| 6227 | | switch (offset & 0x6001) |
| 6228 | | { |
| 6229 | | case 0x0000: |
| 6230 | | map115_helper = mmc_cmd1 ^ data; |
| 6231 | | mmc_cmd1 = data; |
| 6232 | | |
| 6233 | | /* Has PRG Mode changed? */ |
| 6234 | | if (map115_helper & 0x40) |
| 6235 | | mapper115_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 6236 | | |
| 6237 | | /* Has CHR Mode changed? */ |
| 6238 | | if (map115_helper & 0x80) |
| 6239 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 6240 | | break; |
| 6241 | | |
| 6242 | | case 0x0001: |
| 6243 | | cmd = mmc_cmd1 & 0x07; |
| 6244 | | switch (cmd) |
| 6245 | | { |
| 6246 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 6247 | | case 2: case 3: case 4: case 5: |
| 6248 | | vrom_bank[cmd] = data; |
| 6249 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 6250 | | break; |
| 6251 | | case 6: |
| 6252 | | case 7: |
| 6253 | | prg_bank[cmd - 6] = data; |
| 6254 | | mapper115_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 6255 | | break; |
| 6256 | | } |
| 6257 | | break; |
| 6258 | | |
| 6259 | | default: |
| 6260 | | mapper4_w(space, offset, data); |
| 6261 | | break; |
| 6262 | | } |
| 6263 | | } |
| 6264 | | |
| 6265 | | /************************************************************* |
| 6266 | | |
| 6267 | | Mapper 116 |
| 6268 | | |
| 6269 | | Known Boards: Unknown Bootleg Board (Someri?!?) |
| 6270 | | Games: AV Mei Shao Nv Zhan Shi, Chuugoku Taitei |
| 6271 | | |
| 6272 | | In MESS: Unsupported. |
| 6273 | | |
| 6274 | | *************************************************************/ |
| 6275 | | |
| 6276 | | /************************************************************* |
| 6277 | | |
| 6278 | | Mapper 117 |
| 6279 | | |
| 6280 | | Known Boards: Bootleg Board by Future Media |
| 6281 | | Games: Crayon Shin-chan (C), San Guo Zhi 4 - Chi Bi Feng Yun |
| 6282 | | |
| 6283 | | In MESS: Unsupported. |
| 6284 | | |
| 6285 | | *************************************************************/ |
| 6286 | | |
| 6287 | | static void mapper117_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 6288 | | { |
| 6289 | | // if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE) |
| 6290 | | { |
| 6291 | | if (IRQ_enable && IRQ_count) |
| 6292 | | { |
| 6293 | | IRQ_count--; |
| 6294 | | if (!IRQ_count) |
| 6295 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 6296 | | } |
| 6297 | | } |
| 6298 | | } |
| 6299 | | |
| 6300 | | static WRITE8_HANDLER( mapper117_w ) |
| 6301 | | { |
| 6302 | | LOG_MMC(("mapper117_w, offset: %04x, data: %02x\n", offset, data)); |
| 6303 | | |
| 6304 | | switch (offset) |
| 6305 | | { |
| 6306 | | case 0x0000: |
| 6307 | | prg8_89(space->machine, data); |
| 6308 | | break; |
| 6309 | | case 0x0001: |
| 6310 | | prg8_ab(space->machine, data); |
| 6311 | | break; |
| 6312 | | case 0x0002: |
| 6313 | | prg8_cd(space->machine, data); |
| 6314 | | break; |
| 6315 | | case 0x0003: |
| 6316 | | prg8_ef(space->machine, data); |
| 6317 | | break; |
| 6318 | | case 0x2000: |
| 6319 | | case 0x2001: |
| 6320 | | case 0x2002: |
| 6321 | | case 0x2003: |
| 6322 | | case 0x2004: |
| 6323 | | case 0x2005: |
| 6324 | | case 0x2006: |
| 6325 | | case 0x2007: |
| 6326 | | chr1_x(space->machine, offset & 0x07, data, CHRROM); |
| 6327 | | break; |
| 6328 | | |
| 6329 | | case 0x5000: |
| 6330 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 6331 | | break; |
| 6332 | | |
| 6333 | | case 0x4001: |
| 6334 | | IRQ_count_latch = data; |
| 6335 | | break; |
| 6336 | | case 0x4002: |
| 6337 | | // IRQ cleared |
| 6338 | | break; |
| 6339 | | case 0x4003: |
| 6340 | | IRQ_count = IRQ_count_latch; |
| 6341 | | break; |
| 6342 | | case 0x6000: |
| 6343 | | IRQ_enable = data & 0x01; |
| 6344 | | break; |
| 6345 | | } |
| 6346 | | } |
| 6347 | | |
| 6348 | | /************************************************************* |
| 6349 | | |
| 6350 | | Mapper 118 |
| 6351 | | |
| 6352 | | Known Boards: TKSROM, TLSROM |
| 6353 | | Games: Armadillo, Play Action Football, Pro Hockey, RPG |
| 6354 | | Jinsei Game, Y's 3 |
| 6355 | | |
| 6356 | | In MESS: Supported. It also uses mapper4_irq. |
| 6357 | | |
| 6358 | | *************************************************************/ |
| 6359 | | |
| 6360 | | static void mapper118_set_mirror( void ) |
| 6361 | | { |
| 6362 | | if (mmc_cmd1 & 0x80) |
| 6363 | | { |
| 6364 | | set_nt_page(0, CIRAM, (vrom_bank[2] & 0x80) >> 7, 1); |
| 6365 | | set_nt_page(1, CIRAM, (vrom_bank[3] & 0x80) >> 7, 1); |
| 6366 | | set_nt_page(2, CIRAM, (vrom_bank[4] & 0x80) >> 7, 1); |
| 6367 | | set_nt_page(3, CIRAM, (vrom_bank[5] & 0x80) >> 7, 1); |
| 6368 | | } |
| 6369 | | else |
| 6370 | | { |
| 6371 | | set_nt_page(0, CIRAM, (vrom_bank[0] & 0x80) >> 7, 1); |
| 6372 | | set_nt_page(1, CIRAM, (vrom_bank[0] & 0x80) >> 7, 1); |
| 6373 | | set_nt_page(2, CIRAM, (vrom_bank[1] & 0x80) >> 7, 1); |
| 6374 | | set_nt_page(3, CIRAM, (vrom_bank[1] & 0x80) >> 7, 1); |
| 6375 | | } |
| 6376 | | } |
| 6377 | | |
| 6378 | | static WRITE8_HANDLER( mapper118_w ) |
| 6379 | | { |
| 6380 | | UINT8 MMC3_helper, cmd; |
| 6381 | | LOG_MMC(("mapper118_w, offset: %04x, data: %02x\n", offset, data)); |
| 6382 | | |
| 6383 | | switch (offset & 0x6001) |
| 6384 | | { |
| 6385 | | case 0x0000: |
| 6386 | | MMC3_helper = mmc_cmd1 ^ data; |
| 6387 | | mmc_cmd1 = data; |
| 6388 | | |
| 6389 | | /* Has PRG Mode changed? */ |
| 6390 | | if (MMC3_helper & 0x40) |
| 6391 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 6392 | | |
| 6393 | | /* Has CHR Mode changed? */ |
| 6394 | | if (MMC3_helper & 0x80) |
| 6395 | | { |
| 6396 | | mapper118_set_mirror(); |
| 6397 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 6398 | | } |
| 6399 | | break; |
| 6400 | | |
| 6401 | | case 0x0001: |
| 6402 | | cmd = mmc_cmd1 & 0x07; |
| 6403 | | switch (cmd) |
| 6404 | | { |
| 6405 | | case 0: case 1: |
| 6406 | | case 2: case 3: case 4: case 5: |
| 6407 | | vrom_bank[cmd] = data; |
| 6408 | | mapper118_set_mirror(); |
| 6409 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 6410 | | break; |
| 6411 | | case 6: |
| 6412 | | case 7: |
| 6413 | | prg_bank[cmd - 6] = data; |
| 6414 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 6415 | | break; |
| 6416 | | } |
| 6417 | | break; |
| 6418 | | |
| 6419 | | case 0x2000: |
| 6420 | | break; |
| 6421 | | |
| 6422 | | default: |
| 6423 | | mapper4_w(space, offset, data); |
| 6424 | | break; |
| 6425 | | } |
| 6426 | | } |
| 6427 | | |
| 6428 | | /************************************************************* |
| 6429 | | |
| 6430 | | Mapper 119 |
| 6431 | | |
| 6432 | | Known Boards: TQROM |
| 6433 | | Games: Pin Bot, High Speed |
| 6434 | | |
| 6435 | | In MESS: Supported. It also uses mapper4_irq. |
| 6436 | | |
| 6437 | | *************************************************************/ |
| 6438 | | |
| 6439 | | static void mapper119_set_chr( running_machine *machine ) |
| 6440 | | { |
| 6441 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 6442 | | UINT8 chr_src[6], chr_mask[6]; |
| 6443 | | int i; |
| 6444 | | |
| 6445 | | for (i = 0; i < 6; i++) |
| 6446 | | { |
| 6447 | | chr_src[i] = (vrom_bank[i] & 0x40) ? CHRRAM : CHRROM; |
| 6448 | | chr_mask[i] = (vrom_bank[i] & 0x40) ? 0x07 : 0x3f; |
| 6449 | | } |
| 6450 | | |
| 6451 | | chr1_x(machine, chr_page ^ 0, ((vrom_bank[0] & ~0x01) & chr_mask[0]), chr_src[0]); |
| 6452 | | chr1_x(machine, chr_page ^ 1, ((vrom_bank[0] | 0x01) & chr_mask[0]), chr_src[0]); |
| 6453 | | chr1_x(machine, chr_page ^ 2, ((vrom_bank[1] & ~0x01) & chr_mask[1]), chr_src[1]); |
| 6454 | | chr1_x(machine, chr_page ^ 3, ((vrom_bank[1] | 0x01) & chr_mask[1]), chr_src[1]); |
| 6455 | | chr1_x(machine, chr_page ^ 4, (vrom_bank[2] & chr_mask[2]), chr_src[2]); |
| 6456 | | chr1_x(machine, chr_page ^ 5, (vrom_bank[3] & chr_mask[3]), chr_src[3]); |
| 6457 | | chr1_x(machine, chr_page ^ 6, (vrom_bank[4] & chr_mask[4]), chr_src[4]); |
| 6458 | | chr1_x(machine, chr_page ^ 7, (vrom_bank[5] & chr_mask[5]), chr_src[5]); |
| 6459 | | } |
| 6460 | | |
| 6461 | | static WRITE8_HANDLER( mapper119_w ) |
| 6462 | | { |
| 6463 | | UINT8 MMC3_helper, cmd; |
| 6464 | | LOG_MMC(("mapper119_w, offset: %04x, data: %02x\n", offset, data)); |
| 6465 | | |
| 6466 | | switch (offset & 0x6001) |
| 6467 | | { |
| 6468 | | case 0x0000: |
| 6469 | | MMC3_helper = mmc_cmd1 ^ data; |
| 6470 | | mmc_cmd1 = data; |
| 6471 | | |
| 6472 | | /* Has PRG Mode changed? */ |
| 6473 | | if (MMC3_helper & 0x40) |
| 6474 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 6475 | | |
| 6476 | | /* Has CHR Mode changed? */ |
| 6477 | | if (MMC3_helper & 0x80) |
| 6478 | | mapper119_set_chr(space->machine); |
| 6479 | | break; |
| 6480 | | case 0x0001: /* $8001 */ |
| 6481 | | cmd = mmc_cmd1 & 0x07; |
| 6482 | | switch (cmd) |
| 6483 | | { |
| 6484 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 6485 | | case 2: case 3: case 4: case 5: |
| 6486 | | vrom_bank[cmd] = data; |
| 6487 | | mapper119_set_chr(space->machine); |
| 6488 | | break; |
| 6489 | | case 6: |
| 6490 | | case 7: |
| 6491 | | prg_bank[cmd - 6] = data; |
| 6492 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 6493 | | break; |
| 6494 | | } |
| 6495 | | break; |
| 6496 | | |
| 6497 | | default: |
| 6498 | | mapper4_w(space, offset, data); |
| 6499 | | break; |
| 6500 | | } |
| 6501 | | } |
| 6502 | | |
| 6503 | | /************************************************************* |
| 6504 | | |
| 6505 | | Mapper 120 |
| 6506 | | |
| 6507 | | Known Boards: Unknown Bootleg Board |
| 6508 | | Games: Tobidase Daisakusen (FDS Conversion) |
| 6509 | | |
| 6510 | | In MESS: Unsupported. |
| 6511 | | |
| 6512 | | *************************************************************/ |
| 6513 | | |
| 6514 | | /************************************************************* |
| 6515 | | |
| 6516 | | Mapper 121 |
| 6517 | | |
| 6518 | | Known Boards: Bootleg Board |
| 6519 | | Games: The Panda Prince |
| 6520 | | |
| 6521 | | MMC3 clone |
| 6522 | | |
| 6523 | | In MESS: Supported. |
| 6524 | | |
| 6525 | | *************************************************************/ |
| 6526 | | |
| 6527 | | static WRITE8_HANDLER( mapper121_l_w ) |
| 6528 | | { |
| 6529 | | LOG_MMC(("mapper12_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6530 | | offset += 0x100; |
| 6531 | | |
| 6532 | | if (!(offset < 0x1000)) |
| 6533 | | { |
| 6534 | | switch (data & 0x03) |
| 6535 | | { |
| 6536 | | case 0x00: |
| 6537 | | case 0x03: |
| 6538 | | mapper121_reg[2] = 0x00; |
| 6539 | | break; |
| 6540 | | case 0x01: |
| 6541 | | mapper121_reg[2] = 0x83; |
| 6542 | | break; |
| 6543 | | case 0x02: |
| 6544 | | mapper121_reg[2] = 0x42; |
| 6545 | | break; |
| 6546 | | } |
| 6547 | | } |
| 6548 | | } |
| 6549 | | |
| 6550 | | static READ8_HANDLER( mapper121_l_r ) |
| 6551 | | { |
| 6552 | | LOG_MMC(("mapper12_l_r, offset: %04x\n", offset)); |
| 6553 | | offset += 0x100; |
| 6554 | | |
| 6555 | | if (!(offset < 0x1000)) |
| 6556 | | return mapper121_reg[2]; |
| 6557 | | else |
| 6558 | | return 0; |
| 6559 | | } |
| 6560 | | |
| 6561 | | static void mapper121_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 6562 | | { |
| 6563 | | UINT8 prg_flip = (mmc_cmd1 & 0x40) ? 2 : 0; |
| 6564 | | UINT8 new_bank2, new_bank3; |
| 6565 | | |
| 6566 | | new_bank2 = mapper121_reg[0] ? mapper121_reg[0] : prg_bank[2 ^ prg_flip]; |
| 6567 | | new_bank3 = mapper121_reg[1] ? mapper121_reg[1] : prg_bank[3]; |
| 6568 | | |
| 6569 | | prg8_89(machine, prg_base | (prg_bank[0 ^ prg_flip] & prg_mask)); |
| 6570 | | prg8_ab(machine, prg_base | (prg_bank[1] & prg_mask)); |
| 6571 | | prg8_cd(machine, prg_base | (new_bank2 & prg_mask)); |
| 6572 | | prg8_ef(machine, prg_base | (new_bank3 & prg_mask)); |
| 6573 | | } |
| 6574 | | |
| 6575 | | static WRITE8_HANDLER( mapper121_w ) |
| 6576 | | { |
| 6577 | | UINT8 MMC3_helper, cmd; |
| 6578 | | LOG_MMC(("mapper121_w, offset: %04x, data: %02x\n", offset, data)); |
| 6579 | | |
| 6580 | | if ((offset < 0x2000) && (offset & 0x03) == 0x03) |
| 6581 | | { |
| 6582 | | switch (data) |
| 6583 | | { |
| 6584 | | case 0x20: |
| 6585 | | mapper121_reg[1] = 0x13; |
| 6586 | | break; |
| 6587 | | case 0x26: |
| 6588 | | mapper121_reg[1] = 0x08; |
| 6589 | | break; |
| 6590 | | case 0x28: |
| 6591 | | mapper121_reg[0] = 0x0c; |
| 6592 | | break; |
| 6593 | | case 0x29: |
| 6594 | | mapper121_reg[1] = 0x1b; |
| 6595 | | break; |
| 6596 | | case 0xab: |
| 6597 | | mapper121_reg[1] = 0x07; |
| 6598 | | break; |
| 6599 | | case 0xec: |
| 6600 | | case 0xef: |
| 6601 | | mapper121_reg[1] = 0x0d; |
| 6602 | | break; |
| 6603 | | case 0xff: |
| 6604 | | mapper121_reg[1] = 0x09; |
| 6605 | | break; |
| 6606 | | default: |
| 6607 | | mapper121_reg[0] = 0x0; |
| 6608 | | mapper121_reg[1] = 0x0; |
| 6609 | | break; |
| 6610 | | } |
| 6611 | | } |
| 6612 | | else |
| 6613 | | { |
| 6614 | | switch (offset & 0x6001) |
| 6615 | | { |
| 6616 | | case 0x0000: |
| 6617 | | MMC3_helper = mmc_cmd1 ^ data; |
| 6618 | | mmc_cmd1 = data; |
| 6619 | | |
| 6620 | | /* Has PRG Mode changed? */ |
| 6621 | | if (MMC3_helper & 0x40) |
| 6622 | | mapper121_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 6623 | | |
| 6624 | | /* Has CHR Mode changed? */ |
| 6625 | | if (MMC3_helper & 0x80) |
| 6626 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 6627 | | break; |
| 6628 | | |
| 6629 | | case 0x0001: |
| 6630 | | cmd = mmc_cmd1 & 0x07; |
| 6631 | | switch (cmd) |
| 6632 | | { |
| 6633 | | case 0: case 1: |
| 6634 | | case 2: case 3: case 4: case 5: |
| 6635 | | vrom_bank[cmd] = data; |
| 6636 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 6637 | | break; |
| 6638 | | case 6: |
| 6639 | | case 7: |
| 6640 | | prg_bank[cmd - 6] = data; |
| 6641 | | mapper121_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 6642 | | break; |
| 6643 | | } |
| 6644 | | break; |
| 6645 | | |
| 6646 | | default: |
| 6647 | | mapper4_w(space, offset, data); |
| 6648 | | break; |
| 6649 | | } |
| 6650 | | } |
| 6651 | | mapper121_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 6652 | | } |
| 6653 | | |
| 6654 | | /************************************************************* |
| 6655 | | |
| 6656 | | Mapper 122 |
| 6657 | | |
| 6658 | | Known Boards: Undocumented / Unused ?!? |
| 6659 | | Games: ---------- |
| 6660 | | |
| 6661 | | In MESS: ---------- |
| 6662 | | |
| 6663 | | *************************************************************/ |
| 6664 | | |
| 6665 | | /************************************************************* |
| 6666 | | |
| 6667 | | Mapper 123 |
| 6668 | | |
| 6669 | | Known Boards: Bootleg Board ??? |
| 6670 | | Games: [no games in nes.hsi] |
| 6671 | | |
| 6672 | | In MESS: Unsupported. |
| 6673 | | |
| 6674 | | *************************************************************/ |
| 6675 | | |
| 6676 | | /************************************************************* |
| 6677 | | |
| 6678 | | Mapper 124 |
| 6679 | | |
| 6680 | | Known Boards: Undocumented / Unused ?!? |
| 6681 | | Games: ---------- |
| 6682 | | |
| 6683 | | In MESS: ---------- |
| 6684 | | |
| 6685 | | *************************************************************/ |
| 6686 | | |
| 6687 | | /************************************************************* |
| 6688 | | |
| 6689 | | Mapper 125 |
| 6690 | | |
| 6691 | | Known Boards: Undocumented / Unused ?!? |
| 6692 | | Games: ---------- |
| 6693 | | |
| 6694 | | In MESS: ---------- |
| 6695 | | |
| 6696 | | *************************************************************/ |
| 6697 | | |
| 6698 | | /************************************************************* |
| 6699 | | |
| 6700 | | Mapper 126 |
| 6701 | | |
| 6702 | | Known Boards: Unknown Multigame Bootleg Board |
| 6703 | | Games: [no games in nes.hsi] |
| 6704 | | |
| 6705 | | In MESS: Unsupported. |
| 6706 | | |
| 6707 | | *************************************************************/ |
| 6708 | | |
| 6709 | | /************************************************************* |
| 6710 | | |
| 6711 | | Mapper 127 |
| 6712 | | |
| 6713 | | Known Boards: Undocumented / Unused ?!? |
| 6714 | | Games: ---------- |
| 6715 | | |
| 6716 | | In MESS: ---------- |
| 6717 | | |
| 6718 | | *************************************************************/ |
| 6719 | | |
| 6720 | | /************************************************************* |
| 6721 | | |
| 6722 | | Mapper 128 |
| 6723 | | |
| 6724 | | Known Boards: Undocumented / Unused ?!? |
| 6725 | | Games: ---------- |
| 6726 | | |
| 6727 | | In MESS: ---------- |
| 6728 | | |
| 6729 | | *************************************************************/ |
| 6730 | | |
| 6731 | | /************************************************************* |
| 6732 | | |
| 6733 | | Mapper 129 |
| 6734 | | |
| 6735 | | Known Boards: Undocumented / Unused ?!? |
| 6736 | | Games: ---------- |
| 6737 | | |
| 6738 | | In MESS: ---------- |
| 6739 | | |
| 6740 | | *************************************************************/ |
| 6741 | | |
| 6742 | | /************************************************************* |
| 6743 | | |
| 6744 | | Mapper 130 |
| 6745 | | |
| 6746 | | Known Boards: Undocumented / Unused ?!? |
| 6747 | | Games: ---------- |
| 6748 | | |
| 6749 | | In MESS: ---------- |
| 6750 | | |
| 6751 | | *************************************************************/ |
| 6752 | | |
| 6753 | | /************************************************************* |
| 6754 | | |
| 6755 | | Mapper 131 |
| 6756 | | |
| 6757 | | Known Boards: Undocumented / Unused ?!? |
| 6758 | | Games: ---------- |
| 6759 | | |
| 6760 | | In MESS: ---------- |
| 6761 | | |
| 6762 | | *************************************************************/ |
| 6763 | | |
| 6764 | | /************************************************************* |
| 6765 | | |
| 6766 | | Mapper 132 |
| 6767 | | |
| 6768 | | Known Boards: Bootleg Board by TXC (T22211A) |
| 6769 | | Games: Creatom |
| 6770 | | |
| 6771 | | Info from NEStopia: this mapper features write to four |
| 6772 | | registers (0x4100-0x4103). The third one is used to select |
| 6773 | | PRG and CHR banks. |
| 6774 | | |
| 6775 | | In MESS: Supported. |
| 6776 | | |
| 6777 | | *************************************************************/ |
| 6778 | | |
| 6779 | | static WRITE8_HANDLER( mapper132_l_w ) |
| 6780 | | { |
| 6781 | | LOG_MMC(("mapper132_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6782 | | |
| 6783 | | if (offset < 4) |
| 6784 | | txc_reg[offset & 0x03] = data; |
| 6785 | | } |
| 6786 | | |
| 6787 | | static READ8_HANDLER( mapper132_l_r ) |
| 6788 | | { |
| 6789 | | LOG_MMC(("mapper132_l_r, offset: %04x\n", offset)); |
| 6790 | | |
| 6791 | | if (offset == 0x0000) |
| 6792 | | return (txc_reg[1] ^ txc_reg[2]) | 0x40; |
| 6793 | | else |
| 6794 | | return 0x00; |
| 6795 | | } |
| 6796 | | |
| 6797 | | static WRITE8_HANDLER( mapper132_w ) |
| 6798 | | { |
| 6799 | | LOG_MMC(("mapper132_w, offset: %04x, data: %02x\n", offset, data)); |
| 6800 | | |
| 6801 | | prg32(space->machine, txc_reg[2] >> 2); |
| 6802 | | chr8(space->machine, txc_reg[2], CHRROM); |
| 6803 | | } |
| 6804 | | |
| 6805 | | /************************************************************* |
| 6806 | | |
| 6807 | | Mapper 133 |
| 6808 | | |
| 6809 | | Known Boards: Bootleg Board by Sachen (SA72008) |
| 6810 | | Games: Jovial Race, Qi Wang |
| 6811 | | |
| 6812 | | In MESS: Supported. |
| 6813 | | |
| 6814 | | *************************************************************/ |
| 6815 | | |
| 6816 | | static WRITE8_HANDLER( mapper133_l_w ) |
| 6817 | | { |
| 6818 | | LOG_MMC(("mapper133_l_w %04x:%02x\n", offset, data)); |
| 6819 | | |
| 6820 | | prg32(space->machine, data >> 2); |
| 6821 | | chr8(space->machine, data, CHRROM); |
| 6822 | | } |
| 6823 | | |
| 6824 | | static WRITE8_HANDLER( mapper133_m_w ) |
| 6825 | | { |
| 6826 | | LOG_MMC(("mapper133_l_w %04x:%02x\n", offset, data)); |
| 6827 | | |
| 6828 | | mapper133_l_w(space, offset & 0xff, data); // offset does not really count for this mapper |
| 6829 | | } |
| 6830 | | |
| 6831 | | /************************************************************* |
| 6832 | | |
| 6833 | | Mapper 134 |
| 6834 | | |
| 6835 | | Known Boards: Unknown Multigame Bootleg Board (4646B) |
| 6836 | | Games: 2 in 1 - Family Kid & Aladdin 4 |
| 6837 | | |
| 6838 | | MMC3 clone |
| 6839 | | |
| 6840 | | In MESS: Supported. |
| 6841 | | |
| 6842 | | *************************************************************/ |
| 6843 | | |
| 6844 | | static WRITE8_HANDLER( mapper134_m_w ) |
| 6845 | | { |
| 6846 | | LOG_MMC(("mapper134_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6847 | | |
| 6848 | | if (offset == 0x01) |
| 6849 | | { |
| 6850 | | mmc_prg_base = (data & 0x02) << 4; |
| 6851 | | mmc_prg_mask = 0x1f; |
| 6852 | | mmc_chr_base = (data & 0x20) << 3; |
| 6853 | | mmc_chr_mask = 0xff; |
| 6854 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 6855 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 6856 | | } |
| 6857 | | } |
| 6858 | | |
| 6859 | | /************************************************************* |
| 6860 | | |
| 6861 | | Mapper 135 |
| 6862 | | |
| 6863 | | Known Boards: Undocumented / Unused ?!? |
| 6864 | | Games: ---------- |
| 6865 | | |
| 6866 | | In MESS: ---------- |
| 6867 | | |
| 6868 | | *************************************************************/ |
| 6869 | | |
| 6870 | | /************************************************************* |
| 6871 | | |
| 6872 | | Mapper 136 |
| 6873 | | |
| 6874 | | Known Boards: Bootleg Board by Sachen (TCU02) |
| 6875 | | Games: Mei Loi Siu Ji |
| 6876 | | |
| 6877 | | In MESS: Supported. |
| 6878 | | |
| 6879 | | *************************************************************/ |
| 6880 | | |
| 6881 | | static WRITE8_HANDLER( mapper136_l_w ) |
| 6882 | | { |
| 6883 | | LOG_MMC(("mapper136_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6884 | | |
| 6885 | | if ((offset & 0x103) == 0x002) |
| 6886 | | { |
| 6887 | | mmc_cmd1 = (data & 0x30) | ((data + 3) & 0x0f); |
| 6888 | | chr8(space->machine, mmc_cmd1, CHRROM); |
| 6889 | | } |
| 6890 | | } |
| 6891 | | |
| 6892 | | static READ8_HANDLER( mapper136_l_r ) |
| 6893 | | { |
| 6894 | | LOG_MMC(("mapper136_l_r, offset: %04x\n", offset)); |
| 6895 | | |
| 6896 | | if ((offset & 0x103) == 0x000) |
| 6897 | | return mmc_cmd1 | 0x40; |
| 6898 | | else |
| 6899 | | return 0x00; |
| 6900 | | } |
| 6901 | | |
| 6902 | | /************************************************************* |
| 6903 | | |
| 6904 | | Mapper 137 |
| 6905 | | |
| 6906 | | Known Boards: Bootleg Board by Sachen (8259D) |
| 6907 | | Games: The Great Wall |
| 6908 | | |
| 6909 | | In MESS: Supported. |
| 6910 | | |
| 6911 | | *************************************************************/ |
| 6912 | | |
| 6913 | | static void sachen_set_mirror( UINT8 nt ) // used by mappers 137, 138, 139, 141 |
| 6914 | | { |
| 6915 | | switch (nt) |
| 6916 | | { |
| 6917 | | case 0: |
| 6918 | | case 1: |
| 6919 | | set_nt_mirroring(nt ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 6920 | | break; |
| 6921 | | case 2: |
| 6922 | | set_nt_page(0, CIRAM, 0, 1); |
| 6923 | | set_nt_page(1, CIRAM, 1, 1); |
| 6924 | | set_nt_page(2, CIRAM, 1, 1); |
| 6925 | | set_nt_page(3, CIRAM, 1, 1); |
| 6926 | | break; |
| 6927 | | case 3: |
| 6928 | | set_nt_mirroring(PPU_MIRROR_LOW); |
| 6929 | | break; |
| 6930 | | default: |
| 6931 | | LOG_MMC(("Mapper set NT to invalid value %02x", nt)); |
| 6932 | | break; |
| 6933 | | } |
| 6934 | | } |
| 6935 | | |
| 6936 | | static WRITE8_HANDLER( mapper137_l_w ) |
| 6937 | | { |
| 6938 | | LOG_MMC(("mapper137_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6939 | | |
| 6940 | | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 6941 | | if (!(offset & 0x100)) |
| 6942 | | { |
| 6943 | | if (!(offset & 0x01)) |
| 6944 | | mmc_cmd1 = data & 0x07; |
| 6945 | | else |
| 6946 | | { |
| 6947 | | sachen_reg[mmc_cmd1] = data; |
| 6948 | | |
| 6949 | | switch (mmc_cmd1) |
| 6950 | | { |
| 6951 | | case 0x05: |
| 6952 | | prg32(space->machine, data); |
| 6953 | | break; |
| 6954 | | case 0x07: |
| 6955 | | sachen_set_mirror((data & 0x01) ? 0 : (data >> 1) & 0x03); |
| 6956 | | break; |
| 6957 | | default: |
| 6958 | | if (mmc_chr_source == CHRROM) |
| 6959 | | { |
| 6960 | | chr1_0(space->machine, (sachen_reg[0] & 0x07), CHRROM); |
| 6961 | | chr1_1(space->machine, (sachen_reg[1] & 0x07) | (sachen_reg[4] << 4 & 0x10), CHRROM); |
| 6962 | | chr1_2(space->machine, (sachen_reg[2] & 0x07) | (sachen_reg[4] << 3 & 0x10), CHRROM); |
| 6963 | | chr1_3(space->machine, (sachen_reg[3] & 0x07) | (sachen_reg[4] << 2 & 0x10) | (sachen_reg[6] << 3 & 0x08), CHRROM); |
| 6964 | | } |
| 6965 | | break; |
| 6966 | | } |
| 6967 | | } |
| 6968 | | } |
| 6969 | | } |
| 6970 | | |
| 6971 | | static WRITE8_HANDLER( mapper137_m_w ) |
| 6972 | | { |
| 6973 | | LOG_MMC(("mapper137_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6974 | | |
| 6975 | | mapper137_l_w(space, (offset + 0x100) & 0xfff, data); |
| 6976 | | } |
| 6977 | | |
| 6978 | | /************************************************************* |
| 6979 | | |
| 6980 | | Mapper 138 |
| 6981 | | |
| 6982 | | Known Boards: Bootleg Board by Sachen (8259B) |
| 6983 | | Games: Silver Eagle |
| 6984 | | |
| 6985 | | In MESS: Supported. |
| 6986 | | |
| 6987 | | *************************************************************/ |
| 6988 | | |
| 6989 | | static WRITE8_HANDLER( mapper138_l_w ) |
| 6990 | | { |
| 6991 | | UINT8 bank_helper1 = 0, bank_helper2 = 0; |
| 6992 | | LOG_MMC(("mapper138_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6993 | | |
| 6994 | | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 6995 | | if (!(offset & 0x100)) |
| 6996 | | { |
| 6997 | | if (!(offset & 0x01)) |
| 6998 | | mmc_cmd1 = data & 0x07; |
| 6999 | | else |
| 7000 | | { |
| 7001 | | sachen_reg[mmc_cmd1] = data; |
| 7002 | | |
| 7003 | | switch (mmc_cmd1) |
| 7004 | | { |
| 7005 | | case 0x05: |
| 7006 | | prg32(space->machine, data); |
| 7007 | | break; |
| 7008 | | case 0x07: |
| 7009 | | sachen_set_mirror((data & 0x01) ? 0 : (data >> 1) & 0x03); |
| 7010 | | break; |
| 7011 | | default: |
| 7012 | | if (mmc_chr_source == CHRROM) |
| 7013 | | { |
| 7014 | | bank_helper1 = sachen_reg[7] & 0x01; |
| 7015 | | bank_helper2 = (sachen_reg[4] & 0x07) << 3; |
| 7016 | | chr2_0(space->machine, ((sachen_reg[bank_helper1 ? 0 : 0] & 0x07) | bank_helper2), CHRROM); |
| 7017 | | chr2_2(space->machine, ((sachen_reg[bank_helper1 ? 0 : 1] & 0x07) | bank_helper2), CHRROM); |
| 7018 | | chr2_4(space->machine, ((sachen_reg[bank_helper1 ? 0 : 2] & 0x07) | bank_helper2), CHRROM); |
| 7019 | | chr2_6(space->machine, ((sachen_reg[bank_helper1 ? 0 : 3] & 0x07) | bank_helper2), CHRROM); |
| 7020 | | } |
| 7021 | | break; |
| 7022 | | } |
| 7023 | | } |
| 7024 | | } |
| 7025 | | } |
| 7026 | | |
| 7027 | | static WRITE8_HANDLER( mapper138_m_w ) |
| 7028 | | { |
| 7029 | | LOG_MMC(("mapper138_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 7030 | | |
| 7031 | | mapper138_l_w(space, (offset + 0x100) & 0xfff, data); |
| 7032 | | } |
| 7033 | | |
| 7034 | | /************************************************************* |
| 7035 | | |
| 7036 | | Mapper 139 |
| 7037 | | |
| 7038 | | Known Boards: Bootleg Board by Sachen (8259C) |
| 7039 | | Games: Final Combat, Hell Fighter, Mahjong Companion, |
| 7040 | | |
| 7041 | | In MESS: Supported. |
| 7042 | | |
| 7043 | | *************************************************************/ |
| 7044 | | |
| 7045 | | static WRITE8_HANDLER( mapper139_l_w ) |
| 7046 | | { |
| 7047 | | UINT8 bank_helper1 = 0, bank_helper2 = 0; |
| 7048 | | LOG_MMC(("mapper139_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7049 | | |
| 7050 | | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 7051 | | if (!(offset & 0x100)) |
| 7052 | | { |
| 7053 | | if (!(offset & 0x01)) |
| 7054 | | mmc_cmd1 = data & 0x07; |
| 7055 | | else |
| 7056 | | { |
| 7057 | | sachen_reg[mmc_cmd1] = data; |
| 7058 | | |
| 7059 | | switch (mmc_cmd1) |
| 7060 | | { |
| 7061 | | case 0x05: |
| 7062 | | prg32(space->machine, data); |
| 7063 | | break; |
| 7064 | | case 0x07: |
| 7065 | | sachen_set_mirror((data & 0x01) ? 0 : (data >> 1) & 0x03); |
| 7066 | | break; |
| 7067 | | default: |
| 7068 | | if (mmc_chr_source == CHRROM) |
| 7069 | | { |
| 7070 | | bank_helper1 = sachen_reg[7] & 0x01; |
| 7071 | | bank_helper2 = (sachen_reg[4] & 0x07) << 3; |
| 7072 | | chr2_0(space->machine, ((sachen_reg[bank_helper1 ? 0 : 0] & 0x07) | bank_helper2) << 2, CHRROM); |
| 7073 | | chr2_2(space->machine, ((sachen_reg[bank_helper1 ? 0 : 1] & 0x07) | bank_helper2) << 2 | 0x01, CHRROM); |
| 7074 | | chr2_4(space->machine, ((sachen_reg[bank_helper1 ? 0 : 2] & 0x07) | bank_helper2) << 2 | 0x02, CHRROM) ; |
| 7075 | | chr2_6(space->machine, ((sachen_reg[bank_helper1 ? 0 : 3] & 0x07) | bank_helper2) << 2 | 0x03, CHRROM); |
| 7076 | | } |
| 7077 | | break; |
| 7078 | | } |
| 7079 | | } |
| 7080 | | } |
| 7081 | | } |
| 7082 | | |
| 7083 | | static WRITE8_HANDLER( mapper139_m_w ) |
| 7084 | | { |
| 7085 | | LOG_MMC(("mapper139_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 7086 | | |
| 7087 | | mapper139_l_w(space, (offset + 0x100) & 0xfff, data); |
| 7088 | | } |
| 7089 | | |
| 7090 | | /************************************************************* |
| 7091 | | |
| 7092 | | Mapper 140 |
| 7093 | | |
| 7094 | | Known Boards: Jaleco JF11, JF12, JF14 |
| 7095 | | Games: Bio Senshi Dan, Mississippi Satsujin Jiken |
| 7096 | | |
| 7097 | | Writes to 0x6000-0x7fff set both prg32 and chr8 banks |
| 7098 | | |
| 7099 | | In MESS: Supported. |
| 7100 | | |
| 7101 | | *************************************************************/ |
| 7102 | | |
| 7103 | | static WRITE8_HANDLER( mapper_140_m_w ) |
| 7104 | | { |
| 7105 | | chr8(space->machine, data & 0x0f, CHRROM); |
| 7106 | | prg32(space->machine, (data >> 4) & 0x03); |
| 7107 | | } |
| 7108 | | |
| 7109 | | /************************************************************* |
| 7110 | | |
| 7111 | | Mapper 141 |
| 7112 | | |
| 7113 | | Known Boards: Bootleg Board by Sachen (8259A) |
| 7114 | | Games: Po Po Team, Poker Mahjong, Q Boy, Rockball, |
| 7115 | | Super Cartridge (several versions), Super Pang (1 & 2) |
| 7116 | | |
| 7117 | | In MESS: Supported. |
| 7118 | | |
| 7119 | | *************************************************************/ |
| 7120 | | |
| 7121 | | static WRITE8_HANDLER( mapper141_l_w ) |
| 7122 | | { |
| 7123 | | UINT8 bank_helper1 = 0, bank_helper2 = 0; |
| 7124 | | LOG_MMC(("mapper141_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7125 | | |
| 7126 | | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 7127 | | if (!(offset & 0x100)) |
| 7128 | | { |
| 7129 | | if (!(offset & 0x01)) |
| 7130 | | mmc_cmd1 = data & 0x07; |
| 7131 | | else |
| 7132 | | { |
| 7133 | | sachen_reg[mmc_cmd1] = data; |
| 7134 | | |
| 7135 | | switch (mmc_cmd1) |
| 7136 | | { |
| 7137 | | case 0x05: |
| 7138 | | prg32(space->machine, data); |
| 7139 | | break; |
| 7140 | | case 0x07: |
| 7141 | | sachen_set_mirror((data & 0x01) ? 0 : (data >> 1) & 0x03); |
| 7142 | | break; |
| 7143 | | default: |
| 7144 | | if (mmc_chr_source == CHRROM) |
| 7145 | | { |
| 7146 | | bank_helper1 = sachen_reg[7] & 0x01; |
| 7147 | | bank_helper2 = (sachen_reg[4] & 0x07) << 3; |
| 7148 | | chr2_0(space->machine, ((sachen_reg[bank_helper1 ? 0 : 0] & 0x07) | bank_helper2) << 1, mmc_chr_source); |
| 7149 | | chr2_2(space->machine, ((sachen_reg[bank_helper1 ? 0 : 1] & 0x07) | bank_helper2) << 1 | 0x01, mmc_chr_source); |
| 7150 | | chr2_4(space->machine, ((sachen_reg[bank_helper1 ? 0 : 2] & 0x07) | bank_helper2) << 1, mmc_chr_source); |
| 7151 | | chr2_6(space->machine, ((sachen_reg[bank_helper1 ? 0 : 3] & 0x07) | bank_helper2) << 1 | 0x01, mmc_chr_source); |
| 7152 | | } |
| 7153 | | break; |
| 7154 | | } |
| 7155 | | } |
| 7156 | | } |
| 7157 | | } |
| 7158 | | |
| 7159 | | static WRITE8_HANDLER( mapper141_m_w ) |
| 7160 | | { |
| 7161 | | LOG_MMC(("mapper141_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 7162 | | |
| 7163 | | mapper141_l_w(space, (offset + 0x100) & 0xfff, data); |
| 7164 | | } |
| 7165 | | |
| 7166 | | /************************************************************* |
| 7167 | | |
| 7168 | | Mapper 142 |
| 7169 | | |
| 7170 | | Known Boards: Bootleg Board by Kaiser (KS7032) |
| 7171 | | Games: Super Mario Bros. 2 (by Kaiser), Pipe 5 (by Sachen?) |
| 7172 | | |
| 7173 | | In MESS: Unsupported. Requires reads from 0x6000-0x7fff. |
| 7174 | | |
| 7175 | | *************************************************************/ |
| 7176 | | |
| 7177 | | /************************************************************* |
| 7178 | | |
| 7179 | | Mapper 143 |
| 7180 | | |
| 7181 | | Known Boards: Bootleg Board by Sachen (TCA01) |
| 7182 | | Games: Dancing Blocks, Magic Mathematic |
| 7183 | | |
| 7184 | | In MESS: Supported. |
| 7185 | | |
| 7186 | | *************************************************************/ |
| 7187 | | |
| 7188 | | static READ8_HANDLER( mapper143_l_r ) |
| 7189 | | { |
| 7190 | | LOG_MMC(("mapper143_l_r, offset: %04x\n", offset)); |
| 7191 | | |
| 7192 | | /* the address is read only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 7193 | | if (!(offset & 0x100)) |
| 7194 | | return (~offset & 0x3f) | 0x40; |
| 7195 | | else |
| 7196 | | return 0x00; |
| 7197 | | } |
| 7198 | | |
| 7199 | | /************************************************************* |
| 7200 | | |
| 7201 | | Mapper 144 |
| 7202 | | |
| 7203 | | Known Boards: Bootleg Board by AGCI (50282) |
| 7204 | | Games: Death Race |
| 7205 | | |
| 7206 | | Just like mapper 11, except bit 0 taken from ROM and 0x8000 |
| 7207 | | ignored? |
| 7208 | | |
| 7209 | | In MESS: Supported. |
| 7210 | | |
| 7211 | | *************************************************************/ |
| 7212 | | |
| 7213 | | static WRITE8_HANDLER( mapper144_w ) |
| 7214 | | { |
| 7215 | | LOG_MMC(("mapper144_w, offset: %04x, data: %02x\n", offset, data)); |
| 7216 | | |
| 7217 | | if ((offset & 0x7fff) == 0) |
| 7218 | | return; |
| 7219 | | |
| 7220 | | data = data | (memory_read_byte(space, offset) & 1); |
| 7221 | | |
| 7222 | | chr8(space->machine, data >> 4, CHRROM); |
| 7223 | | prg32(space->machine, data & 0x07); |
| 7224 | | } |
| 7225 | | |
| 7226 | | /************************************************************* |
| 7227 | | |
| 7228 | | Mapper 145 |
| 7229 | | |
| 7230 | | Known Boards: Bootleg Board by Sachen (SA72007) |
| 7231 | | Games: Sidewinder |
| 7232 | | |
| 7233 | | Simple mapper: writes to 0x4100 set chr8 banks. |
| 7234 | | |
| 7235 | | In MESS: Supported. |
| 7236 | | |
| 7237 | | *************************************************************/ |
| 7238 | | |
| 7239 | | static WRITE8_HANDLER( mapper145_l_w ) |
| 7240 | | { |
| 7241 | | LOG_MMC(("mapper145_l_w %04x:%02x\n", offset, data)); |
| 7242 | | |
| 7243 | | /* only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 7244 | | if (!(offset & 0x100)) |
| 7245 | | chr8(space->machine, data >> 7, CHRROM); |
| 7246 | | } |
| 7247 | | |
| 7248 | | /************************************************************* |
| 7249 | | |
| 7250 | | Mapper 146 |
| 7251 | | |
| 7252 | | Known Boards: Bootleg Board by Sachen (SA0161M) |
| 7253 | | Games: Galactic Crusader, Lucky 777, Metal Fighter, |
| 7254 | | Millionaire, Pyramid II |
| 7255 | | |
| 7256 | | This is basically the same as Nina-006 (Mapper 79) |
| 7257 | | |
| 7258 | | In MESS: Supported. It shares the handler with mapper 79 |
| 7259 | | |
| 7260 | | *************************************************************/ |
| 7261 | | |
| 7262 | | /************************************************************* |
| 7263 | | |
| 7264 | | Mapper 147 |
| 7265 | | |
| 7266 | | Known Boards: Bootleg Board by Sachen (TCU01) |
| 7267 | | Games: Challenge of the Dragon, Chinese Kungfu |
| 7268 | | |
| 7269 | | Simple mapper: writes to 0x4102 set pgr32 and chr8 banks. |
| 7270 | | |
| 7271 | | In MESS: Supported. |
| 7272 | | |
| 7273 | | *************************************************************/ |
| 7274 | | |
| 7275 | | static WRITE8_HANDLER( mapper147_l_w ) |
| 7276 | | { |
| 7277 | | LOG_MMC(("mapper147_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7278 | | |
| 7279 | | if ((offset & 0x103) == 0x002) |
| 7280 | | { |
| 7281 | | prg32(space->machine, ((data >> 6) & 0x02) | ((data >> 2) & 0x01)); |
| 7282 | | chr8(space->machine, data >> 3, CHRROM); |
| 7283 | | } |
| 7284 | | } |
| 7285 | | |
| 7286 | | static WRITE8_HANDLER( mapper147_m_w ) |
| 7287 | | { |
| 7288 | | LOG_MMC(("mapper147_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 7289 | | |
| 7290 | | mapper147_l_w(space, (offset + 0x100) & 0xfff, data); |
| 7291 | | } |
| 7292 | | |
| 7293 | | static WRITE8_HANDLER( mapper147_w ) |
| 7294 | | { |
| 7295 | | LOG_MMC(("mapper147_w, offset: %04x, data: %02x\n", offset, data)); |
| 7296 | | |
| 7297 | | mapper147_l_w(space, (offset + 0x100) & 0xfff, data); |
| 7298 | | } |
| 7299 | | |
| 7300 | | /************************************************************* |
| 7301 | | |
| 7302 | | Mapper 148 |
| 7303 | | |
| 7304 | | Known Boards: Bootleg Board by Sachen (SA0037) |
| 7305 | | Games: Mahjong World, Shisen Mahjong |
| 7306 | | |
| 7307 | | Very simple mapper: writes to 0x8000-0xffff set pgr32 and chr8 |
| 7308 | | banks |
| 7309 | | |
| 7310 | | In MESS: Supported. |
| 7311 | | |
| 7312 | | *************************************************************/ |
| 7313 | | |
| 7314 | | static WRITE8_HANDLER( mapper148_w ) |
| 7315 | | { |
| 7316 | | LOG_MMC(("mapper148_w, offset: %04x, data: %02x\n", offset, data)); |
| 7317 | | |
| 7318 | | prg32(space->machine, data >> 3 & 0x01); |
| 7319 | | chr8(space->machine, data & 0x07, CHRROM); |
| 7320 | | } |
| 7321 | | |
| 7322 | | /************************************************************* |
| 7323 | | |
| 7324 | | Mapper 149 |
| 7325 | | |
| 7326 | | Known Boards: Bootleg Board by Sachen (SA0036) |
| 7327 | | Games: Taiwan Mahjong 16 |
| 7328 | | |
| 7329 | | Very simple mapper: writes to 0x8000-0xffff set chr8 banks |
| 7330 | | |
| 7331 | | In MESS: Supported. |
| 7332 | | |
| 7333 | | *************************************************************/ |
| 7334 | | |
| 7335 | | static WRITE8_HANDLER( mapper149_w ) |
| 7336 | | { |
| 7337 | | LOG_MMC(("mapper149_w, offset: %04x, data: %02x\n", offset, data)); |
| 7338 | | |
| 7339 | | chr8(space->machine, data >> 7, CHRROM); |
| 7340 | | } |
| 7341 | | |
| 7342 | | /************************************************************* |
| 7343 | | |
| 7344 | | Mapper 150 |
| 7345 | | |
| 7346 | | Known Boards: Bootleg Board by Sachen (74SL374B) |
| 7347 | | Games: Chess Academy, Chinese Checkers Jpn, Mahjong Academy, |
| 7348 | | Olympic IQ, Poker II, Tasac |
| 7349 | | |
| 7350 | | In MESS: Supported. |
| 7351 | | |
| 7352 | | *************************************************************/ |
| 7353 | | |
| 7354 | | static WRITE8_HANDLER( mapper150_l_w ) |
| 7355 | | { |
| 7356 | | LOG_MMC(("mapper150_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7357 | | |
| 7358 | | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 7359 | | if (!(offset & 0x100)) |
| 7360 | | { |
| 7361 | | if (!(offset & 0x01)) |
| 7362 | | mmc_cmd1 = data & 0x07; |
| 7363 | | else |
| 7364 | | { |
| 7365 | | switch (mmc_cmd1) |
| 7366 | | { |
| 7367 | | case 0x02: |
| 7368 | | vrom_bank[0] = (vrom_bank[0] & ~0x08) | ((data << 3) & 0x08); |
| 7369 | | chr8(space->machine, vrom_bank[0], CHRROM); |
| 7370 | | prg32(space->machine, data & 0x01); |
| 7371 | | break; |
| 7372 | | case 0x04: |
| 7373 | | vrom_bank[0] = (vrom_bank[0] & ~0x04) | ((data << 2) & 0x04); |
| 7374 | | chr8(space->machine, vrom_bank[0], CHRROM); |
| 7375 | | break; |
| 7376 | | case 0x05: |
| 7377 | | prg32(space->machine, data & 0x07); |
| 7378 | | break; |
| 7379 | | case 0x06: |
| 7380 | | vrom_bank[0] = (vrom_bank[0] & ~0x03) | (data << 0 & 0x03); |
| 7381 | | chr8(space->machine, vrom_bank[0], CHRROM); |
| 7382 | | break; |
| 7383 | | case 0x07: |
| 7384 | | sachen_set_mirror((data >> 1) & 0x03); |
| 7385 | | break; |
| 7386 | | default: |
| 7387 | | break; |
| 7388 | | } |
| 7389 | | } |
| 7390 | | } |
| 7391 | | } |
| 7392 | | |
| 7393 | | static READ8_HANDLER( mapper150_l_r ) |
| 7394 | | { |
| 7395 | | LOG_MMC(("mapper150_l_r, offset: %04x", offset)); |
| 7396 | | |
| 7397 | | /* read happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 7398 | | if (!(offset & 0x100)) |
| 7399 | | return (~mmc_cmd1 & 0x3f) /* ^ dips*/; // we would need to check the Dips here |
| 7400 | | else |
| 7401 | | return 0; |
| 7402 | | } |
| 7403 | | |
| 7404 | | static WRITE8_HANDLER( mapper150_m_w ) |
| 7405 | | { |
| 7406 | | LOG_MMC(("mapper150_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 7407 | | |
| 7408 | | mapper150_l_w(space, (offset + 0x100) & 0xfff, data); |
| 7409 | | } |
| 7410 | | |
| 7411 | | /************************************************************* |
| 7412 | | |
| 7413 | | Mapper 151 |
| 7414 | | |
| 7415 | | Known Boards: Konami VS System |
| 7416 | | Games: Goonies VS, VS TKO Boxing |
| 7417 | | |
| 7418 | | In MESS: Unsupported, low priority (you should use MAME) |
| 7419 | | |
| 7420 | | *************************************************************/ |
| 7421 | | |
| 7422 | | /************************************************************* |
| 7423 | | |
| 7424 | | Mapper 152 |
| 7425 | | |
| 7426 | | Known Boards: Discrete Logic Mapper |
| 7427 | | Games: Arkanoid 2, Gegege no Kitarou 2, Pocket Zaurus |
| 7428 | | |
| 7429 | | In MESS: Supported. |
| 7430 | | |
| 7431 | | *************************************************************/ |
| 7432 | | |
| 7433 | | static WRITE8_HANDLER( mapper152_w ) |
| 7434 | | { |
| 7435 | | LOG_MMC(("mapper152_w, offset: %04x, data: %02x\n", offset, data)); |
| 7436 | | |
| 7437 | | // we lack bus emulation |
| 7438 | | set_nt_mirroring((data & 0x80) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 7439 | | prg16_89ab(space->machine, (data >> 4) & 0x07); |
| 7440 | | chr8(space->machine, data, CHRROM); |
| 7441 | | } |
| 7442 | | |
| 7443 | | /************************************************************* |
| 7444 | | |
| 7445 | | Mapper 153 |
| 7446 | | |
| 7447 | | Known Boards: Bandai Board |
| 7448 | | Games: Dragon Ball, Dragon Ball 3, Famicom Jump, Famicom |
| 7449 | | Jump II |
| 7450 | | |
| 7451 | | This mapper should be exactly like Mapper 16, but with |
| 7452 | | SRAM in place of EEPROM. Hence, writes to 0x6000-0x7fff |
| 7453 | | go to SRAM (not sure if there exist boards with no SRAM |
| 7454 | | and no EEPROM... investigate!) |
| 7455 | | Famicom Jump II uses a different board (or uses the same |
| 7456 | | board in a very different way) |
| 7457 | | |
| 7458 | | In MESS: Supported. |
| 7459 | | |
| 7460 | | *************************************************************/ |
| 7461 | | |
| 7462 | | static void mapper153_set_prg( running_machine *machine ) |
| 7463 | | { |
| 7464 | | UINT8 mmc_helper = 0; |
| 7465 | | int i; |
| 7466 | | |
| 7467 | | for (i = 0; i < 8; i++) |
| 7468 | | mmc_helper |= ((map153_reg[i] & 0x01) << 4); |
| 7469 | | |
| 7470 | | map153_bank_latch = mmc_helper | (map153_bank_latch & 0x0f); |
| 7471 | | |
| 7472 | | prg16_89ab(machine, map153_bank_latch); |
| 7473 | | prg16_cdef(machine, mmc_helper | 0x0f); |
| 7474 | | } |
| 7475 | | |
| 7476 | | static WRITE8_HANDLER( mapper153_m_w ) |
| 7477 | | { |
| 7478 | | LOG_MMC(("mapper153_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 7479 | | |
| 7480 | | if (nes.crc_hack) // Famicom Jump II uses a different board |
| 7481 | | { |
| 7482 | | switch (offset & 0x0f) // there is no CHRROM and prg banking works differently |
| 7483 | | { |
| 7484 | | case 0: case 1: |
| 7485 | | case 2: case 3: |
| 7486 | | case 4: case 5: |
| 7487 | | case 6: case 7: |
| 7488 | | map153_reg[offset & 0x07] = data; |
| 7489 | | mapper153_set_prg(space->machine); |
| 7490 | | break; |
| 7491 | | case 8: |
| 7492 | | map153_bank_latch = (data & 0x0f) | (map153_bank_latch & 0x10); |
| 7493 | | prg16_89ab(space->machine, map153_bank_latch); |
| 7494 | | break; |
| 7495 | | default: |
| 7496 | | mapper16_m_w(space, offset & 0x0f, data); |
| 7497 | | break; |
| 7498 | | } |
| 7499 | | } |
| 7500 | | else |
| 7501 | | mapper16_m_w(space, offset, data); |
| 7502 | | } |
| 7503 | | |
| 7504 | | static WRITE8_HANDLER( mapper153_w ) |
| 7505 | | { |
| 7506 | | LOG_MMC(("mapper153_w, offset: %04x, data: %02x\n", offset, data)); |
| 7507 | | |
| 7508 | | mapper153_w(space, offset, data); |
| 7509 | | } |
| 7510 | | |
| 7511 | | /************************************************************* |
| 7512 | | |
| 7513 | | Mapper 154 |
| 7514 | | |
| 7515 | | Known Boards: Namcot 34xx |
| 7516 | | Games: Devil Man |
| 7517 | | |
| 7518 | | Acts like mapper 88, but writes to 0x8000 set NT mirroring |
| 7519 | | |
| 7520 | | In MESS: Supported. |
| 7521 | | |
| 7522 | | *************************************************************/ |
| 7523 | | |
| 7524 | | static WRITE8_HANDLER( mapper154_w ) |
| 7525 | | { |
| 7526 | | LOG_MMC(("mapper154_w, offset: %04x, data: %02x\n", offset, data)); |
| 7527 | | switch (offset & 1) |
| 7528 | | { |
| 7529 | | case 0: |
| 7530 | | set_nt_mirroring((data & 0x40) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 7531 | | mmc_cmd1 = data & 7; |
| 7532 | | break; |
| 7533 | | case 1: |
| 7534 | | switch (mmc_cmd1) |
| 7535 | | { |
| 7536 | | case 0: chr2_0(space->machine, data >> 1, CHRROM); break; |
| 7537 | | case 1: chr2_2(space->machine, data >> 1, CHRROM); break; |
| 7538 | | case 2: chr1_4(space->machine, data | 0x40, CHRROM); break; |
| 7539 | | case 3: chr1_5(space->machine, data | 0x40, CHRROM); break; |
| 7540 | | case 4: chr1_6(space->machine, data | 0x40, CHRROM); break; |
| 7541 | | case 5: chr1_7(space->machine, data | 0x40, CHRROM); break; |
| 7542 | | case 6: prg8_89(space->machine, data); break; |
| 7543 | | case 7: prg8_ab(space->machine, data); break; |
| 7544 | | } |
| 7545 | | break; |
| 7546 | | } |
| 7547 | | } |
| 7548 | | |
| 7549 | | /************************************************************* |
| 7550 | | |
| 7551 | | Mapper 155 |
| 7552 | | |
| 7553 | | Known Boards: SKROM |
| 7554 | | Games: Tatakae!! Rahmen Man - Sakuretsu Choujin 102 Gei |
| 7555 | | |
| 7556 | | This is basically MMC1 with a different way to handle WRAM |
| 7557 | | (this difference is not emulated yet, since we don't fully |
| 7558 | | emulate WRAM in MMC1 either) |
| 7559 | | |
| 7560 | | In MESS: Supported (as complete as MMC1). |
| 7561 | | |
| 7562 | | *************************************************************/ |
| 7563 | | |
| 7564 | | /************************************************************* |
| 7565 | | |
| 7566 | | Mapper 156 |
| 7567 | | |
| 7568 | | Known Boards: Bootleg Board by Open Corp (DAOU306) |
| 7569 | | Games: Metal Force (K)? |
| 7570 | | |
| 7571 | | In MESS: Supported. |
| 7572 | | |
| 7573 | | *************************************************************/ |
| 7574 | | |
| 7575 | | static WRITE8_HANDLER( mapper156_w ) |
| 7576 | | { |
| 7577 | | LOG_MMC(("mapper156_w, offset: %04x, data: %02x\n", offset, data)); |
| 7578 | | |
| 7579 | | switch (offset) |
| 7580 | | { |
| 7581 | | case 0x4000: |
| 7582 | | chr1_0(space->machine, data, CHRROM); |
| 7583 | | break; |
| 7584 | | case 0x4001: |
| 7585 | | chr1_1(space->machine, data, CHRROM); |
| 7586 | | break; |
| 7587 | | case 0x4002: |
| 7588 | | chr1_2(space->machine, data, CHRROM); |
| 7589 | | break; |
| 7590 | | case 0x4003: |
| 7591 | | chr1_3(space->machine, data, CHRROM); |
| 7592 | | break; |
| 7593 | | case 0x4008: |
| 7594 | | chr1_4(space->machine, data, CHRROM); |
| 7595 | | break; |
| 7596 | | case 0x4009: |
| 7597 | | chr1_5(space->machine, data, CHRROM); |
| 7598 | | break; |
| 7599 | | case 0x400a: |
| 7600 | | chr1_6(space->machine, data, CHRROM); |
| 7601 | | break; |
| 7602 | | case 0x400b: |
| 7603 | | chr1_7(space->machine, data, CHRROM); |
| 7604 | | break; |
| 7605 | | case 0x4010: |
| 7606 | | prg16_89ab(space->machine, data); |
| 7607 | | break; |
| 7608 | | } |
| 7609 | | } |
| 7610 | | |
| 7611 | | /************************************************************* |
| 7612 | | |
| 7613 | | Mapper 157 |
| 7614 | | |
| 7615 | | Known Boards: Bandai Datach Board |
| 7616 | | Games: Datach Games |
| 7617 | | |
| 7618 | | This mapper is basically Mapper 16 + Datach reader. We |
| 7619 | | currently do not support the Barcode reader. |
| 7620 | | |
| 7621 | | In MESS: Partially supported. Needs reads from 0x6000-0x7fff |
| 7622 | | for the Datach barcode reader |
| 7623 | | |
| 7624 | | *************************************************************/ |
| 7625 | | |
| 7626 | | /************************************************************* |
| 7627 | | |
| 7628 | | Mapper 158 |
| 7629 | | |
| 7630 | | Known Boards: Tengen 800037 |
| 7631 | | Games: Alien Syndrome |
| 7632 | | |
| 7633 | | In MESS: Very preliminary support. |
| 7634 | | |
| 7635 | | *************************************************************/ |
| 7636 | | |
| 7637 | | // probably wrong... |
| 7638 | | static void mapper158_set_mirror( running_machine *machine ) |
| 7639 | | { |
| 7640 | | UINT8 nt_mode = mmc_cmd1 & 0x80; |
| 7641 | | |
| 7642 | | set_nt_page(0, ROM, vrom_bank[nt_mode ? 2 : 0], 0); |
| 7643 | | set_nt_page(1, ROM, vrom_bank[nt_mode ? 3 : 0], 0); |
| 7644 | | set_nt_page(2, ROM, vrom_bank[nt_mode ? 4 : 1], 0); |
| 7645 | | set_nt_page(3, ROM, vrom_bank[nt_mode ? 5 : 1], 0); |
| 7646 | | } |
| 7647 | | |
| 7648 | | static WRITE8_HANDLER( mapper158_w ) |
| 7649 | | { |
| 7650 | | UINT8 map158_helper, cmd; |
| 7651 | | LOG_MMC(("mapper158_w offset: %04x, data: %02x\n", offset, data)); |
| 7652 | | |
| 7653 | | switch (offset & 0x6001) |
| 7654 | | { |
| 7655 | | case 0x0000: |
| 7656 | | map158_helper = mmc_cmd1 ^ data; |
| 7657 | | mmc_cmd1 = data; |
| 7658 | | |
| 7659 | | /* Has PRG Mode changed? */ |
| 7660 | | if (map158_helper & 0x40) |
| 7661 | | mapper64_set_prg(space->machine); |
| 7662 | | |
| 7663 | | /* Has CHR Mode changed? */ |
| 7664 | | if (map158_helper & 0xa0) |
| 7665 | | { |
| 7666 | | mapper64_set_chr(space->machine); |
| 7667 | | mapper158_set_mirror(space->machine); |
| 7668 | | } |
| 7669 | | break; |
| 7670 | | |
| 7671 | | case 0x0001: |
| 7672 | | cmd = mmc_cmd1 & 0x0f; |
| 7673 | | switch (cmd) |
| 7674 | | { |
| 7675 | | case 0: case 1: |
| 7676 | | case 2: case 3: |
| 7677 | | case 4: case 5: |
| 7678 | | vrom_bank[cmd] = data; |
| 7679 | | mapper64_set_chr(space->machine); |
| 7680 | | mapper158_set_mirror(space->machine); |
| 7681 | | break; |
| 7682 | | case 6: case 7: |
| 7683 | | prg_bank[cmd - 6] = data; |
| 7684 | | mapper64_set_prg(space->machine); |
| 7685 | | break; |
| 7686 | | case 8: case 9: |
| 7687 | | vrom_bank[cmd - 2] = data; |
| 7688 | | mapper64_set_chr(space->machine); |
| 7689 | | mapper158_set_mirror(space->machine); |
| 7690 | | break; |
| 7691 | | case 0x0f: |
| 7692 | | prg_bank[2] = data; |
| 7693 | | mapper64_set_prg(space->machine); |
| 7694 | | break; |
| 7695 | | } |
| 7696 | | break; |
| 7697 | | |
| 7698 | | case 0x2000: |
| 7699 | | break; |
| 7700 | | |
| 7701 | | default: |
| 7702 | | mapper64_w(space, offset, data); |
| 7703 | | break; |
| 7704 | | } |
| 7705 | | } |
| 7706 | | |
| 7707 | | /************************************************************* |
| 7708 | | |
| 7709 | | Mapper 159 |
| 7710 | | |
| 7711 | | Known Boards: Bandai Board |
| 7712 | | Games: Dragon Ball Z, Magical Taruruuto-kun, SD Gundam Gaiden |
| 7713 | | |
| 7714 | | This is exactly like Mapper 16, but with different EEPROM I/O. |
| 7715 | | At the moment we don't support EEPROM in either mapper. |
| 7716 | | |
| 7717 | | In MESS: Supported. |
| 7718 | | |
| 7719 | | *************************************************************/ |
| 7720 | | |
| 7721 | | /************************************************************* |
| 7722 | | |
| 7723 | | Mapper 160 |
| 7724 | | |
| 7725 | | Known Boards: Undocumented / Unused ?!? |
| 7726 | | Games: ---------- |
| 7727 | | |
| 7728 | | In MESS: ---------- |
| 7729 | | |
| 7730 | | *************************************************************/ |
| 7731 | | |
| 7732 | | /************************************************************* |
| 7733 | | |
| 7734 | | Mapper 161 |
| 7735 | | |
| 7736 | | Known Boards: Undocumented / Unused ?!? |
| 7737 | | Games: ---------- |
| 7738 | | |
| 7739 | | In MESS: ---------- |
| 7740 | | |
| 7741 | | *************************************************************/ |
| 7742 | | |
| 7743 | | /************************************************************* |
| 7744 | | |
| 7745 | | Mapper 162 |
| 7746 | | |
| 7747 | | Known Boards: Undocumented / Unused ?!? |
| 7748 | | Games: ---------- |
| 7749 | | |
| 7750 | | In MESS: ---------- |
| 7751 | | |
| 7752 | | *************************************************************/ |
| 7753 | | |
| 7754 | | /************************************************************* |
| 7755 | | |
| 7756 | | Mapper 163 |
| 7757 | | |
| 7758 | | Known Boards: Bootleg Board by Nanjing |
| 7759 | | Games: Diablo, Final Fantasy VII, Harvest Moon, He Xin Wei |
| 7760 | | Ji, Yu-Gi-Oh, Zelda - Shen Qi De Mao Zi and other |
| 7761 | | |
| 7762 | | In MESS: Unsupported. |
| 7763 | | |
| 7764 | | *************************************************************/ |
| 7765 | | |
| 7766 | | /************************************************************* |
| 7767 | | |
| 7768 | | Mapper 164 |
| 7769 | | |
| 7770 | | Known Boards: Bootleg Board by Waixing |
| 7771 | | Games: Darkseed, Digital Dragon, Final Fantasy V, Pocket |
| 7772 | | Monster Red |
| 7773 | | |
| 7774 | | In MESS: Supported. |
| 7775 | | |
| 7776 | | *************************************************************/ |
| 7777 | | |
| 7778 | | static WRITE8_HANDLER( mapper164_l_w ) |
| 7779 | | { |
| 7780 | | LOG_MMC(("mapper164_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7781 | | offset += 0x4100; /* the checks work better on addresses */ |
| 7782 | | |
| 7783 | | if (0x5000 == (offset & 0x7300)) |
| 7784 | | prg32(space->machine, data); |
| 7785 | | } |
| 7786 | | |
| 7787 | | static WRITE8_HANDLER( mapper164_w ) |
| 7788 | | { |
| 7789 | | LOG_MMC(("mapper164_w, offset: %04x, data: %02x\n", offset, data)); |
| 7790 | | if ((offset & 0x7300) == 0x5000) |
| 7791 | | prg32(space->machine, data); |
| 7792 | | } |
| 7793 | | |
| 7794 | | /************************************************************* |
| 7795 | | |
| 7796 | | Mapper 165 |
| 7797 | | |
| 7798 | | Known Boards: Bootleg Board by Waixing |
| 7799 | | Games: Fire Emblem (C), Fire Emblem Gaiden (C) |
| 7800 | | |
| 7801 | | MMC3 clone |
| 7802 | | |
| 7803 | | In MESS: Unsupported. |
| 7804 | | |
| 7805 | | *************************************************************/ |
| 7806 | | |
| 7807 | | /************************************************************* |
| 7808 | | |
| 7809 | | Mapper 166 |
| 7810 | | |
| 7811 | | Known Boards: Bootleg Board by Subor (Type 1) |
| 7812 | | Games: Subor v1.0 (R) |
| 7813 | | |
| 7814 | | In MESS: Supported. |
| 7815 | | |
| 7816 | | *************************************************************/ |
| 7817 | | |
| 7818 | | static WRITE8_HANDLER( mapper166_w ) |
| 7819 | | { |
| 7820 | | UINT8 map166_helper1, map166_helper2; |
| 7821 | | LOG_MMC(("mapper166_w, offset: %04x, data: %02x\n", offset, data)); |
| 7822 | | |
| 7823 | | subor_reg[(offset >> 13) & 0x03] = data; |
| 7824 | | map166_helper1 = ((subor_reg[0] ^ subor_reg[1]) << 1) & 0x20; |
| 7825 | | map166_helper2 = ((subor_reg[2] ^ subor_reg[3]) << 0) & 0x1f; |
| 7826 | | |
| 7827 | | if (subor_reg[1] & 0x08) |
| 7828 | | { |
| 7829 | | map166_helper1 += map166_helper2 & 0xfe; |
| 7830 | | map166_helper2 = map166_helper1; |
| 7831 | | map166_helper2 += 1; |
| 7832 | | } |
| 7833 | | else if (subor_reg[1] & 0x04) |
| 7834 | | { |
| 7835 | | map166_helper2 += map166_helper1; |
| 7836 | | map166_helper1 = 0x1f; |
| 7837 | | } |
| 7838 | | else |
| 7839 | | { |
| 7840 | | map166_helper1 += map166_helper2; |
| 7841 | | map166_helper2 = 0x07; |
| 7842 | | } |
| 7843 | | |
| 7844 | | prg16_89ab(space->machine, map166_helper1); |
| 7845 | | prg16_cdef(space->machine, map166_helper2); |
| 7846 | | } |
| 7847 | | |
| 7848 | | /************************************************************* |
| 7849 | | |
| 7850 | | Mapper 167 |
| 7851 | | |
| 7852 | | Known Boards: Bootleg Board by Subor (Type 0) |
| 7853 | | Games: Subor v4.0 (C), English Word Blaster |
| 7854 | | |
| 7855 | | Basically the same as 166, except for the initial prg |
| 7856 | | bank and a couple of bits in the choice of prg banks |
| 7857 | | |
| 7858 | | In MESS: Supported. |
| 7859 | | |
| 7860 | | *************************************************************/ |
| 7861 | | |
| 7862 | | static WRITE8_HANDLER( mapper167_w ) |
| 7863 | | { |
| 7864 | | UINT8 map167_helper1, map167_helper2; |
| 7865 | | LOG_MMC(("mapper167_w, offset: %04x, data: %02x\n", offset, data)); |
| 7866 | | |
| 7867 | | subor_reg[(offset >> 13) & 0x03] = data; |
| 7868 | | map167_helper1 = ((subor_reg[0] ^ subor_reg[1]) << 1) & 0x20; |
| 7869 | | map167_helper2 = ((subor_reg[2] ^ subor_reg[3]) << 0) & 0x1f; |
| 7870 | | |
| 7871 | | if (subor_reg[1] & 0x08) |
| 7872 | | { |
| 7873 | | map167_helper1 += map167_helper2 & 0xfe; |
| 7874 | | map167_helper2 = map167_helper1; |
| 7875 | | map167_helper1 += 1; |
| 7876 | | } |
| 7877 | | else if (subor_reg[1] & 0x04) |
| 7878 | | { |
| 7879 | | map167_helper2 += map167_helper1; |
| 7880 | | map167_helper1 = 0x1f; |
| 7881 | | } |
| 7882 | | else |
| 7883 | | { |
| 7884 | | map167_helper1 += map167_helper2; |
| 7885 | | map167_helper2 = 0x20; |
| 7886 | | } |
| 7887 | | |
| 7888 | | prg16_89ab(space->machine, map167_helper1); |
| 7889 | | prg16_cdef(space->machine, map167_helper2); |
| 7890 | | } |
| 7891 | | |
| 7892 | | /************************************************************* |
| 7893 | | |
| 7894 | | Mapper 168 |
| 7895 | | |
| 7896 | | Known Boards: ??? |
| 7897 | | Games: Racermate Challenger II |
| 7898 | | |
| 7899 | | No info at all are available. |
| 7900 | | |
| 7901 | | In MESS: Unsupported. |
| 7902 | | |
| 7903 | | *************************************************************/ |
| 7904 | | |
| 7905 | | /************************************************************* |
| 7906 | | |
| 7907 | | Mapper 169 |
| 7908 | | |
| 7909 | | Known Boards: Undocumented / Unused ?!? |
| 7910 | | Games: ---------- |
| 7911 | | |
| 7912 | | In MESS: ---------- |
| 7913 | | |
| 7914 | | *************************************************************/ |
| 7915 | | |
| 7916 | | /************************************************************* |
| 7917 | | |
| 7918 | | Mapper 170 |
| 7919 | | |
| 7920 | | Known Boards: Bootleg Board by Fujiya |
| 7921 | | Games: [no games in nes.hsi] |
| 7922 | | |
| 7923 | | In MESS: Unsupported. |
| 7924 | | |
| 7925 | | *************************************************************/ |
| 7926 | | |
| 7927 | | /************************************************************* |
| 7928 | | |
| 7929 | | Mapper 171 |
| 7930 | | |
| 7931 | | Known Boards: Bootleg Board by Kaiser (KS7058) |
| 7932 | | Games: Tui Do Woo Ma Jeung |
| 7933 | | |
| 7934 | | Writes to 0xf000-0xffff set 4k chr banks. Namely, if |
| 7935 | | offset&0x80 is 0 the lower 4k are set, if it is 1 the |
| 7936 | | upper 4k are set. |
| 7937 | | |
| 7938 | | In MESS: Supported. |
| 7939 | | |
| 7940 | | *************************************************************/ |
| 7941 | | |
| 7942 | | static WRITE8_HANDLER( mapper171_w ) |
| 7943 | | { |
| 7944 | | LOG_MMC(("mapper171_w, offset: %04x, data: %02x\n", offset, data)); |
| 7945 | | |
| 7946 | | switch (offset & 0x7080) |
| 7947 | | { |
| 7948 | | case 0x7000: |
| 7949 | | chr4_0(space->machine, data, CHRROM); |
| 7950 | | break; |
| 7951 | | case 0x7080: |
| 7952 | | chr4_4(space->machine, data, CHRROM); |
| 7953 | | break; |
| 7954 | | } |
| 7955 | | } |
| 7956 | | |
| 7957 | | /************************************************************* |
| 7958 | | |
| 7959 | | Mapper 172 |
| 7960 | | |
| 7961 | | Known Boards: Bootleg Board by TXC (T22211B) |
| 7962 | | Games: 1991 Du Ma Racing |
| 7963 | | |
| 7964 | | This mapper is basically the same as 132. Only difference is |
| 7965 | | in the way CHR banks are selected (see below) |
| 7966 | | |
| 7967 | | In MESS: Supported. It shares low handlers with board T22211A |
| 7968 | | (mapper 132) |
| 7969 | | |
| 7970 | | *************************************************************/ |
| 7971 | | |
| 7972 | | static WRITE8_HANDLER( mapper172_w ) |
| 7973 | | { |
| 7974 | | LOG_MMC(("mapper172_w, offset: %04x, data: %02x\n", offset, data)); |
| 7975 | | |
| 7976 | | prg32(space->machine, txc_reg[2] >> 2); |
| 7977 | | chr8(space->machine, (((data ^ txc_reg[2]) >> 3) & 0x02) | (((data ^ txc_reg[2]) >> 5) & 0x01), CHRROM); |
| 7978 | | } |
| 7979 | | |
| 7980 | | /************************************************************* |
| 7981 | | |
| 7982 | | Mapper 173 |
| 7983 | | |
| 7984 | | Known Boards: Bootleg Board by TXC (T22211C) |
| 7985 | | Games: Mahjong Block, Xiao Ma Li |
| 7986 | | |
| 7987 | | This mapper is basically the same as 132 too. Only difference is |
| 7988 | | in 0x4100 reads which expect also bit 0 to be set |
| 7989 | | |
| 7990 | | In MESS: Supported. It shares write handlers with board T22211A |
| 7991 | | (mapper 132) |
| 7992 | | |
| 7993 | | *************************************************************/ |
| 7994 | | |
| 7995 | | static READ8_HANDLER( mapper173_l_r ) |
| 7996 | | { |
| 7997 | | LOG_MMC(("mapper173_l_r, offset: %04x\n", offset)); |
| 7998 | | |
| 7999 | | if (offset == 0x0000) |
| 8000 | | return (txc_reg[1] ^ txc_reg[2]) | 0x41; |
| 8001 | | else |
| 8002 | | return 0x00; |
| 8003 | | } |
| 8004 | | |
| 8005 | | /************************************************************* |
| 8006 | | |
| 8007 | | Mapper 174 |
| 8008 | | |
| 8009 | | Known Boards: Undocumented / Unused ?!? |
| 8010 | | Games: ---------- |
| 8011 | | |
| 8012 | | In MESS: ---------- |
| 8013 | | |
| 8014 | | *************************************************************/ |
| 8015 | | |
| 8016 | | /************************************************************* |
| 8017 | | |
| 8018 | | Mapper 175 |
| 8019 | | |
| 8020 | | Known Boards: Bootleg Board by Kaiser (KS7022) |
| 8021 | | Games: 15 in 1 |
| 8022 | | |
| 8023 | | In MESS: Unsupported. Requires reads from 0xfffc (according to |
| 8024 | | NEStopia). |
| 8025 | | |
| 8026 | | *************************************************************/ |
| 8027 | | |
| 8028 | | /************************************************************* |
| 8029 | | |
| 8030 | | Mapper 176 |
| 8031 | | |
| 8032 | | Known Boards: Unknown Bootleg Board |
| 8033 | | Games: Shu Qi Yu - Zhi Li Xiao Zhuan Yuan |
| 8034 | | |
| 8035 | | Very simple mapper: writes to 0x5ff1 set prg32 (to data>>1), |
| 8036 | | while writes to 0x5ff2 set chr8 |
| 8037 | | |
| 8038 | | In MESS: Supported. |
| 8039 | | |
| 8040 | | *************************************************************/ |
| 8041 | | |
| 8042 | | static WRITE8_HANDLER( mapper176_l_w ) |
| 8043 | | { |
| 8044 | | LOG_MMC(("mapper176_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 8045 | | |
| 8046 | | switch (offset) |
| 8047 | | { |
| 8048 | | case 0x1ef1: /* 0x5ff1 */ |
| 8049 | | prg32(space->machine, data >> 1); |
| 8050 | | break; |
| 8051 | | case 0x1ef2: /* 0x5ff2 */ |
| 8052 | | chr8(space->machine, data, CHRROM); |
| 8053 | | break; |
| 8054 | | } |
| 8055 | | } |
| 8056 | | |
| 8057 | | /************************************************************* |
| 8058 | | |
| 8059 | | Mapper 177 |
| 8060 | | |
| 8061 | | Known Boards: Bootleg Board by Henggedianzi |
| 8062 | | Games: Mei Guo Fu Hao, Shang Gu Shen Jian , Wang Zi Fu |
| 8063 | | Chou Ji, Xing He Zhan Shi |
| 8064 | | |
| 8065 | | Writes to 0x8000-0xffff set prg32. Moreover, data&0x20 sets |
| 8066 | | NT mirroring. |
| 8067 | | |
| 8068 | | In MESS: Supported. |
| 8069 | | |
| 8070 | | *************************************************************/ |
| 8071 | | |
| 8072 | | static WRITE8_HANDLER( mapper177_w ) |
| 8073 | | { |
| 8074 | | LOG_MMC(("mapper177_w, offset: %04x, data: %02x\n", offset, data)); |
| 8075 | | |
| 8076 | | prg32(space->machine, data); |
| 8077 | | set_nt_mirroring(((data & 0x20) >> 5) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 8078 | | } |
| 8079 | | |
| 8080 | | /************************************************************* |
| 8081 | | |
| 8082 | | Mapper 178 |
| 8083 | | |
| 8084 | | Known Boards: Bootleg Board by Waixing |
| 8085 | | Games: Fan Kong Jing Ying, San Guo Zhong Lie Zhuan, Xing |
| 8086 | | Ji Zheng Ba |
| 8087 | | |
| 8088 | | In MESS: Supported. |
| 8089 | | |
| 8090 | | *************************************************************/ |
| 8091 | | |
| 8092 | | static WRITE8_HANDLER( mapper178_l_w ) |
| 8093 | | { |
| 8094 | | LOG_MMC(("mapper178_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 8095 | | |
| 8096 | | switch (offset) |
| 8097 | | { |
| 8098 | | case 0x700: |
| 8099 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 8100 | | break; |
| 8101 | | case 0x701: |
| 8102 | | mmc_cmd1 = (mmc_cmd1 & 0x0c) | ((data >> 1) & 0x03); |
| 8103 | | prg32(space->machine, mmc_cmd1); |
| 8104 | | break; |
| 8105 | | case 0x702: |
| 8106 | | mmc_cmd1 = (mmc_cmd1 & 0x03) | ((data << 2) & 0x0c); |
| 8107 | | break; |
| 8108 | | } |
| 8109 | | } |
| 8110 | | |
| 8111 | | /************************************************************* |
| 8112 | | |
| 8113 | | Mapper 179 |
| 8114 | | |
| 8115 | | Known Boards: Bootleg Board by Henggedianzi |
| 8116 | | Games: Xing He Zhan Shi |
| 8117 | | |
| 8118 | | Writes to 0x5000-0x5fff set prg32 banks, writes to 0x8000- |
| 8119 | | 0xffff set NT mirroring |
| 8120 | | |
| 8121 | | In MESS: Supported. |
| 8122 | | |
| 8123 | | *************************************************************/ |
| 8124 | | |
| 8125 | | static WRITE8_HANDLER( mapper179_l_w ) |
| 8126 | | { |
| 8127 | | LOG_MMC(("mapper179_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 8128 | | offset += 0x4100; |
| 8129 | | |
| 8130 | | if (offset & 0x5000) |
| 8131 | | prg32(space->machine, data >> 1); |
| 8132 | | } |
| 8133 | | |
| 8134 | | static WRITE8_HANDLER( mapper179_w ) |
| 8135 | | { |
| 8136 | | LOG_MMC(("mapper179_w, offset: %04x, data: %02x\n", offset, data)); |
| 8137 | | |
| 8138 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 8139 | | } |
| 8140 | | |
| 8141 | | /************************************************************* |
| 8142 | | |
| 8143 | | Mapper 180 |
| 8144 | | |
| 8145 | | Known Boards: Nihon Bussan UNROM |
| 8146 | | Games: Crazy Climber Jpn |
| 8147 | | |
| 8148 | | Very simple mapper: prg16_89ab is always set to bank 0, |
| 8149 | | while prg16_cdef is set by writes to 0x8000-0xffff. The game |
| 8150 | | uses a custim controller. |
| 8151 | | |
| 8152 | | In MESS: Supported. |
| 8153 | | |
| 8154 | | *************************************************************/ |
| 8155 | | |
| 8156 | | static WRITE8_HANDLER( mapper180_w ) |
| 8157 | | { |
| 8158 | | LOG_MMC(("mapper180_w, offset: %04x, data: %02x\n", offset, data)); |
| 8159 | | |
| 8160 | | prg16_cdef(space->machine, data & 0x07); |
| 8161 | | } |
| 8162 | | |
| 8163 | | /************************************************************* |
| 8164 | | |
| 8165 | | Mapper 181 |
| 8166 | | |
| 8167 | | Known Boards: Undocumented / Unused ?!? |
| 8168 | | Games: ---------- |
| 8169 | | |
| 8170 | | In MESS: ---------- |
| 8171 | | |
| 8172 | | *************************************************************/ |
| 8173 | | |
| 8174 | | /************************************************************* |
| 8175 | | |
| 8176 | | Mapper 182 |
| 8177 | | |
| 8178 | | Known Boards: Bootleg Board by Hosenkan |
| 8179 | | Games: Pocahontas, Super Donkey Kong |
| 8180 | | |
| 8181 | | In MESS: Supported. |
| 8182 | | |
| 8183 | | *************************************************************/ |
| 8184 | | |
| 8185 | | static WRITE8_HANDLER( mapper182_w ) |
| 8186 | | { |
| 8187 | | LOG_MMC(("mapper182_w, offset: %04x, data: %02x\n", offset, data)); |
| 8188 | | |
| 8189 | | switch (offset & 0x7003) |
| 8190 | | { |
| 8191 | | case 0x0001: |
| 8192 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 8193 | | break; |
| 8194 | | case 0x2000: |
| 8195 | | mmc_cmd1 = data; |
| 8196 | | break; |
| 8197 | | case 0x4000: |
| 8198 | | switch (mmc_cmd1) |
| 8199 | | { |
| 8200 | | case 0: |
| 8201 | | chr2_0(space->machine, data >> 1, CHRROM); |
| 8202 | | break; |
| 8203 | | case 1: |
| 8204 | | chr1_5(space->machine, data, CHRROM); |
| 8205 | | break; |
| 8206 | | case 2: |
| 8207 | | chr2_2(space->machine, data >> 1, CHRROM); |
| 8208 | | break; |
| 8209 | | case 3: |
| 8210 | | chr1_7(space->machine, data, CHRROM); |
| 8211 | | break; |
| 8212 | | case 4: |
| 8213 | | prg8_89(space->machine, data); |
| 8214 | | break; |
| 8215 | | case 5: |
| 8216 | | prg8_ab(space->machine, data); |
| 8217 | | break; |
| 8218 | | case 6: |
| 8219 | | chr1_4(space->machine, data, CHRROM); |
| 8220 | | break; |
| 8221 | | case 7: |
| 8222 | | chr1_6(space->machine, data, CHRROM); |
| 8223 | | break; |
| 8224 | | } |
| 8225 | | break; |
| 8226 | | case 0x6003: |
| 8227 | | if (data) |
| 8228 | | { |
| 8229 | | IRQ_count = data; |
| 8230 | | IRQ_enable = 1; |
| 8231 | | } |
| 8232 | | else |
| 8233 | | IRQ_enable = 0; |
| 8234 | | break; |
| 8235 | | } |
| 8236 | | } |
| 8237 | | |
| 8238 | | /************************************************************* |
| 8239 | | |
| 8240 | | Mapper 183 |
| 8241 | | |
| 8242 | | Known Boards: Unknown Bootleg Board |
| 8243 | | Games: Shui Guan Pipe |
| 8244 | | |
| 8245 | | In MESS: Unsupported. |
| 8246 | | |
| 8247 | | *************************************************************/ |
| 8248 | | |
| 8249 | | /************************************************************* |
| 8250 | | |
| 8251 | | Mapper 184 |
| 8252 | | |
| 8253 | | Known Boards: Sunsoft 1 |
| 8254 | | Games: Atlantis no Nazo, Kanshakudama Nage Kantarou no |
| 8255 | | Toukaidou Gojuusan Tsugi, Wing of Madoola |
| 8256 | | |
| 8257 | | Very simple mapper: writes to 0x6000-0x7fff set chr banks |
| 8258 | | (lower bits set chr4_0, higher ones set chr4_4) |
| 8259 | | |
| 8260 | | In MESS: Supported. |
| 8261 | | |
| 8262 | | *************************************************************/ |
| 8263 | | |
| 8264 | | static WRITE8_HANDLER( mapper184_m_w ) |
| 8265 | | { |
| 8266 | | LOG_MMC(("mapper184_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 8267 | | |
| 8268 | | chr4_0(space->machine, data & 0x0f, CHRROM); |
| 8269 | | chr4_4(space->machine, data >> 4, CHRROM); |
| 8270 | | } |
| 8271 | | |
| 8272 | | /************************************************************* |
| 8273 | | |
| 8274 | | Mapper 185 |
| 8275 | | |
| 8276 | | Known Boards: CNROM |
| 8277 | | Games: B-Wings, Mighty Bomb Jack, Seicross, Spy vs. Spy |
| 8278 | | |
| 8279 | | In MESS: Very Preliminar Support. We act like it is mapper 3 |
| 8280 | | but we need to emulate the read back from 0x8000-0xfff! |
| 8281 | | |
| 8282 | | *************************************************************/ |
| 8283 | | |
| 8284 | | static WRITE8_HANDLER( mapper185_w ) |
| 8285 | | { |
| 8286 | | LOG_MMC(("mapper3_w offset: %04x, data: %02x\n", offset, data)); |
| 8287 | | |
| 8288 | | chr8(space->machine, data, CHRROM); |
| 8289 | | } |
| 8290 | | |
| 8291 | | /************************************************************* |
| 8292 | | |
| 8293 | | Mapper 186 |
| 8294 | | |
| 8295 | | Known Boards: Bootleg Board by Fukutake |
| 8296 | | Games: Study Box |
| 8297 | | |
| 8298 | | In MESS: Unsupported. Needs reads from 0x6000-0x7fff. |
| 8299 | | |
| 8300 | | *************************************************************/ |
| 8301 | | |
| 8302 | | /************************************************************* |
| 8303 | | |
| 8304 | | Mapper 187 |
| 8305 | | |
| 8306 | | Known Boards: Unknown Bootleg Board |
| 8307 | | Games: The King of Fighters 96, Sonic 3D Blast 6, Street |
| 8308 | | Fighter Zero 2 |
| 8309 | | |
| 8310 | | MMC3 clone |
| 8311 | | |
| 8312 | | In MESS: Preliminary Support. |
| 8313 | | |
| 8314 | | *************************************************************/ |
| 8315 | | |
| 8316 | | static void mapper187_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 8317 | | { |
| 8318 | | UINT8 prg_flip = (mmc_cmd1 & 0x40) ? 2 : 0; |
| 8319 | | |
| 8320 | | if (!(mapper187_reg[0] & 0x80)) |
| 8321 | | { |
| 8322 | | prg8_89(machine, prg_base | (prg_bank[0 ^ prg_flip] & prg_mask)); |
| 8323 | | prg8_ab(machine, prg_base | (prg_bank[1] & prg_mask)); |
| 8324 | | prg8_cd(machine, prg_base | (prg_bank[2 ^ prg_flip] & prg_mask)); |
| 8325 | | prg8_ef(machine, prg_base | (prg_bank[3] & prg_mask)); |
| 8326 | | } |
| 8327 | | } |
| 8328 | | |
| 8329 | | static void mapper187_set_chr( running_machine *machine, UINT8 chr, int chr_base, int chr_mask ) |
| 8330 | | { |
| 8331 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 8332 | | UINT8 new_base[8]; |
| 8333 | | int i; |
| 8334 | | |
| 8335 | | for (i = 0; i < 8; i++) |
| 8336 | | new_base[i] = ((i & 0x04) == chr_page)? (chr_base | 0x100) : chr_base; |
| 8337 | | |
| 8338 | | chr1_x(machine, chr_page ^ 0, new_base[0] | ((vrom_bank[0] & ~0x01) & chr_mask), chr); |
| 8339 | | chr1_x(machine, chr_page ^ 1, new_base[1] | ((vrom_bank[0] | 0x01) & chr_mask), chr); |
| 8340 | | chr1_x(machine, chr_page ^ 2, new_base[2] | ((vrom_bank[1] & ~0x01) & chr_mask), chr); |
| 8341 | | chr1_x(machine, chr_page ^ 3, new_base[3] | ((vrom_bank[1] | 0x01) & chr_mask), chr); |
| 8342 | | chr1_x(machine, chr_page ^ 4, new_base[4] | (vrom_bank[2] & chr_mask), chr); |
| 8343 | | chr1_x(machine, chr_page ^ 5, new_base[5] | (vrom_bank[3] & chr_mask), chr); |
| 8344 | | chr1_x(machine, chr_page ^ 6, new_base[6] | (vrom_bank[4] & chr_mask), chr); |
| 8345 | | chr1_x(machine, chr_page ^ 7, new_base[7] | (vrom_bank[5] & chr_mask), chr); |
| 8346 | | } |
| 8347 | | |
| 8348 | | static WRITE8_HANDLER( mapper187_l_w ) |
| 8349 | | { |
| 8350 | | UINT8 new_bank; |
| 8351 | | LOG_MMC(("mapper187_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 8352 | | offset += 0x100; |
| 8353 | | |
| 8354 | | if (offset == 0x1000) |
| 8355 | | { |
| 8356 | | switch (data & 0x03) |
| 8357 | | { |
| 8358 | | case 0x00: |
| 8359 | | case 0x01: |
| 8360 | | mapper187_reg[1] = 0x83; |
| 8361 | | break; |
| 8362 | | case 0x02: |
| 8363 | | mapper187_reg[1] = 0x42; |
| 8364 | | break; |
| 8365 | | case 0x03: |
| 8366 | | mapper187_reg[1] = 0x00; |
| 8367 | | break; |
| 8368 | | } |
| 8369 | | } |
| 8370 | | |
| 8371 | | if (!(offset <= 0x1000)) |
| 8372 | | { |
| 8373 | | mapper187_reg[0] = data; |
| 8374 | | |
| 8375 | | if (mapper187_reg[0] & 0x80) |
| 8376 | | { |
| 8377 | | new_bank = (mapper187_reg[0] & 0x1f); |
| 8378 | | |
| 8379 | | if (mapper187_reg[0] & 0x20) |
| 8380 | | prg32(space->machine, new_bank >> 2); |
| 8381 | | else |
| 8382 | | { |
| 8383 | | prg16_89ab(space->machine, new_bank); |
| 8384 | | prg16_cdef(space->machine, new_bank); |
| 8385 | | } |
| 8386 | | } |
| 8387 | | else |
| 8388 | | mapper187_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8389 | | } |
| 8390 | | } |
| 8391 | | |
| 8392 | | static READ8_HANDLER( mapper187_l_r ) |
| 8393 | | { |
| 8394 | | LOG_MMC(("mapper187_l_r, offset: %04x\n", offset)); |
| 8395 | | offset += 0x100; |
| 8396 | | |
| 8397 | | if (!(offset < 0x1000)) |
| 8398 | | return mapper187_reg[1]; |
| 8399 | | else |
| 8400 | | return 0; |
| 8401 | | } |
| 8402 | | |
| 8403 | | static WRITE8_HANDLER( mapper187_w ) |
| 8404 | | { |
| 8405 | | UINT8 MMC3_helper, cmd; |
| 8406 | | LOG_MMC(("mapper187_w, offset: %04x, data: %02x\n", offset, data)); |
| 8407 | | |
| 8408 | | switch (offset & 0x6003) |
| 8409 | | { |
| 8410 | | case 0x0000: |
| 8411 | | mapper187_reg[2] = 1; |
| 8412 | | MMC3_helper = mmc_cmd1 ^ data; |
| 8413 | | mmc_cmd1 = data; |
| 8414 | | |
| 8415 | | /* Has PRG Mode changed? */ |
| 8416 | | if (MMC3_helper & 0x40) |
| 8417 | | mapper187_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8418 | | |
| 8419 | | /* Has CHR Mode changed? */ |
| 8420 | | if (MMC3_helper & 0x80) |
| 8421 | | mapper187_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 8422 | | break; |
| 8423 | | |
| 8424 | | case 0x0001: |
| 8425 | | if (mapper187_reg[2]) |
| 8426 | | { |
| 8427 | | cmd = mmc_cmd1 & 0x07; |
| 8428 | | switch (cmd) |
| 8429 | | { |
| 8430 | | case 0: case 1: |
| 8431 | | case 2: case 3: case 4: case 5: |
| 8432 | | vrom_bank[cmd] = data; |
| 8433 | | mapper187_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 8434 | | break; |
| 8435 | | case 6: |
| 8436 | | case 7: |
| 8437 | | prg_bank[cmd - 6] = data; |
| 8438 | | mapper187_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8439 | | break; |
| 8440 | | } |
| 8441 | | } |
| 8442 | | break; |
| 8443 | | |
| 8444 | | case 0x0002: |
| 8445 | | break; |
| 8446 | | |
| 8447 | | case 0x0003: |
| 8448 | | mapper187_reg[2] = 0; |
| 8449 | | |
| 8450 | | if (data == 0x28) |
| 8451 | | prg8_cd(space->machine, 0x17); |
| 8452 | | else if (data == 0x2a) |
| 8453 | | prg8_ab(space->machine, 0x0f); |
| 8454 | | break; |
| 8455 | | |
| 8456 | | default: |
| 8457 | | mapper4_w(space, offset, data); |
| 8458 | | break; |
| 8459 | | } |
| 8460 | | } |
| 8461 | | |
| 8462 | | /************************************************************* |
| 8463 | | |
| 8464 | | Mapper 188 |
| 8465 | | |
| 8466 | | Known Boards: Bandai Karaoke Board |
| 8467 | | Games: Karaoke Studio |
| 8468 | | |
| 8469 | | In MESS: Partially Supported (missing mic support) |
| 8470 | | |
| 8471 | | *************************************************************/ |
| 8472 | | |
| 8473 | | static WRITE8_HANDLER( mapper188_w ) |
| 8474 | | { |
| 8475 | | LOG_MMC(("mapper188_w, offset: %04x, data: %02x\n", offset, data)); |
| 8476 | | |
| 8477 | | prg16_89ab(space->machine, data ^ 0x08); |
| 8478 | | } |
| 8479 | | |
| 8480 | | /************************************************************* |
| 8481 | | |
| 8482 | | Mapper 189 |
| 8483 | | |
| 8484 | | Known Boards: Bootleg Board by TXC |
| 8485 | | Games: Master Fighter II, Master Fighter 3, Thunder Warrior |
| 8486 | | |
| 8487 | | MMC3 clone |
| 8488 | | |
| 8489 | | In MESS: Supported. |
| 8490 | | |
| 8491 | | *************************************************************/ |
| 8492 | | |
| 8493 | | static WRITE8_HANDLER( mapper189_l_w ) |
| 8494 | | { |
| 8495 | | LOG_MMC(("mapper189_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 8496 | | |
| 8497 | | prg32(space->machine, (data >> 4) | data); |
| 8498 | | } |
| 8499 | | |
| 8500 | | static WRITE8_HANDLER( mapper189_m_w ) |
| 8501 | | { |
| 8502 | | LOG_MMC(("mapper189_m_w, offset: %04x, data: %04x\n", offset, data)); |
| 8503 | | |
| 8504 | | mapper189_l_w(space, offset & 0xff, data); // offset does not really count for this mapper |
| 8505 | | } |
| 8506 | | |
| 8507 | | /* This is like mapper4 but with no PRG bankswitch (beacuse it is handled by low writes) */ |
| 8508 | | static WRITE8_HANDLER( mapper189_w ) |
| 8509 | | { |
| 8510 | | UINT8 MMC3_helper, cmd; |
| 8511 | | LOG_MMC(("mapper189_w, offset: %04x, data: %02x\n", offset, data)); |
| 8512 | | |
| 8513 | | switch (offset & 0x6001) |
| 8514 | | { |
| 8515 | | case 0x0000: |
| 8516 | | MMC3_helper = mmc_cmd1 ^ data; |
| 8517 | | mmc_cmd1 = data; |
| 8518 | | |
| 8519 | | /* Has CHR Mode changed? */ |
| 8520 | | if (MMC3_helper & 0x80) |
| 8521 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 8522 | | break; |
| 8523 | | |
| 8524 | | case 0x0001: |
| 8525 | | cmd = mmc_cmd1 & 0x07; |
| 8526 | | switch (cmd) |
| 8527 | | { |
| 8528 | | case 0: case 1: |
| 8529 | | case 2: case 3: case 4: case 5: |
| 8530 | | vrom_bank[cmd] = data; |
| 8531 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 8532 | | break; |
| 8533 | | } |
| 8534 | | break; |
| 8535 | | |
| 8536 | | default: |
| 8537 | | mapper4_w(space, offset, data); |
| 8538 | | break; |
| 8539 | | } |
| 8540 | | } |
| 8541 | | |
| 8542 | | /************************************************************* |
| 8543 | | |
| 8544 | | Mapper 190 |
| 8545 | | |
| 8546 | | Known Boards: Undocumented / Unused ?!? |
| 8547 | | Games: ---------- |
| 8548 | | |
| 8549 | | In MESS: ---------- |
| 8550 | | |
| 8551 | | *************************************************************/ |
| 8552 | | |
| 8553 | | /************************************************************* |
| 8554 | | |
| 8555 | | Mapper 191 |
| 8556 | | |
| 8557 | | Known Boards: Type B by Waixing |
| 8558 | | Games: Sugoro Quest (C) |
| 8559 | | |
| 8560 | | MMC3 clone. This is a minor modification of Mapper 74, |
| 8561 | | in the sense that it is the same board except for the |
| 8562 | | CHRRAM pages. |
| 8563 | | |
| 8564 | | In MESS: Supported. |
| 8565 | | |
| 8566 | | *************************************************************/ |
| 8567 | | |
| 8568 | | static void mapper191_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 8569 | | { |
| 8570 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 8571 | | UINT8 chr_src[6]; |
| 8572 | | int i; |
| 8573 | | |
| 8574 | | for (i = 0; i < 6; i++) |
| 8575 | | chr_src[i] = (vrom_bank[i] & 0x80) ? CHRRAM : CHRROM; |
| 8576 | | |
| 8577 | | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 8578 | | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 8579 | | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| 8580 | | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr_src[1]); |
| 8581 | | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr_src[2]); |
| 8582 | | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr_src[3]); |
| 8583 | | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr_src[4]); |
| 8584 | | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr_src[5]); |
| 8585 | | } |
| 8586 | | |
| 8587 | | static WRITE8_HANDLER( mapper191_w ) |
| 8588 | | { |
| 8589 | | UINT8 MMC3_helper, cmd; |
| 8590 | | LOG_MMC(("mapper191_w, offset: %04x, data: %02x\n", offset, data)); |
| 8591 | | |
| 8592 | | switch (offset & 0x6001) |
| 8593 | | { |
| 8594 | | case 0x0000: |
| 8595 | | MMC3_helper = mmc_cmd1 ^ data; |
| 8596 | | mmc_cmd1 = data; |
| 8597 | | |
| 8598 | | /* Has PRG Mode changed? */ |
| 8599 | | if (MMC3_helper & 0x40) |
| 8600 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8601 | | |
| 8602 | | /* Has CHR Mode changed? */ |
| 8603 | | if (MMC3_helper & 0x80) |
| 8604 | | mapper191_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8605 | | break; |
| 8606 | | |
| 8607 | | case 0x0001: |
| 8608 | | cmd = mmc_cmd1 & 0x07; |
| 8609 | | switch (cmd) |
| 8610 | | { |
| 8611 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 8612 | | case 2: case 3: case 4: case 5: |
| 8613 | | vrom_bank[cmd] = data; |
| 8614 | | mapper191_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8615 | | break; |
| 8616 | | case 6: |
| 8617 | | case 7: |
| 8618 | | prg_bank[cmd - 6] = data; |
| 8619 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8620 | | break; |
| 8621 | | } |
| 8622 | | break; |
| 8623 | | |
| 8624 | | default: |
| 8625 | | mapper74_w(space, offset, data); |
| 8626 | | break; |
| 8627 | | } |
| 8628 | | } |
| 8629 | | |
| 8630 | | /************************************************************* |
| 8631 | | |
| 8632 | | Mapper 192 |
| 8633 | | |
| 8634 | | Known Boards: Type C by Waixing |
| 8635 | | Games: Ying Lie Qun Xia Zhuan, Young Chivalry |
| 8636 | | |
| 8637 | | MMC3 clone. This is a minor modification of Mapper 74, |
| 8638 | | in the sense that it is the same board except for the |
| 8639 | | CHRRAM pages. |
| 8640 | | |
| 8641 | | In MESS: Supported. |
| 8642 | | |
| 8643 | | *************************************************************/ |
| 8644 | | |
| 8645 | | static void mapper192_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 8646 | | { |
| 8647 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 8648 | | UINT8 chr_src[6]; |
| 8649 | | int i; |
| 8650 | | |
| 8651 | | for (i = 0; i < 6; i++) |
| 8652 | | chr_src[i] = ((vrom_bank[i] == 0x08) || (vrom_bank[i] == 0x09) || (vrom_bank[i] == 0x0a) || (vrom_bank[i] == 0x0b)) ? CHRRAM : CHRROM; |
| 8653 | | |
| 8654 | | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 8655 | | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 8656 | | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| 8657 | | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr_src[1]); |
| 8658 | | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr_src[2]); |
| 8659 | | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr_src[3]); |
| 8660 | | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr_src[4]); |
| 8661 | | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr_src[5]); |
| 8662 | | } |
| 8663 | | |
| 8664 | | static WRITE8_HANDLER( mapper192_w ) |
| 8665 | | { |
| 8666 | | UINT8 MMC3_helper, cmd; |
| 8667 | | LOG_MMC(("mapper192_w, offset: %04x, data: %02x\n", offset, data)); |
| 8668 | | |
| 8669 | | switch (offset & 0x6001) |
| 8670 | | { |
| 8671 | | case 0x0000: |
| 8672 | | MMC3_helper = mmc_cmd1 ^ data; |
| 8673 | | mmc_cmd1 = data; |
| 8674 | | |
| 8675 | | /* Has PRG Mode changed? */ |
| 8676 | | if (MMC3_helper & 0x40) |
| 8677 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8678 | | |
| 8679 | | /* Has CHR Mode changed? */ |
| 8680 | | if (MMC3_helper & 0x80) |
| 8681 | | mapper192_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8682 | | break; |
| 8683 | | |
| 8684 | | case 0x0001: |
| 8685 | | cmd = mmc_cmd1 & 0x07; |
| 8686 | | switch (cmd) |
| 8687 | | { |
| 8688 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 8689 | | case 2: case 3: case 4: case 5: |
| 8690 | | vrom_bank[cmd] = data; |
| 8691 | | mapper192_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8692 | | break; |
| 8693 | | case 6: |
| 8694 | | case 7: |
| 8695 | | prg_bank[cmd - 6] = data; |
| 8696 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8697 | | break; |
| 8698 | | } |
| 8699 | | break; |
| 8700 | | |
| 8701 | | default: |
| 8702 | | mapper74_w(space, offset, data); |
| 8703 | | break; |
| 8704 | | } |
| 8705 | | } |
| 8706 | | |
| 8707 | | /************************************************************* |
| 8708 | | |
| 8709 | | Mapper 193 |
| 8710 | | |
| 8711 | | Known Boards: Bootleg Board by NTDEC |
| 8712 | | Games: Fighting Hero |
| 8713 | | |
| 8714 | | Very simple mapper: writes to 0x6000-0x7fff swap PRG and |
| 8715 | | CHR banks. |
| 8716 | | |
| 8717 | | In MESS: Supported. |
| 8718 | | |
| 8719 | | *************************************************************/ |
| 8720 | | |
| 8721 | | static WRITE8_HANDLER( mapper193_m_w ) |
| 8722 | | { |
| 8723 | | LOG_MMC(("mapper193_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 8724 | | |
| 8725 | | switch (offset & 0x03) |
| 8726 | | { |
| 8727 | | case 0: |
| 8728 | | chr4_0(space->machine, data >> 2, CHRROM); |
| 8729 | | break; |
| 8730 | | case 1: |
| 8731 | | chr2_4(space->machine, data >> 1, CHRROM); |
| 8732 | | break; |
| 8733 | | case 2: |
| 8734 | | chr2_6(space->machine, data >> 1 , CHRROM); |
| 8735 | | break; |
| 8736 | | case 3: |
| 8737 | | prg8_89(space->machine, data); |
| 8738 | | break; |
| 8739 | | } |
| 8740 | | } |
| 8741 | | |
| 8742 | | /************************************************************* |
| 8743 | | |
| 8744 | | Mapper 194 |
| 8745 | | |
| 8746 | | Known Boards: Type D by Waixing |
| 8747 | | Games: Super Robot Taisen (C) |
| 8748 | | |
| 8749 | | MMC3 clone. This is a minor modification of Mapper 74, |
| 8750 | | in the sense that it is the same board except for the |
| 8751 | | CHRRAM pages. |
| 8752 | | |
| 8753 | | In MESS: Supported. |
| 8754 | | |
| 8755 | | *************************************************************/ |
| 8756 | | |
| 8757 | | static void mapper194_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 8758 | | { |
| 8759 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 8760 | | UINT8 chr_src[6]; |
| 8761 | | int i; |
| 8762 | | |
| 8763 | | for (i = 0; i < 6; i++) |
| 8764 | | chr_src[i] = (vrom_bank[i] < 0x02) ? CHRRAM : CHRROM; |
| 8765 | | |
| 8766 | | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 8767 | | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 8768 | | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| 8769 | | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr_src[1]); |
| 8770 | | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr_src[2]); |
| 8771 | | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr_src[3]); |
| 8772 | | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr_src[4]); |
| 8773 | | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr_src[5]); |
| 8774 | | } |
| 8775 | | |
| 8776 | | static WRITE8_HANDLER( mapper194_w ) |
| 8777 | | { |
| 8778 | | UINT8 MMC3_helper, cmd; |
| 8779 | | LOG_MMC(("mapper194_w, offset: %04x, data: %02x\n", offset, data)); |
| 8780 | | |
| 8781 | | switch (offset & 0x6001) |
| 8782 | | { |
| 8783 | | case 0x0000: |
| 8784 | | MMC3_helper = mmc_cmd1 ^ data; |
| 8785 | | mmc_cmd1 = data; |
| 8786 | | |
| 8787 | | /* Has PRG Mode changed? */ |
| 8788 | | if (MMC3_helper & 0x40) |
| 8789 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8790 | | |
| 8791 | | /* Has CHR Mode changed? */ |
| 8792 | | if (MMC3_helper & 0x80) |
| 8793 | | mapper194_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8794 | | break; |
| 8795 | | |
| 8796 | | case 0x0001: |
| 8797 | | cmd = mmc_cmd1 & 0x07; |
| 8798 | | switch (cmd) |
| 8799 | | { |
| 8800 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 8801 | | case 2: case 3: case 4: case 5: |
| 8802 | | vrom_bank[cmd] = data; |
| 8803 | | mapper194_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8804 | | break; |
| 8805 | | case 6: |
| 8806 | | case 7: |
| 8807 | | prg_bank[cmd - 6] = data; |
| 8808 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8809 | | break; |
| 8810 | | } |
| 8811 | | break; |
| 8812 | | |
| 8813 | | default: |
| 8814 | | mapper74_w(space, offset, data); |
| 8815 | | break; |
| 8816 | | } |
| 8817 | | } |
| 8818 | | |
| 8819 | | /************************************************************* |
| 8820 | | |
| 8821 | | Mapper 195 |
| 8822 | | |
| 8823 | | Known Boards: Type E by Waixing |
| 8824 | | Games: Captain Tsubasa Vol. II (C), Chaos World, God |
| 8825 | | Slayer (C), Zu Qiu Xiao Jiang |
| 8826 | | |
| 8827 | | MMC3 clone. This is a minor modification of Mapper 74, |
| 8828 | | in the sense that it is the same board except for the |
| 8829 | | CHRRAM pages. |
| 8830 | | |
| 8831 | | In MESS: Supported. |
| 8832 | | |
| 8833 | | *************************************************************/ |
| 8834 | | |
| 8835 | | static void mapper195_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 8836 | | { |
| 8837 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 8838 | | UINT8 chr_src[6]; |
| 8839 | | int i; |
| 8840 | | |
| 8841 | | for (i = 0; i < 6; i++) |
| 8842 | | chr_src[i] = (vrom_bank[i] < 0x04) ? CHRRAM : CHRROM; |
| 8843 | | |
| 8844 | | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 8845 | | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 8846 | | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| 8847 | | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr_src[1]); |
| 8848 | | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr_src[2]); |
| 8849 | | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr_src[3]); |
| 8850 | | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr_src[4]); |
| 8851 | | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr_src[5]); |
| 8852 | | } |
| 8853 | | |
| 8854 | | static WRITE8_HANDLER( mapper195_w ) |
| 8855 | | { |
| 8856 | | UINT8 MMC3_helper, cmd; |
| 8857 | | LOG_MMC(("mapper195_w, offset: %04x, data: %02x\n", offset, data)); |
| 8858 | | |
| 8859 | | switch (offset & 0x6001) |
| 8860 | | { |
| 8861 | | case 0x0000: |
| 8862 | | MMC3_helper = mmc_cmd1 ^ data; |
| 8863 | | mmc_cmd1 = data; |
| 8864 | | |
| 8865 | | /* Has PRG Mode changed? */ |
| 8866 | | if (MMC3_helper & 0x40) |
| 8867 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8868 | | |
| 8869 | | /* Has CHR Mode changed? */ |
| 8870 | | if (MMC3_helper & 0x80) |
| 8871 | | mapper195_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8872 | | break; |
| 8873 | | |
| 8874 | | case 0x0001: |
| 8875 | | cmd = mmc_cmd1 & 0x07; |
| 8876 | | switch (cmd) |
| 8877 | | { |
| 8878 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 8879 | | case 2: case 3: case 4: case 5: |
| 8880 | | vrom_bank[cmd] = data; |
| 8881 | | mapper195_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8882 | | break; |
| 8883 | | case 6: |
| 8884 | | case 7: |
| 8885 | | prg_bank[cmd - 6] = data; |
| 8886 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8887 | | break; |
| 8888 | | } |
| 8889 | | break; |
| 8890 | | |
| 8891 | | default: |
| 8892 | | mapper74_w(space, offset, data); |
| 8893 | | break; |
| 8894 | | } |
| 8895 | | } |
| 8896 | | |
| 8897 | | /************************************************************* |
| 8898 | | |
| 8899 | | Mapper 196 |
| 8900 | | |
| 8901 | | Known Boards: Unknown Bootleg Board |
| 8902 | | Games: Super Mario Bros. 11, Super Mario Bros. 17 |
| 8903 | | |
| 8904 | | This acts basically like a MMC3 with different use of write |
| 8905 | | address. |
| 8906 | | |
| 8907 | | In MESS: Supported. |
| 8908 | | |
| 8909 | | *************************************************************/ |
| 8910 | | |
| 8911 | | static WRITE8_HANDLER( mapper196_w ) |
| 8912 | | { |
| 8913 | | LOG_MMC(("mapper196_w, offset: %04x, data: %02x\n", offset, data)); |
| 8914 | | |
| 8915 | | mapper4_w(space, (offset & 0x6000) | ((offset & 0x04) >> 2), data); |
| 8916 | | } |
| 8917 | | |
| 8918 | | /************************************************************* |
| 8919 | | |
| 8920 | | Mapper 197 |
| 8921 | | |
| 8922 | | Known Boards: Unknown Bootleg Board |
| 8923 | | Games: Super Fighter III |
| 8924 | | |
| 8925 | | MMC3 clone |
| 8926 | | |
| 8927 | | In MESS: Supported. |
| 8928 | | |
| 8929 | | *************************************************************/ |
| 8930 | | |
| 8931 | | static void mapper197_set_chr( running_machine *machine, UINT8 chr_source, int chr_base, int chr_mask ) |
| 8932 | | { |
| 8933 | | chr4_0(machine, chr_base | ((vrom_bank[0] >> 1) & chr_mask), chr_source); |
| 8934 | | chr2_4(machine, chr_base | (vrom_bank[1] & chr_mask), chr_source); |
| 8935 | | chr2_6(machine, chr_base | (vrom_bank[2] & chr_mask), chr_source); |
| 8936 | | } |
| 8937 | | |
| 8938 | | static WRITE8_HANDLER( mapper197_w ) |
| 8939 | | { |
| 8940 | | UINT8 MMC3_helper, cmd; |
| 8941 | | LOG_MMC(("mapper197_w, offset: %04x, data: %02x\n", offset, data)); |
| 8942 | | |
| 8943 | | switch (offset & 0x6001) |
| 8944 | | { |
| 8945 | | case 0x0000: |
| 8946 | | MMC3_helper = mmc_cmd1 ^ data; |
| 8947 | | mmc_cmd1 = data; |
| 8948 | | |
| 8949 | | /* Has PRG Mode changed? */ |
| 8950 | | if (MMC3_helper & 0x40) |
| 8951 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8952 | | |
| 8953 | | /* Has CHR Mode changed? */ |
| 8954 | | if (MMC3_helper & 0x80) |
| 8955 | | mapper197_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 8956 | | break; |
| 8957 | | |
| 8958 | | case 0x0001: |
| 8959 | | cmd = mmc_cmd1 & 0x0f; |
| 8960 | | switch (cmd) |
| 8961 | | { |
| 8962 | | case 0: case 2: case 4: |
| 8963 | | vrom_bank[cmd >> 1] = data; |
| 8964 | | mapper197_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 8965 | | break; |
| 8966 | | case 6: |
| 8967 | | case 7: |
| 8968 | | prg_bank[cmd - 6] = data; |
| 8969 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8970 | | break; |
| 8971 | | } |
| 8972 | | break; |
| 8973 | | |
| 8974 | | default: |
| 8975 | | mapper4_w(space, offset, data); |
| 8976 | | break; |
| 8977 | | } |
| 8978 | | } |
| 8979 | | |
| 8980 | | /************************************************************* |
| 8981 | | |
| 8982 | | Mapper 198 |
| 8983 | | |
| 8984 | | Known Boards: Type F by Waixing |
| 8985 | | Games: Tenchi wo Kurau II (C) |
| 8986 | | |
| 8987 | | MMC3 clone. |
| 8988 | | |
| 8989 | | In MESS: Preliminary support. |
| 8990 | | |
| 8991 | | *************************************************************/ |
| 8992 | | |
| 8993 | | static void mapper198_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 8994 | | { |
| 8995 | | UINT8 prg_flip = (mmc_cmd1 & 0x40) ? 2 : 0; |
| 8996 | | |
| 8997 | | prg8_89(machine, prg_base | (prg_bank[0 ^ prg_flip] & prg_mask)); |
| 8998 | | prg8_ab(machine, prg_base | (prg_bank[1] & prg_mask)); |
| 8999 | | prg8_cd(machine, prg_base | (prg_bank[2 ^ prg_flip] & prg_mask)); |
| 9000 | | prg8_ef(machine, prg_base | (prg_bank[3] & prg_mask)); |
| 9001 | | } |
| 9002 | | |
| 9003 | | static WRITE8_HANDLER( mapper198_w ) |
| 9004 | | { |
| 9005 | | UINT8 MMC3_helper, cmd; |
| 9006 | | LOG_MMC(("mapper198_w, offset: %04x, data: %02x\n", offset, data)); |
| 9007 | | |
| 9008 | | switch (offset & 0x6001) |
| 9009 | | { |
| 9010 | | case 0x0000: |
| 9011 | | MMC3_helper = mmc_cmd1 ^ data; |
| 9012 | | mmc_cmd1 = data; |
| 9013 | | |
| 9014 | | /* Has PRG Mode changed? */ |
| 9015 | | if (MMC3_helper & 0x40) |
| 9016 | | mapper198_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9017 | | |
| 9018 | | /* Has CHR Mode changed? */ |
| 9019 | | if (MMC3_helper & 0x80) |
| 9020 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 9021 | | break; |
| 9022 | | |
| 9023 | | case 0x0001: |
| 9024 | | cmd = mmc_cmd1 & 0x07; |
| 9025 | | switch (cmd) |
| 9026 | | { |
| 9027 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 9028 | | case 2: case 3: case 4: case 5: |
| 9029 | | vrom_bank[cmd] = data; |
| 9030 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 9031 | | break; |
| 9032 | | case 6: |
| 9033 | | case 7: |
| 9034 | | prg_bank[cmd - 6] = data & ((data > 0x3f) ? 0x4f : 0x3f); |
| 9035 | | mapper198_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9036 | | break; |
| 9037 | | } |
| 9038 | | break; |
| 9039 | | |
| 9040 | | default: |
| 9041 | | mapper74_w(space, offset, data); |
| 9042 | | break; |
| 9043 | | } |
| 9044 | | } |
| 9045 | | |
| 9046 | | /************************************************************* |
| 9047 | | |
| 9048 | | Mapper 199 |
| 9049 | | |
| 9050 | | Known Boards: Type G by Waixing |
| 9051 | | Games: San Guo Zhi 2, Dragon Ball Z Gaiden (C), Dragon |
| 9052 | | Ball Z II (C) |
| 9053 | | |
| 9054 | | MMC3 clone |
| 9055 | | |
| 9056 | | In MESS: Supported. |
| 9057 | | |
| 9058 | | *************************************************************/ |
| 9059 | | |
| 9060 | | static void mapper199_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 9061 | | { |
| 9062 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 9063 | | UINT8 chr_src[8]; |
| 9064 | | int i; |
| 9065 | | |
| 9066 | | for (i = 0; i < 8; i++) |
| 9067 | | chr_src[i] = (vrom_bank[i] < 0x08) ? CHRRAM : CHRROM; |
| 9068 | | |
| 9069 | | chr1_x(machine, chr_page ^ 0, chr_base | (vrom_bank[0] & chr_mask), chr_src[0]); |
| 9070 | | chr1_x(machine, chr_page ^ 1, chr_base | (vrom_bank[6] & chr_mask), chr_src[6]); |
| 9071 | | chr1_x(machine, chr_page ^ 2, chr_base | (vrom_bank[1] & chr_mask), chr_src[1]); |
| 9072 | | chr1_x(machine, chr_page ^ 3, chr_base | (vrom_bank[7] & chr_mask), chr_src[7]); |
| 9073 | | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr_src[2]); |
| 9074 | | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr_src[3]); |
| 9075 | | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr_src[4]); |
| 9076 | | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr_src[5]); |
| 9077 | | } |
| 9078 | | |
| 9079 | | static WRITE8_HANDLER( mapper199_w ) |
| 9080 | | { |
| 9081 | | UINT8 MMC3_helper, cmd; |
| 9082 | | LOG_MMC(("mapper199_w, offset: %04x, data: %02x\n", offset, data)); |
| 9083 | | |
| 9084 | | switch (offset & 0x6001) |
| 9085 | | { |
| 9086 | | case 0x0000: |
| 9087 | | MMC3_helper = mmc_cmd1 ^ data; |
| 9088 | | mmc_cmd1 = data; |
| 9089 | | |
| 9090 | | /* Has PRG Mode changed? */ |
| 9091 | | if (MMC3_helper & 0x40) |
| 9092 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9093 | | |
| 9094 | | /* Has CHR Mode changed? */ |
| 9095 | | if (MMC3_helper & 0x80) |
| 9096 | | mapper199_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 9097 | | break; |
| 9098 | | |
| 9099 | | case 0x0001: |
| 9100 | | cmd = mmc_cmd1 & 0x0f; |
| 9101 | | switch (cmd) |
| 9102 | | { |
| 9103 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 9104 | | case 2: case 3: case 4: case 5: |
| 9105 | | vrom_bank[cmd] = data; |
| 9106 | | mapper199_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 9107 | | break; |
| 9108 | | case 6: |
| 9109 | | case 7: |
| 9110 | | case 8: |
| 9111 | | case 9: |
| 9112 | | prg_bank[cmd - 6] = data; |
| 9113 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9114 | | break; |
| 9115 | | case 0x0a: case 0x0b: |
| 9116 | | vrom_bank[cmd - 4] = data; |
| 9117 | | mapper199_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 9118 | | break; |
| 9119 | | } |
| 9120 | | break; |
| 9121 | | |
| 9122 | | default: |
| 9123 | | mapper4_w(space, offset, data); |
| 9124 | | break; |
| 9125 | | } |
| 9126 | | } |
| 9127 | | |
| 9128 | | /************************************************************* |
| 9129 | | |
| 9130 | | Mapper 200 |
| 9131 | | |
| 9132 | | Known Boards: Unknown Bootleg Multigame Board |
| 9133 | | Games: 36 in 1, 1200 in 1 |
| 9134 | | |
| 9135 | | In MESS: Supported. |
| 9136 | | |
| 9137 | | *************************************************************/ |
| 9138 | | |
| 9139 | | static WRITE8_HANDLER( mapper200_w ) |
| 9140 | | { |
| 9141 | | LOG_MMC(("mapper200_w, offset: %04x, data: %02x\n", offset, data)); |
| 9142 | | |
| 9143 | | prg16_89ab(space->machine, offset & 0x07); |
| 9144 | | prg16_cdef(space->machine, offset & 0x07); |
| 9145 | | chr8(space->machine, offset & 0x07, CHRROM); |
| 9146 | | |
| 9147 | | set_nt_mirroring((offset & 0x08) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9148 | | } |
| 9149 | | |
| 9150 | | /************************************************************* |
| 9151 | | |
| 9152 | | Mapper 201 |
| 9153 | | |
| 9154 | | Known Boards: Unknown Bootleg Multigame Board |
| 9155 | | Games: 8 in 1, 21 in 1 |
| 9156 | | |
| 9157 | | In MESS: Supported. |
| 9158 | | |
| 9159 | | *************************************************************/ |
| 9160 | | |
| 9161 | | static WRITE8_HANDLER( mapper201_w ) |
| 9162 | | { |
| 9163 | | LOG_MMC(("mapper201_w, offset: %04x, data: %02x\n", offset, data)); |
| 9164 | | |
| 9165 | | prg32(space->machine, offset & 0x03); |
| 9166 | | chr8(space->machine, offset & 0x03, CHRROM); |
| 9167 | | } |
| 9168 | | |
| 9169 | | /************************************************************* |
| 9170 | | |
| 9171 | | Mapper 202 |
| 9172 | | |
| 9173 | | Known Boards: Unknown Bootleg Multigame Board |
| 9174 | | Games: 150 in 1 |
| 9175 | | |
| 9176 | | In MESS: Supported. |
| 9177 | | |
| 9178 | | *************************************************************/ |
| 9179 | | |
| 9180 | | static WRITE8_HANDLER( mapper202_w ) |
| 9181 | | { |
| 9182 | | int bank = (offset >> 1) & 0x07; |
| 9183 | | |
| 9184 | | LOG_MMC(("mapper202_w, offset: %04x, data: %02x\n", offset, data)); |
| 9185 | | |
| 9186 | | prg16_89ab(space->machine, bank); |
| 9187 | | prg16_cdef(space->machine, bank + (((bank & 0x06) == 0x06) ? 1 : 0)); |
| 9188 | | chr8(space->machine, bank, CHRROM); |
| 9189 | | |
| 9190 | | set_nt_mirroring((offset & 0x01) ? PPU_MIRROR_HORZ: PPU_MIRROR_VERT); |
| 9191 | | } |
| 9192 | | |
| 9193 | | /************************************************************* |
| 9194 | | |
| 9195 | | Mapper 203 |
| 9196 | | |
| 9197 | | Known Boards: Unknown Bootleg Multigame Board |
| 9198 | | Games: 35 in 1 |
| 9199 | | |
| 9200 | | In MESS: Supported. |
| 9201 | | |
| 9202 | | *************************************************************/ |
| 9203 | | |
| 9204 | | static WRITE8_HANDLER( mapper203_w ) |
| 9205 | | { |
| 9206 | | LOG_MMC(("mapper203_w, offset: %04x, data: %02x\n", offset, data)); |
| 9207 | | |
| 9208 | | prg16_89ab(space->machine, (data >> 2) & 0x03); |
| 9209 | | prg16_cdef(space->machine, (data >> 2) & 0x03); |
| 9210 | | chr8(space->machine, data & 0x03, CHRROM); |
| 9211 | | } |
| 9212 | | |
| 9213 | | /************************************************************* |
| 9214 | | |
| 9215 | | Mapper 204 |
| 9216 | | |
| 9217 | | Known Boards: Unknown Bootleg Multigame Board |
| 9218 | | Games: 64 in 1 |
| 9219 | | |
| 9220 | | In MESS: Supported. |
| 9221 | | |
| 9222 | | *************************************************************/ |
| 9223 | | |
| 9224 | | static WRITE8_HANDLER( mapper204_w ) |
| 9225 | | { |
| 9226 | | int bank = (offset >> 1) & (offset >> 2) & 0x01; |
| 9227 | | |
| 9228 | | LOG_MMC(("mapper204_w, offset: %04x, data: %02x\n", offset, data)); |
| 9229 | | |
| 9230 | | prg16_89ab(space->machine, offset & ~bank); |
| 9231 | | prg16_cdef(space->machine, offset | bank); |
| 9232 | | chr8(space->machine, offset & ~bank, CHRROM); |
| 9233 | | |
| 9234 | | set_nt_mirroring((offset & 0x10) ? PPU_MIRROR_HORZ: PPU_MIRROR_VERT); |
| 9235 | | } |
| 9236 | | |
| 9237 | | /************************************************************* |
| 9238 | | |
| 9239 | | Mapper 205 |
| 9240 | | |
| 9241 | | Known Boards: Unknown Bootleg Multigame Board |
| 9242 | | Games: 3 in 1, 15 in 1 |
| 9243 | | |
| 9244 | | MMC3 clone |
| 9245 | | |
| 9246 | | In MESS: Supported. |
| 9247 | | |
| 9248 | | *************************************************************/ |
| 9249 | | |
| 9250 | | static WRITE8_HANDLER( mapper205_m_w ) |
| 9251 | | { |
| 9252 | | LOG_MMC(("mapper205_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 9253 | | |
| 9254 | | if (offset & 0x0800) |
| 9255 | | { |
| 9256 | | mmc_prg_base = (data & 0x03) << 4; |
| 9257 | | mmc_prg_mask = (data & 0x02) ? 0x0f : 0x1f; |
| 9258 | | mmc_chr_base = (data & 0x03) << 7; |
| 9259 | | mmc_chr_mask = (data & 0x02) ? 0x7f : 0xff; |
| 9260 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9261 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 9262 | | } |
| 9263 | | } |
| 9264 | | |
| 9265 | | /************************************************************* |
| 9266 | | |
| 9267 | | Mapper 206 |
| 9268 | | |
| 9269 | | Known Boards: Namcot 34x3 boards, DEROM, DE1ROM, DRROM and |
| 9270 | | Tengen 800002, 800004, 800030 boards |
| 9271 | | Games: Babel no Tou, Dragon Buster II, Family Circuit, |
| 9272 | | Family Tennis, Fantasy Zone, Gauntlet, Karnov, |
| 9273 | | Mappy Land, Pac-Mania, R.B.I. Baseball, Super Sprint |
| 9274 | | |
| 9275 | | In MESS: Supported. |
| 9276 | | |
| 9277 | | *************************************************************/ |
| 9278 | | |
| 9279 | | static WRITE8_HANDLER( mapper206_w ) |
| 9280 | | { |
| 9281 | | if ((offset & 0x6001) == 0x2000) |
| 9282 | | return; |
| 9283 | | |
| 9284 | | mapper4_w(space, offset, data); |
| 9285 | | } |
| 9286 | | |
| 9287 | | /************************************************************* |
| 9288 | | |
| 9289 | | Mapper 207 |
| 9290 | | |
| 9291 | | Known Boards: Taito X1-005 Ver. B |
| 9292 | | Games: Fudou Myouou Den |
| 9293 | | |
| 9294 | | Very similar to mapper 80, but with a very particular NT |
| 9295 | | mirroring procedure (see below) |
| 9296 | | |
| 9297 | | In MESS: Supported. |
| 9298 | | |
| 9299 | | *************************************************************/ |
| 9300 | | |
| 9301 | | static WRITE8_HANDLER( mapper207_m_w ) |
| 9302 | | { |
| 9303 | | LOG_MMC(("mapper207_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 9304 | | |
| 9305 | | switch (offset) |
| 9306 | | { |
| 9307 | | case 0x1ef0: |
| 9308 | | set_nt_page(0, CIRAM, (data & 0x80) ? 1 : 0, 1); |
| 9309 | | set_nt_page(1, CIRAM, (data & 0x80) ? 1 : 0, 1); |
| 9310 | | /* Switch 2k VROM at $0000 */ |
| 9311 | | chr2_0(space->machine, (data & 0x7f) >> 1, CHRROM); |
| 9312 | | break; |
| 9313 | | case 0x1ef1: |
| 9314 | | set_nt_page(2, CIRAM, (data & 0x80) ? 1 : 0, 1); |
| 9315 | | set_nt_page(3, CIRAM, (data & 0x80) ? 1 : 0, 1); |
| 9316 | | /* Switch 2k VROM at $0000 */ |
| 9317 | | chr2_2(space->machine, (data & 0x7f) >> 1, CHRROM); |
| 9318 | | break; |
| 9319 | | case 0x1ef2: |
| 9320 | | /* Switch 1k VROM at $1000 */ |
| 9321 | | chr1_4(space->machine, data, CHRROM); |
| 9322 | | break; |
| 9323 | | case 0x1ef3: |
| 9324 | | /* Switch 1k VROM at $1400 */ |
| 9325 | | chr1_5(space->machine, data, CHRROM); |
| 9326 | | break; |
| 9327 | | case 0x1ef4: |
| 9328 | | /* Switch 1k VROM at $1800 */ |
| 9329 | | chr1_6(space->machine, data, CHRROM); |
| 9330 | | break; |
| 9331 | | case 0x1ef5: |
| 9332 | | /* Switch 1k VROM at $1c00 */ |
| 9333 | | chr1_7(space->machine, data, CHRROM); |
| 9334 | | break; |
| 9335 | | case 0x1efa: |
| 9336 | | case 0x1efb: |
| 9337 | | /* Switch 8k ROM at $8000 */ |
| 9338 | | prg8_89(space->machine, data); |
| 9339 | | break; |
| 9340 | | case 0x1efc: |
| 9341 | | case 0x1efd: |
| 9342 | | /* Switch 8k ROM at $a000 */ |
| 9343 | | prg8_ab(space->machine, data); |
| 9344 | | break; |
| 9345 | | case 0x1efe: |
| 9346 | | case 0x1eff: |
| 9347 | | /* Switch 8k ROM at $c000 */ |
| 9348 | | prg8_cd(space->machine, data); |
| 9349 | | break; |
| 9350 | | default: |
| 9351 | | logerror("mapper207_m_w uncaught addr: %04x, value: %02x\n", offset + 0x6000, data); |
| 9352 | | break; |
| 9353 | | } |
| 9354 | | } |
| 9355 | | |
| 9356 | | /************************************************************* |
| 9357 | | |
| 9358 | | Mapper 208 |
| 9359 | | |
| 9360 | | Known Boards: 37017 (?) by Gouder |
| 9361 | | Games: Street Fighter IV |
| 9362 | | |
| 9363 | | MMC3 clone. It also requires reads from 0x5000-0x7fff. |
| 9364 | | |
| 9365 | | In MESS: Preliminary Support. |
| 9366 | | |
| 9367 | | *************************************************************/ |
| 9368 | | |
| 9369 | | static WRITE8_HANDLER( mapper208_l_w ) |
| 9370 | | { |
| 9371 | | static const UINT8 conv_table[256] = |
| 9372 | | { |
| 9373 | | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x49,0x19,0x09,0x59,0x49,0x19,0x09, |
| 9374 | | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x51,0x41,0x11,0x01,0x51,0x41,0x11,0x01, |
| 9375 | | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x49,0x19,0x09,0x59,0x49,0x19,0x09, |
| 9376 | | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x51,0x41,0x11,0x01,0x51,0x41,0x11,0x01, |
| 9377 | | 0x00,0x10,0x40,0x50,0x00,0x10,0x40,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 9378 | | 0x08,0x18,0x48,0x58,0x08,0x18,0x48,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 9379 | | 0x00,0x10,0x40,0x50,0x00,0x10,0x40,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 9380 | | 0x08,0x18,0x48,0x58,0x08,0x18,0x48,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 9381 | | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x58,0x48,0x18,0x08,0x58,0x48,0x18,0x08, |
| 9382 | | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x50,0x40,0x10,0x00,0x50,0x40,0x10,0x00, |
| 9383 | | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x58,0x48,0x18,0x08,0x58,0x48,0x18,0x08, |
| 9384 | | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x50,0x40,0x10,0x00,0x50,0x40,0x10,0x00, |
| 9385 | | 0x01,0x11,0x41,0x51,0x01,0x11,0x41,0x51,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 9386 | | 0x09,0x19,0x49,0x59,0x09,0x19,0x49,0x59,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 9387 | | 0x01,0x11,0x41,0x51,0x01,0x11,0x41,0x51,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 9388 | | 0x09,0x19,0x49,0x59,0x09,0x19,0x49,0x59,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
| 9389 | | }; |
| 9390 | | |
| 9391 | | LOG_MMC(("mapper208_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 9392 | | |
| 9393 | | if (!(offset < 0x1700)) |
| 9394 | | map208_reg[offset & 0x03] = data ^ conv_table[map208_reg[4]]; |
| 9395 | | else if (!(offset < 0xf00)) |
| 9396 | | map208_reg[4] = data; |
| 9397 | | else if (!(offset < 0x700)) |
| 9398 | | prg32(space->machine, ((data >> 3) & 0x02) | (data & 0x01)); |
| 9399 | | } |
| 9400 | | |
| 9401 | | static READ8_HANDLER( mapper208_l_r ) |
| 9402 | | { |
| 9403 | | LOG_MMC(("mapper208_l_r, offset: %04x\n", offset)); |
| 9404 | | |
| 9405 | | if (!(offset < 0x1700)) |
| 9406 | | return map208_reg[offset & 0x03]; |
| 9407 | | |
| 9408 | | return 0x00; |
| 9409 | | } |
| 9410 | | |
| 9411 | | /* This is like mapper4 but with no PRG bankswitch (beacuse it is handled by low writes) */ |
| 9412 | | // replace with map189_w... they are the same!! |
| 9413 | | static WRITE8_HANDLER( mapper208_w ) |
| 9414 | | { |
| 9415 | | UINT8 MMC3_helper, cmd; |
| 9416 | | LOG_MMC(("mapper208_w, offset: %04x, data: %02x\n", offset, data)); |
| 9417 | | |
| 9418 | | switch (offset & 0x6001) |
| 9419 | | { |
| 9420 | | case 0x0000: |
| 9421 | | MMC3_helper = mmc_cmd1 ^ data; |
| 9422 | | mmc_cmd1 = data; |
| 9423 | | |
| 9424 | | /* Has CHR Mode changed? */ |
| 9425 | | if (MMC3_helper & 0x80) |
| 9426 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 9427 | | break; |
| 9428 | | |
| 9429 | | case 0x0001: |
| 9430 | | cmd = mmc_cmd1 & 0x07; |
| 9431 | | switch (cmd) |
| 9432 | | { |
| 9433 | | case 0: case 1: |
| 9434 | | case 2: case 3: case 4: case 5: |
| 9435 | | vrom_bank[cmd] = data; |
| 9436 | | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 9437 | | break; |
| 9438 | | } |
| 9439 | | break; |
| 9440 | | |
| 9441 | | default: |
| 9442 | | mapper4_w(space, offset, data); |
| 9443 | | break; |
| 9444 | | } |
| 9445 | | } |
| 9446 | | |
| 9447 | | /************************************************************* |
| 9448 | | |
| 9449 | | Mapper 209 |
| 9450 | | |
| 9451 | | Known Boards: Type B by J.Y. Company |
| 9452 | | Games: Power Rangers 3, Power Rangers 4, Shin Samurai |
| 9453 | | Spirits 2 |
| 9454 | | |
| 9455 | | In MESS: Unsupported. |
| 9456 | | |
| 9457 | | *************************************************************/ |
| 9458 | | |
| 9459 | | /************************************************************* |
| 9460 | | |
| 9461 | | Mapper 210 |
| 9462 | | |
| 9463 | | Known Boards: Undocumented / Unused ?!? |
| 9464 | | Games: ---------- |
| 9465 | | |
| 9466 | | For some emulators, this is the same as Mapper 19 but it |
| 9467 | | has hardwired mirroring and no additional sound hardware. |
| 9468 | | Initializing Mirroring to Vertical in Mapper 19 seems to |
| 9469 | | fix all glitches in 'so-called' Mapper 210 games, so there |
| 9470 | | seems to be no reason to have this duplicate mapper (at |
| 9471 | | least until we emulate additional sound hardware... if sound |
| 9472 | | writes would create conflicts, we might consider to split the |
| 9473 | | mapper in two variants) |
| 9474 | | |
| 9475 | | In MESS: ---------- |
| 9476 | | |
| 9477 | | *************************************************************/ |
| 9478 | | |
| 9479 | | /************************************************************* |
| 9480 | | |
| 9481 | | Mapper 211 |
| 9482 | | |
| 9483 | | Known Boards: Type C by J.Y. Company |
| 9484 | | Games: Tiny Toon Adventures 6, Donkey Kong Country 4 |
| 9485 | | |
| 9486 | | In MESS: Unsupported. |
| 9487 | | |
| 9488 | | *************************************************************/ |
| 9489 | | |
| 9490 | | /************************************************************* |
| 9491 | | |
| 9492 | | Mapper 212 |
| 9493 | | |
| 9494 | | Known Boards: Unknown Bootleg Multigame Board |
| 9495 | | Games: 100000 in 1, Super HIK 300 in 1, 1997 in 1 |
| 9496 | | |
| 9497 | | In MESS: Supported. |
| 9498 | | |
| 9499 | | *************************************************************/ |
| 9500 | | |
| 9501 | | static WRITE8_HANDLER( mapper212_w ) |
| 9502 | | { |
| 9503 | | LOG_MMC(("mapper212_w, offset: %04x, data: %02x\n", offset, data)); |
| 9504 | | |
| 9505 | | set_nt_mirroring((offset & 0x08) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9506 | | chr8(space->machine, offset, CHRROM); |
| 9507 | | |
| 9508 | | if (offset < 0x4000) |
| 9509 | | { |
| 9510 | | prg16_89ab(space->machine, offset); |
| 9511 | | prg16_cdef(space->machine, offset); |
| 9512 | | } |
| 9513 | | else |
| 9514 | | prg32(space->machine, offset >> 1); |
| 9515 | | } |
| 9516 | | |
| 9517 | | /************************************************************* |
| 9518 | | |
| 9519 | | Mapper 213 |
| 9520 | | |
| 9521 | | Known Boards: Unknown Bootleg Multigame Board |
| 9522 | | Games: 9999999 in 1 |
| 9523 | | |
| 9524 | | In MESS: Supported. |
| 9525 | | |
| 9526 | | *************************************************************/ |
| 9527 | | |
| 9528 | | static WRITE8_HANDLER( mapper213_w ) |
| 9529 | | { |
| 9530 | | LOG_MMC(("mapper213_w, offset: %04x, data: %02x\n", offset, data)); |
| 9531 | | |
| 9532 | | prg32(space->machine, offset >> 1); |
| 9533 | | chr8(space->machine, offset >> 3, CHRROM); |
| 9534 | | } |
| 9535 | | |
| 9536 | | /************************************************************* |
| 9537 | | |
| 9538 | | Mapper 214 |
| 9539 | | |
| 9540 | | Known Boards: Unknown Bootleg Multigame Board |
| 9541 | | Games: Super Gun 20 in 1 |
| 9542 | | |
| 9543 | | In MESS: Supported. |
| 9544 | | |
| 9545 | | *************************************************************/ |
| 9546 | | |
| 9547 | | static WRITE8_HANDLER( mapper214_w ) |
| 9548 | | { |
| 9549 | | LOG_MMC(("mapper214_w, offset: %04x, data: %02x\n", offset, data)); |
| 9550 | | |
| 9551 | | prg16_89ab(space->machine, offset >> 2); |
| 9552 | | prg16_cdef(space->machine, offset >> 2); |
| 9553 | | chr8(space->machine, offset, CHRROM); |
| 9554 | | } |
| 9555 | | |
| 9556 | | /************************************************************* |
| 9557 | | |
| 9558 | | Mapper 215 |
| 9559 | | |
| 9560 | | Known Boards: Unknown Bootleg Board by Super Game |
| 9561 | | Games: Boogerman, Mortal Kombat III |
| 9562 | | |
| 9563 | | MMC3 clone. Also, it probably needs a hack to support both |
| 9564 | | variants (Boogerman & MK3). |
| 9565 | | |
| 9566 | | In MESS: Preliminary support. |
| 9567 | | |
| 9568 | | *************************************************************/ |
| 9569 | | |
| 9570 | | // remove mask & base parameters! |
| 9571 | | static void mapper215_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 9572 | | { |
| 9573 | | if (map215_reg[0] & 0x80) |
| 9574 | | { |
| 9575 | | prg16_89ab(machine, (map215_reg[0] & 0xf0) | (map215_reg[1] & 0x10)); |
| 9576 | | prg16_cdef(machine, (map215_reg[0] & 0xf0) | (map215_reg[1] & 0x10)); |
| 9577 | | } |
| 9578 | | else |
| 9579 | | { |
| 9580 | | mmc_prg_base = (map215_reg[1] & 0x08) ? 0x20 : (map215_reg[1] & 0x10); |
| 9581 | | mmc_prg_mask = (map215_reg[1] & 0x08) ? 0x1f : 0x0f; |
| 9582 | | |
| 9583 | | mapper4_set_prg(machine, mmc_prg_base, mmc_prg_mask); |
| 9584 | | } |
| 9585 | | } |
| 9586 | | |
| 9587 | | static void mapper215_set_chr( running_machine *machine, UINT8 chr ) |
| 9588 | | { |
| 9589 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 9590 | | int chr_base = (map215_reg[1] & 0x04) ? 0x100 : ((map215_reg[1] & 0x10) << 3); |
| 9591 | | int chr_mask = (map215_reg[1] & 0x04) ? 0xff : 0x7f; |
| 9592 | | |
| 9593 | | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr); |
| 9594 | | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr); |
| 9595 | | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr); |
| 9596 | | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr); |
| 9597 | | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr); |
| 9598 | | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr); |
| 9599 | | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr); |
| 9600 | | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr); |
| 9601 | | } |
| 9602 | | |
| 9603 | | static WRITE8_HANDLER( mapper215_l_w ) |
| 9604 | | { |
| 9605 | | LOG_MMC(("mapper215_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 9606 | | offset += 0x100; |
| 9607 | | |
| 9608 | | if (offset == 0x1000) |
| 9609 | | { |
| 9610 | | map215_reg[0] = data; |
| 9611 | | mapper215_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9612 | | } |
| 9613 | | else if (offset == 0x1001) |
| 9614 | | { |
| 9615 | | map215_reg[1] = data; |
| 9616 | | mapper215_set_chr(space->machine, mmc_chr_source); |
| 9617 | | } |
| 9618 | | else if (offset == 0x1007) |
| 9619 | | { |
| 9620 | | mmc_cmd1 = 0; |
| 9621 | | map215_reg[2] = data; |
| 9622 | | mapper215_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9623 | | mapper215_set_chr(space->machine, mmc_chr_source); |
| 9624 | | } |
| 9625 | | } |
| 9626 | | |
| 9627 | | static WRITE8_HANDLER( mapper215_w ) |
| 9628 | | { |
| 9629 | | UINT8 MMC3_helper, cmd; |
| 9630 | | static const UINT8 conv_table[8] = {0,2,5,3,6,1,7,4}; |
| 9631 | | LOG_MMC(("mapper215_w, offset: %04x, data: %02x\n", offset, data)); |
| 9632 | | |
| 9633 | | if (!map215_reg[2]) // in this case we act like MMC3, only with alt prg/chr handlers |
| 9634 | | { |
| 9635 | | switch (offset & 0x6001) |
| 9636 | | { |
| 9637 | | case 0x0000: |
| 9638 | | MMC3_helper = mmc_cmd1 ^ data; |
| 9639 | | mmc_cmd1 = data; |
| 9640 | | |
| 9641 | | /* Has PRG Mode changed? */ |
| 9642 | | if (MMC3_helper & 0x40) |
| 9643 | | mapper215_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9644 | | |
| 9645 | | /* Has CHR Mode changed? */ |
| 9646 | | if (MMC3_helper & 0x80) |
| 9647 | | mapper215_set_chr(space->machine, mmc_chr_source); |
| 9648 | | break; |
| 9649 | | |
| 9650 | | case 0x0001: |
| 9651 | | cmd = mmc_cmd1 & 0x07; |
| 9652 | | switch (cmd) |
| 9653 | | { |
| 9654 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 9655 | | case 2: case 3: case 4: case 5: |
| 9656 | | vrom_bank[cmd] = data; |
| 9657 | | mapper215_set_chr(space->machine, mmc_chr_source); |
| 9658 | | break; |
| 9659 | | case 6: |
| 9660 | | case 7: |
| 9661 | | prg_bank[cmd - 6] = data; |
| 9662 | | mapper215_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9663 | | break; |
| 9664 | | } |
| 9665 | | break; |
| 9666 | | |
| 9667 | | default: |
| 9668 | | mapper4_w(space, offset, data); |
| 9669 | | break; |
| 9670 | | } |
| 9671 | | } |
| 9672 | | else |
| 9673 | | { |
| 9674 | | switch (offset & 0x6001) |
| 9675 | | { |
| 9676 | | case 0x0000: |
| 9677 | | break; |
| 9678 | | |
| 9679 | | case 0x0001: |
| 9680 | | cmd = mmc_cmd1 & 0x07; |
| 9681 | | if (map215_reg[3] && ((map215_reg[0] & 0x80) == 0 || cmd < 6)) // if we use the prg16 banks and cmd=6,7 DON'T enter! |
| 9682 | | { |
| 9683 | | map215_reg[3] = 0; |
| 9684 | | switch (cmd) |
| 9685 | | { |
| 9686 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 9687 | | case 2: case 3: case 4: case 5: |
| 9688 | | vrom_bank[cmd] = data; |
| 9689 | | mapper215_set_chr(space->machine, mmc_chr_source); |
| 9690 | | break; |
| 9691 | | case 6: |
| 9692 | | case 7: |
| 9693 | | prg_bank[cmd - 6] = data; |
| 9694 | | mapper215_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9695 | | break; |
| 9696 | | } |
| 9697 | | } |
| 9698 | | break; |
| 9699 | | |
| 9700 | | case 0x2000: |
| 9701 | | data = (data & 0xc0) | conv_table[data & 0x07]; |
| 9702 | | MMC3_helper = mmc_cmd1 ^ data; |
| 9703 | | mmc_cmd1 = data; |
| 9704 | | |
| 9705 | | /* Has PRG Mode changed? */ |
| 9706 | | if (MMC3_helper & 0x40) |
| 9707 | | mapper215_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9708 | | |
| 9709 | | /* Has CHR Mode changed? */ |
| 9710 | | if (MMC3_helper & 0x80) |
| 9711 | | mapper215_set_chr(space->machine, mmc_chr_source); |
| 9712 | | |
| 9713 | | map215_reg[3] = 1; |
| 9714 | | break; |
| 9715 | | |
| 9716 | | // case 0x2001: |
| 9717 | | // mapper4_w(space, 0x4001, data); |
| 9718 | | // break; |
| 9719 | | |
| 9720 | | case 0x4000: |
| 9721 | | set_nt_mirroring(((data >> 7) | data) & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9722 | | break; |
| 9723 | | |
| 9724 | | case 0x4001: |
| 9725 | | mapper4_w(space, 0x6001, data); |
| 9726 | | break; |
| 9727 | | |
| 9728 | | // case 0x6000: |
| 9729 | | // mapper4_w(space, 0x6000, data); |
| 9730 | | // break; |
| 9731 | | |
| 9732 | | case 0x6001: |
| 9733 | | mapper4_w(space, 0x4000, data); |
| 9734 | | mapper4_w(space, 0x4001, data); |
| 9735 | | break; |
| 9736 | | |
| 9737 | | default: |
| 9738 | | mapper4_w(space, offset, data); |
| 9739 | | break; |
| 9740 | | } |
| 9741 | | } |
| 9742 | | } |
| 9743 | | |
| 9744 | | /************************************************************* |
| 9745 | | |
| 9746 | | Mapper 216 |
| 9747 | | |
| 9748 | | Known Boards: Unknown Bootleg Board by RCM |
| 9749 | | Games: Bonza, Magic Jewelry 2 |
| 9750 | | |
| 9751 | | Very simple mapper: writes to 0x8000-0xffff sets prg32 |
| 9752 | | to offset and chr8 to offset>>1 (when chrrom is present) |
| 9753 | | |
| 9754 | | In MESS: Supported. |
| 9755 | | |
| 9756 | | *************************************************************/ |
| 9757 | | |
| 9758 | | static WRITE8_HANDLER( mapper216_w ) |
| 9759 | | { |
| 9760 | | LOG_MMC(("mapper216_w, offset: %04x, data: %02x\n", offset, data)); |
| 9761 | | |
| 9762 | | prg32(space->machine, offset); |
| 9763 | | chr8(space->machine, offset >> 1, mmc_chr_source); |
| 9764 | | } |
| 9765 | | |
| 9766 | | /************************************************************* |
| 9767 | | |
| 9768 | | Mapper 217 |
| 9769 | | |
| 9770 | | Known Boards: Unknown Bootleg Multigame Board |
| 9771 | | Games: Golden Card 6 in 1 |
| 9772 | | |
| 9773 | | MMC3 clone |
| 9774 | | |
| 9775 | | In MESS: Supported. |
| 9776 | | |
| 9777 | | *************************************************************/ |
| 9778 | | |
| 9779 | | // remove mask & base parameters! |
| 9780 | | static void mapper217_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 9781 | | { |
| 9782 | | mmc_prg_base = (map217_reg[1] & 0x08) ? 0 : (map217_reg[1] & 0x10); |
| 9783 | | mmc_prg_mask = (map217_reg[1] & 0x08) ? 0x1f : 0x0f; |
| 9784 | | |
| 9785 | | mmc_prg_base |= ((map217_reg[1] & 0x03) << 5); |
| 9786 | | |
| 9787 | | mapper4_set_prg(machine, mmc_prg_base, mmc_prg_mask); |
| 9788 | | } |
| 9789 | | |
| 9790 | | static void mapper217_set_chr( running_machine *machine, UINT8 chr ) |
| 9791 | | { |
| 9792 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 9793 | | int chr_base = (map217_reg[1] & 0x08) ? 0x00 : ((map217_reg[1] & 0x10) << 3); |
| 9794 | | int chr_mask = (map217_reg[1] & 0x08) ? 0xff : 0x7f; |
| 9795 | | |
| 9796 | | chr_base |= ((map217_reg[1] & 0x03) << 8); |
| 9797 | | |
| 9798 | | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr); |
| 9799 | | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr); |
| 9800 | | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr); |
| 9801 | | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr); |
| 9802 | | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr); |
| 9803 | | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr); |
| 9804 | | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr); |
| 9805 | | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr); |
| 9806 | | } |
| 9807 | | |
| 9808 | | static WRITE8_HANDLER( mapper217_l_w ) |
| 9809 | | { |
| 9810 | | UINT8 bank; |
| 9811 | | LOG_MMC(("mapper217_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 9812 | | offset += 0x100; |
| 9813 | | |
| 9814 | | if (offset == 0x1000) |
| 9815 | | { |
| 9816 | | map217_reg[0] = data; |
| 9817 | | if (data & 0x80) |
| 9818 | | { |
| 9819 | | bank = (data & 0x0f) | ((map217_reg[1] & 0x03) << 4); |
| 9820 | | prg16_89ab(space->machine, bank); |
| 9821 | | prg16_cdef(space->machine, bank); |
| 9822 | | } |
| 9823 | | else |
| 9824 | | mapper217_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9825 | | } |
| 9826 | | else if (offset == 0x1001) |
| 9827 | | { |
| 9828 | | map217_reg[1] = data; |
| 9829 | | mapper217_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9830 | | } |
| 9831 | | else if (offset == 0x1007) |
| 9832 | | { |
| 9833 | | map217_reg[2] = data; |
| 9834 | | } |
| 9835 | | } |
| 9836 | | |
| 9837 | | static WRITE8_HANDLER( mapper217_w ) |
| 9838 | | { |
| 9839 | | UINT8 MMC3_helper, cmd; |
| 9840 | | static const UINT8 conv_table[8] = {0, 6, 3, 7, 5, 2, 4, 1}; |
| 9841 | | LOG_MMC(("mapper217_w, offset: %04x, data: %02x\n", offset, data)); |
| 9842 | | |
| 9843 | | if (!map217_reg[2]) // in this case we act like MMC3, only with alt prg/chr handlers |
| 9844 | | { |
| 9845 | | switch (offset & 0x6001) |
| 9846 | | { |
| 9847 | | case 0x0000: |
| 9848 | | MMC3_helper = mmc_cmd1 ^ data; |
| 9849 | | mmc_cmd1 = data; |
| 9850 | | |
| 9851 | | /* Has PRG Mode changed? */ |
| 9852 | | if (MMC3_helper & 0x40) |
| 9853 | | mapper217_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9854 | | |
| 9855 | | /* Has CHR Mode changed? */ |
| 9856 | | if (MMC3_helper & 0x80) |
| 9857 | | mapper217_set_chr(space->machine, mmc_chr_source); |
| 9858 | | break; |
| 9859 | | |
| 9860 | | case 0x0001: |
| 9861 | | cmd = mmc_cmd1 & 0x07; |
| 9862 | | switch (cmd) |
| 9863 | | { |
| 9864 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 9865 | | case 2: case 3: case 4: case 5: |
| 9866 | | vrom_bank[cmd] = data; |
| 9867 | | mapper217_set_chr(space->machine, mmc_chr_source); |
| 9868 | | break; |
| 9869 | | case 6: |
| 9870 | | case 7: |
| 9871 | | prg_bank[cmd - 6] = data; |
| 9872 | | mapper217_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9873 | | break; |
| 9874 | | } |
| 9875 | | break; |
| 9876 | | |
| 9877 | | default: |
| 9878 | | mapper4_w(space, offset, data); |
| 9879 | | break; |
| 9880 | | } |
| 9881 | | } |
| 9882 | | else |
| 9883 | | { |
| 9884 | | switch (offset & 0x6001) |
| 9885 | | { |
| 9886 | | case 0x0000: |
| 9887 | | mapper4_w(space, 0xc000, data); |
| 9888 | | break; |
| 9889 | | |
| 9890 | | case 0x0001: |
| 9891 | | data = (data & 0xc0) | conv_table[data & 0x07]; |
| 9892 | | MMC3_helper = mmc_cmd1 ^ data; |
| 9893 | | mmc_cmd1 = data; |
| 9894 | | |
| 9895 | | /* Has PRG Mode changed? */ |
| 9896 | | if (MMC3_helper & 0x40) |
| 9897 | | mapper217_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9898 | | |
| 9899 | | /* Has CHR Mode changed? */ |
| 9900 | | if (MMC3_helper & 0x80) |
| 9901 | | mapper217_set_chr(space->machine, mmc_chr_source); |
| 9902 | | |
| 9903 | | map217_reg[3] = 1; |
| 9904 | | break; |
| 9905 | | |
| 9906 | | case 0x2000: |
| 9907 | | cmd = mmc_cmd1 & 0x07; |
| 9908 | | if (map217_reg[3]) |
| 9909 | | { |
| 9910 | | map217_reg[3] = 0; |
| 9911 | | switch (cmd) |
| 9912 | | { |
| 9913 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 9914 | | case 2: case 3: case 4: case 5: |
| 9915 | | vrom_bank[cmd] = data; |
| 9916 | | mapper217_set_chr(space->machine, mmc_chr_source); |
| 9917 | | break; |
| 9918 | | case 6: |
| 9919 | | case 7: |
| 9920 | | prg_bank[cmd - 6] = data; |
| 9921 | | mapper217_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9922 | | break; |
| 9923 | | } |
| 9924 | | } |
| 9925 | | break; |
| 9926 | | |
| 9927 | | |
| 9928 | | case 0x2001: |
| 9929 | | set_nt_mirroring(data & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9930 | | break; |
| 9931 | | |
| 9932 | | default: |
| 9933 | | mapper4_w(space, offset, data); |
| 9934 | | break; |
| 9935 | | } |
| 9936 | | } |
| 9937 | | } |
| 9938 | | |
| 9939 | | /************************************************************* |
| 9940 | | |
| 9941 | | Mapper 218 |
| 9942 | | |
| 9943 | | Known Boards: Undocumented / Unused ?!? |
| 9944 | | Games: ---------- |
| 9945 | | |
| 9946 | | In MESS: ---------- |
| 9947 | | |
| 9948 | | *************************************************************/ |
| 9949 | | |
| 9950 | | /************************************************************* |
| 9951 | | |
| 9952 | | Mapper 219 |
| 9953 | | |
| 9954 | | Known Boards: A9746?? |
| 9955 | | Games: [no games in nes.hsi] |
| 9956 | | |
| 9957 | | MMC3 clone according to NEStopia |
| 9958 | | |
| 9959 | | In MESS: Unsupported. |
| 9960 | | |
| 9961 | | *************************************************************/ |
| 9962 | | |
| 9963 | | /************************************************************* |
| 9964 | | |
| 9965 | | Mapper 220 |
| 9966 | | |
| 9967 | | Known Boards: ??? |
| 9968 | | Games: Summer Carnival '92 - Recca US ?? (MMC3 for nestopia) |
| 9969 | | |
| 9970 | | In MESS: Unsupported. |
| 9971 | | |
| 9972 | | *************************************************************/ |
| 9973 | | |
| 9974 | | /************************************************************* |
| 9975 | | |
| 9976 | | Mapper 221 |
| 9977 | | |
| 9978 | | Known Boards: Unknown Bootleg Board, N625092 |
| 9979 | | Games: 400 in 1, 700 in 1, 1000 in 1 |
| 9980 | | |
| 9981 | | In MESS: Supported. |
| 9982 | | |
| 9983 | | *************************************************************/ |
| 9984 | | |
| 9985 | | static void mapper221_set_prg( running_machine *machine, UINT8 reg1, UINT8 reg2 ) |
| 9986 | | { |
| 9987 | | UINT8 map221_helper1, map221_helper2; |
| 9988 | | |
| 9989 | | map221_helper1 = !(reg1 & 0x01) ? reg2 : |
| 9990 | | (reg1 & 0x80) ? reg2 : (reg2 & 0x06) | 0x00; |
| 9991 | | map221_helper2 = !(reg1 & 0x01) ? reg2 : |
| 9992 | | (reg1 & 0x80) ? 0x07 : (reg2 & 0x06) | 0x01; |
| 9993 | | |
| 9994 | | prg16_89ab(machine, map221_helper1 | ((reg1 & 0x70) >> 1)); |
| 9995 | | prg16_cdef(machine, map221_helper2 | ((reg1 & 0x70) >> 1)); |
| 9996 | | } |
| 9997 | | |
| 9998 | | static WRITE8_HANDLER( mapper221_w ) |
| 9999 | | { |
| 10000 | | LOG_MMC(("mapper221_w, offset: %04x, data: %02x\n", offset, data)); |
| 10001 | | |
| 10002 | | if (offset < 0x4000) |
| 10003 | | { |
| 10004 | | set_nt_mirroring(offset & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10005 | | offset = (offset >> 1) & 0xff; |
| 10006 | | |
| 10007 | | if (mmc_cmd1 != offset) |
| 10008 | | { |
| 10009 | | mmc_cmd1 = offset; |
| 10010 | | mapper221_set_prg(space->machine, mmc_cmd1, mmc_cmd2); |
| 10011 | | } |
| 10012 | | } |
| 10013 | | else |
| 10014 | | { |
| 10015 | | offset &= 0x07; |
| 10016 | | |
| 10017 | | if (mmc_cmd2 != offset) |
| 10018 | | { |
| 10019 | | mmc_cmd2 = offset; |
| 10020 | | mapper221_set_prg(space->machine, mmc_cmd1, mmc_cmd2); |
| 10021 | | } |
| 10022 | | } |
| 10023 | | } |
| 10024 | | |
| 10025 | | /************************************************************* |
| 10026 | | |
| 10027 | | Mapper 222 |
| 10028 | | |
| 10029 | | Known Boards: Unknown Bootleg Board |
| 10030 | | Games: Dragon Ninja (Bootleg), Super Mario Bros. 8 |
| 10031 | | |
| 10032 | | In MESS: Unsupported. |
| 10033 | | |
| 10034 | | *************************************************************/ |
| 10035 | | |
| 10036 | | /* Scanline based IRQ ? */ |
| 10037 | | static void mapper222_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 10038 | | { |
| 10039 | | if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE) |
| 10040 | | { |
| 10041 | | if (!IRQ_count || ++IRQ_count < 240) |
| 10042 | | return; |
| 10043 | | |
| 10044 | | IRQ_count = 0; |
| 10045 | | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, |
| 10046 | | video_screen_get_vpos(device->machine->primary_screen), video_screen_get_hpos(device->machine->primary_screen))); |
| 10047 | | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 10048 | | } |
| 10049 | | } |
| 10050 | | |
| 10051 | | static WRITE8_HANDLER( mapper222_w ) |
| 10052 | | { |
| 10053 | | UINT8 bank; |
| 10054 | | LOG_MMC(("mapper222_w, offset: %04x, data: %02x\n", offset, data)); |
| 10055 | | |
| 10056 | | switch (offset & 0x7003) |
| 10057 | | { |
| 10058 | | case 0x0000: |
| 10059 | | prg8_89(space->machine, data); |
| 10060 | | break; |
| 10061 | | case 0x1000: |
| 10062 | | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10063 | | break; |
| 10064 | | case 0x2000: |
| 10065 | | prg8_ab(space->machine, data); |
| 10066 | | break; |
| 10067 | | case 0x3000: |
| 10068 | | case 0x3002: |
| 10069 | | case 0x4000: |
| 10070 | | case 0x4002: |
| 10071 | | case 0x5000: |
| 10072 | | case 0x5002: |
| 10073 | | case 0x6000: |
| 10074 | | case 0x6002: |
| 10075 | | bank = ((offset & 0x7000) - 0x3000) / 0x0800 + ((offset & 0x0002) >> 3); |
| 10076 | | chr1_x(space->machine, bank, data, CHRROM); |
| 10077 | | break; |
| 10078 | | case 0x7000: |
| 10079 | | IRQ_count = data; |
| 10080 | | break; |
| 10081 | | } |
| 10082 | | } |
| 10083 | | |
| 10084 | | /************************************************************* |
| 10085 | | |
| 10086 | | Mapper 223 |
| 10087 | | |
| 10088 | | Known Boards: Type I by Waixing |
| 10089 | | Games: [no games in nes.hsi] Tang Mu Li Xian Ji? |
| 10090 | | |
| 10091 | | MMC3 clone according to NEStopia |
| 10092 | | |
| 10093 | | In MESS: Unsupported. |
| 10094 | | |
| 10095 | | *************************************************************/ |
| 10096 | | |
| 10097 | | /************************************************************* |
| 10098 | | |
| 10099 | | Mapper 224 |
| 10100 | | |
| 10101 | | Known Boards: Type J by Waixing |
| 10102 | | Games: [no games in nes.hsi] Ying Xiong Chuan Qi? |
| 10103 | | |
| 10104 | | MMC3 clone according to NEStopia |
| 10105 | | |
| 10106 | | In MESS: Unsupported. |
| 10107 | | |
| 10108 | | *************************************************************/ |
| 10109 | | |
| 10110 | | /************************************************************* |
| 10111 | | |
| 10112 | | Mapper 225 |
| 10113 | | |
| 10114 | | Known Boards: Unknown Bootleg Multigame Board |
| 10115 | | Games: 72 in 1, 115 in 1 and other multigame carts |
| 10116 | | |
| 10117 | | In MESS: Supported. |
| 10118 | | |
| 10119 | | *************************************************************/ |
| 10120 | | |
| 10121 | | static WRITE8_HANDLER( mapper225_w ) |
| 10122 | | { |
| 10123 | | int hi_bank; |
| 10124 | | int size_16; |
| 10125 | | int bank; |
| 10126 | | |
| 10127 | | LOG_MMC(("mapper225_w, offset: %04x, data: %02x\n", offset, data)); |
| 10128 | | |
| 10129 | | chr8(space->machine, offset, CHRROM); |
| 10130 | | set_nt_mirroring((offset & 0x2000) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10131 | | |
| 10132 | | hi_bank = offset & 0x40; |
| 10133 | | size_16 = offset & 0x1000; |
| 10134 | | bank = (offset & 0xf80) >> 7; |
| 10135 | | if (size_16) |
| 10136 | | { |
| 10137 | | bank <<= 1; |
| 10138 | | if (hi_bank) |
| 10139 | | bank ++; |
| 10140 | | |
| 10141 | | prg16_89ab(space->machine, bank); |
| 10142 | | prg16_cdef(space->machine, bank); |
| 10143 | | } |
| 10144 | | else |
| 10145 | | prg32(space->machine, bank); |
| 10146 | | } |
| 10147 | | |
| 10148 | | /************************************************************* |
| 10149 | | |
| 10150 | | Mapper 226 |
| 10151 | | |
| 10152 | | Known Boards: Unknown Bootleg Multigame Board |
| 10153 | | Games: 76 in 1, Super 42 in 1 |
| 10154 | | |
| 10155 | | In MESS: Supported. |
| 10156 | | |
| 10157 | | *************************************************************/ |
| 10158 | | |
| 10159 | | static WRITE8_HANDLER( mapper226_w ) |
| 10160 | | { |
| 10161 | | int hi_bank; |
| 10162 | | int size_16; |
| 10163 | | int bank; |
| 10164 | | |
| 10165 | | LOG_MMC(("mapper226_w, offset: %04x, data: %02x\n", offset, data)); |
| 10166 | | |
| 10167 | | if (offset & 0x01) |
| 10168 | | { |
| 10169 | | mmc_cmd2 = data; |
| 10170 | | } |
| 10171 | | else |
| 10172 | | { |
| 10173 | | mmc_cmd1 = data; |
| 10174 | | } |
| 10175 | | |
| 10176 | | set_nt_mirroring((mmc_cmd1 & 0x40) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10177 | | |
| 10178 | | hi_bank = mmc_cmd1 & 0x01; |
| 10179 | | size_16 = mmc_cmd1 & 0x20; |
| 10180 | | bank = ((mmc_cmd1 & 0x1e) >> 1) | ((mmc_cmd1 & 0x80) >> 3) | ((mmc_cmd2 & 0x01) << 5); |
| 10181 | | |
| 10182 | | if (size_16) |
| 10183 | | { |
| 10184 | | bank <<= 1; |
| 10185 | | if (hi_bank) |
| 10186 | | bank ++; |
| 10187 | | |
| 10188 | | prg16_89ab(space->machine, bank); |
| 10189 | | prg16_cdef(space->machine, bank); |
| 10190 | | } |
| 10191 | | else |
| 10192 | | prg32(space->machine, bank); |
| 10193 | | } |
| 10194 | | |
| 10195 | | /************************************************************* |
| 10196 | | |
| 10197 | | Mapper 227 |
| 10198 | | |
| 10199 | | Known Boards: Unknown Bootleg Multigame Board |
| 10200 | | Games: 1200 in 1, 295 in 1, 76 in 1 |
| 10201 | | |
| 10202 | | In MESS: Supported. |
| 10203 | | |
| 10204 | | *************************************************************/ |
| 10205 | | |
| 10206 | | static WRITE8_HANDLER( mapper227_w ) |
| 10207 | | { |
| 10208 | | int hi_bank; |
| 10209 | | int size_32; |
| 10210 | | int bank; |
| 10211 | | |
| 10212 | | LOG_MMC(("mapper227_w, offset: %04x, data: %02x\n", offset, data)); |
| 10213 | | |
| 10214 | | hi_bank = offset & 0x04; |
| 10215 | | size_32 = offset & 0x01; |
| 10216 | | bank = ((offset & 0x78) >> 3) | ((offset & 0x0100) >> 4); |
| 10217 | | if (!size_32) |
| 10218 | | { |
| 10219 | | bank <<= 1; |
| 10220 | | if (hi_bank) |
| 10221 | | bank ++; |
| 10222 | | |
| 10223 | | prg16_89ab(space->machine, bank); |
| 10224 | | prg16_cdef(space->machine, bank); |
| 10225 | | } |
| 10226 | | else |
| 10227 | | prg32(space->machine, bank); |
| 10228 | | |
| 10229 | | if (!(offset & 0x80)) |
| 10230 | | { |
| 10231 | | if (offset & 0x200) |
| 10232 | | prg16_cdef(space->machine, ((bank << 1) & 0x38) + 7); |
| 10233 | | else |
| 10234 | | prg16_cdef(space->machine, ((bank << 1) & 0x38)); |
| 10235 | | } |
| 10236 | | |
| 10237 | | set_nt_mirroring((offset & 0x02) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10238 | | } |
| 10239 | | |
| 10240 | | /************************************************************* |
| 10241 | | |
| 10242 | | Mapper 228 |
| 10243 | | |
| 10244 | | Known Boards: Bootleg Board by Active Enterprise |
| 10245 | | Games: Action 52, Cheetah Men II |
| 10246 | | |
| 10247 | | In MESS: Partially Supported. |
| 10248 | | |
| 10249 | | *************************************************************/ |
| 10250 | | |
| 10251 | | static WRITE8_HANDLER( mapper228_w ) |
| 10252 | | { |
| 10253 | | int prg_bank, prg_chip, chr_bank; |
| 10254 | | UINT8 prg_mode; |
| 10255 | | LOG_MMC(("mapper228_w, offset: %04x, data: %02x\n", offset, data)); |
| 10256 | | |
| 10257 | | set_nt_mirroring((offset & 0x2000) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10258 | | |
| 10259 | | chr_bank = (data & 0x03) | ((offset & 0x0f) << 2); |
| 10260 | | chr8(space->machine, chr_bank, CHRROM); |
| 10261 | | |
| 10262 | | prg_bank = (offset & 0x7c0) >> 6; |
| 10263 | | prg_chip = (offset & 0x1800) >> 11; |
| 10264 | | prg_mode = offset & 0x20; |
| 10265 | | |
| 10266 | | switch (prg_chip) |
| 10267 | | { |
| 10268 | | case 0: break; // we are already at the correct bank |
| 10269 | | case 1: prg_bank |= 0x10; break; // chip 1 starts at block 16 |
| 10270 | | case 2: break; // chip 2 was an empty socket |
| 10271 | | case 3: prg_bank |= 0x20; break; // chip 3 starts at block 32 |
| 10272 | | } |
| 10273 | | |
| 10274 | | if (prg_mode) |
| 10275 | | { |
| 10276 | | prg16_89ab(space->machine, prg_bank); |
| 10277 | | prg16_cdef(space->machine, prg_bank); |
| 10278 | | } |
| 10279 | | else |
| 10280 | | prg32(space->machine, prg_bank >> 1); |
| 10281 | | } |
| 10282 | | |
| 10283 | | /************************************************************* |
| 10284 | | |
| 10285 | | Mapper 229 |
| 10286 | | |
| 10287 | | Known Boards: Unknown Bootleg Multigame Board |
| 10288 | | Games: 31 in 1 |
| 10289 | | |
| 10290 | | In MESS: Supported. |
| 10291 | | |
| 10292 | | *************************************************************/ |
| 10293 | | |
| 10294 | | static WRITE8_HANDLER( mapper229_w ) |
| 10295 | | { |
| 10296 | | LOG_MMC(("mapper229_w, offset: %04x, data: %02x\n", offset, data)); |
| 10297 | | |
| 10298 | | set_nt_mirroring((offset & 0x20) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10299 | | chr8(space->machine, offset, CHRROM); |
| 10300 | | |
| 10301 | | if ((offset & 0x1e) == 0) |
| 10302 | | { |
| 10303 | | prg16_89ab(space->machine, 0); |
| 10304 | | prg16_89ab(space->machine, 1); |
| 10305 | | } |
| 10306 | | else |
| 10307 | | { |
| 10308 | | prg16_89ab(space->machine, offset & 0x1f); |
| 10309 | | prg16_89ab(space->machine, offset & 0x1f); |
| 10310 | | } |
| 10311 | | } |
| 10312 | | |
| 10313 | | /************************************************************* |
| 10314 | | |
| 10315 | | Mapper 230 |
| 10316 | | |
| 10317 | | Known Boards: Unknown Bootleg Multigame Board |
| 10318 | | Games: 22 in 1 |
| 10319 | | |
| 10320 | | In MESS: Partially Supported. It would need a reset |
| 10321 | | to work (not possible yet) |
| 10322 | | |
| 10323 | | *************************************************************/ |
| 10324 | | |
| 10325 | | static WRITE8_HANDLER( mapper230_w ) |
| 10326 | | { |
| 10327 | | LOG_MMC(("mapper230_w, offset: %04x, data: %02x\n", offset, data)); |
| 10328 | | |
| 10329 | | if (1) // this should flip at reset |
| 10330 | | { |
| 10331 | | prg16_89ab(space->machine, data & 0x07); |
| 10332 | | } |
| 10333 | | else |
| 10334 | | { |
| 10335 | | if (data & 0x20) |
| 10336 | | { |
| 10337 | | prg16_89ab(space->machine, (data & 0x1f) + 8); |
| 10338 | | prg16_cdef(space->machine, (data & 0x1f) + 8); |
| 10339 | | } |
| 10340 | | else |
| 10341 | | { |
| 10342 | | prg16_89ab(space->machine, (data & 0x1f) + 8); |
| 10343 | | prg16_cdef(space->machine, (data & 0x1f) + 9); |
| 10344 | | } |
| 10345 | | set_nt_mirroring((data & 0x40) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 10346 | | } |
| 10347 | | } |
| 10348 | | |
| 10349 | | /************************************************************* |
| 10350 | | |
| 10351 | | Mapper 231 |
| 10352 | | |
| 10353 | | Known Boards: Unknown Bootleg Multigame Board |
| 10354 | | Games: 20 in 1 |
| 10355 | | |
| 10356 | | In MESS: Supported. |
| 10357 | | |
| 10358 | | *************************************************************/ |
| 10359 | | |
| 10360 | | static WRITE8_HANDLER( mapper231_w ) |
| 10361 | | { |
| 10362 | | LOG_MMC(("mapper231_w, offset: %04x, data: %02x\n", offset, data)); |
| 10363 | | |
| 10364 | | set_nt_mirroring((offset & 0x80) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10365 | | |
| 10366 | | prg16_89ab(space->machine, (offset & 0x1e)); |
| 10367 | | prg16_cdef(space->machine, (offset & 0x1e) | ((offset & 0x20) ? 1 : 0)); |
| 10368 | | } |
| 10369 | | |
| 10370 | | /************************************************************* |
| 10371 | | |
| 10372 | | Mapper 232 |
| 10373 | | |
| 10374 | | Known Boards: Camerica BF9096 & ALGQV11 Boards |
| 10375 | | Games: Quattro Adventure, Quattro Arcade, Quattro Sports |
| 10376 | | |
| 10377 | | Writes to 0x8000-0x9fff set prg block to (data&0x18)>>1, |
| 10378 | | writes to 0xa000-0xbfff set prg page to data&3. selected |
| 10379 | | prg are: prg16_89ab = block|page, prg_cdef = 3|page. |
| 10380 | | For more info on the hardware to bypass the NES lockout, see |
| 10381 | | Kevtris' Camerica Mappers documentation. |
| 10382 | | |
| 10383 | | In MESS: Supported. |
| 10384 | | |
| 10385 | | *************************************************************/ |
| 10386 | | |
| 10387 | | static void mapper232_set_prg( running_machine *machine ) |
| 10388 | | { |
| 10389 | | prg16_89ab(machine, (mmc_cmd2 & 0x03) | ((mmc_cmd1 & 0x18) >> 1)); |
| 10390 | | prg16_cdef(machine, 0x03 | ((mmc_cmd1 & 0x18) >> 1)); |
| 10391 | | } |
| 10392 | | |
| 10393 | | static WRITE8_HANDLER( mapper232_w ) |
| 10394 | | { |
| 10395 | | LOG_MMC(("mapper232_w, offset: %04x, data: %02x\n", offset, data)); |
| 10396 | | |
| 10397 | | if (offset < 0x2000) |
| 10398 | | mmc_cmd1 = data; |
| 10399 | | else |
| 10400 | | mmc_cmd2 = data; |
| 10401 | | |
| 10402 | | mapper232_set_prg(space->machine); |
| 10403 | | } |
| 10404 | | |
| 10405 | | /************************************************************* |
| 10406 | | |
| 10407 | | Mapper 233 |
| 10408 | | |
| 10409 | | Known Boards: Unknown Bootleg Multigame Board |
| 10410 | | Games: Super 22 in 1 |
| 10411 | | |
| 10412 | | In MESS: Unsupported. Banking depends on dipswitch, so we |
| 10413 | | need to implement these... |
| 10414 | | |
| 10415 | | *************************************************************/ |
| 10416 | | |
| 10417 | | /************************************************************* |
| 10418 | | |
| 10419 | | Mapper 234 |
| 10420 | | |
| 10421 | | Known Boards: Bootleg Board by AVE (D1012) |
| 10422 | | Games: Maxi 15 Eur |
| 10423 | | |
| 10424 | | In MESS: Unsupported. Needs to read from 0xff80-0xffff. |
| 10425 | | |
| 10426 | | *************************************************************/ |
| 10427 | | |
| 10428 | | /************************************************************* |
| 10429 | | |
| 10430 | | Mapper 235 |
| 10431 | | |
| 10432 | | Known Boards: Unknown Bootleg Board by Golden Game |
| 10433 | | Games: 260 in 1, 150 in 1 |
| 10434 | | |
| 10435 | | In MESS: Unsupported. |
| 10436 | | |
| 10437 | | *************************************************************/ |
| 10438 | | |
| 10439 | | /************************************************************* |
| 10440 | | |
| 10441 | | Mapper 236 |
| 10442 | | |
| 10443 | | Known Boards: Unknown Bootleg Multigame Board |
| 10444 | | Games: a 800 in 1 multigame cart present in NEStopia db. |
| 10445 | | |
| 10446 | | No info available. |
| 10447 | | |
| 10448 | | In MESS: Unsupported. |
| 10449 | | |
| 10450 | | *************************************************************/ |
| 10451 | | |
| 10452 | | /************************************************************* |
| 10453 | | |
| 10454 | | Mapper 237 |
| 10455 | | |
| 10456 | | Known Boards: Undocumented / Unused ?!? |
| 10457 | | Games: ---------- |
| 10458 | | |
| 10459 | | In MESS: ---------- |
| 10460 | | |
| 10461 | | *************************************************************/ |
| 10462 | | |
| 10463 | | /************************************************************* |
| 10464 | | |
| 10465 | | Mapper 238 |
| 10466 | | |
| 10467 | | Known Boards: Unknown Bootleg Board, 6035052 |
| 10468 | | Games: Contra Fighter |
| 10469 | | |
| 10470 | | MMC3 simple clone. |
| 10471 | | |
| 10472 | | In MESS: Unsupported. Needs to read from 0x6000-0x7fff (for |
| 10473 | | protection). It also needs to read in 0x4020-0x40ff. |
| 10474 | | |
| 10475 | | *************************************************************/ |
| 10476 | | |
| 10477 | | /************************************************************* |
| 10478 | | |
| 10479 | | Mapper 239 |
| 10480 | | |
| 10481 | | Known Boards: Undocumented / Unused ?!? |
| 10482 | | Games: ---------- |
| 10483 | | |
| 10484 | | In MESS: ---------- |
| 10485 | | |
| 10486 | | *************************************************************/ |
| 10487 | | |
| 10488 | | /************************************************************* |
| 10489 | | |
| 10490 | | Mapper 240 |
| 10491 | | |
| 10492 | | Known Boards: Bootleg Board by C&E |
| 10493 | | Games: Jing Ke Xin Zhuan, Sheng Huo Lie Zhuan |
| 10494 | | |
| 10495 | | Simple Mapper: writes to 0x4020-0x5fff sets prg32 to |
| 10496 | | data>>4 and chr8 to data&f. We currently do not map |
| 10497 | | writes to 0x4020-0x40ff (to do: verify if this produces |
| 10498 | | issues) |
| 10499 | | |
| 10500 | | In MESS: Supported. |
| 10501 | | |
| 10502 | | *************************************************************/ |
| 10503 | | |
| 10504 | | static WRITE8_HANDLER( mapper240_l_w ) |
| 10505 | | { |
| 10506 | | LOG_MMC(("mapper240_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 10507 | | |
| 10508 | | prg32(space->machine, data >> 4); |
| 10509 | | chr8(space->machine, data & 0x0f, CHRROM); |
| 10510 | | } |
| 10511 | | |
| 10512 | | /************************************************************* |
| 10513 | | |
| 10514 | | Mapper 241 |
| 10515 | | |
| 10516 | | Known Boards: Bootleg Board by TXC |
| 10517 | | Games: Commandos, Journey to the West, Ma Bu Mi Zhen & |
| 10518 | | Qu Wei Cheng Yu Wu, Si Lu Chuan Qi |
| 10519 | | |
| 10520 | | Simple Mapper: writes to 0x8000-0xffff sets the prg32 bank. |
| 10521 | | Not sure if returning 0x50 for reads in 0x4100-0x5000 is correct. |
| 10522 | | |
| 10523 | | In MESS: Supported. |
| 10524 | | |
| 10525 | | *************************************************************/ |
| 10526 | | |
| 10527 | | static READ8_HANDLER( mapper241_l_r ) |
| 10528 | | { |
| 10529 | | return 0x50; |
| 10530 | | } |
| 10531 | | |
| 10532 | | static WRITE8_HANDLER( mapper241_w ) |
| 10533 | | { |
| 10534 | | LOG_MMC(("mapper241_w, offset: %04x, data: %02x\n", offset, data)); |
| 10535 | | |
| 10536 | | prg32(space->machine, data); |
| 10537 | | } |
| 10538 | | |
| 10539 | | /************************************************************* |
| 10540 | | |
| 10541 | | Mapper 242 |
| 10542 | | |
| 10543 | | Known Boards: Bootleg Board by Waixing |
| 10544 | | Games: Wai Xing Zhan Shi, Dragon Quest VIII |
| 10545 | | |
| 10546 | | Simple mapper: writes to 0x8000-0xffff sets prg32 banks to |
| 10547 | | (offset>>3)&f. written data&3 sets the mirroring (with |
| 10548 | | switched high/low compared to the standard one). However, |
| 10549 | | a second variant DQ8 and requires no NT mirroring. |
| 10550 | | |
| 10551 | | A crc check is required to support Dragon Quest VIII (which |
| 10552 | | uses a slightly different board) |
| 10553 | | |
| 10554 | | In MESS: Supported. |
| 10555 | | |
| 10556 | | *************************************************************/ |
| 10557 | | |
| 10558 | | static WRITE8_HANDLER( mapper242_w ) |
| 10559 | | { |
| 10560 | | LOG_MMC(("mapper242_w, offset: %04x, data: %02x\n", offset, data)); |
| 10561 | | |
| 10562 | | prg32(space->machine, offset >> 3); |
| 10563 | | |
| 10564 | | if (!nes.crc_hack) // DQ8 board does not have this / Zan Shi does |
| 10565 | | { |
| 10566 | | switch (data & 0x03) |
| 10567 | | { |
| 10568 | | case 0: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 10569 | | case 1: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 10570 | | case 2: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 10571 | | case 3: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 10572 | | } |
| 10573 | | } |
| 10574 | | } |
| 10575 | | |
| 10576 | | /************************************************************* |
| 10577 | | |
| 10578 | | Mapper 243 |
| 10579 | | |
| 10580 | | Known Boards: Bootleg Board by Sachen (74SL374A) |
| 10581 | | Games: Poker III |
| 10582 | | |
| 10583 | | The board is similar to the one of mapper 150. |
| 10584 | | |
| 10585 | | In MESS: Supported. |
| 10586 | | |
| 10587 | | *************************************************************/ |
| 10588 | | |
| 10589 | | static WRITE8_HANDLER( mapper243_l_w ) |
| 10590 | | { |
| 10591 | | LOG_MMC(("mapper243_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 10592 | | |
| 10593 | | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 10594 | | if (!(offset & 0x100)) |
| 10595 | | { |
| 10596 | | if (!(offset & 0x01)) |
| 10597 | | mmc_cmd1 = data; |
| 10598 | | else |
| 10599 | | { |
| 10600 | | switch (mmc_cmd1 & 0x07) |
| 10601 | | { |
| 10602 | | case 0x00: |
| 10603 | | prg32(space->machine, 0); |
| 10604 | | chr8(space->machine, 3, CHRROM); |
| 10605 | | break; |
| 10606 | | case 0x02: |
| 10607 | | vrom_bank[0] = (vrom_bank[0] & ~0x08) | (data << 3 & 0x08); |
| 10608 | | chr8(space->machine, vrom_bank[0], CHRROM); |
| 10609 | | break; |
| 10610 | | case 0x04: |
| 10611 | | vrom_bank[0] = (vrom_bank[0] & ~0x01) | (data << 0 & 0x01); |
| 10612 | | chr8(space->machine, vrom_bank[0], CHRROM); |
| 10613 | | break; |
| 10614 | | case 0x05: |
| 10615 | | prg32(space->machine, data & 0x01); |
| 10616 | | break; |
| 10617 | | case 0x06: |
| 10618 | | vrom_bank[0] = (vrom_bank[0] & ~0x06) | (data << 1 & 0x06); |
| 10619 | | chr8(space->machine, vrom_bank[0], CHRROM); |
| 10620 | | break; |
| 10621 | | case 0x07: |
| 10622 | | set_nt_mirroring(data & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10623 | | break; |
| 10624 | | default: |
| 10625 | | break; |
| 10626 | | } |
| 10627 | | } |
| 10628 | | } |
| 10629 | | } |
| 10630 | | |
| 10631 | | /************************************************************* |
| 10632 | | |
| 10633 | | Mapper 244 |
| 10634 | | |
| 10635 | | Known Boards: Unknown Bootleg Board by C&E |
| 10636 | | Games: Decathlon |
| 10637 | | |
| 10638 | | Pretty simple mapper: writes to 0x8065-0x80a4 set prg32 to |
| 10639 | | data & 3; writes to 0x80a5-0x80e4 set chr8 to data & 7 |
| 10640 | | |
| 10641 | | In MESS: Supported. |
| 10642 | | |
| 10643 | | *************************************************************/ |
| 10644 | | |
| 10645 | | static WRITE8_HANDLER( mapper244_w ) |
| 10646 | | { |
| 10647 | | LOG_MMC(("mapper244_w, offset: %04x, data: %02x\n", offset, data)); |
| 10648 | | |
| 10649 | | if (offset < 0x0065) |
| 10650 | | return; |
| 10651 | | if (offset < 0x00a5) |
| 10652 | | { |
| 10653 | | prg32(space->machine, (offset - 0x0065) & 0x03); |
| 10654 | | return; |
| 10655 | | } |
| 10656 | | if (offset < 0x00e5) |
| 10657 | | { |
| 10658 | | chr8(space->machine, (offset - 0x00a5) & 0x07, CHRROM); |
| 10659 | | } |
| 10660 | | } |
| 10661 | | |
| 10662 | | /************************************************************* |
| 10663 | | |
| 10664 | | Mapper 245 |
| 10665 | | |
| 10666 | | Known Boards: Type H by Waixing |
| 10667 | | Games: Ying Xiong Yuan Yi Jing Chuan Qi, Yong Zhe Dou E |
| 10668 | | Long - Dragon Quest VII |
| 10669 | | |
| 10670 | | MMC3 clone. More info to come. |
| 10671 | | |
| 10672 | | In MESS: Supported. |
| 10673 | | |
| 10674 | | *************************************************************/ |
| 10675 | | |
| 10676 | | static WRITE8_HANDLER( mapper245_w ) |
| 10677 | | { |
| 10678 | | UINT8 cmd, map245_helper; |
| 10679 | | LOG_MMC(("mapper245_w, offset: %04x, data: %02x\n", offset, data)); |
| 10680 | | |
| 10681 | | switch (offset & 0x6001) |
| 10682 | | { |
| 10683 | | case 0x0001: |
| 10684 | | cmd = mmc_cmd1 & 0x0f; |
| 10685 | | switch (cmd) |
| 10686 | | { |
| 10687 | | case 0: // in this case we set prg_base in addition to vrom_bank! |
| 10688 | | mmc_prg_base = (data << 5) & 0x40; |
| 10689 | | mmc_prg_mask = 0x3f; |
| 10690 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 10691 | | case 1: case 2: case 3: case 4: case 5: |
| 10692 | | vrom_bank[cmd] = data; |
| 10693 | | if (nes.chr_chunks > 0) |
| 10694 | | mapper4_set_chr(space->machine, CHRROM, mmc_chr_base, mmc_chr_mask); |
| 10695 | | else // according to Disch's docs, mmc_cmd1&0x80 swaps 4k CHRRAM banks |
| 10696 | | { |
| 10697 | | map245_helper = /*(mmc_cmd1 & 0x80) ? 1 : */0; |
| 10698 | | chr4_0(space->machine, 0 ^ map245_helper, CHRRAM); |
| 10699 | | chr4_4(space->machine, 1 ^ map245_helper, CHRRAM); |
| 10700 | | } |
| 10701 | | break; |
| 10702 | | case 6: |
| 10703 | | case 7: |
| 10704 | | prg_bank[cmd - 6] = data; |
| 10705 | | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 10706 | | break; |
| 10707 | | } |
| 10708 | | break; |
| 10709 | | |
| 10710 | | case 0x2001: |
| 10711 | | break; |
| 10712 | | |
| 10713 | | default: |
| 10714 | | mapper4_w(space, offset, data); |
| 10715 | | break; |
| 10716 | | } |
| 10717 | | } |
| 10718 | | |
| 10719 | | /************************************************************* |
| 10720 | | |
| 10721 | | Mapper 246 |
| 10722 | | |
| 10723 | | Known Boards: Unknown Bootleg Board by C&E |
| 10724 | | Games: Fong Shen Bang - Zhu Lu Zhi Zhan |
| 10725 | | |
| 10726 | | Simple mapper: writes to 0x6000-0x67ff set PRG and CHR banks. |
| 10727 | | Namely, 0x6000->0x6003 select resp. prg8_89, prg8_ab, prg8_cd |
| 10728 | | and prg8_ef. 0x6004->0x6007 select resp. crh2_0, chr2_2, |
| 10729 | | chr2_4 and chr2_6. In 0x6800-0x7fff lies WRAM. |
| 10730 | | |
| 10731 | | In MESS: Supported. |
| 10732 | | |
| 10733 | | *************************************************************/ |
| 10734 | | |
| 10735 | | static WRITE8_HANDLER( mapper246_m_w ) |
| 10736 | | { |
| 10737 | | LOG_MMC(("mapper246_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 10738 | | |
| 10739 | | if (offset < 0x0800) |
| 10740 | | { |
| 10741 | | switch (offset & 0x0007) |
| 10742 | | { |
| 10743 | | case 0x0000: |
| 10744 | | prg8_89(space->machine, data); |
| 10745 | | break; |
| 10746 | | case 0x0001: |
| 10747 | | prg8_ab(space->machine, data); |
| 10748 | | break; |
| 10749 | | case 0x0002: |
| 10750 | | prg8_cd(space->machine, data); |
| 10751 | | break; |
| 10752 | | case 0x0003: |
| 10753 | | prg8_ef(space->machine, data); |
| 10754 | | break; |
| 10755 | | case 0x0004: |
| 10756 | | chr2_0(space->machine, data, CHRROM); |
| 10757 | | break; |
| 10758 | | case 0x0005: |
| 10759 | | chr2_2(space->machine, data, CHRROM); |
| 10760 | | break; |
| 10761 | | case 0x0006: |
| 10762 | | chr2_4(space->machine, data, CHRROM); |
| 10763 | | break; |
| 10764 | | case 0x0007: |
| 10765 | | chr2_6(space->machine, data, CHRROM); |
| 10766 | | break; |
| 10767 | | } |
| 10768 | | } |
| 10769 | | else |
| 10770 | | nes.wram[offset] = data; |
| 10771 | | } |
| 10772 | | |
| 10773 | | /************************************************************* |
| 10774 | | |
| 10775 | | Mapper 247 |
| 10776 | | |
| 10777 | | Known Boards: Undocumented / Unused ?!? |
| 10778 | | Games: ---------- |
| 10779 | | |
| 10780 | | In MESS: ---------- |
| 10781 | | |
| 10782 | | *************************************************************/ |
| 10783 | | |
| 10784 | | /************************************************************* |
| 10785 | | |
| 10786 | | Mapper 248 |
| 10787 | | |
| 10788 | | Known Boards: Undocumented / Unused ?!? |
| 10789 | | Games: ---------- |
| 10790 | | |
| 10791 | | In MESS: ---------- |
| 10792 | | |
| 10793 | | *************************************************************/ |
| 10794 | | |
| 10795 | | /************************************************************* |
| 10796 | | |
| 10797 | | Mapper 249 |
| 10798 | | |
| 10799 | | Known Boards: Waixing with Security Chip |
| 10800 | | Games: Duo Bao Xiao Ying Hao - Guang Ming yu An Hei Chuan Shuo, |
| 10801 | | Myth Struggle, San Shi Liu Ji, Shui Hu Zhuan |
| 10802 | | |
| 10803 | | MMC3 clone |
| 10804 | | |
| 10805 | | In MESS: Partially Supported. |
| 10806 | | |
| 10807 | | *************************************************************/ |
| 10808 | | |
| 10809 | | static void mapper249_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 10810 | | { |
| 10811 | | int i; |
| 10812 | | |
| 10813 | | if (map249_reg) |
| 10814 | | { |
| 10815 | | for (i = 0; i < 4; i ++) // should this apply only to bank[0],bank[1]? |
| 10816 | | { |
| 10817 | | prg_bank[i] = ((prg_bank[i] & 0x01)) | ((prg_bank[i] >> 3) & 0x02) | |
| 10818 | | ((prg_bank[i] >> 1) & 0x04) | ((prg_bank[i] << 2) & 0x18); |
| 10819 | | } |
| 10820 | | } |
| 10821 | | |
| 10822 | | mapper4_set_prg(machine, prg_base, prg_mask); |
| 10823 | | } |
| 10824 | | |
| 10825 | | static void mapper249_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 10826 | | { |
| 10827 | | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 10828 | | int i; |
| 10829 | | |
| 10830 | | if (map249_reg) |
| 10831 | | { |
| 10832 | | for (i = 0; i < 6; i ++) |
| 10833 | | { |
| 10834 | | vrom_bank[i] = ((vrom_bank[i] & 0x03)) | ((vrom_bank[i] >> 1) & 0x04) | |
| 10835 | | ((vrom_bank[i] >> 4) & 0x08) | ((vrom_bank[i] >> 2) & 0x10) | |
| 10836 | | ((vrom_bank[i] << 3) & 0x20) | ((vrom_bank[i] << 2) & 0xc0); |
| 10837 | | } |
| 10838 | | } |
| 10839 | | |
| 10840 | | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), mmc_chr_source); |
| 10841 | | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), mmc_chr_source); |
| 10842 | | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), mmc_chr_source); |
| 10843 | | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), mmc_chr_source); |
| 10844 | | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), mmc_chr_source); |
| 10845 | | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), mmc_chr_source); |
| 10846 | | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), mmc_chr_source); |
| 10847 | | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), mmc_chr_source); |
| 10848 | | } |
| 10849 | | |
| 10850 | | static WRITE8_HANDLER( mapper249_l_w ) |
| 10851 | | { |
| 10852 | | LOG_MMC(("mapper249_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 10853 | | |
| 10854 | | offset += 0x100; |
| 10855 | | |
| 10856 | | if (offset == 0x1000) |
| 10857 | | { |
| 10858 | | map249_reg = data & 0x02; |
| 10859 | | mapper249_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 10860 | | mapper249_set_chr(space->machine, mmc_prg_base, mmc_prg_mask); |
| 10861 | | } |
| 10862 | | } |
| 10863 | | |
| 10864 | | static WRITE8_HANDLER( mapper249_w ) |
| 10865 | | { |
| 10866 | | UINT8 MMC3_helper, cmd; |
| 10867 | | LOG_MMC(("mapper249_w, offset: %04x, data: %02x\n", offset, data)); |
| 10868 | | |
| 10869 | | switch (offset & 0x6001) |
| 10870 | | { |
| 10871 | | case 0x0000: |
| 10872 | | MMC3_helper = mmc_cmd1 ^ data; |
| 10873 | | mmc_cmd1 = data; |
| 10874 | | |
| 10875 | | /* Has PRG Mode changed? */ |
| 10876 | | if (MMC3_helper & 0x40) |
| 10877 | | mapper249_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 10878 | | |
| 10879 | | /* Has CHR Mode changed? */ |
| 10880 | | if (MMC3_helper & 0x80) |
| 10881 | | mapper249_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 10882 | | break; |
| 10883 | | |
| 10884 | | case 0x0001: |
| 10885 | | cmd = mmc_cmd1 & 0x07; |
| 10886 | | switch (cmd) |
| 10887 | | { |
| 10888 | | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 10889 | | case 2: case 3: case 4: case 5: |
| 10890 | | vrom_bank[cmd] = data; |
| 10891 | | mapper249_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 10892 | | break; |
| 10893 | | case 6: |
| 10894 | | case 7: |
| 10895 | | prg_bank[cmd - 6] = data; |
| 10896 | | mapper249_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 10897 | | break; |
| 10898 | | } |
| 10899 | | break; |
| 10900 | | |
| 10901 | | default: |
| 10902 | | mapper4_w(space, offset, data); |
| 10903 | | break; |
| 10904 | | } |
| 10905 | | } |
| 10906 | | |
| 10907 | | /************************************************************* |
| 10908 | | |
| 10909 | | Mapper 250 |
| 10910 | | |
| 10911 | | Known Boards: Unknown Bootleg Board by Nitra |
| 10912 | | Games: Time Diver Avenger |
| 10913 | | |
| 10914 | | This acts basically like a MMC3 with different use of write |
| 10915 | | address. |
| 10916 | | |
| 10917 | | In MESS: Supported. |
| 10918 | | |
| 10919 | | *************************************************************/ |
| 10920 | | |
| 10921 | | static WRITE8_HANDLER( mapper250_w ) |
| 10922 | | { |
| 10923 | | LOG_MMC(("mapper250_w, offset: %04x, data: %02x\n", offset, data)); |
| 10924 | | |
| 10925 | | mapper4_w(space, (offset & 0x6000) | ((offset & 0x400) >> 10), offset & 0xff); |
| 10926 | | } |
| 10927 | | |
| 10928 | | /************************************************************* |
| 10929 | | |
| 10930 | | Mapper 251 |
| 10931 | | |
| 10932 | | Known Boards: Undocumented |
| 10933 | | Games: Super 8-in-1 99 King Fighter |
| 10934 | | |
| 10935 | | In MESS: Unsupported. |
| 10936 | | |
| 10937 | | *************************************************************/ |
| 10938 | | |
| 10939 | | /************************************************************* |
| 10940 | | |
| 10941 | | Mapper 252 |
| 10942 | | |
| 10943 | | Known Boards: Unknown Bootleg Board by Waixing |
| 10944 | | Games: San Guo Zhi |
| 10945 | | |
| 10946 | | This board uses Konami IRQ |
| 10947 | | |
| 10948 | | In MESS: Unsupported. |
| 10949 | | |
| 10950 | | *************************************************************/ |
| 10951 | | |
| 10952 | | static WRITE8_HANDLER( mapper252_w ) |
| 10953 | | { |
| 10954 | | UINT8 mmc_helper, bank; |
| 10955 | | LOG_MMC(("mapper252_w, offset: %04x, data: %02x\n", offset, data)); |
| 10956 | | |
| 10957 | | switch (offset & 0x7000) |
| 10958 | | { |
| 10959 | | case 0x0000: |
| 10960 | | prg8_89(space->machine, data); |
| 10961 | | break; |
| 10962 | | case 0x2000: |
| 10963 | | prg8_ab(space->machine, data); |
| 10964 | | break; |
| 10965 | | case 0x3000: |
| 10966 | | case 0x4000: |
| 10967 | | case 0x5000: |
| 10968 | | case 0x6000: |
| 10969 | | bank = ((offset & 0x7000) - 0x3000) / 0x0800 + ((offset & 0x0008) >> 3); |
| 10970 | | mmc_helper = offset & 0x04; |
| 10971 | | if (mmc_helper) |
| 10972 | | vrom_bank[bank] = (vrom_bank[bank] & 0x0f) | ((data & 0x0f) << 4); |
| 10973 | | else |
| 10974 | | vrom_bank[bank] = (vrom_bank[bank] & 0xf0) | (data & 0x0f); |
| 10975 | | chr1_x(space->machine, bank, vrom_bank[bank], CHRROM); |
| 10976 | | break; |
| 10977 | | case 0xf000: |
| 10978 | | switch (offset & 0x0c) |
| 10979 | | { |
| 10980 | | case 0x00: |
| 10981 | | IRQ_count_latch = (IRQ_count_latch & 0xf0) | (data & 0x0f); |
| 10982 | | break; |
| 10983 | | case 0x04: |
| 10984 | | IRQ_count_latch = (IRQ_count_latch & 0x0f) | ((data & 0x0f) << 4); |
| 10985 | | break; |
| 10986 | | case 0x08: |
| 10987 | | IRQ_enable = data & 0x02; |
| 10988 | | IRQ_enable_latch = data & 0x01; |
| 10989 | | if (data & 0x02) |
| 10990 | | IRQ_count = IRQ_count_latch; |
| 10991 | | break; |
| 10992 | | case 0x0c: |
| 10993 | | IRQ_enable = IRQ_enable_latch; |
| 10994 | | break; |
| 10995 | | } |
| 10996 | | break; |
| 10997 | | } |
| 10998 | | } |
| 10999 | | |
| 11000 | | /************************************************************* |
| 11001 | | |
| 11002 | | Mapper 253 |
| 11003 | | |
| 11004 | | Known Boards: Undocumented |
| 11005 | | Games: Shen Hua Jian Yun III ? |
| 11006 | | |
| 11007 | | In MESS: Unsupported. |
| 11008 | | |
| 11009 | | *************************************************************/ |
| 11010 | | |
| 11011 | | /************************************************************* |
| 11012 | | |
| 11013 | | Mapper 254 |
| 11014 | | |
| 11015 | | Known Boards: Unknown Bootleg Board |
| 11016 | | Games: Pikachu Y2K |
| 11017 | | |
| 11018 | | MMC3 simple clone. |
| 11019 | | |
| 11020 | | In MESS: Unsupported. Needs to read from 0x6000-0x7fff (for |
| 11021 | | protection). |
| 11022 | | |
| 11023 | | *************************************************************/ |
| 11024 | | |
| 11025 | | /************************************************************* |
| 11026 | | |
| 11027 | | Mapper 255 |
| 11028 | | |
| 11029 | | Known Boards: Unknown Bootleg Board |
| 11030 | | Games: 110 in 1 |
| 11031 | | |
| 11032 | | In MESS: Preliminary support. |
| 11033 | | |
| 11034 | | *************************************************************/ |
| 11035 | | |
| 11036 | | static WRITE8_HANDLER( mapper255_w ) |
| 11037 | | { |
| 11038 | | UINT8 map255_helper1 = (offset >> 12) ? 0 : 1; |
| 11039 | | UINT8 map255_helper2 = ((offset >> 8) & 0x40) | ((offset >> 6) & 0x3f); |
| 11040 | | |
| 11041 | | LOG_MMC(("mapper255_w, offset: %04x, data: %02x\n", offset, data)); |
| 11042 | | |
| 11043 | | set_nt_mirroring((offset & 0x2000) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 11044 | | prg16_89ab(space->machine, map255_helper1 & ~map255_helper2); |
| 11045 | | prg16_cdef(space->machine, map255_helper1 | map255_helper2); |
| 11046 | | chr8(space->machine, ((offset >> 8) & 0x40) | (offset & 0x3f), CHRROM); |
| 11047 | | } |
| 11048 | | |
| 11049 | | |
| 11050 | | |
| 11051 | | /************************************************************* |
| 11052 | | |
| 11053 | | mmc_list |
| 11054 | | |
| 11055 | | Supported mappers and corresponding handlers |
| 11056 | | |
| 11057 | | *************************************************************/ |
| 11058 | | |
| 11059 | | static const mmc mmc_list[] = |
| 11060 | | { |
| 11061 | | /* INES DESC LOW_W, LOW_R, MED_W, HIGH_W, PPU_latch, scanline CB, hblank CB */ |
| 11062 | | { 0, "No Mapper", NULL, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 11063 | | { 1, "MMC1", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL }, |
| 11064 | | { 2, "Ux-ROM", NULL, NULL, NULL, mapper2_w, NULL, NULL, NULL }, |
| 11065 | | { 3, "Cx-ROM", NULL, NULL, NULL, mapper3_w, NULL, NULL, NULL }, |
| 11066 | | { 4, "MMC3", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq }, |
| 11067 | | { 5, "MMC5", mapper5_l_w, mapper5_l_r, NULL, mapper5_w, NULL, NULL, mapper5_irq }, |
| 11068 | | { 6, "FFE F4xxxx", mapper6_l_w, NULL, NULL, mapper6_w, NULL, NULL, ffe_irq }, |
| 11069 | | { 7, "Ax-ROM", NULL, NULL, NULL, mapper7_w, NULL, NULL, NULL }, |
| 11070 | | { 8, "FFE F3xxxx", NULL, NULL, NULL, mapper8_w, NULL, NULL, NULL }, |
| 11071 | | { 9, "MMC2", NULL, NULL, NULL, mapper9_w, mapper9_latch, NULL, NULL}, |
| 11072 | | { 10, "MMC4", NULL, NULL, NULL, mapper10_w, mapper9_latch, NULL, NULL }, |
| 11073 | | { 11, "Color Dreams", NULL, NULL, NULL, mapper11_w, NULL, NULL, NULL }, |
| 11074 | | { 12, "Rex Soft DBZ5", mapper12_l_w, mapper12_l_r, NULL, mapper12_w, NULL, NULL, mapper4_irq }, |
| 11075 | | { 13, "CP-ROM", NULL, NULL, NULL, mapper13_w, NULL, NULL, NULL }, |
| 11076 | | { 14, "Rex Soft SL1632", NULL, NULL, NULL, mapper14_w, NULL, NULL, mapper4_irq }, |
| 11077 | | { 15, "100-in-1", NULL, NULL, NULL, mapper15_w, NULL, NULL, NULL }, |
| 11078 | | { 16, "Bandai LZ93D50 - 24C02", NULL, NULL, mapper16_m_w, mapper16_w, NULL,NULL, bandai_irq }, |
| 11079 | | { 17, "FFE F8xxx", mapper17_l_w, NULL, NULL, NULL, NULL, NULL, ffe_irq }, |
| 11080 | | { 18, "Jaleco SS88006", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq }, |
| 11081 | | { 19, "Namcot 106 + N106", mapper19_l_w, mapper19_l_r, NULL, mapper19_w, NULL, NULL, namcot_irq }, |
| 11082 | | { 20, "Famicom Disk System", NULL, NULL, NULL, NULL, NULL, NULL, fds_irq }, |
| 11083 | | { 21, "Konami VRC 4", NULL, NULL, NULL, konami_vrc4_w, NULL, NULL, konami_irq }, |
| 11084 | | { 22, "Konami VRC 2a", NULL, NULL, NULL, konami_vrc2a_w, NULL, NULL, NULL }, |
| 11085 | | { 23, "Konami VRC 2b", NULL, NULL, NULL, konami_vrc2b_w, NULL, NULL, konami_irq }, |
| 11086 | | { 24, "Konami VRC 6a", NULL, NULL, NULL, konami_vrc6a_w, NULL, NULL, konami_irq }, |
| 11087 | | { 25, "Konami VRC 4", NULL, NULL, NULL, konami_vrc4_w, NULL, NULL, konami_irq }, |
| 11088 | | { 26, "Konami VRC 6b", NULL, NULL, NULL, konami_vrc6b_w, NULL, NULL, konami_irq }, |
| 11089 | | // 27 World Hero |
| 11090 | | // 28, 29, 30, 31 Unused |
| 11091 | | { 32, "Irem G-101", NULL, NULL, NULL, mapper32_w, NULL, NULL, NULL }, |
| 11092 | | { 33, "Taito TC0190FMC", NULL, NULL, NULL, mapper33_w, NULL, NULL, NULL }, |
| 11093 | | { 34, "Nina-001", NULL, NULL, mapper34_m_w, mapper34_w, NULL, NULL, NULL }, |
| 11094 | | // 35 Unused |
| 11095 | | { 36, "TXC Policeman", NULL, NULL, NULL, mapper36_w, NULL, NULL, NULL }, |
| 11096 | | { 37, "ZZ Board", NULL, NULL, mapper37_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 11097 | | { 38, "Crime Buster", NULL, NULL, mapper38_m_w, NULL, NULL, NULL, NULL }, |
| 11098 | | { 39, "Subor Study n Game", NULL, NULL, NULL, mapper39_w, NULL, NULL, NULL }, |
| 11099 | | { 40, "SMB2 JPN (bootleg)", NULL, NULL, NULL, mapper40_w, NULL, NULL, mapper40_irq }, |
| 11100 | | { 41, "Caltron 6-in-1", NULL, NULL, mapper41_m_w, mapper41_w, NULL, NULL, NULL }, |
| 11101 | | { 42, "Mario Baby", NULL, NULL, NULL, mapper42_w, NULL, NULL, NULL }, |
| 11102 | | { 43, "150-in-1", NULL, NULL, NULL, mapper43_w, NULL, NULL, NULL }, |
| 11103 | | { 44, "SuperBig 7-in-1", NULL, NULL, NULL, mapper44_w, NULL, NULL, mapper4_irq }, |
| 11104 | | { 45, "X-in-1 MMC3", NULL, NULL, mapper45_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 11105 | | { 46, "Rumblestation", NULL, NULL, mapper46_m_w, mapper46_w, NULL, NULL, NULL }, |
| 11106 | | { 47, "QJ Board", NULL, NULL, mapper47_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 11107 | | { 48, "Taito TC0190FMC PAL16R4", NULL, NULL, NULL, mapper48_w, NULL, NULL, mapper4_irq }, |
| 11108 | | { 49, "Super HIK 4-in-1", NULL, NULL, mapper49_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 11109 | | { 50, "SMB2 JPN (bootleg 2)", mapper50_l_w, NULL, NULL, NULL, NULL, NULL, mapper50_irq }, |
| 11110 | | { 51, "Ballgames 11-in-1", NULL, NULL, mapper51_m_w, mapper51_w, NULL, NULL, NULL }, |
| 11111 | | { 52, "Mario 7-in-1", NULL, NULL, mapper52_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 11112 | | // 53 Supervision 16-in-1 |
| 11113 | | // 54 Novel Diamond X-in-1 |
| 11114 | | // 55 Genius SMB |
| 11115 | | // 56 Kaiser KS202 |
| 11116 | | { 57, "GKA 6-in-1", NULL, NULL, NULL, mapper57_w, NULL, NULL, NULL }, |
| 11117 | | { 58, "GKB X-in-1", NULL, NULL, NULL, mapper58_w, NULL, NULL, NULL }, |
| 11118 | | // 59 Unused |
| 11119 | | // 60 4-in-1 Reset based |
| 11120 | | { 61, "Tetris Family 20-in-1", NULL, NULL, NULL, mapper61_w, NULL, NULL, NULL }, |
| 11121 | | { 62, "Super 700-in-1", NULL, NULL, NULL, mapper62_w, NULL, NULL, NULL }, |
| 11122 | | // 63 CH001 X-in-1 |
| 11123 | | { 64, "Tengen 800032", NULL, NULL, NULL, mapper64_w, NULL, NULL, mapper64_irq }, |
| 11124 | | { 65, "Irem H3001", NULL, NULL, NULL, mapper65_w, NULL, NULL, irem_irq }, |
| 11125 | | { 66, "Gx-ROM", NULL, NULL, NULL, mapper66_w, NULL, NULL, NULL }, |
| 11126 | | { 67, "SunSoft 3", NULL, NULL, NULL, mapper67_w, NULL, NULL, mapper67_irq }, |
| 11127 | | { 68, "SunSoft 4", NULL, NULL, NULL, mapper68_w, NULL, NULL, NULL }, |
| 11128 | | { 69, "SunSoft FME", NULL, NULL, NULL, mapper69_w, NULL, NULL, mapper69_irq }, |
| 11129 | | { 70, "74161/32 Bandai", NULL, NULL, NULL, mapper70_w, NULL, NULL, NULL }, |
| 11130 | | { 71, "Camerica", NULL, NULL, NULL, mapper71_w, NULL, NULL, NULL }, |
| 11131 | | { 72, "74161/32 Jaleco", NULL, NULL, NULL, mapper72_w, NULL, NULL, NULL }, |
| 11132 | | { 73, "Konami VRC 3", NULL, NULL, NULL, mapper73_w, NULL, NULL, konami_irq }, |
| 11133 | | { 74, "Waixing Type A", NULL, NULL, NULL, mapper74_w, NULL, NULL, mapper4_irq }, |
| 11134 | | { 75, "Konami VRC 1", NULL, NULL, NULL, mapper75_w, NULL, NULL, NULL }, |
| 11135 | | { 76, "Namco 3446", NULL, NULL, NULL, mapper76_w, NULL, NULL, NULL }, |
| 11136 | | { 77, "Irem LROG017", NULL, NULL, NULL, mapper77_w, NULL, NULL, NULL }, |
| 11137 | | { 78, "Irem Holy Diver", NULL, NULL, NULL, mapper78_w, NULL, NULL, NULL }, |
| 11138 | | { 79, "Nina-03", mapper79_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 11139 | | { 80, "Taito X1-005 Ver. A", NULL, NULL, mapper80_m_w, NULL, NULL, NULL, NULL }, |
| 11140 | | // 81 Unused |
| 11141 | | { 82, "Taito X1-017", NULL, NULL, mapper82_m_w, NULL, NULL, NULL, NULL }, |
| 11142 | | { 83, "Cony", mapper83_l_w, mapper83_l_r, NULL, mapper83_w, NULL, NULL, NULL }, |
| 11143 | | { 84, "Pasofami hacked images?", NULL, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 11144 | | { 85, "Konami VRC 7", NULL, NULL, NULL, konami_vrc7_w, NULL, NULL, konami_irq }, |
| 11145 | | { 86, "Jaleco JF13", NULL, NULL, mapper86_m_w, NULL, NULL, NULL, NULL }, |
| 11146 | | { 87, "74139/74", NULL, NULL, mapper87_m_w, NULL, NULL, NULL, NULL }, |
| 11147 | | { 88, "Namcot 34x3", NULL, NULL, NULL, mapper88_w, NULL, NULL, NULL }, |
| 11148 | | { 89, "Sunsoft 2b", NULL, NULL, NULL, mapper89_w, NULL, NULL, NULL }, |
| 11149 | | // 90 JY Company Type A |
| 11150 | | { 91, "HK-SF3 (bootleg)", NULL, NULL, mapper91_m_w, NULL, NULL, NULL, mapper4_irq }, |
| 11151 | | { 92, "Jaleco JF19 / JF21", NULL, NULL, NULL, mapper92_w, NULL, NULL, NULL }, |
| 11152 | | { 93, "Sunsoft 2A", NULL, NULL, NULL, mapper93_w, NULL, NULL, NULL }, |
| 11153 | | { 94, "Capcom LS161", NULL, NULL, NULL, mapper94_w, NULL, NULL, NULL }, |
| 11154 | | { 95, "Namcot 3425", NULL, NULL, NULL, mapper95_w, NULL, NULL, NULL }, |
| 11155 | | { 96, "Bandai OekaKids", NULL, NULL, NULL, mapper96_w, NULL, NULL, NULL }, |
| 11156 | | { 97, "Irem Kaiketsu", NULL, NULL, NULL, mapper97_w, NULL, NULL, NULL }, |
| 11157 | | // 98 Unused |
| 11158 | | // 99 VS. system |
| 11159 | | // 100 images hacked to work with nesticle? |
| 11160 | | { 101, "Jaleco?? LS161", NULL, NULL, mapper101_m_w, mapper101_w, NULL, NULL, NULL }, |
| 11161 | | // 102 Unused |
| 11162 | | // 103 Bootleg cart 2708 |
| 11163 | | { 104, "Golden Five", NULL, NULL, NULL, mapper104_w, NULL, NULL, NULL }, |
| 11164 | | // 105 Nintendo World Championship |
| 11165 | | { 106, "SMB3 (bootleg)", NULL, NULL, NULL, mapper106_w, NULL, NULL, mapper106_irq }, |
| 11166 | | { 107, "Magic Dragon", NULL, NULL, NULL, mapper107_w, NULL, NULL, NULL }, |
| 11167 | | // 108 Whirlwind |
| 11168 | | // 109, 110 Unused |
| 11169 | | // 111 Ninja Ryuukenden Chinese? |
| 11170 | | { 112, "Asder", NULL, NULL, NULL, mapper112_w, NULL, NULL, NULL }, |
| 11171 | | { 113, "Sachen/Hacker/Nina", mapper113_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 11172 | | { 114, "The Lion King", NULL, NULL, mapper114_m_w, mapper114_w, NULL, NULL, mapper4_irq }, |
| 11173 | | { 115, "Kasing", NULL, NULL, mapper115_m_w, mapper115_w, NULL, NULL, mapper4_irq }, |
| 11174 | | // 116 Someri Team |
| 11175 | | { 117, "Future Media", NULL, NULL, NULL, mapper117_w, NULL, NULL, mapper117_irq }, |
| 11176 | | { 118, "TKS-ROM / TLS-ROM", NULL, NULL, NULL, mapper118_w, NULL, NULL, mapper4_irq }, |
| 11177 | | { 119, "TQ-ROM", NULL, NULL, NULL, mapper119_w, NULL, NULL, mapper4_irq }, |
| 11178 | | // 120 FDS bootleg |
| 11179 | | { 121, "K - Panda Prince", mapper121_l_w, mapper121_l_r, NULL, mapper121_w, NULL, NULL, mapper4_irq }, |
| 11180 | | // 122 Unused |
| 11181 | | // 123 K H2288 |
| 11182 | | // 124, 125 Unused |
| 11183 | | // 126 Powerjoy 84-in-1 |
| 11184 | | // 127, 128, 129, 130, 131 Unused |
| 11185 | | { 132, "TXC T22211A", mapper132_l_w, mapper132_l_r, NULL, mapper132_w, NULL, NULL, NULL }, |
| 11186 | | { 133, "Sachen SA72008", mapper133_l_w, NULL, mapper133_m_w, NULL, NULL, NULL, NULL }, |
| 11187 | | { 134, "Family 4646B", NULL, NULL, mapper134_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 11188 | | // 135 Unused |
| 11189 | | { 136, "Sachen TCU01", mapper136_l_w, mapper136_l_r, NULL, NULL, NULL, NULL, NULL }, |
| 11190 | | { 137, "Sachen 8259D", mapper137_l_w, NULL, mapper137_m_w, NULL, NULL, NULL, NULL }, |
| 11191 | | { 138, "Sachen 8259B", mapper138_l_w, NULL, mapper138_m_w, NULL, NULL, NULL, NULL }, |
| 11192 | | { 139, "Sachen 8259C", mapper139_l_w, NULL, mapper139_m_w, NULL, NULL, NULL, NULL }, |
| 11193 | | { 140, "Jaleco JF11", NULL, NULL, mapper_140_m_w, NULL, NULL, NULL, NULL }, |
| 11194 | | { 141, "Sachen 8259A", mapper141_l_w, NULL, mapper141_m_w, NULL, NULL, NULL, NULL }, |
| 11195 | | // 142 Kaiser KS7032 |
| 11196 | | { 143, "Sachen TCA01", NULL, mapper143_l_r, NULL, NULL, NULL, NULL, NULL }, |
| 11197 | | { 144, "AGCI 50282", NULL, NULL, NULL, mapper144_w, NULL, NULL, NULL }, //Death Race only |
| 11198 | | { 145, "Sachen SA72007", mapper145_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 11199 | | { 146, "Sachen SA0161M", mapper79_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, // basically same as Mapper 79 (Nina006) |
| 11200 | | { 147, "Sachen TCU02", mapper147_l_w, NULL, mapper147_m_w, mapper147_w, NULL, NULL, NULL }, |
| 11201 | | { 148, "Sachen SA0037", NULL, NULL, NULL, mapper148_w, NULL, NULL, NULL }, |
| 11202 | | { 149, "Sachen SA0036", NULL, NULL, NULL, mapper149_w, NULL, NULL, NULL }, |
| 11203 | | { 150, "Sachen 74LS374B", mapper150_l_w, mapper150_l_r, mapper150_m_w, NULL, NULL, NULL, NULL }, |
| 11204 | | // 151 Konami VS. system |
| 11205 | | { 152, "Taito 74161/161", NULL, NULL, NULL, mapper152_w, NULL, NULL, NULL }, |
| 11206 | | { 153, "Bandai LZ93D50", NULL, NULL, mapper153_m_w, mapper153_w, NULL,NULL, bandai_irq }, |
| 11207 | | { 154, "Namcot 34xx", NULL, NULL, NULL, mapper154_w, NULL, NULL, NULL }, |
| 11208 | | { 155, "SK-ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL }, // diff compared to MMC1 concern WRAM (unsupported for MMC1 as well, atm) |
| 11209 | | { 156, "Open Corp. DAOU36", NULL, NULL, NULL, mapper156_w, NULL, NULL, NULL }, |
| 11210 | | { 157, "Bandai Datach Board", NULL, NULL, mapper16_m_w, mapper16_w, NULL,NULL, bandai_irq }, // no Datach Reader -> we fall back to mapper 16 |
| 11211 | | { 158, "Tengen T800037", NULL, NULL, NULL, mapper158_w, NULL, NULL, mapper64_irq }, |
| 11212 | | { 159, "Bandai LZ93D50 - 24C01", NULL, NULL, mapper16_m_w, mapper16_w, NULL,NULL, bandai_irq }, |
| 11213 | | // 160, 161, 162 Unused |
| 11214 | | // 163 Nanjing |
| 11215 | | { 164, "Final Fantasy V", mapper164_l_w, NULL, NULL, mapper164_w, NULL, NULL, NULL }, |
| 11216 | | // 165 Waixing SH2 |
| 11217 | | { 166, "Subor Board Type 1", NULL, NULL, NULL, mapper166_w, NULL, NULL, NULL }, |
| 11218 | | { 167, "Subor Board Type 2", NULL, NULL, NULL, mapper167_w, NULL, NULL, NULL }, |
| 11219 | | // 168 Racermate Challenger II |
| 11220 | | // 169 Unused |
| 11221 | | // 170 Fujiya |
| 11222 | | { 171, "Kaiser KS7058", NULL, NULL, NULL, mapper171_w, NULL, NULL, NULL }, |
| 11223 | | { 172, "TXC T22211B", mapper132_l_w, mapper132_l_r, NULL, mapper172_w, NULL, NULL, NULL }, |
| 11224 | | { 173, "TXC T22211C", mapper132_l_w, mapper173_l_r, NULL, mapper132_w, NULL, NULL, NULL }, |
| 11225 | | // 174 Unused |
| 11226 | | // 175 Kaiser KS7022 |
| 11227 | | { 176, "Zhi Li Xiao Zhuan Yuan", mapper176_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 11228 | | { 177, "Henggedianzi Board", NULL, NULL, NULL, mapper177_w, NULL, NULL, NULL }, |
| 11229 | | { 178, "San Guo Zhong Lie Zhuan", mapper178_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 11230 | | { 179, "Xing He Zhan Shi", mapper179_l_w, NULL, NULL, mapper179_w, NULL, NULL, NULL }, |
| 11231 | | { 180, "Nihon Bussan UN-ROM", NULL, NULL, NULL, mapper180_w, NULL, NULL, NULL }, |
| 11232 | | // 181 Unused |
| 11233 | | { 182, "Hosenkan", NULL, NULL, NULL, mapper182_w, NULL, NULL, mapper4_irq }, |
| 11234 | | // 183 FDS bootleg |
| 11235 | | { 184, "Sunsoft 1", NULL, NULL, mapper184_m_w, NULL, NULL, NULL, NULL }, |
| 11236 | | { 185, "CN-ROM", NULL, NULL, NULL, mapper185_w, NULL, NULL, NULL }, |
| 11237 | | // 186 Fukutake |
| 11238 | | { 187, "King of Fighters 96", mapper187_l_w, mapper187_l_r, NULL, mapper187_w, NULL, NULL, mapper4_irq }, |
| 11239 | | { 188, "Bandai Karaoke", NULL, NULL, NULL, mapper188_w, NULL, NULL, NULL }, |
| 11240 | | { 189, "TXC TW Board", mapper189_l_w, NULL, mapper189_m_w, mapper189_w, NULL, NULL, mapper4_irq }, |
| 11241 | | // 190 Unused |
| 11242 | | { 191, "Waixing Type B", NULL, NULL, NULL, mapper191_w, NULL, NULL, mapper4_irq }, |
| 11243 | | { 192, "Waixing Type C", NULL, NULL, NULL, mapper192_w, NULL, NULL, mapper4_irq }, |
| 11244 | | { 193, "Fighting Hero", NULL, NULL, mapper193_m_w, NULL, NULL, NULL, NULL }, |
| 11245 | | { 194, "Waixing Type D", NULL, NULL, NULL, mapper194_w, NULL, NULL, mapper4_irq }, |
| 11246 | | { 195, "Waixing Type E", NULL, NULL, NULL, mapper195_w, NULL, NULL, mapper4_irq }, |
| 11247 | | { 196, "Super Mario Bros. 11", NULL, NULL, NULL, mapper196_w, NULL, NULL, mapper4_irq }, |
| 11248 | | { 197, "Super Fighter 3", NULL, NULL, NULL, mapper197_w, NULL, NULL, mapper4_irq }, |
| 11249 | | { 198, "Waixing Type F", NULL, NULL, NULL, mapper198_w, NULL, NULL, mapper4_irq }, |
| 11250 | | { 199, "Waixing Type G", NULL, NULL, NULL, mapper199_w, NULL, NULL, mapper4_irq }, |
| 11251 | | { 200, "36-in-1", NULL, NULL, NULL, mapper200_w, NULL, NULL, NULL }, |
| 11252 | | { 201, "21-in-1", NULL, NULL, NULL, mapper201_w, NULL, NULL, NULL }, |
| 11253 | | { 202, "150-in-1", NULL, NULL, NULL, mapper202_w, NULL, NULL, NULL }, |
| 11254 | | { 203, "35-in-1", NULL, NULL, NULL, mapper203_w, NULL, NULL, NULL }, |
| 11255 | | { 204, "64-in-1", NULL, NULL, NULL, mapper204_w, NULL, NULL, NULL }, |
| 11256 | | { 205, "15-in-1", NULL, NULL, mapper205_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 11257 | | { 206, "MIMIC-1", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq }, |
| 11258 | | { 207, "Taito X1-005 Ver. B", NULL, NULL, mapper207_m_w, NULL, NULL, NULL, NULL }, |
| 11259 | | { 208, "Gouder G3717", mapper208_l_w, mapper208_l_r, NULL, mapper208_w, NULL, NULL, mapper4_irq }, |
| 11260 | | // 209 JY Company Type B |
| 11261 | | // 210 Some emu uses this as Mapper 19 without some features |
| 11262 | | // 211 JY Company Type C |
| 11263 | | { 212, "Super HIK 300-in-1", NULL, NULL, NULL, mapper212_w, NULL, NULL, NULL }, |
| 11264 | | { 213, "9999999-in-1", NULL, NULL, NULL, mapper213_w, NULL, NULL, NULL }, |
| 11265 | | { 214, "Super Gun 20-in-1", NULL, NULL, NULL, mapper214_w, NULL, NULL, NULL }, |
| 11266 | | { 215, "Super Game Boogerman", mapper215_l_w, NULL, NULL, mapper215_w, NULL, NULL, mapper4_irq }, |
| 11267 | | { 216, "RCM GS2015", NULL, NULL, NULL, mapper216_w, NULL, NULL, NULL }, |
| 11268 | | { 217, "Golden Card 6-in-1", mapper217_l_w, NULL, NULL, mapper217_w, NULL, NULL, mapper4_irq }, |
| 11269 | | // 218 Unused |
| 11270 | | // 219 Bootleg a9746 |
| 11271 | | // 220 Summer Carnival '92?? |
| 11272 | | { 221, "X-in-1 (N625092)", NULL, NULL, NULL, mapper221_w, NULL, NULL, NULL }, |
| 11273 | | { 222, "Dragonninja Bootleg", NULL, NULL, NULL, mapper222_w, NULL, NULL, mapper222_irq }, |
| 11274 | | // 223 Waixing Type I |
| 11275 | | // 224 Waixing Type J |
| 11276 | | { 225, "72-in-1 bootleg", NULL, NULL, NULL, mapper225_w, NULL, NULL, NULL }, |
| 11277 | | { 226, "76-in-1 bootleg", NULL, NULL, NULL, mapper226_w, NULL, NULL, NULL }, |
| 11278 | | { 227, "1200-in-1 bootleg", NULL, NULL, NULL, mapper227_w, NULL, NULL, NULL }, |
| 11279 | | { 228, "Action 52", NULL, NULL, NULL, mapper228_w, NULL, NULL, NULL }, |
| 11280 | | { 229, "31-in-1", NULL, NULL, NULL, mapper229_w, NULL, NULL, NULL }, |
| 11281 | | { 230, "22-in-1", NULL, NULL, NULL, mapper230_w, NULL, NULL, NULL }, |
| 11282 | | { 231, "20-in-1", NULL, NULL, NULL, mapper231_w, NULL, NULL, NULL }, |
| 11283 | | { 232, "Quattro", NULL, NULL, mapper232_w, mapper232_w, NULL, NULL, NULL }, |
| 11284 | | // 233 Super 22 Games |
| 11285 | | // 234 AVE Maxi 15 |
| 11286 | | // 235 Golden Game x-in-1 |
| 11287 | | // 236 Game 800-in-1 |
| 11288 | | // 237 Unused |
| 11289 | | // 238 Bootleg 6035052 |
| 11290 | | // 239 Unused |
| 11291 | | { 240, "Jing Ke Xin Zhuan", mapper240_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 11292 | | { 241, "Education 18-in-1", NULL, mapper241_l_r, NULL, mapper241_w, NULL, NULL, NULL }, |
| 11293 | | { 242, "Wai Xing Zhan Shi", NULL, NULL, NULL, mapper242_w, NULL, NULL, NULL }, |
| 11294 | | { 243, "Sachen 74LS374A", mapper243_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 11295 | | { 244, "Decathlon", NULL, NULL, NULL, mapper244_w, NULL, NULL, NULL }, |
| 11296 | | { 245, "Waixing Type H", NULL, NULL, NULL, mapper245_w, NULL, NULL, mapper4_irq }, |
| 11297 | | { 246, "Fong Shen Bang", NULL, NULL, mapper246_m_w, NULL, NULL, NULL, NULL }, |
| 11298 | | // 247, 248 Unused |
| 11299 | | { 249, "Waixing Security Board", mapper249_l_w, NULL, NULL, mapper249_w, NULL, NULL, mapper4_irq }, |
| 11300 | | { 250, "Time Diver Avenger", NULL, NULL, NULL, mapper250_w, NULL, NULL, mapper4_irq }, |
| 11301 | | // 251 Shen Hua Jian Yun III?? |
| 11302 | | { 252, "Waixing San Guo Zhi", NULL, NULL, NULL, mapper252_w, NULL, NULL, konami_irq }, |
| 11303 | | // 253 Super 8-in-1 99 King Fighter?? |
| 11304 | | // 254 Pikachu Y2K |
| 11305 | | { 255, "110-in-1", NULL, NULL, NULL, mapper255_w, NULL, NULL, NULL }, |
| 11306 | | }; |
| 11307 | | |
| 11308 | | |
| 11309 | | const mmc *nes_mapper_lookup( int mapper ) |
| 11310 | | { |
| 11311 | | int i; |
| 11312 | | for (i = 0; i < sizeof(mmc_list) / sizeof(mmc_list[0]); i++) |
| 11313 | | { |
| 11314 | | if (mmc_list[i].iNesMapper == nes.mapper) |
| 11315 | | return &mmc_list[i]; |
| 11316 | | } |
| 11317 | | return NULL; |
| 11318 | | } |
| 11319 | | |
| 11320 | | /************************************************************* |
| 11321 | | |
| 11322 | | mapper_reset |
| 11323 | | |
| 11324 | | Resets the mapper bankswitch areas to their defaults. |
| 11325 | | It returns a value "err" that indicates if it was |
| 11326 | | successful. Possible values for err are: |
| 11327 | | |
| 11328 | | 0 = success |
| 11329 | | 1 = no mapper found |
| 11330 | | 2 = mapper not supported |
| 11331 | | |
| 11332 | | *************************************************************/ |
| 11333 | | |
| 11334 | | int mapper_reset( running_machine *machine, int mmc_num ) |
| 11335 | | { |
| 11336 | 745 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 11337 | | nes_state *state = machine->driver_data; |
| 11338 | 746 | int err = 0, i; |
| 11339 | | const mmc *mapper; |
| 11340 | 747 | |
| 11341 | | if (nes.chr_chunks == 0) |
| 11342 | | chr8(machine, 0,CHRRAM); |
| 11343 | | else |
| 11344 | | chr8(machine, 0,CHRROM); |
| 11345 | | |
| 11346 | | /* Set the mapper irq callback */ |
| 11347 | | mapper = nes_mapper_lookup(mmc_num); |
| 11348 | | |
| 11349 | | if (mapper == NULL) |
| 11350 | | fatalerror("Unimplemented Mapper %d", mmc_num); |
| 11351 | | // logerror("Mapper %d is not yet supported, defaulting to no mapper.\n", mmc_num); // this one would be a better output |
| 11352 | | |
| 11353 | | |
| 11354 | | ppu2c0x_set_scanline_callback(state->ppu, mapper ? mapper->mmc_scanline : NULL); |
| 11355 | | ppu2c0x_set_hblank_callback(state->ppu, mapper ? mapper->mmc_hblank : NULL); |
| 11356 | | |
| 11357 | | if (!nes_irq_timer) |
| 11358 | | nes_irq_timer = timer_alloc(machine, nes_irq_callback, NULL); |
| 11359 | | |
| 11360 | | mapper_warning = 0; |
| 11361 | | |
| 11362 | | MMC5_vram_control = 0; |
| 11363 | | |
| 11364 | | /* Point the WRAM/battery area to the first RAM bank */ |
| 11365 | | if (mmc_num != 20) |
| 11366 | | memory_set_bankptr(space->machine, 5, &nes.wram[0x0000]); |
| 11367 | | |
| 11368 | | /* Here, we init a few helpers: 4 prg banks and 16 chr banks - some mappers use them */ |
| 11369 | | for (i = 0; i < 4; i++) |
| 11370 | | prg_bank[i] = 0; |
| 11371 | | for (i = 0; i < 16; i++) |
| 11372 | | vrom_bank[i] = 0; |
| 11373 | | for (i = 0; i < 16; i++) |
| 11374 | | extra_bank[i] = 0; |
| 11375 | | |
| 11376 | | /* Finally, we init IRQ-related quantities. */ |
| 11377 | | IRQ_enable = IRQ_enable_latch = 0; |
| 11378 | | IRQ_count = IRQ_count_latch = 0; |
| 11379 | | IRQ_toggle = 0; |
| 11380 | | |
| 11381 | 748 | switch (mmc_num) |
| 11382 | 749 | { |
| 11383 | 750 | case 0: |
| r6047 | r6048 | |
| 12161 | 1528 | err = 2; |
| 12162 | 1529 | break; |
| 12163 | 1530 | } |
| 1531 | |
| 12164 | 1532 | return err; |
| 12165 | 1533 | } |
| 12166 | 1534 | |
| 12167 | | /* VERY preliminary UNIF code - to be split afterwords! */ |
| 12168 | | |
| 12169 | 1535 | /************************************************************* |
| 12170 | 1536 | |
| 12171 | | unif_list |
| 1537 | mapper_reset |
| 12172 | 1538 | |
| 12173 | | Supported UNIF boards and corresponding handlers |
| 1539 | Resets the mapper bankswitch areas to their defaults. |
| 1540 | It returns a value "err" that indicates if it was |
| 1541 | successful. Possible values for err are: |
| 12174 | 1542 | |
| 1543 | 0 = success |
| 1544 | 1 = no mapper found |
| 1545 | 2 = mapper not supported |
| 1546 | |
| 12175 | 1547 | *************************************************************/ |
| 12176 | 1548 | |
| 12177 | | enum |
| 1549 | int mapper_reset( running_machine *machine, int mmc_num ) |
| 12178 | 1550 | { |
| 12179 | | CHRRAM_0 = 0, |
| 12180 | | CHRRAM_1, |
| 12181 | | CHRRAM_2, |
| 12182 | | CHRRAM_4, |
| 12183 | | CHRRAM_6, |
| 12184 | | CHRRAM_8, |
| 12185 | | CHRRAM_16, |
| 12186 | | CHRRAM_32 |
| 12187 | | }; |
| 1551 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1552 | nes_state *state = machine->driver_data; |
| 1553 | int err = 0, i; |
| 1554 | const mmc *mapper; |
| 12188 | 1555 | |
| 12189 | | enum |
| 12190 | | { |
| 12191 | | NROM = 0, |
| 12192 | | SACHEN_8259A |
| 12193 | | }; |
| 1556 | if (nes.chr_chunks == 0) |
| 1557 | chr8(machine, 0,CHRRAM); |
| 1558 | else |
| 1559 | chr8(machine, 0,CHRROM); |
| 12194 | 1560 | |
| 12195 | | static const unif unif_list[] = |
| 12196 | | { |
| 12197 | | /* UNIF LOW_W, LOW_R, MED_W, HIGH_W, PPU_latch, scanline CB, hblank CB PRG CHR NVW WRAM CRAM NMT IDX*/ |
| 12198 | | { "UNL-SACHEN-8259A", mapper141_l_w, NULL, mapper141_m_w, NULL, NULL, NULL, NULL, 16, 32, 0, 0, CHRRAM_0, 0, SACHEN_8259A}, |
| 12199 | | }; |
| 1561 | /* Set the mapper irq callback */ |
| 1562 | mapper = nes_mapper_lookup(mmc_num); |
| 12200 | 1563 | |
| 12201 | | const unif *nes_unif_lookup( const char *board ) |
| 12202 | | { |
| 12203 | | int i; |
| 12204 | | for (i = 0; i < sizeof(unif_list) / sizeof(unif_list[0]); i++) |
| 12205 | | { |
| 12206 | | if (!mame_stricmp(unif_list[i].board, board)) |
| 12207 | | return &unif_list[i]; |
| 12208 | | } |
| 12209 | | return NULL; |
| 1564 | if (mapper == NULL) |
| 1565 | fatalerror("Unimplemented Mapper %d", mmc_num); |
| 1566 | // logerror("Mapper %d is not yet supported, defaulting to no mapper.\n", mmc_num); // this one would be a better output |
| 1567 | |
| 1568 | |
| 1569 | ppu2c0x_set_scanline_callback(state->ppu, mapper ? mapper->mmc_scanline : NULL); |
| 1570 | ppu2c0x_set_hblank_callback(state->ppu, mapper ? mapper->mmc_hblank : NULL); |
| 1571 | |
| 1572 | if (!nes_irq_timer) |
| 1573 | nes_irq_timer = timer_alloc(machine, nes_irq_callback, NULL); |
| 1574 | |
| 1575 | mapper_warning = 0; |
| 1576 | |
| 1577 | MMC5_vram_control = 0; |
| 1578 | |
| 1579 | /* Point the WRAM/battery area to the first RAM bank */ |
| 1580 | if (mmc_num != 20) |
| 1581 | memory_set_bankptr(space->machine, 5, &nes.wram[0x0000]); |
| 1582 | |
| 1583 | /* Here, we init a few helpers: 4 prg banks and 16 chr banks - some mappers use them */ |
| 1584 | for (i = 0; i < 4; i++) |
| 1585 | prg_bank[i] = 0; |
| 1586 | for (i = 0; i < 16; i++) |
| 1587 | vrom_bank[i] = 0; |
| 1588 | for (i = 0; i < 16; i++) |
| 1589 | extra_bank[i] = 0; |
| 1590 | |
| 1591 | /* Finally, we init IRQ-related quantities. */ |
| 1592 | IRQ_enable = IRQ_enable_latch = 0; |
| 1593 | IRQ_count = IRQ_count_latch = 0; |
| 1594 | IRQ_toggle = 0; |
| 1595 | |
| 1596 | err = mapper_initialize(machine, mmc_num); |
| 1597 | |
| 1598 | return err; |
| 12210 | 1599 | } |
| 12211 | 1600 | |
| 1601 | /************************************************************* |
| 12212 | 1602 | |
| 12213 | | // WIP code - not very satisfactory... we would end up with a lot of duplicate code... |
| 1603 | Support for .unf Files |
| 1604 | |
| 1605 | *************************************************************/ |
| 1606 | |
| 1607 | /* Include emulation of UNIF Boards for .unf files */ |
| 1608 | #include "machine/nes_unif.c" |
| 1609 | |
| 1610 | // WIP code |
| 12214 | 1611 | int unif_reset( running_machine *machine, const char *board ) |
| 12215 | 1612 | { |
| 12216 | 1613 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| r6047 | r6048 | |
| 12240 | 1637 | |
| 12241 | 1638 | switch (unif_board->board_idx) |
| 12242 | 1639 | { |
| 1640 | case STD_NROM: |
| 1641 | case HVC_FAMBASIC: |
| 1642 | case JALECO_JF01: |
| 1643 | case JALECO_JF02: |
| 1644 | case JALECO_JF03: |
| 1645 | case JALECO_JF04: |
| 1646 | mapper_initialize(machine, 0); |
| 1647 | break; |
| 1648 | case STD_SAROM: |
| 1649 | case STD_SBROM: |
| 1650 | case STD_SCROM: |
| 1651 | case STD_SEROM: |
| 1652 | case STD_SFROM: |
| 1653 | case STD_SGROM: |
| 1654 | case STD_SHROM: |
| 1655 | case STD_SJROM: |
| 1656 | case STD_SKROM: |
| 1657 | case STD_SLROM: |
| 1658 | case STD_SNROM: |
| 1659 | case STD_SOROM: |
| 1660 | case STD_SUROM: |
| 1661 | case STD_SXROM: |
| 1662 | mapper_initialize(machine, 1); |
| 1663 | break; |
| 1664 | case STD_UNROM: |
| 1665 | case STD_UOROM: |
| 1666 | case JALECO_JF15: |
| 1667 | case JALECO_JF18: |
| 1668 | case JALECO_JF39: |
| 1669 | mapper_initialize(machine, 2); |
| 1670 | break; |
| 1671 | case AVE_74161: |
| 1672 | case BANDAI_PT554: |
| 1673 | case STD_CNROM: |
| 1674 | case NTDEC_N715062: |
| 1675 | case TENGEN_800008: |
| 1676 | mapper_initialize(machine, 3); |
| 1677 | break; |
| 1678 | case STD_HKROM: |
| 1679 | case STD_TEROM: |
| 1680 | case STD_TBROM: |
| 1681 | case STD_TFROM: |
| 1682 | case STD_TGROM: |
| 1683 | case STD_TKROM: |
| 1684 | case STD_TLROM: |
| 1685 | case STD_TNROM: |
| 1686 | case STD_TR1ROM: |
| 1687 | case STD_TSROM: |
| 1688 | case STD_TVROM: |
| 1689 | mapper_initialize(machine, 4); |
| 1690 | break; |
| 1691 | case STD_EKROM: |
| 1692 | case STD_ELROM: |
| 1693 | case STD_ETROM: |
| 1694 | case STD_EWROM: |
| 1695 | mapper_initialize(machine, 5); |
| 1696 | break; |
| 1697 | case STD_AMROM: |
| 1698 | case STD_ANROM: |
| 1699 | case STD_AN1ROM: |
| 1700 | case STD_AOROM: |
| 1701 | mapper_initialize(machine, 7); |
| 1702 | break; |
| 1703 | case STD_FJROM: |
| 1704 | case STD_FKROM: |
| 1705 | mapper_initialize(machine, 10); |
| 1706 | break; |
| 1707 | case AGCI_47516: |
| 1708 | case AVE_NINA07: |
| 1709 | case COLORDREAMS: |
| 1710 | mapper_initialize(machine, 11); |
| 1711 | break; |
| 1712 | case REXSOFT_SL1632: |
| 1713 | mapper_initialize(machine, 14); |
| 1714 | break; |
| 1715 | case BANDAI_LZ93D50_A: |
| 1716 | case BANDAI_LZ93D50_B: |
| 1717 | mapper_initialize(machine, 16); |
| 1718 | break; |
| 1719 | case JALECO_JF23: |
| 1720 | case JALECO_JF24: |
| 1721 | case JALECO_JF25: |
| 1722 | case JALECO_JF27: |
| 1723 | case JALECO_JF29: |
| 1724 | case JALECO_JF30: |
| 1725 | case JALECO_JF31: |
| 1726 | case JALECO_JF32: |
| 1727 | case JALECO_JF33: |
| 1728 | case JALECO_JF34: |
| 1729 | case JALECO_JF35: |
| 1730 | case JALECO_JF36: |
| 1731 | case JALECO_JF37: |
| 1732 | case JALECO_JF38: |
| 1733 | case JALECO_JF40: |
| 1734 | case JALECO_JF41: |
| 1735 | mapper_initialize(machine, 18); |
| 1736 | break; |
| 1737 | case NAMCOT_163: |
| 1738 | mapper_initialize(machine, 19); |
| 1739 | break; |
| 1740 | case KONAMI_VRC4: |
| 1741 | mapper_initialize(machine, 21); |
| 1742 | break; |
| 1743 | case KONAMI_VRC2: |
| 1744 | mapper_initialize(machine, 22); |
| 1745 | break; |
| 1746 | case KONAMI_VRC6: |
| 1747 | mapper_initialize(machine, 24); |
| 1748 | break; |
| 1749 | case IREM_G101: |
| 1750 | case IREM_G101A: |
| 1751 | case IREM_G101B: |
| 1752 | mapper_initialize(machine, 32); |
| 1753 | break; |
| 1754 | case TAITO_TC0190FMC: |
| 1755 | mapper_initialize(machine, 33); |
| 1756 | break; |
| 1757 | case STD_BNROM: |
| 1758 | case AVE_NINA01: |
| 1759 | case AVE_NINA02: |
| 1760 | mapper_initialize(machine, 34); |
| 1761 | break; |
| 1762 | case NES_ZZ: |
| 1763 | mapper_initialize(machine, 37); |
| 1764 | break; |
| 1765 | case CALTRON_6IN1: |
| 1766 | mapper_initialize(machine, 41); |
| 1767 | break; |
| 1768 | case UNL_SMB2J: |
| 1769 | mapper_initialize(machine, 43); |
| 1770 | break; |
| 1771 | case NES_QJ: |
| 1772 | mapper_initialize(machine, 47); |
| 1773 | break; |
| 1774 | case TAITO_TC0190FMCP: |
| 1775 | mapper_initialize(machine, 48); |
| 1776 | break; |
| 1777 | case TENGEN_800032: |
| 1778 | mapper_initialize(machine, 64); |
| 1779 | break; |
| 1780 | case STD_GNROM: |
| 1781 | case STD_MHROM: |
| 1782 | mapper_initialize(machine, 66); |
| 1783 | break; |
| 1784 | case SUNSOFT_3: |
| 1785 | mapper_initialize(machine, 67); |
| 1786 | break; |
| 1787 | case STD_NTBROM: |
| 1788 | case SUNSOFT_4: |
| 1789 | case TENGEN_800042: |
| 1790 | mapper_initialize(machine, 68); |
| 1791 | break; |
| 1792 | case STD_JLROM: |
| 1793 | case STD_JSROM: |
| 1794 | case NES_BTR: |
| 1795 | case SUNSOFT_5B: |
| 1796 | case SUNSOFT_FME7: |
| 1797 | mapper_initialize(machine, 69); |
| 1798 | break; |
| 1799 | case BANDAI_74161: |
| 1800 | case TAITO_74161: |
| 1801 | mapper_initialize(machine, 70); |
| 1802 | break; |
| 1803 | case CAMERICA_ALGN: |
| 1804 | case CAMERICA_9093: |
| 1805 | mapper_initialize(machine, 71); |
| 1806 | break; |
| 1807 | case CAMERICA_9097: |
| 1808 | nes.crc_hack = 0xf0; |
| 1809 | mapper_initialize(machine, 71); |
| 1810 | break; |
| 1811 | case JALECO_JF17: |
| 1812 | case JALECO_JF26: |
| 1813 | case JALECO_JF28: |
| 1814 | mapper_initialize(machine, 72); |
| 1815 | break; |
| 1816 | case KONAMI_VRC3: |
| 1817 | mapper_initialize(machine, 73); |
| 1818 | break; |
| 1819 | case KONAMI_VRC1: |
| 1820 | case JALECO_JF20: |
| 1821 | case JALECO_JF22: |
| 1822 | mapper_initialize(machine, 75); |
| 1823 | break; |
| 1824 | case NAMCOT_3446: |
| 1825 | mapper_initialize(machine, 76); |
| 1826 | break; |
| 1827 | case IREM_74161: |
| 1828 | mapper_initialize(machine, 77); |
| 1829 | break; |
| 1830 | case IREM_HOLYDIV: |
| 1831 | case JALECO_JF16: |
| 1832 | mapper_initialize(machine, 78); |
| 1833 | break; |
| 1834 | case AVE_NINA03: |
| 1835 | case AVE_NINA06: |
| 1836 | case AVE_MB91: |
| 1837 | mapper_initialize(machine, 79); |
| 1838 | break; |
| 1839 | case TAITO_X1005: |
| 1840 | mapper_initialize(machine, 80); |
| 1841 | break; |
| 1842 | case TAITO_X1017: |
| 1843 | mapper_initialize(machine, 82); |
| 1844 | break; |
| 1845 | case KONAMI_VRC7: |
| 1846 | mapper_initialize(machine, 85); |
| 1847 | break; |
| 1848 | case JALECO_JF13: |
| 1849 | mapper_initialize(machine, 86); |
| 1850 | break; |
| 1851 | case TAITO_74139: |
| 1852 | case KONAMI_74139: |
| 1853 | case JALECO_JF05: |
| 1854 | case JALECO_JF06: |
| 1855 | case JALECO_JF07: |
| 1856 | case JALECO_JF08: |
| 1857 | case JALECO_JF09: |
| 1858 | case JALECO_JF10: |
| 1859 | mapper_initialize(machine, 87); |
| 1860 | break; |
| 1861 | case NAMCOT_3443: |
| 1862 | case NAMCOT_3433: |
| 1863 | mapper_initialize(machine, 88); |
| 1864 | break; |
| 1865 | case SUNSOFT_2B: |
| 1866 | mapper_initialize(machine, 89); |
| 1867 | break; |
| 1868 | case JALECO_JF19: |
| 1869 | case JALECO_JF21: |
| 1870 | mapper_initialize(machine, 92); |
| 1871 | break; |
| 1872 | case STD_UN1ROM: |
| 1873 | mapper_initialize(machine, 94); |
| 1874 | break; |
| 1875 | case NAMCOT_3425: |
| 1876 | mapper_initialize(machine, 95); |
| 1877 | break; |
| 1878 | case STD_TKSROM: |
| 1879 | case STD_TLSROM: |
| 1880 | mapper_initialize(machine, 118); |
| 1881 | break; |
| 1882 | case STD_TQROM: |
| 1883 | mapper_initialize(machine, 119); |
| 1884 | break; |
| 1885 | case TXC_22211A: |
| 1886 | mapper_initialize(machine, 132); |
| 1887 | break; |
| 1888 | case SACHEN_SA72008: |
| 1889 | mapper_initialize(machine, 133); |
| 1890 | break; |
| 1891 | case SACHEN_TCU02: |
| 1892 | mapper_initialize(machine, 136); |
| 1893 | break; |
| 1894 | case SACHEN_8259D: |
| 1895 | mapper_initialize(machine, 137); |
| 1896 | break; |
| 1897 | case SACHEN_8259B: |
| 1898 | mapper_initialize(machine, 138); |
| 1899 | break; |
| 1900 | case SACHEN_8259C: |
| 1901 | mapper_initialize(machine, 139); |
| 1902 | break; |
| 1903 | case JALECO_JF11: |
| 1904 | case JALECO_JF12: |
| 1905 | case JALECO_JF14: |
| 1906 | mapper_initialize(machine, 140); |
| 1907 | break; |
| 12243 | 1908 | case SACHEN_8259A: |
| 12244 | | mmc_cmd1 = 0; |
| 12245 | | mmc_chr_source = nes.chr_chunks ? CHRROM : CHRRAM; |
| 12246 | | prg32(space->machine, 0); |
| 12247 | | chr8(space->machine, 0, mmc_chr_source); |
| 12248 | | set_nt_mirroring(PPU_MIRROR_VERT); |
| 1909 | mapper_initialize(machine, 141); |
| 12249 | 1910 | break; |
| 1911 | case SACHEN_TCA01: |
| 1912 | mapper_initialize(machine, 143); |
| 1913 | break; |
| 1914 | case AGCI_50282: |
| 1915 | mapper_initialize(machine, 144); |
| 1916 | break; |
| 1917 | case SACHEN_SA72007: |
| 1918 | mapper_initialize(machine, 145); |
| 1919 | break; |
| 1920 | case SACHEN_SA0161M: |
| 1921 | mapper_initialize(machine, 146); |
| 1922 | break; |
| 1923 | case SACHEN_TCU01: |
| 1924 | mapper_initialize(machine, 147); |
| 1925 | break; |
| 1926 | case SACHEN_SA0037: |
| 1927 | mapper_initialize(machine, 148); |
| 1928 | break; |
| 1929 | case SACHEN_SA0036: |
| 1930 | mapper_initialize(machine, 149); |
| 1931 | break; |
| 1932 | case SACHEN_74LS374: |
| 1933 | mapper_initialize(machine, 150); |
| 1934 | break; |
| 1935 | case BANDAI_FCG1: |
| 1936 | case BANDAI_FCG2: |
| 1937 | case BANDAI_JUMP2: |
| 1938 | mapper_initialize(machine, 153); |
| 1939 | break; |
| 1940 | case TENGEN_800037: |
| 1941 | mapper_initialize(machine, 158); |
| 1942 | break; |
| 1943 | case SUNSOFT_1: |
| 1944 | mapper_initialize(machine, 184); |
| 1945 | break; |
| 1946 | case STD_DEROM: |
| 1947 | case STD_DE1ROM: |
| 1948 | case STD_DRROM: |
| 1949 | case TENGEN_800002: |
| 1950 | case TENGEN_800004: |
| 1951 | case TENGEN_800030: |
| 1952 | mapper_initialize(machine, 206); |
| 1953 | break; |
| 1954 | case UNL_N625092: |
| 1955 | mapper_initialize(machine, 221); |
| 1956 | break; |
| 1957 | case ACTENT_ACT52: |
| 1958 | mapper_initialize(machine, 228); |
| 1959 | break; |
| 1960 | case CAMERICA_ALGQ: |
| 1961 | case CAMERICA_9096: |
| 1962 | mapper_initialize(machine, 232); |
| 1963 | break; |
| 1964 | |
| 12250 | 1965 | default: |
| 12251 | 1966 | /* Mapper not supported */ |
| 12252 | 1967 | err = 2; |
| r6047 | r6048 | |
| 12254 | 1969 | } |
| 12255 | 1970 | return err; |
| 12256 | 1971 | } |
| 12257 | | |
src/mess/machine/nes_ines.c
| r0 | r6048 | |
| 1 | /***************************************************************************************** |
| 2 | |
| 3 | NES MMC Emulation |
| 4 | |
| 5 | Support for iNES Mappers |
| 6 | |
| 7 | ****************************************************************************************/ |
| 8 | |
| 9 | /************************************************************* |
| 10 | |
| 11 | Mapper 0 |
| 12 | |
| 13 | 32K PRG ROM + 8K or less CHR ROM |
| 14 | No need of additional MMC |
| 15 | |
| 16 | Known Boards: NROM, FB02??, FB04??, Jaleco JF01, JF02, JF03, JF04 |
| 17 | Games: Mario Bros., Super Mario Bros., Tennis and most of |
| 18 | the first generation games |
| 19 | |
| 20 | In MESS: Supported, no need of specific handlers or IRQ |
| 21 | |
| 22 | *************************************************************/ |
| 23 | |
| 24 | /************************************************************* |
| 25 | |
| 26 | Mapper 1 |
| 27 | |
| 28 | Known Boards: MMC1 based Boards, i.e. SAROM, SBROM, SCROM, |
| 29 | SEROM, SFROM, SGROM, SHROM, SJROM, SKROM, SLROM, SNROM, |
| 30 | SOROM, SUROM, SXROM, WH?? |
| 31 | Games: Faxanadu, Final Fantasy I & II, Kid Icarus, Legend |
| 32 | of Zelda, Metroid |
| 33 | |
| 34 | In MESS: Supported |
| 35 | |
| 36 | *************************************************************/ |
| 37 | |
| 38 | static void MMC1_set_prg( running_machine *machine ) |
| 39 | { |
| 40 | UINT8 prg_mode, prg_offset; |
| 41 | |
| 42 | prg_mode = MMC1_regs[0] & 0x0c; |
| 43 | /* prg_mode&0x8 determines bank size: 32k (if 0) or 16k (if 1)? when in 16k mode, |
| 44 | prg_mode&0x4 determines which half of the PRG space we can swap: if it is 4, |
| 45 | MMC1_regs[3] sets banks at 0x8000; if it is 0, MMC1_regs[3] sets banks at 0xc000. */ |
| 46 | |
| 47 | prg_offset = MMC1_regs[1] & 0x10; |
| 48 | /* In principle, MMC1_regs[2]&0x10 might affect "extended" banks as well, when chr_mode=1. |
| 49 | However, quoting Disch's docs: When in 4k CHR mode, 0x10 in both $A000 and $C000 *must* be |
| 50 | set to the same value, or else pages will constantly be swapped as graphics render! |
| 51 | Hence, we use only MMC1_regs[1]&0x10 for prg_offset */ |
| 52 | |
| 53 | switch (prg_mode) |
| 54 | { |
| 55 | case 0x00: |
| 56 | case 0x04: |
| 57 | prg32(machine, prg_offset + MMC1_regs[3]); |
| 58 | break; |
| 59 | case 0x08: |
| 60 | prg16_89ab(machine, prg_offset + 0); |
| 61 | prg16_cdef(machine, prg_offset + MMC1_regs[3]); |
| 62 | break; |
| 63 | case 0x0c: |
| 64 | prg16_89ab(machine, prg_offset + MMC1_regs[3]); |
| 65 | prg16_cdef(machine, prg_offset + 0x0f); |
| 66 | break; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | static void MMC1_set_chr( running_machine *machine ) |
| 71 | { |
| 72 | UINT8 chr_mode = MMC1_regs[0] & 0x10; |
| 73 | |
| 74 | if (nes.chr_chunks) |
| 75 | { |
| 76 | if (chr_mode) |
| 77 | { |
| 78 | chr4_0(machine, MMC1_regs[1] & 0x1f, CHRROM); |
| 79 | chr4_4(machine, MMC1_regs[2] & 0x1f, CHRROM); |
| 80 | } |
| 81 | else |
| 82 | chr8(machine, (MMC1_regs[1] & 0x1f) >> 1, CHRROM); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | static WRITE8_HANDLER( mapper1_w ) |
| 87 | { |
| 88 | /* Note that there is only one latch and shift counter, shared amongst the 4 regs */ |
| 89 | /* Space Shuttle will not work if they have independent variables. */ |
| 90 | LOG_MMC(("mapper1_w offset: %04x, data: %02x\n", offset, data)); |
| 91 | |
| 92 | |
| 93 | /* here we would need to add an if(cpu_cycles_passed>1) test, and |
| 94 | if requirement is not met simply return without writing anything. |
| 95 | AD&D Hillsfar and Bill & Ted rely on this behavior!! */ |
| 96 | if (data & 0x80) |
| 97 | { |
| 98 | mmc_count = 0; |
| 99 | mmc_cmd1 = 0; |
| 100 | |
| 101 | /* Set reg at 0x8000 to size 16k and lower half swap - needed for Robocop 3, Dynowars */ |
| 102 | MMC1_regs[0] |= 0x0c; |
| 103 | MMC1_set_prg(space->machine); |
| 104 | |
| 105 | LOG_MMC(("=== MMC1 regs reset to default\n")); |
| 106 | return; |
| 107 | } |
| 108 | |
| 109 | if (mmc_count < 5) |
| 110 | { |
| 111 | if (mmc_count == 0) mmc_cmd1 = 0; |
| 112 | mmc_cmd1 >>= 1; |
| 113 | mmc_cmd1 |= (data & 0x01) ? 0x10 : 0x00; |
| 114 | mmc_count++; |
| 115 | } |
| 116 | |
| 117 | if (mmc_count == 5) |
| 118 | { |
| 119 | switch (offset & 0x6000) /* Which reg shall we write to? */ |
| 120 | { |
| 121 | case 0x0000: |
| 122 | MMC1_regs[0] = mmc_cmd1; |
| 123 | |
| 124 | switch (MMC1_regs[0] & 0x03) |
| 125 | { |
| 126 | case 0: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 127 | case 1: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 128 | case 2: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 129 | case 3: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 130 | } |
| 131 | MMC1_set_chr(space->machine); |
| 132 | MMC1_set_prg(space->machine); |
| 133 | break; |
| 134 | case 0x2000: |
| 135 | MMC1_regs[1] = mmc_cmd1; |
| 136 | MMC1_set_chr(space->machine); |
| 137 | MMC1_set_prg(space->machine); |
| 138 | break; |
| 139 | case 0x4000: |
| 140 | MMC1_regs[2] = mmc_cmd1; |
| 141 | MMC1_set_chr(space->machine); |
| 142 | break; |
| 143 | case 0x6000: |
| 144 | MMC1_regs[3] = mmc_cmd1; |
| 145 | MMC1_set_prg(space->machine); |
| 146 | break; |
| 147 | } |
| 148 | |
| 149 | mmc_count = 0; |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | /************************************************************* |
| 154 | |
| 155 | Mapper 2 |
| 156 | |
| 157 | Known Boards: UNROM, UOROM, UXROM, Jaleco JF15, JF18 & JF39 |
| 158 | Games: Castlevania, Dragon Quest II, Duck Tales, MegaMan, Metal Gear |
| 159 | |
| 160 | In MESS: Supported |
| 161 | |
| 162 | *************************************************************/ |
| 163 | |
| 164 | static WRITE8_HANDLER( mapper2_w ) |
| 165 | { |
| 166 | LOG_MMC(("mapper2_w offset: %04x, data: %02x\n", offset, data)); |
| 167 | |
| 168 | prg16_89ab(space->machine, data); |
| 169 | } |
| 170 | |
| 171 | /************************************************************* |
| 172 | |
| 173 | Mapper 3 |
| 174 | |
| 175 | Known Boards: CNROM, CXROM, X79B?, Bandai Aerobics Board, |
| 176 | Tengen 800008, Bootleg Board by NTDEC (N715062) |
| 177 | Games: Adventure Island, Flipull, Friday 13th, GeGeGe no |
| 178 | Kitarou, Ghostbusters, Gradius, Hokuto no Ken, Milon's |
| 179 | Secret Castle |
| 180 | |
| 181 | In MESS: Supported |
| 182 | |
| 183 | *************************************************************/ |
| 184 | |
| 185 | static WRITE8_HANDLER( mapper3_w ) |
| 186 | { |
| 187 | LOG_MMC(("mapper3_w offset: %04x, data: %02x\n", offset, data)); |
| 188 | |
| 189 | chr8(space->machine, data, CHRROM); |
| 190 | } |
| 191 | |
| 192 | /************************************************************* |
| 193 | |
| 194 | Mapper 4 |
| 195 | |
| 196 | Known Boards: MMC3 based Boards, i.e. HKROM, TEROM, TBROM, |
| 197 | TFROM, TGROM, TKROM, TLROM, TNROM, TR1ROM, TSROM, |
| 198 | TVROM, TRXROM |
| 199 | Games: Final Fantasy III, MegaMan 3,4,5 & 6, Startropics, |
| 200 | Super Mario Bros. 2 & 3, |
| 201 | |
| 202 | In MESS: Supported |
| 203 | |
| 204 | *************************************************************/ |
| 205 | |
| 206 | /* Many multigame carts based on MMC3 works as follows: they select a |
| 207 | block of banks by writing in the 0x6000-0x7fff range and then they |
| 208 | operate like a common MMC3 board on that specific block. To emulate this |
| 209 | we use the concept of bases and masks. Original MMC3 boards simply |
| 210 | set base = 0 and mask = 0xff at start and never change them */ |
| 211 | /* Notice that, atm, there is no way to directly handle MMC3 clone mappers |
| 212 | which use custom routines to set PRG/CHR. For these mappers we have to |
| 213 | re-define the 0x8000-0xffff handler at least for offsets 0 & 1 (i.e. the |
| 214 | offsets where are used set_prg/set_chr) by using the mapper-specific routines, |
| 215 | and then we can fall back to mapper4_w for the remaining offsets */ |
| 216 | |
| 217 | static void mapper4_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 218 | { |
| 219 | UINT8 prg_flip = (mmc_cmd1 & 0x40) ? 2 : 0; |
| 220 | |
| 221 | prg8_89(machine, prg_base | (prg_bank[0 ^ prg_flip] & prg_mask)); |
| 222 | prg8_ab(machine, prg_base | (prg_bank[1] & prg_mask)); |
| 223 | prg8_cd(machine, prg_base | (prg_bank[2 ^ prg_flip] & prg_mask)); |
| 224 | prg8_ef(machine, prg_base | (prg_bank[3] & prg_mask)); |
| 225 | } |
| 226 | |
| 227 | static void mapper4_set_chr( running_machine *machine, UINT8 chr, int chr_base, int chr_mask ) |
| 228 | { |
| 229 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 230 | |
| 231 | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr); |
| 232 | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr); |
| 233 | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr); |
| 234 | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr); |
| 235 | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr); |
| 236 | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr); |
| 237 | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr); |
| 238 | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr); |
| 239 | } |
| 240 | |
| 241 | /* Here, IRQ counter decrements every scanline. */ |
| 242 | static void mapper4_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 243 | { |
| 244 | if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE) |
| 245 | { |
| 246 | int priorCount = IRQ_count; |
| 247 | if ((IRQ_count == 0)) |
| 248 | { |
| 249 | IRQ_count = IRQ_count_latch; |
| 250 | } |
| 251 | else |
| 252 | IRQ_count--; |
| 253 | |
| 254 | if (IRQ_enable && !blanked && (IRQ_count == 0) && priorCount) |
| 255 | { |
| 256 | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, |
| 257 | video_screen_get_vpos(device->machine->primary_screen), video_screen_get_hpos(device->machine->primary_screen))); |
| 258 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | static WRITE8_HANDLER( mapper4_w ) |
| 264 | { |
| 265 | UINT8 MMC3_helper, cmd; |
| 266 | |
| 267 | LOG_MMC(("mapper4_w offset: %04x, data: %02x\n", offset, data)); |
| 268 | |
| 269 | switch (offset & 0x6001) |
| 270 | { |
| 271 | case 0x0000: |
| 272 | MMC3_helper = mmc_cmd1 ^ data; |
| 273 | mmc_cmd1 = data; |
| 274 | |
| 275 | /* Has PRG Mode changed? */ |
| 276 | if (MMC3_helper & 0x40) |
| 277 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 278 | |
| 279 | /* Has CHR Mode changed? */ |
| 280 | if (MMC3_helper & 0x80) |
| 281 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 282 | break; |
| 283 | |
| 284 | case 0x0001: |
| 285 | cmd = mmc_cmd1 & 0x07; |
| 286 | switch (cmd) |
| 287 | { |
| 288 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 289 | case 2: case 3: case 4: case 5: |
| 290 | vrom_bank[cmd] = data; |
| 291 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 292 | break; |
| 293 | case 6: |
| 294 | case 7: |
| 295 | prg_bank[cmd - 6] = data; |
| 296 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 297 | break; |
| 298 | } |
| 299 | break; |
| 300 | |
| 301 | case 0x2000: |
| 302 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 303 | break; |
| 304 | |
| 305 | case 0x2001: /* extra RAM enable/disable */ |
| 306 | mmc_cmd2 = data; /* This actually is made of two parts: data&0x80 = WRAM enabled and data&0x40 = WRAM readonly! */ |
| 307 | /* We save this twice because we will need mmc_cmd2 in some clone mapper */ |
| 308 | nes.mid_ram_enable = data; |
| 309 | break; |
| 310 | |
| 311 | case 0x4000: |
| 312 | IRQ_count_latch = data; |
| 313 | break; |
| 314 | |
| 315 | case 0x4001: /* some sources state that here we must have IRQ_count = IRQ_count_latch */ |
| 316 | IRQ_count = 0; |
| 317 | break; |
| 318 | |
| 319 | case 0x6000: |
| 320 | IRQ_enable = 0; |
| 321 | break; |
| 322 | |
| 323 | case 0x6001: |
| 324 | IRQ_enable = 1; |
| 325 | break; |
| 326 | |
| 327 | default: |
| 328 | logerror("mapper4_w uncaught: %04x value: %02x\n", offset + 0x8000, data); |
| 329 | break; |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | /************************************************************* |
| 334 | |
| 335 | Mapper 5 |
| 336 | |
| 337 | Known Boards: MMC3 based Boards, i.e. ELROM, EKROM, ETROM, |
| 338 | EWROM and EXROM variants |
| 339 | Games: Castlevania III, Just Breed, many Koei titles |
| 340 | |
| 341 | In MESS: Partially supported |
| 342 | |
| 343 | *************************************************************/ |
| 344 | |
| 345 | static void mapper5_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 346 | { |
| 347 | #if 1 |
| 348 | if (scanline == 0) |
| 349 | IRQ_status |= 0x40; |
| 350 | else if (scanline > PPU_BOTTOM_VISIBLE_SCANLINE) |
| 351 | IRQ_status &= ~0x40; |
| 352 | #endif |
| 353 | |
| 354 | if (scanline == IRQ_count) |
| 355 | { |
| 356 | if (IRQ_enable) |
| 357 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 358 | |
| 359 | IRQ_status = 0xff; |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | static void ppu_mirror_MMC5( int page, int src ) |
| 364 | { |
| 365 | switch (src) |
| 366 | { |
| 367 | case 0: /* CIRAM0 */ |
| 368 | set_nt_page(page, CIRAM, 0, 1); |
| 369 | break; |
| 370 | case 1: /* CIRAM1 */ |
| 371 | set_nt_page(page, CIRAM, 1, 1); |
| 372 | break; |
| 373 | case 2: /* ExRAM */ |
| 374 | set_nt_page(page, EXRAM, 0, 1); // actually only works during rendering. |
| 375 | break; |
| 376 | case 3: /* Fill Registers */ |
| 377 | set_nt_page(page, MMC5FILL, 0, 0); |
| 378 | break; |
| 379 | default: |
| 380 | fatalerror("This should never happen"); |
| 381 | break; |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | static READ8_HANDLER( mapper5_l_r ) |
| 386 | { |
| 387 | int retVal; |
| 388 | |
| 389 | /* $5c00 - $5fff: extended videoram attributes */ |
| 390 | if ((offset >= 0x1b00) && (offset <= 0x1eff)) |
| 391 | { |
| 392 | return MMC5_vram[offset - 0x1b00]; |
| 393 | } |
| 394 | |
| 395 | switch (offset) |
| 396 | { |
| 397 | case 0x1104: /* $5204 */ |
| 398 | #if 0 |
| 399 | if (current_scanline == MMC5_scanline) |
| 400 | return 0x80; |
| 401 | else |
| 402 | return 0x00; |
| 403 | #else |
| 404 | retVal = IRQ_status; |
| 405 | IRQ_status &= ~0x80; |
| 406 | return retVal; |
| 407 | #endif |
| 408 | |
| 409 | case 0x1105: /* $5205 */ |
| 410 | return (mult1 * mult2) & 0xff; |
| 411 | case 0x1106: /* $5206 */ |
| 412 | return ((mult1 * mult2) & 0xff00) >> 8; |
| 413 | |
| 414 | default: |
| 415 | logerror("** MMC5 uncaught read, offset: %04x\n", offset + 0x4100); |
| 416 | return 0x00; |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | //static void mapper5_sync_vrom (int mode) |
| 421 | //{ |
| 422 | // int i; |
| 423 | // |
| 424 | // for (i = 0; i < 8; i ++) |
| 425 | // nes_vram[i] = vrom_bank[0 + (mode * 8)] * 64; |
| 426 | //} |
| 427 | |
| 428 | static WRITE8_HANDLER( mapper5_l_w ) |
| 429 | { |
| 430 | nes_state *state = space->machine->driver_data; |
| 431 | |
| 432 | // static int vrom_next[4]; |
| 433 | static int vrom_page_a; |
| 434 | static int vrom_page_b; |
| 435 | |
| 436 | // LOG_MMC(("Mapper 5 write, offset: %04x, data: %02x\n", offset + 0x4100, data)); |
| 437 | /* Send $5000-$5015 to the sound chip */ |
| 438 | if ((offset >= 0xf00) && (offset <= 0xf15)) |
| 439 | { |
| 440 | nes_psg_w(state->sound, offset & 0x1f, data); |
| 441 | return; |
| 442 | } |
| 443 | |
| 444 | /* $5c00 - $5fff: extended videoram attributes */ |
| 445 | if ((offset >= 0x1b00) && (offset <= 0x1eff)) |
| 446 | { |
| 447 | if (MMC5_vram_protect == 0x03) |
| 448 | MMC5_vram[offset - 0x1b00] = data; |
| 449 | return; |
| 450 | } |
| 451 | |
| 452 | switch (offset) |
| 453 | { |
| 454 | case 0x1000: /* $5100 */ |
| 455 | MMC5_rom_bank_mode = data & 0x03; |
| 456 | LOG_MMC(("MMC5 rom bank mode: %02x\n", data)); |
| 457 | break; |
| 458 | |
| 459 | case 0x1001: /* $5101 */ |
| 460 | MMC5_vrom_bank_mode = data & 0x03; |
| 461 | LOG_MMC(("MMC5 vrom bank mode: %02x\n", data)); |
| 462 | break; |
| 463 | |
| 464 | case 0x1002: /* $5102 */ |
| 465 | if (data == 0x02) |
| 466 | MMC5_vram_protect |= 1; |
| 467 | else |
| 468 | MMC5_vram_protect = 0; |
| 469 | LOG_MMC(("MMC5 vram protect 1: %02x\n", data)); |
| 470 | break; |
| 471 | case 0x1003: /* 5103 */ |
| 472 | if (data == 0x01) |
| 473 | MMC5_vram_protect |= 2; |
| 474 | else |
| 475 | MMC5_vram_protect = 0; |
| 476 | LOG_MMC(("MMC5 vram protect 2: %02x\n", data)); |
| 477 | break; |
| 478 | |
| 479 | case 0x1004: /* $5104 - Extra VRAM (EXRAM) control */ |
| 480 | MMC5_vram_control = data; |
| 481 | LOG_MMC(("MMC5 exram control: %02x\n", data)); |
| 482 | break; |
| 483 | |
| 484 | case 0x1005: /* $5105 */ |
| 485 | ppu_mirror_MMC5(0, data & 0x03); |
| 486 | ppu_mirror_MMC5(1, (data & 0x0c) >> 2); |
| 487 | ppu_mirror_MMC5(2, (data & 0x30) >> 4); |
| 488 | ppu_mirror_MMC5(3, (data & 0xc0) >> 6); |
| 489 | break; |
| 490 | |
| 491 | /* tile data for MMC5 flood-fill NT mode */ |
| 492 | case 0x1006: |
| 493 | MMC5_floodtile = data; |
| 494 | break; |
| 495 | |
| 496 | /* attr data for MMC5 flood-fill NT mode */ |
| 497 | case 0x1007: |
| 498 | switch (data & 3) |
| 499 | { |
| 500 | default: |
| 501 | case 0: MMC5_floodattr = 0x00; break; |
| 502 | case 1: MMC5_floodattr = 0x55; break; |
| 503 | case 2: MMC5_floodattr = 0xaa; break; |
| 504 | case 3: MMC5_floodattr = 0xff; break; |
| 505 | } |
| 506 | break; |
| 507 | |
| 508 | case 0x1013: /* $5113 */ |
| 509 | LOG_MMC(("MMC5 mid RAM bank select: %02x\n", data & 0x07)); |
| 510 | memory_set_bankptr(space->machine, 5, &nes.wram[data * 0x2000]); |
| 511 | /* The & 4 is a hack that'll tide us over for now */ |
| 512 | nes_battery_ram = &nes.wram[(data & 4) * 0x2000]; |
| 513 | break; |
| 514 | |
| 515 | case 0x1014: /* $5114 */ |
| 516 | LOG_MMC(("MMC5 $5114 bank select: %02x (mode: %d)\n", data, MMC5_rom_bank_mode)); |
| 517 | switch (MMC5_rom_bank_mode) |
| 518 | { |
| 519 | case 0x03: |
| 520 | /* 8k switch */ |
| 521 | if (data & 0x80) |
| 522 | { |
| 523 | /* ROM */ |
| 524 | LOG_MMC(("\tROM bank select (8k, $8000): %02x\n", data)); |
| 525 | data &= ((nes.prg_chunks << 1) - 1); |
| 526 | memory_set_bankptr(space->machine, 1, &nes.rom[data * 0x2000 + 0x10000]); |
| 527 | } |
| 528 | else |
| 529 | { |
| 530 | /* RAM */ |
| 531 | LOG_MMC(("\tRAM bank select (8k, $8000): %02x\n", data & 0x07)); |
| 532 | /* The & 4 is a hack that'll tide us over for now */ |
| 533 | memory_set_bankptr(space->machine, 1, &nes.wram[(data & 4) * 0x2000]); |
| 534 | } |
| 535 | break; |
| 536 | } |
| 537 | break; |
| 538 | case 0x1015: /* $5115 */ |
| 539 | LOG_MMC(("MMC5 $5115 bank select: %02x (mode: %d)\n", data, MMC5_rom_bank_mode)); |
| 540 | switch (MMC5_rom_bank_mode) |
| 541 | { |
| 542 | case 0x01: |
| 543 | case 0x02: |
| 544 | if (data & 0x80) |
| 545 | { |
| 546 | /* 16k switch - ROM only */ |
| 547 | prg16_89ab(space->machine, (data & 0x7f) >> 1); |
| 548 | } |
| 549 | else |
| 550 | { |
| 551 | /* RAM */ |
| 552 | LOG_MMC(("\tRAM bank select (16k, $8000): %02x\n", data & 0x07)); |
| 553 | /* The & 4 is a hack that'll tide us over for now */ |
| 554 | memory_set_bankptr(space->machine, 1, &nes.wram[((data & 4) >> 1) * 0x4000]); |
| 555 | memory_set_bankptr(space->machine, 2, &nes.wram[((data & 4) >> 1) * 0x4000 + 0x2000]); |
| 556 | } |
| 557 | break; |
| 558 | case 0x03: |
| 559 | /* 8k switch */ |
| 560 | if (data & 0x80) |
| 561 | { |
| 562 | /* ROM */ |
| 563 | data &= ((nes.prg_chunks << 1) - 1); |
| 564 | memory_set_bankptr(space->machine, 2, &nes.rom[data * 0x2000 + 0x10000]); |
| 565 | } |
| 566 | else |
| 567 | { |
| 568 | /* RAM */ |
| 569 | LOG_MMC(("\tRAM bank select (8k, $a000): %02x\n", data & 0x07)); |
| 570 | /* The & 4 is a hack that'll tide us over for now */ |
| 571 | memory_set_bankptr(space->machine, 2, &nes.wram[(data & 4) * 0x2000]); |
| 572 | } |
| 573 | break; |
| 574 | } |
| 575 | break; |
| 576 | case 0x1016: /* $5116 */ |
| 577 | LOG_MMC(("MMC5 $5116 bank select: %02x (mode: %d)\n", data, MMC5_rom_bank_mode)); |
| 578 | switch (MMC5_rom_bank_mode) |
| 579 | { |
| 580 | case 0x02: |
| 581 | case 0x03: |
| 582 | /* 8k switch */ |
| 583 | if (data & 0x80) |
| 584 | { |
| 585 | /* ROM */ |
| 586 | data &= ((nes.prg_chunks << 1) - 1); |
| 587 | memory_set_bankptr(space->machine, 3, &nes.rom[data * 0x2000 + 0x10000]); |
| 588 | } |
| 589 | else |
| 590 | { |
| 591 | /* RAM */ |
| 592 | LOG_MMC(("\tRAM bank select (8k, $c000): %02x\n", data & 0x07)); |
| 593 | /* The & 4 is a hack that'll tide us over for now */ |
| 594 | memory_set_bankptr(space->machine, 3, &nes.wram[(data & 4)* 0x2000]); |
| 595 | } |
| 596 | break; |
| 597 | } |
| 598 | break; |
| 599 | case 0x1017: /* $5117 */ |
| 600 | LOG_MMC(("MMC5 $5117 bank select: %02x (mode: %d)\n", data, MMC5_rom_bank_mode)); |
| 601 | switch (MMC5_rom_bank_mode) |
| 602 | { |
| 603 | case 0x00: |
| 604 | /* 32k switch - ROM only */ |
| 605 | prg32(space->machine, data >> 2); |
| 606 | break; |
| 607 | case 0x01: |
| 608 | /* 16k switch - ROM only */ |
| 609 | prg16_cdef(space->machine, data >> 1); |
| 610 | break; |
| 611 | case 0x02: |
| 612 | case 0x03: |
| 613 | /* 8k switch */ |
| 614 | data &= ((nes.prg_chunks << 1) - 1); |
| 615 | memory_set_bankptr(space->machine, 4, &nes.rom[data * 0x2000 + 0x10000]); |
| 616 | break; |
| 617 | } |
| 618 | break; |
| 619 | case 0x1020: /* $5120 */ |
| 620 | LOG_MMC(("MMC5 $5120 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 621 | switch (MMC5_vrom_bank_mode) |
| 622 | { |
| 623 | case 0x03: |
| 624 | /* 1k switch */ |
| 625 | vrom_bank[0] = data; |
| 626 | // mapper5_sync_vrom(0); |
| 627 | chr1_0(space->machine, vrom_bank[0], CHRROM); |
| 628 | // nes_vram_sprite[0] = vrom_bank[0] * 64; |
| 629 | // vrom_next[0] = 4; |
| 630 | // vrom_page_a = 1; |
| 631 | // vrom_page_b = 0; |
| 632 | break; |
| 633 | } |
| 634 | break; |
| 635 | case 0x1021: /* $5121 */ |
| 636 | LOG_MMC(("MMC5 $5121 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 637 | switch (MMC5_vrom_bank_mode) |
| 638 | { |
| 639 | case 0x02: |
| 640 | /* 2k switch */ |
| 641 | chr2_0 (space->machine, data, CHRROM); |
| 642 | break; |
| 643 | case 0x03: |
| 644 | /* 1k switch */ |
| 645 | vrom_bank[1] = data; |
| 646 | // mapper5_sync_vrom(0); |
| 647 | chr1_1(space->machine, vrom_bank[1], CHRROM); |
| 648 | // nes_vram_sprite[1] = vrom_bank[0] * 64; |
| 649 | // vrom_next[1] = 5; |
| 650 | // vrom_page_a = 1; |
| 651 | // vrom_page_b = 0; |
| 652 | break; |
| 653 | } |
| 654 | break; |
| 655 | case 0x1022: /* $5122 */ |
| 656 | LOG_MMC(("MMC5 $5122 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 657 | switch (MMC5_vrom_bank_mode) |
| 658 | { |
| 659 | case 0x03: |
| 660 | /* 1k switch */ |
| 661 | vrom_bank[2] = data; |
| 662 | // mapper5_sync_vrom(0); |
| 663 | chr1_2(space->machine, vrom_bank[2], CHRROM); |
| 664 | // nes_vram_sprite[2] = vrom_bank[0] * 64; |
| 665 | // vrom_next[2] = 6; |
| 666 | // vrom_page_a = 1; |
| 667 | // vrom_page_b = 0; |
| 668 | break; |
| 669 | } |
| 670 | break; |
| 671 | case 0x1023: /* $5123 */ |
| 672 | LOG_MMC(("MMC5 $5123 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 673 | switch (MMC5_vrom_bank_mode) |
| 674 | { |
| 675 | case 0x01: |
| 676 | chr4_0 (space->machine, data, CHRROM); |
| 677 | break; |
| 678 | case 0x02: |
| 679 | /* 2k switch */ |
| 680 | chr2_2 (space->machine, data, CHRROM); |
| 681 | break; |
| 682 | case 0x03: |
| 683 | /* 1k switch */ |
| 684 | vrom_bank[3] = data; |
| 685 | // mapper5_sync_vrom(0); |
| 686 | chr1_3(space->machine, vrom_bank[3], CHRROM); |
| 687 | // nes_vram_sprite[3] = vrom_bank[0] * 64; |
| 688 | // vrom_next[3] = 7; |
| 689 | // vrom_page_a = 1; |
| 690 | // vrom_page_b = 0; |
| 691 | break; |
| 692 | } |
| 693 | break; |
| 694 | case 0x1024: /* $5124 */ |
| 695 | LOG_MMC(("MMC5 $5124 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 696 | switch (MMC5_vrom_bank_mode) |
| 697 | { |
| 698 | case 0x03: |
| 699 | /* 1k switch */ |
| 700 | vrom_bank[4] = data; |
| 701 | // mapper5_sync_vrom(0); |
| 702 | chr1_4(space->machine, vrom_bank[4], CHRROM); |
| 703 | // nes_vram_sprite[4] = vrom_bank[0] * 64; |
| 704 | // vrom_next[0] = 0; |
| 705 | // vrom_page_a = 0; |
| 706 | // vrom_page_b = 0; |
| 707 | break; |
| 708 | } |
| 709 | break; |
| 710 | case 0x1025: /* $5125 */ |
| 711 | LOG_MMC(("MMC5 $5125 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 712 | switch (MMC5_vrom_bank_mode) |
| 713 | { |
| 714 | case 0x02: |
| 715 | /* 2k switch */ |
| 716 | chr2_4 (space->machine, data, CHRROM); |
| 717 | break; |
| 718 | case 0x03: |
| 719 | /* 1k switch */ |
| 720 | vrom_bank[5] = data; |
| 721 | // mapper5_sync_vrom(0); |
| 722 | chr1_5(space->machine, vrom_bank[5], CHRROM); |
| 723 | // nes_vram_sprite[5] = vrom_bank[0] * 64; |
| 724 | // vrom_next[1] = 1; |
| 725 | // vrom_page_a = 0; |
| 726 | // vrom_page_b = 0; |
| 727 | break; |
| 728 | } |
| 729 | break; |
| 730 | case 0x1026: /* $5126 */ |
| 731 | LOG_MMC(("MMC5 $5126 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 732 | switch (MMC5_vrom_bank_mode) |
| 733 | { |
| 734 | case 0x03: |
| 735 | /* 1k switch */ |
| 736 | vrom_bank[6] = data; |
| 737 | // mapper5_sync_vrom(0); |
| 738 | chr1_6(space->machine, vrom_bank[6], CHRROM); |
| 739 | // nes_vram_sprite[6] = vrom_bank[0] * 64; |
| 740 | // vrom_next[2] = 2; |
| 741 | // vrom_page_a = 0; |
| 742 | // vrom_page_b = 0; |
| 743 | break; |
| 744 | } |
| 745 | break; |
| 746 | case 0x1027: /* $5127 */ |
| 747 | LOG_MMC(("MMC5 $5127 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 748 | switch (MMC5_vrom_bank_mode) |
| 749 | { |
| 750 | case 0x00: |
| 751 | /* 8k switch */ |
| 752 | chr8(space->machine, data, CHRROM); |
| 753 | break; |
| 754 | case 0x01: |
| 755 | /* 4k switch */ |
| 756 | chr4_4 (space->machine, data, CHRROM); |
| 757 | break; |
| 758 | case 0x02: |
| 759 | /* 2k switch */ |
| 760 | chr2_6 (space->machine, data, CHRROM); |
| 761 | break; |
| 762 | case 0x03: |
| 763 | /* 1k switch */ |
| 764 | vrom_bank[7] = data; |
| 765 | // mapper5_sync_vrom(0); |
| 766 | chr1_7(space->machine, vrom_bank[7], CHRROM); |
| 767 | // nes_vram_sprite[7] = vrom_bank[0] * 64; |
| 768 | // vrom_next[3] = 3; |
| 769 | // vrom_page_a = 0; |
| 770 | // vrom_page_b = 0; |
| 771 | break; |
| 772 | } |
| 773 | break; |
| 774 | case 0x1028: /* $5128 */ |
| 775 | LOG_MMC(("MMC5 $5128 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 776 | switch (MMC5_vrom_bank_mode) |
| 777 | { |
| 778 | case 0x03: |
| 779 | /* 1k switch */ |
| 780 | vrom_bank[8] = vrom_bank[12] = data; |
| 781 | // nes_vram[vrom_next[0]] = data * 64; |
| 782 | // nes_vram[0 + (vrom_page_a*4)] = data * 64; |
| 783 | // nes_vram[0] = data * 64; |
| 784 | chr1_4(space->machine, data, CHRROM); |
| 785 | // mapper5_sync_vrom(1); |
| 786 | if (!vrom_page_b) |
| 787 | { |
| 788 | vrom_page_a ^= 0x01; |
| 789 | vrom_page_b = 1; |
| 790 | } |
| 791 | break; |
| 792 | } |
| 793 | break; |
| 794 | case 0x1029: /* $5129 */ |
| 795 | LOG_MMC(("MMC5 $5129 vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 796 | switch (MMC5_vrom_bank_mode) |
| 797 | { |
| 798 | case 0x02: |
| 799 | /* 2k switch */ |
| 800 | chr2_0 (space->machine, data, CHRROM); |
| 801 | chr2_4 (space->machine, data, CHRROM); |
| 802 | break; |
| 803 | case 0x03: |
| 804 | /* 1k switch */ |
| 805 | vrom_bank[9] = vrom_bank[13] = data; |
| 806 | // nes_vram[vrom_next[1]] = data * 64; |
| 807 | // nes_vram[1 + (vrom_page_a*4)] = data * 64; |
| 808 | // nes_vram[1] = data * 64; |
| 809 | chr1_5(space->machine, data, CHRROM); |
| 810 | // mapper5_sync_vrom(1); |
| 811 | if (!vrom_page_b) |
| 812 | { |
| 813 | vrom_page_a ^= 0x01; |
| 814 | vrom_page_b = 1; |
| 815 | } |
| 816 | break; |
| 817 | } |
| 818 | break; |
| 819 | case 0x102a: /* $512a */ |
| 820 | LOG_MMC(("MMC5 $512a vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 821 | switch (MMC5_vrom_bank_mode) |
| 822 | { |
| 823 | case 0x03: |
| 824 | /* 1k switch */ |
| 825 | vrom_bank[10] = vrom_bank[14] = data; |
| 826 | // nes_vram[vrom_next[2]] = data * 64; |
| 827 | // nes_vram[2 + (vrom_page_a*4)] = data * 64; |
| 828 | // nes_vram[2] = data * 64; |
| 829 | chr1_6(space->machine, data, CHRROM); |
| 830 | // mapper5_sync_vrom(1); |
| 831 | if (!vrom_page_b) |
| 832 | { |
| 833 | vrom_page_a ^= 0x01; |
| 834 | vrom_page_b = 1; |
| 835 | } |
| 836 | break; |
| 837 | } |
| 838 | break; |
| 839 | case 0x102b: /* $512b */ |
| 840 | LOG_MMC(("MMC5 $512b vrom select: %02x (mode: %d)\n", data, MMC5_vrom_bank_mode)); |
| 841 | switch (MMC5_vrom_bank_mode) |
| 842 | { |
| 843 | case 0x00: |
| 844 | /* 8k switch */ |
| 845 | /* switches in first half of an 8K bank!) */ |
| 846 | chr4_0 (space->machine, data << 1, CHRROM); |
| 847 | chr4_4 (space->machine, data << 1, CHRROM); |
| 848 | break; |
| 849 | case 0x01: |
| 850 | /* 4k switch */ |
| 851 | chr4_0 (space->machine, data, CHRROM); |
| 852 | chr4_4 (space->machine, data, CHRROM); |
| 853 | break; |
| 854 | case 0x02: |
| 855 | /* 2k switch */ |
| 856 | chr2_2 (space->machine, data, CHRROM); |
| 857 | chr2_6 (space->machine, data, CHRROM); |
| 858 | break; |
| 859 | case 0x03: |
| 860 | /* 1k switch */ |
| 861 | vrom_bank[11] = vrom_bank[15] = data; |
| 862 | // nes_vram[vrom_next[3]] = data * 64; |
| 863 | // nes_vram[3 + (vrom_page_a*4)] = data * 64; |
| 864 | // nes_vram[3] = data * 64; |
| 865 | chr1_7(space->machine, data, CHRROM); |
| 866 | // mapper5_sync_vrom(1); |
| 867 | if (!vrom_page_b) |
| 868 | { |
| 869 | vrom_page_a ^= 0x01; |
| 870 | vrom_page_b = 1; |
| 871 | } |
| 872 | break; |
| 873 | } |
| 874 | break; |
| 875 | |
| 876 | case 0x1103: /* $5203 */ |
| 877 | IRQ_count = data; |
| 878 | MMC5_scanline = data; |
| 879 | LOG_MMC(("MMC5 irq scanline: %d\n", IRQ_count)); |
| 880 | break; |
| 881 | case 0x1104: /* $5204 */ |
| 882 | IRQ_enable = data & 0x80; |
| 883 | LOG_MMC(("MMC5 irq enable: %02x\n", data)); |
| 884 | break; |
| 885 | case 0x1105: /* $5205 */ |
| 886 | mult1 = data; |
| 887 | break; |
| 888 | case 0x1106: /* $5206 */ |
| 889 | mult2 = data; |
| 890 | break; |
| 891 | |
| 892 | default: |
| 893 | logerror("** MMC5 uncaught write, offset: %04x, data: %02x\n", offset + 0x4100, data); |
| 894 | break; |
| 895 | } |
| 896 | } |
| 897 | |
| 898 | static WRITE8_HANDLER( mapper5_w ) |
| 899 | { |
| 900 | logerror("MMC5 uncaught high mapper w, %04x: %02x\n", offset, data); |
| 901 | } |
| 902 | |
| 903 | /************************************************************* |
| 904 | |
| 905 | Mapper 6 |
| 906 | |
| 907 | Known Boards: FFE4 Copier Board |
| 908 | Games: Hacked versions of games |
| 909 | |
| 910 | In MESS: Supported? Not sure if we could also have ExRAM or not... |
| 911 | However, priority is pretty low for this mapper. |
| 912 | |
| 913 | *************************************************************/ |
| 914 | |
| 915 | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 916 | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 917 | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 918 | static void ffe_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 919 | { |
| 920 | /* 114 is the number of cycles per scanline */ |
| 921 | /* TODO: change to reflect the actual number of cycles spent */ |
| 922 | if (IRQ_enable) |
| 923 | { |
| 924 | if ((0xffff - IRQ_count) < 114) |
| 925 | { |
| 926 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 927 | IRQ_count = 0xffff; |
| 928 | IRQ_enable = 0; |
| 929 | } |
| 930 | IRQ_count -= 114; |
| 931 | } |
| 932 | } |
| 933 | |
| 934 | static WRITE8_HANDLER( mapper6_l_w ) |
| 935 | { |
| 936 | LOG_MMC(("mapper6_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 937 | |
| 938 | switch (offset) |
| 939 | { |
| 940 | case 0x1fe: |
| 941 | mmc_cmd1 = data & 0x80; |
| 942 | set_nt_mirroring((data & 0x10) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 943 | break; |
| 944 | case 0x1ff: |
| 945 | set_nt_mirroring((data & 0x10) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 946 | break; |
| 947 | |
| 948 | case 0x401: |
| 949 | IRQ_enable = data & 0x01; |
| 950 | break; |
| 951 | case 0x402: |
| 952 | IRQ_count = (IRQ_count & 0xff00) | data; |
| 953 | break; |
| 954 | case 0x403: |
| 955 | IRQ_enable = 1; |
| 956 | IRQ_count = (IRQ_count & 0x00ff) | (data << 8); |
| 957 | break; |
| 958 | } |
| 959 | } |
| 960 | |
| 961 | static WRITE8_HANDLER( mapper6_w ) |
| 962 | { |
| 963 | LOG_MMC(("mapper6_w, offset: %04x, data: %02x\n", offset, data)); |
| 964 | |
| 965 | if (!mmc_cmd1) // when in "FFE mode" we are forced to use CHRRAM/EXRAM bank? |
| 966 | { |
| 967 | prg16_89ab(space->machine, data >> 2); |
| 968 | // chr8(space->machine, data & 0x03, ???); |
| 969 | // due to lack of info on the exact behavior, we simply act as if mmc_cmd=1 |
| 970 | if (mmc_chr_source == CHRROM) |
| 971 | chr8(space->machine, data & 0x03, CHRROM); |
| 972 | } |
| 973 | else if (mmc_chr_source == CHRROM) // otherwise, we can use CHRROM (when present) |
| 974 | chr8(space->machine, data, CHRROM); |
| 975 | } |
| 976 | |
| 977 | /************************************************************* |
| 978 | |
| 979 | Mapper 7 |
| 980 | |
| 981 | Known Boards: AMROM, ANROM, AN1ROM, AOROM and unlicensed |
| 982 | AxROM |
| 983 | Games: Arch Rivals, Battletoads, Cabal, Commando, Solstice |
| 984 | |
| 985 | In MESS: Supported |
| 986 | |
| 987 | *************************************************************/ |
| 988 | |
| 989 | static WRITE8_HANDLER( mapper7_w ) |
| 990 | { |
| 991 | LOG_MMC(("mapper7_w, offset: %04x, data: %02x\n", offset, data)); |
| 992 | |
| 993 | set_nt_mirroring((data & 0x10) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 994 | prg32(space->machine, data); |
| 995 | } |
| 996 | |
| 997 | /************************************************************* |
| 998 | |
| 999 | Mapper 8 |
| 1000 | |
| 1001 | Known Boards: FFE3 Copier Board |
| 1002 | Games: Hacked versions of games |
| 1003 | |
| 1004 | In MESS: Supported? (I have no games to test this) |
| 1005 | |
| 1006 | *************************************************************/ |
| 1007 | |
| 1008 | static WRITE8_HANDLER( mapper8_w ) |
| 1009 | { |
| 1010 | LOG_MMC(("mapper8_w, offset: %04x, data: %02x\n", offset, data)); |
| 1011 | |
| 1012 | chr8(space->machine, data & 0x07, CHRROM); |
| 1013 | prg16_89ab(space->machine, data >> 3); |
| 1014 | } |
| 1015 | |
| 1016 | /************************************************************* |
| 1017 | |
| 1018 | Mapper 9 |
| 1019 | |
| 1020 | Known Boards: MMC2 based Boards, i.e. PNROM & PEEOROM |
| 1021 | Games: Punch Out!!, Mike Tyson's Punch Out!! |
| 1022 | |
| 1023 | In MESS: Supported |
| 1024 | |
| 1025 | *************************************************************/ |
| 1026 | |
| 1027 | static void mapper9_latch (const device_config *device, offs_t offset) |
| 1028 | { |
| 1029 | if ((offset & 0x3ff0) == 0x0fd0) |
| 1030 | { |
| 1031 | LOG_MMC(("mapper9 vrom latch switch (bank 0 low): %02x\n", MMC2_regs[0])); |
| 1032 | mmc_cmd1 = 0xfd; |
| 1033 | chr4_0(device->machine, MMC2_regs[0], CHRROM); |
| 1034 | } |
| 1035 | else if ((offset & 0x3ff0) == 0x0fe0) |
| 1036 | { |
| 1037 | LOG_MMC(("mapper9 vrom latch switch (bank 0 high): %02x\n", MMC2_regs[1])); |
| 1038 | mmc_cmd1 = 0xfe; |
| 1039 | chr4_0(device->machine, MMC2_regs[1], CHRROM); |
| 1040 | } |
| 1041 | else if ((offset & 0x3ff0) == 0x1fd0) |
| 1042 | { |
| 1043 | LOG_MMC(("mapper9 vrom latch switch (bank 1 low): %02x\n", MMC2_regs[2])); |
| 1044 | mmc_cmd2 = 0xfd; |
| 1045 | chr4_4(device->machine, MMC2_regs[2], CHRROM); |
| 1046 | } |
| 1047 | else if ((offset & 0x3ff0) == 0x1fe0) |
| 1048 | { |
| 1049 | LOG_MMC(("mapper9 vrom latch switch (bank 0 high): %02x\n", MMC2_regs[3])); |
| 1050 | mmc_cmd2 = 0xfe; |
| 1051 | chr4_4(device->machine, MMC2_regs[3], CHRROM); |
| 1052 | } |
| 1053 | } |
| 1054 | |
| 1055 | static WRITE8_HANDLER( mapper9_w ) |
| 1056 | { |
| 1057 | LOG_MMC(("mapper9_w, offset: %04x, data: %02x\n", offset, data)); |
| 1058 | switch (offset & 0x7000) |
| 1059 | { |
| 1060 | case 0x2000: |
| 1061 | prg8_89(space->machine, data); |
| 1062 | break; |
| 1063 | case 0x3000: |
| 1064 | MMC2_regs[0] = data; |
| 1065 | if (mmc_cmd1 == 0xfd) |
| 1066 | chr4_0(space->machine, MMC2_regs[0], CHRROM); |
| 1067 | break; |
| 1068 | case 0x4000: |
| 1069 | MMC2_regs[1] = data; |
| 1070 | if (mmc_cmd1 == 0xfe) |
| 1071 | chr4_0(space->machine, MMC2_regs[1], CHRROM); |
| 1072 | break; |
| 1073 | case 0x5000: |
| 1074 | MMC2_regs[2] = data; |
| 1075 | if (mmc_cmd2 == 0xfd) |
| 1076 | chr4_4(space->machine, MMC2_regs[2], CHRROM); |
| 1077 | break; |
| 1078 | case 0x6000: |
| 1079 | MMC2_regs[3] = data; |
| 1080 | if (mmc_cmd2 == 0xfe) |
| 1081 | chr4_4(space->machine, MMC2_regs[3], CHRROM); |
| 1082 | break; |
| 1083 | case 0x7000: |
| 1084 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 1085 | break; |
| 1086 | default: |
| 1087 | LOG_MMC(("MMC2 uncaught w: %04x:%02x\n", offset, data)); |
| 1088 | break; |
| 1089 | } |
| 1090 | } |
| 1091 | |
| 1092 | |
| 1093 | /************************************************************* |
| 1094 | |
| 1095 | Mapper 10 |
| 1096 | |
| 1097 | Known Boards: MMC4 based Boards, i.e. FJROM & FKROM |
| 1098 | Games: Famicom Wars, Fire Emblem, Fire Emblem Gaiden |
| 1099 | |
| 1100 | In MESS: Supported |
| 1101 | |
| 1102 | *************************************************************/ |
| 1103 | |
| 1104 | static WRITE8_HANDLER( mapper10_w ) |
| 1105 | { |
| 1106 | LOG_MMC(("mapper10_w, offset: %04x, data: %02x\n", offset, data)); |
| 1107 | switch (offset & 0x7000) |
| 1108 | { |
| 1109 | case 0x2000: |
| 1110 | prg16_89ab(space->machine, data); |
| 1111 | break; |
| 1112 | default: |
| 1113 | mapper9_w(space, offset, data); |
| 1114 | break; |
| 1115 | } |
| 1116 | } |
| 1117 | |
| 1118 | /************************************************************* |
| 1119 | |
| 1120 | Mapper 11 |
| 1121 | |
| 1122 | Known Boards: Discrete Logic Board, NINA07 |
| 1123 | Games: many Color Dreams and Wisdom Tree titles |
| 1124 | |
| 1125 | In MESS: Supported |
| 1126 | |
| 1127 | *************************************************************/ |
| 1128 | |
| 1129 | static WRITE8_HANDLER( mapper11_w ) |
| 1130 | { |
| 1131 | LOG_MMC(("mapper11_w, offset: %04x, data: %02x\n", offset, data)); |
| 1132 | |
| 1133 | chr8(space->machine, data >> 4, mmc_chr_source); |
| 1134 | prg32(space->machine, data & 0x0f); |
| 1135 | } |
| 1136 | |
| 1137 | /************************************************************* |
| 1138 | |
| 1139 | Mapper 12 |
| 1140 | |
| 1141 | Known Boards: Bootleg Board by Rex Soft |
| 1142 | Games: Dragon Ball Z 5, Dragon Ball Z Super |
| 1143 | |
| 1144 | MMC3 clone |
| 1145 | |
| 1146 | In MESS: Partially Supported |
| 1147 | |
| 1148 | *************************************************************/ |
| 1149 | |
| 1150 | static WRITE8_HANDLER( mapper12_l_w ) |
| 1151 | { |
| 1152 | LOG_MMC(("mapper12_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 1153 | |
| 1154 | mapper12_reg = data; |
| 1155 | } |
| 1156 | |
| 1157 | /* we would need to use this read handler in 0x6000-0x7fff as well */ |
| 1158 | static READ8_HANDLER( mapper12_l_r ) |
| 1159 | { |
| 1160 | LOG_MMC(("mapper12_l_r, offset: %04x\n", offset)); |
| 1161 | return 0x01; |
| 1162 | } |
| 1163 | |
| 1164 | static void mapper12_set_chr( running_machine *machine ) |
| 1165 | { |
| 1166 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 1167 | |
| 1168 | chr1_x(machine, chr_page ^ 0, ((mapper12_reg & 0x01) << 8) | (vrom_bank[0] & ~0x01), CHRROM); |
| 1169 | chr1_x(machine, chr_page ^ 1, ((mapper12_reg & 0x01) << 8) | (vrom_bank[0] | 0x01), CHRROM); |
| 1170 | chr1_x(machine, chr_page ^ 2, ((mapper12_reg & 0x01) << 8) | (vrom_bank[1] & ~0x01), CHRROM); |
| 1171 | chr1_x(machine, chr_page ^ 3, ((mapper12_reg & 0x01) << 8) | (vrom_bank[1] | 0x01), CHRROM); |
| 1172 | chr1_x(machine, chr_page ^ 4, ((mapper12_reg & 0x10) << 4) | vrom_bank[2], CHRROM); |
| 1173 | chr1_x(machine, chr_page ^ 5, ((mapper12_reg & 0x10) << 4) | vrom_bank[3], CHRROM); |
| 1174 | chr1_x(machine, chr_page ^ 6, ((mapper12_reg & 0x10) << 4) | vrom_bank[4], CHRROM); |
| 1175 | chr1_x(machine, chr_page ^ 7, ((mapper12_reg & 0x10) << 4) | vrom_bank[5], CHRROM); |
| 1176 | } |
| 1177 | |
| 1178 | static WRITE8_HANDLER( mapper12_w ) |
| 1179 | { |
| 1180 | UINT8 MMC3_helper, cmd; |
| 1181 | LOG_MMC(("mapper12_w, offset: %04x, data: %02x\n", offset, data)); |
| 1182 | |
| 1183 | switch (offset & 0x6001) |
| 1184 | { |
| 1185 | case 0x0000: |
| 1186 | MMC3_helper = mmc_cmd1 ^ data; |
| 1187 | mmc_cmd1 = data; |
| 1188 | |
| 1189 | /* Has PRG Mode changed? */ |
| 1190 | if (MMC3_helper & 0x40) |
| 1191 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 1192 | |
| 1193 | /* Has CHR Mode changed? */ |
| 1194 | if (MMC3_helper & 0x80) |
| 1195 | mapper12_set_chr(space->machine); |
| 1196 | break; |
| 1197 | |
| 1198 | case 0x0001: |
| 1199 | cmd = mmc_cmd1 & 0x07; |
| 1200 | switch (cmd) |
| 1201 | { |
| 1202 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 1203 | case 2: case 3: case 4: case 5: |
| 1204 | vrom_bank[cmd] = data; |
| 1205 | mapper12_set_chr(space->machine); |
| 1206 | break; |
| 1207 | case 6: |
| 1208 | case 7: |
| 1209 | prg_bank[cmd - 6] = data; |
| 1210 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 1211 | break; |
| 1212 | } |
| 1213 | break; |
| 1214 | |
| 1215 | default: |
| 1216 | mapper4_w(space, offset, data); |
| 1217 | break; |
| 1218 | } |
| 1219 | } |
| 1220 | |
| 1221 | /************************************************************* |
| 1222 | |
| 1223 | Mapper 13 |
| 1224 | |
| 1225 | Known Boards: CPROM |
| 1226 | Games: Videomation |
| 1227 | |
| 1228 | In MESS: Supported |
| 1229 | |
| 1230 | *************************************************************/ |
| 1231 | |
| 1232 | static WRITE8_HANDLER( mapper13_w ) |
| 1233 | { |
| 1234 | LOG_MMC(("mapper13_w, offset: %04x, data: %02x\n", offset, data)); |
| 1235 | chr4_4(space->machine, data, CHRRAM); |
| 1236 | } |
| 1237 | |
| 1238 | /************************************************************* |
| 1239 | |
| 1240 | Mapper 14 |
| 1241 | |
| 1242 | Known Boards: Bootleg Board by Rex Soft (SL1632) |
| 1243 | Games: Samurai Spirits |
| 1244 | |
| 1245 | MMC3 clone |
| 1246 | |
| 1247 | In MESS: Supported |
| 1248 | |
| 1249 | *************************************************************/ |
| 1250 | |
| 1251 | static void mapper14_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 1252 | { |
| 1253 | if (map14_reg[0] & 0x02) |
| 1254 | { |
| 1255 | mapper4_set_prg(machine, prg_base, prg_mask); |
| 1256 | } |
| 1257 | else |
| 1258 | { |
| 1259 | prg8_89(machine, extra_bank[0]); |
| 1260 | prg8_ab(machine, extra_bank[1]); |
| 1261 | prg8_cd(machine, extra_bank[2]); |
| 1262 | prg8_ef(machine, extra_bank[3]); |
| 1263 | } |
| 1264 | } |
| 1265 | |
| 1266 | static void mapper14_set_chr( running_machine *machine, UINT8 chr, int chr_base, int chr_mask ) |
| 1267 | { |
| 1268 | static const UINT8 conv_table[8] = {5, 5, 5, 5, 3, 3, 1, 1}; |
| 1269 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 1270 | UINT8 bank[8]; |
| 1271 | UINT8 chr_base2[8]; |
| 1272 | int i; |
| 1273 | |
| 1274 | if (map14_reg[0] & 0x02) |
| 1275 | { |
| 1276 | for(i = 0; i < 8; i++) |
| 1277 | { |
| 1278 | bank[i] = vrom_bank[i]; |
| 1279 | chr_base2[i] = chr_base | ((map14_reg[0] << conv_table[i]) & 0x100); |
| 1280 | } |
| 1281 | } |
| 1282 | else |
| 1283 | { |
| 1284 | for(i = 0; i < 8; i++) |
| 1285 | { |
| 1286 | bank[i] = extra_bank[i + 4]; // first 4 extra_banks are PRG |
| 1287 | chr_base2[i] = chr_base; |
| 1288 | } |
| 1289 | } |
| 1290 | |
| 1291 | chr1_x(machine, chr_page ^ 0, chr_base2[0] | (bank[0] & chr_mask), chr); |
| 1292 | chr1_x(machine, chr_page ^ 1, chr_base2[1] | (bank[1] & chr_mask), chr); |
| 1293 | chr1_x(machine, chr_page ^ 2, chr_base2[2] | (bank[2] & chr_mask), chr); |
| 1294 | chr1_x(machine, chr_page ^ 3, chr_base2[3] | (bank[3] & chr_mask), chr); |
| 1295 | chr1_x(machine, chr_page ^ 4, chr_base2[4] | (bank[4] & chr_mask), chr); |
| 1296 | chr1_x(machine, chr_page ^ 5, chr_base2[5] | (bank[5] & chr_mask), chr); |
| 1297 | chr1_x(machine, chr_page ^ 6, chr_base2[6] | (bank[6] & chr_mask), chr); |
| 1298 | chr1_x(machine, chr_page ^ 7, chr_base2[7] | (bank[7] & chr_mask), chr); |
| 1299 | } |
| 1300 | |
| 1301 | static WRITE8_HANDLER( mapper14_w ) |
| 1302 | { |
| 1303 | UINT8 map14_helper1, map14_helper2, MMC3_helper, cmd; |
| 1304 | LOG_MMC(("mapper14_w, offset: %04x, data: %02x\n", offset, data)); |
| 1305 | |
| 1306 | if (offset == 0x2131) |
| 1307 | { |
| 1308 | map14_reg[0] = data; |
| 1309 | mapper14_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 1310 | mapper14_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 1311 | |
| 1312 | if (!(map14_reg[0] & 0x02)) |
| 1313 | set_nt_mirroring(map14_reg[1] & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 1314 | } |
| 1315 | |
| 1316 | if (map14_reg[0] & 0x02) |
| 1317 | { |
| 1318 | switch (offset & 0x6001) |
| 1319 | { |
| 1320 | case 0x0000: |
| 1321 | MMC3_helper = mmc_cmd1 ^ data; |
| 1322 | mmc_cmd1 = data; |
| 1323 | |
| 1324 | /* Has PRG Mode changed? */ |
| 1325 | if (MMC3_helper & 0x40) |
| 1326 | mapper14_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 1327 | |
| 1328 | /* Has CHR Mode changed? */ |
| 1329 | if (MMC3_helper & 0x80) |
| 1330 | mapper14_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 1331 | break; |
| 1332 | |
| 1333 | case 0x0001: |
| 1334 | cmd = mmc_cmd1 & 0x07; |
| 1335 | switch (cmd) |
| 1336 | { |
| 1337 | case 0: case 1: // these have to be changed due to the different way mapper14_set_chr works (it handles 1k banks)! |
| 1338 | vrom_bank[2 * cmd] = data; |
| 1339 | vrom_bank[2 * cmd + 1] = data; |
| 1340 | mapper14_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 1341 | break; |
| 1342 | case 2: case 3: case 4: case 5: |
| 1343 | vrom_bank[cmd + 2] = data; |
| 1344 | mapper14_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 1345 | break; |
| 1346 | case 6: |
| 1347 | case 7: |
| 1348 | prg_bank[cmd - 6] = data; |
| 1349 | mapper14_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 1350 | break; |
| 1351 | } |
| 1352 | break; |
| 1353 | |
| 1354 | case 0x2000: |
| 1355 | set_nt_mirroring(map14_reg[1] & 0x01 ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 1356 | break; |
| 1357 | |
| 1358 | default: |
| 1359 | mapper4_w(space, offset, data); |
| 1360 | break; |
| 1361 | } |
| 1362 | } |
| 1363 | else if (offset >= 0x3000 && offset <= 0x6003 ) |
| 1364 | { |
| 1365 | map14_helper1 = (offset & 0x01) << 2; |
| 1366 | offset = ((offset & 0x02) | (offset >> 10)) >> 1; |
| 1367 | map14_helper2 = ((offset + 2) & 0x07) + 4; // '+4' because first 4 extra_banks are for PRG! |
| 1368 | extra_bank[map14_helper2] = (extra_bank[map14_helper2] & (0xf0 >> map14_helper1)) | ((data & 0x0f) << map14_helper1); |
| 1369 | mapper14_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 1370 | } |
| 1371 | else |
| 1372 | { |
| 1373 | switch (offset & 0x7003) |
| 1374 | { |
| 1375 | case 0x0000: |
| 1376 | case 0x2000: |
| 1377 | extra_bank[offset >> 13] = data; |
| 1378 | mapper14_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 1379 | break; |
| 1380 | |
| 1381 | case 0x1000: |
| 1382 | map14_reg[1] = data; |
| 1383 | set_nt_mirroring(map14_reg[1] & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 1384 | break; |
| 1385 | } |
| 1386 | } |
| 1387 | } |
| 1388 | |
| 1389 | /************************************************************* |
| 1390 | |
| 1391 | Mapper 15 |
| 1392 | |
| 1393 | Known Boards: Bootleg Board by Waixing (and probably others) |
| 1394 | Games: Bao Xiao Tien Guo, Bio Hazard, Pokemon Gold, Subor (R) |
| 1395 | |
| 1396 | In MESS: Supported |
| 1397 | |
| 1398 | *************************************************************/ |
| 1399 | |
| 1400 | static WRITE8_HANDLER( mapper15_w ) |
| 1401 | { |
| 1402 | UINT8 map15_flip = (data & 0x80) >> 7; |
| 1403 | UINT8 map15_helper = (data & 0x7f) << 1; |
| 1404 | |
| 1405 | LOG_MMC(("mapper15_w, offset: %04x, data: %02x\n", offset, data)); |
| 1406 | |
| 1407 | set_nt_mirroring((data & 0x40) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 1408 | |
| 1409 | switch (offset & 0x0fff) |
| 1410 | { |
| 1411 | case 0x000: |
| 1412 | prg8_89(space->machine, (map15_helper + 0) ^ map15_flip); |
| 1413 | prg8_ab(space->machine, (map15_helper + 1) ^ map15_flip); |
| 1414 | prg8_cd(space->machine, (map15_helper + 2) ^ map15_flip); |
| 1415 | prg8_ef(space->machine, (map15_helper + 3) ^ map15_flip); |
| 1416 | break; |
| 1417 | case 0x001: |
| 1418 | map15_helper |= map15_flip; |
| 1419 | prg8_89(space->machine, map15_helper); |
| 1420 | prg8_ab(space->machine, map15_helper + 1); |
| 1421 | prg8_cd(space->machine, map15_helper + 1); |
| 1422 | prg8_ef(space->machine, map15_helper + 1); |
| 1423 | break; |
| 1424 | case 0x002: |
| 1425 | map15_helper |= map15_flip; |
| 1426 | prg8_89(space->machine, map15_helper); |
| 1427 | prg8_ab(space->machine, map15_helper); |
| 1428 | prg8_cd(space->machine, map15_helper); |
| 1429 | prg8_ef(space->machine, map15_helper); |
| 1430 | break; |
| 1431 | case 0x003: |
| 1432 | map15_helper |= map15_flip; |
| 1433 | prg8_89(space->machine, map15_helper); |
| 1434 | prg8_ab(space->machine, map15_helper + 1); |
| 1435 | prg8_cd(space->machine, map15_helper); |
| 1436 | prg8_ef(space->machine, map15_helper + 1); |
| 1437 | break; |
| 1438 | } |
| 1439 | } |
| 1440 | |
| 1441 | /************************************************************* |
| 1442 | |
| 1443 | Mapper 16 |
| 1444 | |
| 1445 | Known Boards: Bandai LZ93D50 24C02 |
| 1446 | Games: Crayon Shin-Chan - Ora to Poi Poi, Dragon Ball Z Gaiden, |
| 1447 | Dragon Ball Z II & III, Rokudenashi Blues, SD Gundam |
| 1448 | Gaiden - KGM2 |
| 1449 | |
| 1450 | At the moment, we don't support EEPROM I/O |
| 1451 | |
| 1452 | In MESS: Supported |
| 1453 | |
| 1454 | *************************************************************/ |
| 1455 | |
| 1456 | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 1457 | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 1458 | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 1459 | static void bandai_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 1460 | { |
| 1461 | /* 114 is the number of cycles per scanline */ |
| 1462 | /* TODO: change to reflect the actual number of cycles spent */ |
| 1463 | if (IRQ_enable) |
| 1464 | { |
| 1465 | if (IRQ_count <= 114) |
| 1466 | { |
| 1467 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 1468 | IRQ_count = (0xffff - 114 + IRQ_count); // wrap around the 16 bits counter |
| 1469 | } |
| 1470 | IRQ_count -= 114; |
| 1471 | } |
| 1472 | } |
| 1473 | |
| 1474 | static WRITE8_HANDLER( mapper16_m_w ) |
| 1475 | { |
| 1476 | LOG_MMC(("mapper16_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 1477 | |
| 1478 | switch (offset & 0x000f) |
| 1479 | { |
| 1480 | case 0: case 1: |
| 1481 | case 2: case 3: |
| 1482 | case 4: case 5: |
| 1483 | case 6: case 7: |
| 1484 | chr1_x(space->machine, offset & 0x07, data, mmc_chr_source); |
| 1485 | break; |
| 1486 | case 8: |
| 1487 | prg16_89ab(space->machine, data); |
| 1488 | break; |
| 1489 | case 9: |
| 1490 | switch (data & 0x03) |
| 1491 | { |
| 1492 | case 0: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 1493 | case 1: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 1494 | case 2: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 1495 | case 3: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 1496 | } |
| 1497 | break; |
| 1498 | case 0x0a: |
| 1499 | IRQ_enable = data & 0x01; |
| 1500 | break; |
| 1501 | case 0x0b: |
| 1502 | IRQ_count = (IRQ_count & 0xff00) | data; |
| 1503 | break; |
| 1504 | case 0x0c: |
| 1505 | IRQ_count = (IRQ_count & 0x00ff) | (data << 8); |
| 1506 | break; |
| 1507 | default: |
| 1508 | logerror("** uncaught mapper 16 write, offset: %04x, data: %02x\n", offset, data); |
| 1509 | break; |
| 1510 | } |
| 1511 | } |
| 1512 | |
| 1513 | static WRITE8_HANDLER( mapper16_w ) |
| 1514 | { |
| 1515 | LOG_MMC(("mapper16_w, offset: %04x, data: %02x\n", offset, data)); |
| 1516 | |
| 1517 | mapper16_m_w(space, offset, data); |
| 1518 | } |
| 1519 | |
| 1520 | /************************************************************* |
| 1521 | |
| 1522 | Mapper 17 |
| 1523 | |
| 1524 | Known Boards: FFE8 Copier Board |
| 1525 | Games: Hacked versions of games |
| 1526 | |
| 1527 | In MESS: Supported?. IRQ support is just a guess (used to |
| 1528 | use MMC3 IRQ but it was wrong and it never enabled it) |
| 1529 | |
| 1530 | *************************************************************/ |
| 1531 | |
| 1532 | static WRITE8_HANDLER( mapper17_l_w ) |
| 1533 | { |
| 1534 | LOG_MMC(("mapper17_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 1535 | |
| 1536 | switch (offset) |
| 1537 | { |
| 1538 | case 0x1fe: |
| 1539 | set_nt_mirroring((data & 0x10) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 1540 | break; |
| 1541 | case 0x1ff: |
| 1542 | set_nt_mirroring((data & 0x10) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 1543 | break; |
| 1544 | |
| 1545 | case 0x401: |
| 1546 | IRQ_enable = data & 0x01; |
| 1547 | break; |
| 1548 | case 0x402: |
| 1549 | IRQ_count = (IRQ_count & 0xff00) | data; |
| 1550 | break; |
| 1551 | case 0x403: |
| 1552 | IRQ_enable = 1; |
| 1553 | IRQ_count = (IRQ_count & 0x00ff) | (data << 8); |
| 1554 | break; |
| 1555 | |
| 1556 | case 0x404: |
| 1557 | prg8_89(space->machine, data); |
| 1558 | break; |
| 1559 | case 0x405: |
| 1560 | prg8_ab(space->machine, data); |
| 1561 | break; |
| 1562 | case 0x406: |
| 1563 | prg8_cd(space->machine, data); |
| 1564 | break; |
| 1565 | case 0x407: |
| 1566 | prg8_ef(space->machine, data); |
| 1567 | break; |
| 1568 | |
| 1569 | case 0x410: |
| 1570 | case 0x411: |
| 1571 | case 0x412: |
| 1572 | case 0x413: |
| 1573 | case 0x414: |
| 1574 | case 0x415: |
| 1575 | case 0x416: |
| 1576 | case 0x417: |
| 1577 | chr1_x(space->machine, offset & 7, data, CHRROM); |
| 1578 | break; |
| 1579 | } |
| 1580 | } |
| 1581 | |
| 1582 | /************************************************************* |
| 1583 | |
| 1584 | Mapper 18 |
| 1585 | |
| 1586 | Known Boards: Jaleco JF23, JF24, JF25, JF27, JF29, JF30, JF31, |
| 1587 | JF32, JF33, JF34, JF35, JF36, JF37, JF38, JF40, JF41, SS88006 |
| 1588 | Games: Lord of King, Magic John, Moe Pro '90, Ninja Jajamaru, |
| 1589 | Pizza Pop, Plasma Ball |
| 1590 | |
| 1591 | In MESS: Supported |
| 1592 | |
| 1593 | *************************************************************/ |
| 1594 | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 1595 | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 1596 | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 1597 | static void jaleco_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 1598 | { |
| 1599 | /* Increment & check the IRQ scanline counter */ |
| 1600 | if (IRQ_enable) |
| 1601 | { |
| 1602 | LOG_MMC(("scanline: %d, irq count: %04x\n", scanline, IRQ_count)); |
| 1603 | if (IRQ_mode & 0x08) |
| 1604 | { |
| 1605 | if ((IRQ_count & 0x000f) < 114) // always true, but we only update the IRQ once per scanlines so we cannot be more precise :( |
| 1606 | { |
| 1607 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 1608 | IRQ_count = (IRQ_count & ~0x000f) | (0x0f - (114 & 0x0f) + (IRQ_count & 0x000f)); // sort of wrap around the counter |
| 1609 | } |
| 1610 | // decrements should not affect upper bits, so we don't do anything here (114 > 0x0f) |
| 1611 | } |
| 1612 | else if (IRQ_mode & 0x04) |
| 1613 | { |
| 1614 | if ((IRQ_count & 0x00ff) < 114) |
| 1615 | { |
| 1616 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 1617 | IRQ_count = (IRQ_count & ~0x00ff) | (0xff - 114 + (IRQ_count & 0x00ff)); // wrap around the 8 bits counter |
| 1618 | } |
| 1619 | else |
| 1620 | IRQ_count -= 114; |
| 1621 | } |
| 1622 | else if (IRQ_mode & 0x02) |
| 1623 | { |
| 1624 | if ((IRQ_count & 0x0fff) < 114) |
| 1625 | { |
| 1626 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 1627 | IRQ_count = (IRQ_count & ~0x0fff) | (0xfff - 114 + (IRQ_count & 0x0fff)); // wrap around the 12 bits counter |
| 1628 | } |
| 1629 | else |
| 1630 | IRQ_count -= 114; |
| 1631 | } |
| 1632 | else if (IRQ_count < 114) |
| 1633 | { |
| 1634 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 1635 | IRQ_count = (0xffff - 114 + IRQ_count); // wrap around the 16 bits counter |
| 1636 | } |
| 1637 | else |
| 1638 | IRQ_count -= 114; |
| 1639 | } |
| 1640 | } |
| 1641 | |
| 1642 | static WRITE8_HANDLER( mapper18_w ) |
| 1643 | { |
| 1644 | UINT8 bank; |
| 1645 | LOG_MMC(("mapper18_w, offset: %04x, data: %02x\n", offset, data)); |
| 1646 | |
| 1647 | switch (offset & 0x7003) |
| 1648 | { |
| 1649 | case 0x0000: |
| 1650 | prg_bank[0] = (prg_bank[0] & 0xf0) | (data & 0x0f); |
| 1651 | prg8_89(space->machine, prg_bank[0]); |
| 1652 | break; |
| 1653 | case 0x0001: |
| 1654 | prg_bank[0] = (prg_bank[0] & 0x0f) | (data << 4); |
| 1655 | prg8_89(space->machine, prg_bank[0]); |
| 1656 | break; |
| 1657 | case 0x0002: |
| 1658 | prg_bank[1] = (prg_bank[1] & 0xf0) | (data & 0x0f); |
| 1659 | prg8_ab(space->machine, prg_bank[1]); |
| 1660 | break; |
| 1661 | case 0x0003: |
| 1662 | prg_bank[1] = (prg_bank[1] & 0x0f) | (data << 4); |
| 1663 | prg8_ab(space->machine, prg_bank[1]); |
| 1664 | break; |
| 1665 | case 0x1000: |
| 1666 | prg_bank[2] = (prg_bank[2] & 0xf0) | (data & 0x0f); |
| 1667 | prg8_cd(space->machine, prg_bank[2]); |
| 1668 | break; |
| 1669 | case 0x1001: |
| 1670 | prg_bank[2] = (prg_bank[2] & 0x0f) | (data << 4); |
| 1671 | prg8_cd(space->machine, prg_bank[2]); |
| 1672 | break; |
| 1673 | |
| 1674 | /* $9002, 3 (1002, 3) uncaught = Jaleco Baseball writes 0 */ |
| 1675 | /* believe it's related to battery-backed ram enable/disable */ |
| 1676 | |
| 1677 | case 0x2000: case 0x2001: case 0x2002: case 0x2003: |
| 1678 | case 0x3000: case 0x3001: case 0x3002: case 0x3003: |
| 1679 | case 0x4000: case 0x4001: case 0x4002: case 0x4003: |
| 1680 | case 0x5000: case 0x5001: case 0x5002: case 0x5003: |
| 1681 | bank = ((offset & 0x7000) - 0x2000) / 0x0800 + ((offset & 0x0002) >> 1); |
| 1682 | if (offset & 0x0001) |
| 1683 | vrom_bank[bank] = (vrom_bank[bank] & 0x0f) | ((data & 0x0f)<< 4); |
| 1684 | else |
| 1685 | vrom_bank[bank] = (vrom_bank[bank] & 0xf0) | (data & 0x0f); |
| 1686 | |
| 1687 | chr1_x(space->machine, bank, vrom_bank[bank], CHRROM); |
| 1688 | break; |
| 1689 | |
| 1690 | case 0x6000: |
| 1691 | IRQ_count_latch = (IRQ_count_latch & 0xfff0) | (data & 0x0f); |
| 1692 | break; |
| 1693 | case 0x6001: |
| 1694 | IRQ_count_latch = (IRQ_count_latch & 0xff0f) | ((data & 0x0f) << 4); |
| 1695 | break; |
| 1696 | case 0x6002: |
| 1697 | IRQ_count_latch = (IRQ_count_latch & 0xf0ff) | ((data & 0x0f) << 8); |
| 1698 | break; |
| 1699 | case 0x6003: |
| 1700 | IRQ_count_latch = (IRQ_count_latch & 0x0fff) | ((data & 0x0f) << 12); |
| 1701 | break; |
| 1702 | |
| 1703 | case 0x7000: |
| 1704 | IRQ_count = IRQ_count_latch; |
| 1705 | break; |
| 1706 | case 0x7001: |
| 1707 | IRQ_enable = data & 0x01; |
| 1708 | IRQ_mode = data & 0x0e; |
| 1709 | break; |
| 1710 | |
| 1711 | case 0x7002: |
| 1712 | switch (data & 0x03) |
| 1713 | { |
| 1714 | case 0: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 1715 | case 1: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 1716 | case 2: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 1717 | case 3: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 1718 | } |
| 1719 | break; |
| 1720 | |
| 1721 | default: |
| 1722 | logerror("Mapper 18 uncaught addr: %04x value: %02x\n", offset + 0x8000, data); |
| 1723 | break; |
| 1724 | } |
| 1725 | } |
| 1726 | |
| 1727 | /************************************************************* |
| 1728 | |
| 1729 | Mapper 19 |
| 1730 | |
| 1731 | Known Boards: Namcot 163 & 163S |
| 1732 | Games: Battle Fleet, Family Circuit '91, Famista '90, '91, |
| 1733 | '92 & '94, Megami Tensei II, Top Striker, Wagyan Land 2 & 3 |
| 1734 | |
| 1735 | In MESS: Supported |
| 1736 | |
| 1737 | *************************************************************/ |
| 1738 | |
| 1739 | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 1740 | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 1741 | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 1742 | static void namcot_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 1743 | { |
| 1744 | if (IRQ_enable) |
| 1745 | { |
| 1746 | if (IRQ_count >= (0x7fff - 114)) |
| 1747 | { |
| 1748 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 1749 | IRQ_count = 0; |
| 1750 | } |
| 1751 | else |
| 1752 | IRQ_count += 114; |
| 1753 | } |
| 1754 | } |
| 1755 | |
| 1756 | static WRITE8_HANDLER( mapper19_l_w ) |
| 1757 | { |
| 1758 | LOG_MMC(("mapper19_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 1759 | offset += 0x100; |
| 1760 | |
| 1761 | switch (offset & 0x1800) |
| 1762 | { |
| 1763 | case 0x0800: |
| 1764 | LOG_MMC(("Mapper 19 sound port write, data: %02x\n", data)); |
| 1765 | break; |
| 1766 | case 0x1000: /* low byte of IRQ */ |
| 1767 | IRQ_count = (IRQ_count & 0x7f00) | data; |
| 1768 | break; |
| 1769 | case 0x1800: /* high byte of IRQ, IRQ enable in high bit */ |
| 1770 | IRQ_count = (IRQ_count & 0xff) | ((data & 0x7f) << 8); |
| 1771 | IRQ_enable = data & 0x80; |
| 1772 | break; |
| 1773 | } |
| 1774 | } |
| 1775 | |
| 1776 | static READ8_HANDLER( mapper19_l_r ) |
| 1777 | { |
| 1778 | LOG_MMC(("mapper19_l_r, offset: %04x\n", offset)); |
| 1779 | offset += 0x100; |
| 1780 | |
| 1781 | switch (offset & 0x1800) |
| 1782 | { |
| 1783 | case 0x1000: |
| 1784 | return IRQ_count & 0xff; |
| 1785 | case 0x1800: |
| 1786 | return (IRQ_count >> 8) & 0xff; |
| 1787 | default: |
| 1788 | return 0x00; |
| 1789 | } |
| 1790 | } |
| 1791 | |
| 1792 | static void mapper19_set_mirror( UINT8 page, UINT8 data ) |
| 1793 | { |
| 1794 | if (!(data < 0xe0)) |
| 1795 | set_nt_page(page, CIRAM, data & 0x01, 1); |
| 1796 | else |
| 1797 | set_nt_page(page, ROM, data, 0); |
| 1798 | } |
| 1799 | |
| 1800 | static WRITE8_HANDLER( mapper19_w ) |
| 1801 | { |
| 1802 | LOG_MMC(("mapper19_w, offset: %04x, data: %02x\n", offset, data)); |
| 1803 | switch (offset & 0x7800) |
| 1804 | { |
| 1805 | case 0x0000: case 0x0800: |
| 1806 | case 0x1000: case 0x1800: |
| 1807 | case 0x2000: case 0x2800: |
| 1808 | case 0x3000: case 0x3800: |
| 1809 | chr1_x(space->machine, offset / 0x800, data, CHRROM); |
| 1810 | break; |
| 1811 | case 0x4000: |
| 1812 | mapper19_set_mirror(0, data); |
| 1813 | break; |
| 1814 | case 0x4800: |
| 1815 | mapper19_set_mirror(1, data); |
| 1816 | break; |
| 1817 | case 0x5000: |
| 1818 | mapper19_set_mirror(2, data); |
| 1819 | break; |
| 1820 | case 0x5800: |
| 1821 | mapper19_set_mirror(3, data); |
| 1822 | break; |
| 1823 | case 0x6000: |
| 1824 | prg8_89(space->machine, data & 0x3f); |
| 1825 | break; |
| 1826 | case 0x6800: |
| 1827 | mmc_cmd1 = data & 0xc0; // this should enable High CHRRAM, but we still have to properly implement it! |
| 1828 | prg8_ab(space->machine, data & 0x3f); |
| 1829 | break; |
| 1830 | case 0x7000: |
| 1831 | prg8_cd(space->machine, data & 0x3f); |
| 1832 | break; |
| 1833 | case 0x7800: |
| 1834 | LOG_MMC(("Mapper 19 sound address write, data: %02x\n", data)); |
| 1835 | break; |
| 1836 | } |
| 1837 | } |
| 1838 | |
| 1839 | /************************************************************* |
| 1840 | |
| 1841 | Mapper 20 |
| 1842 | |
| 1843 | Known Boards: Reserved for FDS |
| 1844 | Games: any FDS disk |
| 1845 | |
| 1846 | In MESS: Supported |
| 1847 | |
| 1848 | *************************************************************/ |
| 1849 | |
| 1850 | static void fds_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 1851 | { |
| 1852 | if (IRQ_enable_latch) |
| 1853 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 1854 | |
| 1855 | if (IRQ_enable) |
| 1856 | { |
| 1857 | if (IRQ_count <= 114) |
| 1858 | { |
| 1859 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 1860 | IRQ_enable = 0; |
| 1861 | nes_fds.status0 |= 0x01; |
| 1862 | } |
| 1863 | else |
| 1864 | IRQ_count -= 114; |
| 1865 | } |
| 1866 | } |
| 1867 | |
| 1868 | READ8_HANDLER( fds_r ) |
| 1869 | { |
| 1870 | UINT8 ret = 0x00; |
| 1871 | LOG_MMC(("fds_r, offset: %04x\n", offset)); |
| 1872 | |
| 1873 | switch (offset) |
| 1874 | { |
| 1875 | case 0x00: /* $4030 - disk status 0 */ |
| 1876 | ret = nes_fds.status0; |
| 1877 | /* clear the disk IRQ detect flag */ |
| 1878 | nes_fds.status0 &= ~0x01; |
| 1879 | break; |
| 1880 | case 0x01: /* $4031 - data latch */ |
| 1881 | /* don't read data if disk is unloaded */ |
| 1882 | if (nes_fds.data == NULL) |
| 1883 | ret = 0; |
| 1884 | else if (nes_fds.current_side) |
| 1885 | ret = nes_fds.data[(nes_fds.current_side-1) * 65500 + nes_fds.head_position++]; |
| 1886 | else |
| 1887 | ret = 0; |
| 1888 | break; |
| 1889 | case 0x02: /* $4032 - disk status 1 */ |
| 1890 | /* return "no disk" status if disk is unloaded */ |
| 1891 | if (nes_fds.data == NULL) |
| 1892 | ret = 1; |
| 1893 | else if (fds_last_side != nes_fds.current_side) |
| 1894 | { |
| 1895 | /* If we've switched disks, report "no disk" for a few reads */ |
| 1896 | ret = 1; |
| 1897 | fds_count ++; |
| 1898 | if (fds_count == 50) |
| 1899 | { |
| 1900 | fds_last_side = nes_fds.current_side; |
| 1901 | fds_count = 0; |
| 1902 | } |
| 1903 | } |
| 1904 | else |
| 1905 | ret = (nes_fds.current_side == 0); /* 0 if a disk is inserted */ |
| 1906 | break; |
| 1907 | case 0x03: /* $4033 */ |
| 1908 | ret = 0x80; |
| 1909 | break; |
| 1910 | default: |
| 1911 | ret = 0x00; |
| 1912 | break; |
| 1913 | } |
| 1914 | |
| 1915 | LOG_FDS(("fds_r, address: %04x, data: %02x\n", offset + 0x4030, ret)); |
| 1916 | |
| 1917 | return ret; |
| 1918 | } |
| 1919 | |
| 1920 | WRITE8_HANDLER( fds_w ) |
| 1921 | { |
| 1922 | LOG_MMC(("fds_w, offset: %04x, data: %02x\n", offset, data)); |
| 1923 | |
| 1924 | switch (offset) |
| 1925 | { |
| 1926 | case 0x00: |
| 1927 | IRQ_count_latch = (IRQ_count_latch & 0xff00) | data; |
| 1928 | break; |
| 1929 | case 0x01: |
| 1930 | IRQ_count_latch = (IRQ_count_latch & 0x00ff) | (data << 8); |
| 1931 | break; |
| 1932 | case 0x02: |
| 1933 | IRQ_count = IRQ_count_latch; |
| 1934 | IRQ_enable = data; |
| 1935 | break; |
| 1936 | case 0x03: |
| 1937 | // d0 = sound io (1 = enable) |
| 1938 | // d1 = disk io (1 = enable) |
| 1939 | break; |
| 1940 | case 0x04: |
| 1941 | /* write data out to disk */ |
| 1942 | break; |
| 1943 | case 0x05: |
| 1944 | nes_fds.motor_on = data & 0x01; |
| 1945 | |
| 1946 | if (data & 0x02) |
| 1947 | nes_fds.head_position = 0; |
| 1948 | |
| 1949 | nes_fds.read_mode = data & 0x04; |
| 1950 | set_nt_mirroring((data & 0x08) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 1951 | |
| 1952 | if ((!(data & 0x40)) && (nes_fds.write_reg & 0x40)) |
| 1953 | nes_fds.head_position -= 2; // ??? |
| 1954 | |
| 1955 | IRQ_enable_latch = data & 0x80; |
| 1956 | nes_fds.write_reg = data; |
| 1957 | break; |
| 1958 | } |
| 1959 | |
| 1960 | LOG_FDS(("fds_w, address: %04x, data: %02x\n", offset + 0x4020, data)); |
| 1961 | } |
| 1962 | |
| 1963 | /************************************************************* |
| 1964 | |
| 1965 | Mapper 21 & 25 |
| 1966 | |
| 1967 | Known Boards: Konami VRC4A & VRC4C (21), VRC4B & VRC4D (25) |
| 1968 | Games: Ganbare Goemon Gaiden 2, Wai Wai World 2 (21), Bio |
| 1969 | Miracle Bokutte Upa, Ganbare Goemon Gaiden, TMNT 1 & 2 Jpn (25) |
| 1970 | |
| 1971 | In MESS: Supported |
| 1972 | |
| 1973 | *************************************************************/ |
| 1974 | |
| 1975 | static void konami_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 1976 | { |
| 1977 | /* Increment & check the IRQ scanline counter */ |
| 1978 | if (IRQ_enable && (++IRQ_count == 0x100)) |
| 1979 | { |
| 1980 | IRQ_count = IRQ_count_latch; |
| 1981 | IRQ_enable = IRQ_enable_latch; |
| 1982 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 1983 | } |
| 1984 | } |
| 1985 | |
| 1986 | static WRITE8_HANDLER( konami_vrc4_w ) |
| 1987 | { |
| 1988 | LOG_MMC(("konami_vrc4_w, offset: %04x, data: %02x\n", offset, data)); |
| 1989 | |
| 1990 | switch (offset & 0x7007) |
| 1991 | { |
| 1992 | case 0x0000: |
| 1993 | prg8_89(space->machine, data); |
| 1994 | break; |
| 1995 | case 0x1000: |
| 1996 | switch (data & 0x03) |
| 1997 | { |
| 1998 | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 1999 | case 0x01: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 2000 | case 0x02: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 2001 | case 0x03: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 2002 | } |
| 2003 | break; |
| 2004 | |
| 2005 | /* $1001 is uncaught */ |
| 2006 | |
| 2007 | case 0x2000: |
| 2008 | prg8_ab(space->machine, data); |
| 2009 | break; |
| 2010 | case 0x3000: |
| 2011 | vrom_bank[0] = (vrom_bank[0] & 0xf0) | (data & 0x0f); |
| 2012 | chr1_0(space->machine, vrom_bank[0], CHRROM); |
| 2013 | break; |
| 2014 | case 0x3002: |
| 2015 | vrom_bank[0] = (vrom_bank[0] & 0x0f) | (data << 4); |
| 2016 | chr1_0(space->machine, vrom_bank[0], CHRROM); |
| 2017 | break; |
| 2018 | case 0x3001: |
| 2019 | case 0x3004: |
| 2020 | vrom_bank[1] = (vrom_bank[1] & 0xf0) | (data & 0x0f); |
| 2021 | chr1_1(space->machine, vrom_bank[1], CHRROM); |
| 2022 | break; |
| 2023 | case 0x3003: |
| 2024 | case 0x3006: |
| 2025 | vrom_bank[1] = (vrom_bank[1] & 0x0f) | (data << 4); |
| 2026 | chr1_1(space->machine, vrom_bank[1], CHRROM); |
| 2027 | break; |
| 2028 | case 0x4000: |
| 2029 | vrom_bank[2] = (vrom_bank[2] & 0xf0) | (data & 0x0f); |
| 2030 | chr1_2(space->machine, vrom_bank[2], CHRROM); |
| 2031 | break; |
| 2032 | case 0x4002: |
| 2033 | vrom_bank[2] = (vrom_bank[2] & 0x0f) | (data << 4); |
| 2034 | chr1_2(space->machine, vrom_bank[2], CHRROM); |
| 2035 | break; |
| 2036 | case 0x4001: |
| 2037 | case 0x4004: |
| 2038 | vrom_bank[3] = (vrom_bank[3] & 0xf0) | (data & 0x0f); |
| 2039 | chr1_3(space->machine, vrom_bank[3], CHRROM); |
| 2040 | break; |
| 2041 | case 0x4003: |
| 2042 | case 0x4006: |
| 2043 | vrom_bank[3] = (vrom_bank[3] & 0x0f) | (data << 4); |
| 2044 | chr1_3(space->machine, vrom_bank[3], CHRROM); |
| 2045 | break; |
| 2046 | case 0x5000: |
| 2047 | vrom_bank[4] = (vrom_bank[4] & 0xf0) | (data & 0x0f); |
| 2048 | chr1_4(space->machine, vrom_bank[4], CHRROM); |
| 2049 | break; |
| 2050 | case 0x5002: |
| 2051 | vrom_bank[4] = (vrom_bank[4] & 0x0f) | (data << 4); |
| 2052 | chr1_4(space->machine, vrom_bank[4], CHRROM); |
| 2053 | break; |
| 2054 | case 0x5001: |
| 2055 | case 0x5004: |
| 2056 | vrom_bank[5] = (vrom_bank[5] & 0xf0) | (data & 0x0f); |
| 2057 | chr1_5(space->machine, vrom_bank[5], CHRROM); |
| 2058 | break; |
| 2059 | case 0x5003: |
| 2060 | case 0x5006: |
| 2061 | vrom_bank[5] = (vrom_bank[5] & 0x0f) | (data << 4); |
| 2062 | chr1_5(space->machine, vrom_bank[5], CHRROM); |
| 2063 | break; |
| 2064 | case 0x6000: |
| 2065 | vrom_bank[6] = (vrom_bank[6] & 0xf0) | (data & 0x0f); |
| 2066 | chr1_6(space->machine, vrom_bank[6], CHRROM); |
| 2067 | break; |
| 2068 | case 0x6002: |
| 2069 | vrom_bank[6] = (vrom_bank[6] & 0x0f) | (data << 4); |
| 2070 | chr1_6(space->machine, vrom_bank[6], CHRROM); |
| 2071 | break; |
| 2072 | case 0x6001: |
| 2073 | case 0x6004: |
| 2074 | vrom_bank[7] = (vrom_bank[7] & 0xf0) | (data & 0x0f); |
| 2075 | chr1_7(space->machine, vrom_bank[7], CHRROM); |
| 2076 | break; |
| 2077 | case 0x6003: |
| 2078 | case 0x6006: |
| 2079 | vrom_bank[7] = (vrom_bank[7] & 0x0f) | (data << 4); |
| 2080 | chr1_7(space->machine, vrom_bank[7], CHRROM); |
| 2081 | break; |
| 2082 | |
| 2083 | case 0x7000: |
| 2084 | IRQ_count_latch = (IRQ_count_latch & 0xf0) | (data & 0x0f); |
| 2085 | break; |
| 2086 | case 0x7002: |
| 2087 | case 0x7040: |
| 2088 | IRQ_count_latch = (IRQ_count_latch & 0x0f) | ((data & 0x0f) << 4 ); |
| 2089 | break; |
| 2090 | case 0x7004: |
| 2091 | case 0x7001: |
| 2092 | case 0x7080: |
| 2093 | IRQ_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 2094 | IRQ_enable = data & 0x02; |
| 2095 | IRQ_enable_latch = data & 0x01; |
| 2096 | if (data & 0x02) |
| 2097 | IRQ_count = IRQ_count_latch; |
| 2098 | break; |
| 2099 | case 0x7006: |
| 2100 | case 0x7003: |
| 2101 | case 0x70c0: |
| 2102 | IRQ_enable = IRQ_enable_latch; |
| 2103 | break; |
| 2104 | default: |
| 2105 | LOG_MMC(("konami_vrc4_w uncaught offset: %04x value: %02x\n", offset, data)); |
| 2106 | break; |
| 2107 | } |
| 2108 | } |
| 2109 | |
| 2110 | /************************************************************* |
| 2111 | |
| 2112 | Mapper 22 |
| 2113 | |
| 2114 | Known Boards: Konami VRC2A |
| 2115 | Games: Ganbare Pennant Race, Twin Bee 3 |
| 2116 | |
| 2117 | In MESS: Supported. |
| 2118 | |
| 2119 | *************************************************************/ |
| 2120 | |
| 2121 | static WRITE8_HANDLER( konami_vrc2a_w ) |
| 2122 | { |
| 2123 | UINT8 bank; |
| 2124 | LOG_MMC(("konami_vrc2a_w, offset: %04x, data: %02x\n", offset, data)); |
| 2125 | |
| 2126 | switch (offset & 0x7000) |
| 2127 | { |
| 2128 | case 0x0000: |
| 2129 | prg8_89(space->machine, data); |
| 2130 | break; |
| 2131 | case 0x1000: |
| 2132 | switch (data & 0x03) |
| 2133 | { |
| 2134 | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 2135 | case 0x01: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 2136 | case 0x02: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 2137 | case 0x03: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 2138 | } |
| 2139 | break; |
| 2140 | case 0x2000: |
| 2141 | prg8_ab(space->machine, data); |
| 2142 | break; |
| 2143 | case 0x3000: |
| 2144 | case 0x4000: |
| 2145 | case 0x5000: |
| 2146 | case 0x6000: |
| 2147 | bank = ((offset & 0x7000) - 0x3000) / 0x0800 + (offset & 0x0001); |
| 2148 | /* Notice that we store the banks as in other VRC, but then we take vrom_bank>>1 because it's VRC2A!*/ |
| 2149 | if (offset & 0x0002) |
| 2150 | vrom_bank[bank] = (vrom_bank[bank] & 0x0f) | (data << 4); |
| 2151 | else |
| 2152 | vrom_bank[bank] = (vrom_bank[bank] & 0xf0) | (data & 0x0f); |
| 2153 | |
| 2154 | chr1_x(space->machine, bank, vrom_bank[bank] >> 1, CHRROM); |
| 2155 | break; |
| 2156 | |
| 2157 | default: |
| 2158 | LOG_MMC(("konami_vrc2a_w uncaught offset: %04x value: %02x\n", offset, data)); |
| 2159 | break; |
| 2160 | } |
| 2161 | } |
| 2162 | |
| 2163 | /************************************************************* |
| 2164 | |
| 2165 | Mapper 23 |
| 2166 | |
| 2167 | Known Boards: Konami VRC2B & VRC4E |
| 2168 | Games: Getsufuu Maden, Parodius Da! |
| 2169 | |
| 2170 | In MESS: Supported. It also uses konami_irq. |
| 2171 | |
| 2172 | *************************************************************/ |
| 2173 | |
| 2174 | static WRITE8_HANDLER( konami_vrc2b_w ) |
| 2175 | { |
| 2176 | UINT16 select; |
| 2177 | UINT8 bank; |
| 2178 | |
| 2179 | LOG_MMC(("konami_vrc2b_w, offset: %04x, data: %02x\n", offset, data)); |
| 2180 | |
| 2181 | if (offset < 0x3000) |
| 2182 | { |
| 2183 | switch (offset & 0x3000) |
| 2184 | { |
| 2185 | case 0: |
| 2186 | prg8_89(space->machine, data); |
| 2187 | break; |
| 2188 | case 0x1000: |
| 2189 | switch (data & 0x03) |
| 2190 | { |
| 2191 | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 2192 | case 0x01: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 2193 | case 0x02: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 2194 | case 0x03: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 2195 | } |
| 2196 | break; |
| 2197 | case 0x2000: |
| 2198 | prg8_ab(space->machine, data); |
| 2199 | break; |
| 2200 | default: |
| 2201 | LOG_MMC(("konami_vrc2b_w offset: %04x value: %02x\n", offset, data)); |
| 2202 | break; |
| 2203 | } |
| 2204 | return; |
| 2205 | } |
| 2206 | |
| 2207 | /* The low 2 select bits vary from cart to cart */ |
| 2208 | select = (offset & 0x7000) | (offset & 0x03) | ((offset & 0x0c) >> 2); |
| 2209 | |
| 2210 | switch (select) |
| 2211 | { |
| 2212 | case 0x3000: |
| 2213 | case 0x3001: |
| 2214 | case 0x3002: |
| 2215 | case 0x3003: |
| 2216 | case 0x4000: |
| 2217 | case 0x4001: |
| 2218 | case 0x4002: |
| 2219 | case 0x4003: |
| 2220 | case 0x5000: |
| 2221 | case 0x5001: |
| 2222 | case 0x5002: |
| 2223 | case 0x5003: |
| 2224 | case 0x6000: |
| 2225 | case 0x6001: |
| 2226 | case 0x6002: |
| 2227 | case 0x6003: |
| 2228 | bank = ((select & 0x7000) - 0x3000) / 0x0800 + ((select & 0x0002) >> 1); |
| 2229 | if (select & 0x0001) |
| 2230 | vrom_bank[bank] = (vrom_bank[bank] & 0x0f) | (data << 4); |
| 2231 | else |
| 2232 | vrom_bank[bank] = (vrom_bank[bank] & 0xf0) | (data & 0x0f); |
| 2233 | |
| 2234 | chr1_x(space->machine, bank, vrom_bank[bank], mmc_chr_source); |
| 2235 | break; |
| 2236 | case 0x7000: |
| 2237 | IRQ_count_latch &= ~0x0f; |
| 2238 | IRQ_count_latch |= data & 0x0f; |
| 2239 | break; |
| 2240 | case 0x7001: |
| 2241 | IRQ_count_latch &= ~0xf0; |
| 2242 | IRQ_count_latch |= (data << 4) & 0xf0; |
| 2243 | break; |
| 2244 | case 0x7002: |
| 2245 | IRQ_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 2246 | IRQ_enable = data & 0x02; |
| 2247 | IRQ_enable_latch = data & 0x01; |
| 2248 | if (data & 0x02) |
| 2249 | IRQ_count = IRQ_count_latch; |
| 2250 | break; |
| 2251 | |
| 2252 | default: |
| 2253 | logerror("konami_vrc2b_w uncaught offset: %04x value: %02x\n", offset, data); |
| 2254 | break; |
| 2255 | } |
| 2256 | } |
| 2257 | |
| 2258 | /************************************************************* |
| 2259 | |
| 2260 | Mapper 24 |
| 2261 | |
| 2262 | Known Boards: Konami VRC6 |
| 2263 | Games: Akumajou Densetsu |
| 2264 | |
| 2265 | In MESS: Supported. It also uses konami_irq. |
| 2266 | |
| 2267 | *************************************************************/ |
| 2268 | |
| 2269 | static WRITE8_HANDLER( konami_vrc6a_w ) |
| 2270 | { |
| 2271 | UINT8 bank; |
| 2272 | LOG_MMC(("konami_vrc6a_w, offset: %04x, data: %02x\n", offset, data)); |
| 2273 | |
| 2274 | switch (offset & 0x7003) |
| 2275 | { |
| 2276 | case 0x0000: |
| 2277 | case 0x0001: |
| 2278 | case 0x0002: |
| 2279 | case 0x0003: |
| 2280 | prg16_89ab(space->machine, data); |
| 2281 | break; |
| 2282 | |
| 2283 | /* $1000-$1002 = sound regs */ |
| 2284 | /* $2000-$2002 = sound regs */ |
| 2285 | /* $3000-$3002 = sound regs */ |
| 2286 | |
| 2287 | case 0x3003: |
| 2288 | switch (data & 0x0c) |
| 2289 | { |
| 2290 | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 2291 | case 0x04: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 2292 | case 0x08: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 2293 | case 0x0c: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 2294 | } |
| 2295 | break; |
| 2296 | case 0x4000: |
| 2297 | case 0x4001: |
| 2298 | case 0x4002: |
| 2299 | case 0x4003: |
| 2300 | prg8_cd(space->machine, data); |
| 2301 | break; |
| 2302 | case 0x5000: |
| 2303 | case 0x5001: |
| 2304 | case 0x5002: |
| 2305 | case 0x5003: |
| 2306 | case 0x6000: |
| 2307 | case 0x6001: |
| 2308 | case 0x6002: |
| 2309 | case 0x6003: |
| 2310 | bank = ((offset & 0x7000) - 0x5000) / 0x0400 + (offset & 0x0003); |
| 2311 | chr1_x(space->machine, bank, data, CHRROM); |
| 2312 | break; |
| 2313 | |
| 2314 | case 0x7000: |
| 2315 | IRQ_count_latch = data; |
| 2316 | break; |
| 2317 | case 0x7001: |
| 2318 | IRQ_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 2319 | IRQ_enable = data & 0x02; |
| 2320 | IRQ_enable_latch = data & 0x01; |
| 2321 | if (data & 0x02) |
| 2322 | IRQ_count = IRQ_count_latch; |
| 2323 | break; |
| 2324 | case 0x7002: |
| 2325 | IRQ_enable = IRQ_enable_latch; |
| 2326 | break; |
| 2327 | |
| 2328 | default: |
| 2329 | logerror("konami_vrc6_w uncaught addr: %04x value: %02x\n", offset + 0x8000, data); |
| 2330 | break; |
| 2331 | } |
| 2332 | } |
| 2333 | |
| 2334 | /************************************************************* |
| 2335 | |
| 2336 | Mapper 26 |
| 2337 | |
| 2338 | Known Boards: Konami VRC6 variant |
| 2339 | Games: Esper Dream 2, Mouryou Senki Madara |
| 2340 | |
| 2341 | In MESS: Supported. It also uses konami_irq. |
| 2342 | |
| 2343 | *************************************************************/ |
| 2344 | |
| 2345 | static WRITE8_HANDLER( konami_vrc6b_w ) |
| 2346 | { |
| 2347 | UINT8 bank; |
| 2348 | |
| 2349 | LOG_MMC(("konami_vrc6b_w, offset: %04x, data: %02x\n", offset, data)); |
| 2350 | |
| 2351 | switch (offset & 0x7003) |
| 2352 | { |
| 2353 | case 0: case 1: case 2: case 3: |
| 2354 | prg16_89ab(space->machine, data); |
| 2355 | break; |
| 2356 | |
| 2357 | /* $1000-$1002 = sound regs */ |
| 2358 | /* $2000-$2002 = sound regs */ |
| 2359 | /* $3000-$3002 = sound regs */ |
| 2360 | |
| 2361 | case 0x3003: |
| 2362 | switch (data & 0x0c) |
| 2363 | { |
| 2364 | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 2365 | case 0x04: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 2366 | case 0x08: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 2367 | case 0x0c: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 2368 | } |
| 2369 | break; |
| 2370 | case 0x4000: case 0x4001: case 0x4002: case 0x4003: |
| 2371 | prg8_cd(space->machine, data); |
| 2372 | break; |
| 2373 | case 0x5000: |
| 2374 | case 0x5001: |
| 2375 | case 0x5002: |
| 2376 | case 0x5003: |
| 2377 | case 0x6000: |
| 2378 | case 0x6001: |
| 2379 | case 0x6002: |
| 2380 | case 0x6003: |
| 2381 | bank = ((offset & 0x7000) - 0x5000) / 0x0400 + ((offset & 0x0001) << 1) + ((offset & 0x0002) >> 1); |
| 2382 | chr1_x(space->machine, bank, data, CHRROM); |
| 2383 | break; |
| 2384 | case 0x7000: |
| 2385 | IRQ_count_latch = data; |
| 2386 | break; |
| 2387 | case 0x7001: |
| 2388 | IRQ_enable = IRQ_enable_latch; |
| 2389 | break; |
| 2390 | case 0x7002: |
| 2391 | IRQ_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 2392 | IRQ_enable = data & 0x02; |
| 2393 | IRQ_enable_latch = data & 0x01; |
| 2394 | if (data & 0x02) |
| 2395 | IRQ_count = IRQ_count_latch; |
| 2396 | break; |
| 2397 | |
| 2398 | default: |
| 2399 | logerror("konami_vrc6_w uncaught addr: %04x value: %02x\n", offset + 0x8000, data); |
| 2400 | break; |
| 2401 | } |
| 2402 | } |
| 2403 | |
| 2404 | /************************************************************* |
| 2405 | |
| 2406 | Mapper 27 |
| 2407 | |
| 2408 | Known Boards: Unknown Bootleg Board |
| 2409 | Games: World Hero |
| 2410 | |
| 2411 | In MESS: Unsupported. |
| 2412 | |
| 2413 | *************************************************************/ |
| 2414 | |
| 2415 | /************************************************************* |
| 2416 | |
| 2417 | Mapper 28 |
| 2418 | |
| 2419 | Known Boards: Undocumented / Unused ?!? |
| 2420 | Games: ---------- |
| 2421 | |
| 2422 | In MESS: ---------- |
| 2423 | |
| 2424 | *************************************************************/ |
| 2425 | |
| 2426 | /************************************************************* |
| 2427 | |
| 2428 | Mapper 29 |
| 2429 | |
| 2430 | Known Boards: Undocumented / Unused ?!? |
| 2431 | Games: ---------- |
| 2432 | |
| 2433 | In MESS: ---------- |
| 2434 | |
| 2435 | *************************************************************/ |
| 2436 | |
| 2437 | /************************************************************* |
| 2438 | |
| 2439 | Mapper 30 |
| 2440 | |
| 2441 | Known Boards: Undocumented / Unused ?!? |
| 2442 | Games: ---------- |
| 2443 | |
| 2444 | In MESS: ---------- |
| 2445 | |
| 2446 | *************************************************************/ |
| 2447 | |
| 2448 | /************************************************************* |
| 2449 | |
| 2450 | Mapper 31 |
| 2451 | |
| 2452 | Known Boards: Undocumented / Unused ?!? |
| 2453 | Games: ---------- |
| 2454 | |
| 2455 | In MESS: ---------- |
| 2456 | |
| 2457 | *************************************************************/ |
| 2458 | |
| 2459 | /************************************************************* |
| 2460 | |
| 2461 | Mapper 32 |
| 2462 | |
| 2463 | Known Boards: Irem G101A & G101B |
| 2464 | Games: Ai Sensei no Oshiete, Image Fight, Kaiketsu |
| 2465 | Yanchamaru 2, Maikyuu Shima, Paaman, Paaman 2 |
| 2466 | |
| 2467 | A crc check is required to support Major League (which uses |
| 2468 | a slightly different board) |
| 2469 | |
| 2470 | In MESS: Supported. |
| 2471 | |
| 2472 | *************************************************************/ |
| 2473 | |
| 2474 | static WRITE8_HANDLER( mapper32_w ) |
| 2475 | { |
| 2476 | LOG_MMC(("mapper32_w, offset: %04x, data: %02x\n", offset, data)); |
| 2477 | |
| 2478 | switch (offset & 0x7000) |
| 2479 | { |
| 2480 | case 0x0000: |
| 2481 | mmc_cmd1 ? prg8_cd(space->machine, data) : prg8_89(space->machine, data); |
| 2482 | break; |
| 2483 | case 0x1000: |
| 2484 | mmc_cmd1 = data & 0x02; |
| 2485 | if (!nes.crc_hack) // Major League has hardwired mirroring (it would have required a separate mapper) |
| 2486 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 2487 | break; |
| 2488 | case 0x2000: |
| 2489 | prg8_ab(space->machine, data); |
| 2490 | break; |
| 2491 | case 0x3000: |
| 2492 | chr1_x(space->machine, offset & 0x07, data, CHRROM); |
| 2493 | break; |
| 2494 | default: |
| 2495 | logerror("Uncaught mapper 32 write, addr: %04x value: %02x\n", offset + 0x8000, data); |
| 2496 | break; |
| 2497 | } |
| 2498 | } |
| 2499 | |
| 2500 | /************************************************************* |
| 2501 | |
| 2502 | Mapper 33 |
| 2503 | |
| 2504 | Known Boards: Taito TC0190FMC |
| 2505 | Games: Akira, Bakushou!! Jinsei Gekijou, Don Doko Don, |
| 2506 | Insector X, Operation Wolf, Power Blazer, Takeshi no |
| 2507 | Sengoku Fuuunji |
| 2508 | |
| 2509 | In MESS: Supported. |
| 2510 | |
| 2511 | *************************************************************/ |
| 2512 | |
| 2513 | static WRITE8_HANDLER( mapper33_w ) |
| 2514 | { |
| 2515 | LOG_MMC(("mapper33_w, offset: %04x, data: %02x\n", offset, data)); |
| 2516 | |
| 2517 | switch (offset & 0x6003) |
| 2518 | { |
| 2519 | case 0x0000: |
| 2520 | set_nt_mirroring((data & 0x40) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 2521 | prg8_89(space->machine, data); |
| 2522 | break; |
| 2523 | case 0x0001: |
| 2524 | prg8_ab(space->machine, data); |
| 2525 | break; |
| 2526 | case 0x0002: |
| 2527 | chr2_0(space->machine, data, CHRROM); |
| 2528 | break; |
| 2529 | case 0x0003: |
| 2530 | chr2_2(space->machine, data, CHRROM); |
| 2531 | break; |
| 2532 | case 0x2000: |
| 2533 | chr1_4(space->machine, data, CHRROM); |
| 2534 | break; |
| 2535 | case 0x2001: |
| 2536 | chr1_5(space->machine, data, CHRROM); |
| 2537 | break; |
| 2538 | case 0x2002: |
| 2539 | chr1_6(space->machine, data, CHRROM); |
| 2540 | break; |
| 2541 | case 0x2003: |
| 2542 | chr1_7(space->machine, data, CHRROM); |
| 2543 | break; |
| 2544 | } |
| 2545 | } |
| 2546 | |
| 2547 | /************************************************************* |
| 2548 | |
| 2549 | Mapper 34 |
| 2550 | |
| 2551 | Known Boards: BNROM, Unlicensed BxROM, NINA001, NINA002 |
| 2552 | Games: Deadly Tower, Impossible Mission II, Titanic 1912, |
| 2553 | Dance Xtreme |
| 2554 | |
| 2555 | There actually exist TWO different kind of boards using |
| 2556 | this mapper. NINA-001 is not compatible with the other |
| 2557 | kind of board, so Impossible Mission II requires a crc check |
| 2558 | to be supported. |
| 2559 | |
| 2560 | In MESS: Supported. |
| 2561 | |
| 2562 | *************************************************************/ |
| 2563 | |
| 2564 | static WRITE8_HANDLER( mapper34_m_w ) |
| 2565 | { |
| 2566 | LOG_MMC(("mapper34_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 2567 | |
| 2568 | if (nes.crc_hack) // is it AVE Nina-01? |
| 2569 | { |
| 2570 | switch (offset) |
| 2571 | { |
| 2572 | case 0x1ffd: |
| 2573 | prg32(space->machine, data); |
| 2574 | break; |
| 2575 | case 0x1ffe: |
| 2576 | chr4_0(space->machine, data, CHRROM); |
| 2577 | break; |
| 2578 | case 0x1fff: |
| 2579 | chr4_4(space->machine, data, CHRROM); |
| 2580 | break; |
| 2581 | } |
| 2582 | } |
| 2583 | } |
| 2584 | |
| 2585 | static WRITE8_HANDLER( mapper34_w ) |
| 2586 | { |
| 2587 | /* This portion of the mapper is nearly identical to Mapper 7, except no one-screen mirroring */ |
| 2588 | /* Deadly Towers is really a Mapper 34 game - the demo screens look wrong using mapper 7. */ |
| 2589 | LOG_MMC(("mapper34_w, offset: %04x, data: %02x\n", offset, data)); |
| 2590 | |
| 2591 | if (!nes.crc_hack) // is it plain BxROM? |
| 2592 | prg32(space->machine, data); |
| 2593 | } |
| 2594 | |
| 2595 | /************************************************************* |
| 2596 | |
| 2597 | Mapper 35 |
| 2598 | |
| 2599 | Known Boards: Undocumented / Unused ?!? |
| 2600 | Games: ---------- |
| 2601 | |
| 2602 | In MESS: ---------- |
| 2603 | |
| 2604 | *************************************************************/ |
| 2605 | |
| 2606 | /************************************************************* |
| 2607 | |
| 2608 | Mapper 36 |
| 2609 | |
| 2610 | Known Boards: Bootleg Board by TXC |
| 2611 | Games: Strike Wolf (also Policeman?? according to Nestopia) |
| 2612 | |
| 2613 | In MESS: Supported. |
| 2614 | |
| 2615 | *************************************************************/ |
| 2616 | |
| 2617 | static WRITE8_HANDLER( mapper36_w ) |
| 2618 | { |
| 2619 | LOG_MMC(("mapper36_w, offset: %04x, data: %02x\n", offset, data)); |
| 2620 | |
| 2621 | if ((offset >= 0x400) && (offset < 0x7fff)) |
| 2622 | { |
| 2623 | prg32(space->machine, data >> 4); |
| 2624 | chr8(space->machine, data & 0x0f, CHRROM); |
| 2625 | } |
| 2626 | } |
| 2627 | |
| 2628 | /************************************************************* |
| 2629 | |
| 2630 | Mapper 37 |
| 2631 | |
| 2632 | Known Boards: Custom ZZ?? |
| 2633 | Games: Super Mario Bros. + Tetris + Nintendo World Cup (E) |
| 2634 | |
| 2635 | MMC3 clone |
| 2636 | |
| 2637 | In MESS: Supported. |
| 2638 | |
| 2639 | *************************************************************/ |
| 2640 | |
| 2641 | static WRITE8_HANDLER( mapper37_m_w ) |
| 2642 | { |
| 2643 | UINT8 map37_helper; |
| 2644 | LOG_MMC(("mapper37_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 2645 | |
| 2646 | map37_helper = (data & 0x06) >> 1; |
| 2647 | |
| 2648 | mmc_prg_base = map37_helper << 3; |
| 2649 | mmc_prg_mask = (map37_helper == 2) ? 0x0f : 0x07; |
| 2650 | mmc_chr_base = map37_helper << 6; |
| 2651 | mmc_chr_mask = 0x7f; |
| 2652 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 2653 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 2654 | } |
| 2655 | |
| 2656 | /************************************************************* |
| 2657 | |
| 2658 | Mapper 38 |
| 2659 | |
| 2660 | Known Boards: Discrete Logic Board |
| 2661 | Games: Crime Busters |
| 2662 | |
| 2663 | In MESS: Supported. |
| 2664 | |
| 2665 | *************************************************************/ |
| 2666 | |
| 2667 | static WRITE8_HANDLER( mapper38_m_w ) |
| 2668 | { |
| 2669 | LOG_MMC(("mapper38_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 2670 | |
| 2671 | prg32(space->machine, data); |
| 2672 | chr8(space->machine, data >> 4, CHRROM); |
| 2673 | } |
| 2674 | |
| 2675 | /************************************************************* |
| 2676 | |
| 2677 | Mapper 39 |
| 2678 | |
| 2679 | Known Boards: Bootleg Board by Subor |
| 2680 | Games: Study n Game 32 in 1 |
| 2681 | |
| 2682 | In MESS: Partially Supported. |
| 2683 | |
| 2684 | *************************************************************/ |
| 2685 | |
| 2686 | static WRITE8_HANDLER( mapper39_w ) |
| 2687 | { |
| 2688 | LOG_MMC(("mapper39_w, offset: %04x, data: %02x\n", offset, data)); |
| 2689 | |
| 2690 | prg32(space->machine, data); |
| 2691 | } |
| 2692 | |
| 2693 | /************************************************************* |
| 2694 | |
| 2695 | Mapper 40 |
| 2696 | |
| 2697 | Known Boards: Unknown Bootleg Board |
| 2698 | Games: Super Mario Bros. 2 Pirate (Jpn version of SMB2) |
| 2699 | |
| 2700 | In MESS: Supported. |
| 2701 | |
| 2702 | *************************************************************/ |
| 2703 | |
| 2704 | static void mapper40_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 2705 | { |
| 2706 | if (IRQ_enable) |
| 2707 | { |
| 2708 | if ((0xfff - IRQ_count) <= 114) |
| 2709 | { |
| 2710 | IRQ_count = (IRQ_count + 1) & 0xfff; |
| 2711 | IRQ_enable = 0; |
| 2712 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 2713 | } |
| 2714 | else |
| 2715 | IRQ_count += 114; |
| 2716 | } |
| 2717 | } |
| 2718 | |
| 2719 | static WRITE8_HANDLER( mapper40_w ) |
| 2720 | { |
| 2721 | LOG_MMC(("mapper40_w, offset: %04x, data: %02x\n", offset, data)); |
| 2722 | |
| 2723 | switch (offset & 0x6000) |
| 2724 | { |
| 2725 | case 0x0000: |
| 2726 | IRQ_enable = 0; |
| 2727 | IRQ_count = 0; |
| 2728 | break; |
| 2729 | case 0x2000: |
| 2730 | IRQ_enable = 1; |
| 2731 | break; |
| 2732 | case 0x6000: |
| 2733 | prg8_cd(space->machine, data); |
| 2734 | break; |
| 2735 | } |
| 2736 | } |
| 2737 | |
| 2738 | /************************************************************* |
| 2739 | |
| 2740 | Mapper 41 |
| 2741 | |
| 2742 | Known Boards: Caltron Board |
| 2743 | Games: 6 in 1 by Caltron |
| 2744 | |
| 2745 | In MESS: Supported. |
| 2746 | |
| 2747 | *************************************************************/ |
| 2748 | |
| 2749 | static WRITE8_HANDLER( mapper41_m_w ) |
| 2750 | { |
| 2751 | LOG_MMC(("mapper41_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 2752 | |
| 2753 | mmc_cmd1 = offset & 0xff; |
| 2754 | set_nt_mirroring((offset & 0x20) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 2755 | prg32(space->machine, offset & 0x07); |
| 2756 | } |
| 2757 | |
| 2758 | static WRITE8_HANDLER( mapper41_w ) |
| 2759 | { |
| 2760 | LOG_MMC(("mapper41_w, offset: %04x, data: %02x\n", offset, data)); |
| 2761 | |
| 2762 | if (mmc_cmd1 & 0x04) |
| 2763 | chr8(space->machine, ((mmc_cmd1 & 0x18) >> 1) | (data & 0x03), CHRROM); |
| 2764 | } |
| 2765 | |
| 2766 | /************************************************************* |
| 2767 | |
| 2768 | Mapper 42 |
| 2769 | |
| 2770 | Known Boards: Unknown Bootleg Board |
| 2771 | Games: Mario Baby, Ai Senshi Nicol |
| 2772 | |
| 2773 | In MESS: Supported. |
| 2774 | |
| 2775 | *************************************************************/ |
| 2776 | |
| 2777 | static WRITE8_HANDLER( mapper42_w ) |
| 2778 | { |
| 2779 | LOG_MMC(("mapper42_w, offset: %04x, data: %02x\n", offset, data)); |
| 2780 | |
| 2781 | if (offset >= 0x7000) |
| 2782 | { |
| 2783 | switch(offset & 0x03) |
| 2784 | { |
| 2785 | case 0x00: |
| 2786 | prg8_67(space->machine, data); |
| 2787 | break; |
| 2788 | case 0x01: |
| 2789 | set_nt_mirroring((data & 0x08) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 2790 | break; |
| 2791 | case 0x02: |
| 2792 | /* Check if IRQ is being enabled */ |
| 2793 | if (!IRQ_enable && (data & 0x02)) |
| 2794 | { |
| 2795 | IRQ_enable = 1; |
| 2796 | timer_adjust_oneshot(nes_irq_timer, cputag_clocks_to_attotime(space->machine, "maincpu", 24576), 0); |
| 2797 | } |
| 2798 | if (!(data & 0x02)) |
| 2799 | { |
| 2800 | IRQ_enable = 0; |
| 2801 | timer_adjust_oneshot(nes_irq_timer, attotime_never, 0); |
| 2802 | } |
| 2803 | break; |
| 2804 | } |
| 2805 | } |
| 2806 | } |
| 2807 | |
| 2808 | /************************************************************* |
| 2809 | |
| 2810 | Mapper 43 |
| 2811 | |
| 2812 | Known Boards: Unknown Bootleg Board |
| 2813 | Games: Super Mario Bros. 2 Pirate (LF36) |
| 2814 | |
| 2815 | In MESS: Supported? The only image I found is not working |
| 2816 | (not even in NEStopia). |
| 2817 | |
| 2818 | *************************************************************/ |
| 2819 | |
| 2820 | static WRITE8_HANDLER( mapper43_w ) |
| 2821 | { |
| 2822 | int bank = (((offset >> 8) & 0x03) * 0x20) + (offset & 0x1f); |
| 2823 | |
| 2824 | LOG_MMC(("mapper43_w, offset: %04x, data: %02x\n", offset, data)); |
| 2825 | |
| 2826 | set_nt_mirroring((offset& 0x2000) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 2827 | |
| 2828 | if (offset & 0x0800) |
| 2829 | { |
| 2830 | if (offset & 0x1000) |
| 2831 | { |
| 2832 | if (bank * 2 >= nes.prg_chunks) |
| 2833 | { |
| 2834 | memory_set_bankptr(space->machine, 3, nes.wram); |
| 2835 | memory_set_bankptr(space->machine, 4, nes.wram); |
| 2836 | } |
| 2837 | else |
| 2838 | { |
| 2839 | LOG_MMC(("mapper43_w, selecting upper 16KB bank of #%02x\n", bank)); |
| 2840 | prg16_cdef(space->machine, 2 * bank + 1); |
| 2841 | } |
| 2842 | } |
| 2843 | else |
| 2844 | { |
| 2845 | if (bank * 2 >= nes.prg_chunks) |
| 2846 | { |
| 2847 | memory_set_bankptr(space->machine, 1, nes.wram); |
| 2848 | memory_set_bankptr(space->machine, 2, nes.wram); |
| 2849 | } |
| 2850 | else |
| 2851 | { |
| 2852 | LOG_MMC(("mapper43_w, selecting lower 16KB bank of #%02x\n", bank)); |
| 2853 | prg16_89ab(space->machine, 2 * bank); |
| 2854 | } |
| 2855 | } |
| 2856 | } |
| 2857 | else |
| 2858 | { |
| 2859 | if (bank * 2 >= nes.prg_chunks) |
| 2860 | { |
| 2861 | memory_set_bankptr(space->machine, 1, nes.wram); |
| 2862 | memory_set_bankptr(space->machine, 2, nes.wram); |
| 2863 | memory_set_bankptr(space->machine, 3, nes.wram); |
| 2864 | memory_set_bankptr(space->machine, 4, nes.wram); |
| 2865 | } |
| 2866 | else |
| 2867 | { |
| 2868 | LOG_MMC(("mapper43_w, selecting 32KB bank #%02x\n", bank)); |
| 2869 | prg32(space->machine, bank); |
| 2870 | } |
| 2871 | } |
| 2872 | } |
| 2873 | |
| 2874 | /************************************************************* |
| 2875 | |
| 2876 | Mapper 44 |
| 2877 | |
| 2878 | Known Boards: Unknown Multigame Bootleg Board |
| 2879 | Games: Kunio 8 in 1, Super Big 7 in 1 |
| 2880 | |
| 2881 | In MESS: Supported. It also uses mapper4_irq. |
| 2882 | |
| 2883 | *************************************************************/ |
| 2884 | |
| 2885 | static WRITE8_HANDLER( mapper44_w ) |
| 2886 | { |
| 2887 | UINT8 page; |
| 2888 | LOG_MMC(("mapper44_w offset: %04x, data: %02x\n", offset, data)); |
| 2889 | |
| 2890 | switch (offset & 0x6001) |
| 2891 | { |
| 2892 | case 0x2001: /* $a001 - Select 128K ROM/VROM base (0..5) or last 256K ROM/VRAM base (6) */ |
| 2893 | page = (data & 0x07); |
| 2894 | if (page > 6) |
| 2895 | page = 6; |
| 2896 | |
| 2897 | mmc_prg_base = page << 4; |
| 2898 | mmc_prg_mask = (page > 5) ? 0x1f : 0x0f; |
| 2899 | mmc_chr_base = page << 7; |
| 2900 | mmc_chr_mask = (page > 5) ? 0xff : 0x7f; |
| 2901 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 2902 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 2903 | break; |
| 2904 | |
| 2905 | default: |
| 2906 | mapper4_w(space, offset, data); |
| 2907 | break; |
| 2908 | } |
| 2909 | } |
| 2910 | |
| 2911 | /************************************************************* |
| 2912 | |
| 2913 | Mapper 45 |
| 2914 | |
| 2915 | Known Boards: Unknown Multigame Bootleg Board |
| 2916 | Games: Street Fighter V, various multigame carts |
| 2917 | |
| 2918 | In MESS: Supported. It also uses mapper4_irq. |
| 2919 | |
| 2920 | *************************************************************/ |
| 2921 | |
| 2922 | static WRITE8_HANDLER( mapper45_m_w ) |
| 2923 | { |
| 2924 | LOG_MMC(("mapper45_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 2925 | |
| 2926 | /* This bit is the "register lock". Once register are locked, writes go to WRAM |
| 2927 | and there is no way to unlock them (except by resetting the machine) */ |
| 2928 | if (mapper45_reg[3] & 0x40) |
| 2929 | nes.wram[offset] = data; |
| 2930 | else |
| 2931 | { |
| 2932 | mapper45_reg[mmc_count] = data; |
| 2933 | mmc_count = (mmc_count + 1) & 0x03; |
| 2934 | |
| 2935 | if (!mmc_count) |
| 2936 | { |
| 2937 | LOG_MMC(("mapper45_m_w, command completed %02x %02x %02x %02x\n", mapper45_reg[3], |
| 2938 | mapper45_reg[2], mapper45_reg[1], mapper45_reg[0])); |
| 2939 | |
| 2940 | mmc_prg_base = mapper45_reg[1]; |
| 2941 | mmc_prg_mask = 0x3f ^ (mapper45_reg[3] & 0x3f); |
| 2942 | mmc_chr_base = ((mapper45_reg[2] & 0xf0) << 4) + mapper45_reg[0]; |
| 2943 | mmc_chr_mask = 0xff >> (~mapper45_reg[2] & 0x0f); |
| 2944 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 2945 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 2946 | } |
| 2947 | } |
| 2948 | } |
| 2949 | |
| 2950 | /************************************************************* |
| 2951 | |
| 2952 | Mapper 46 |
| 2953 | |
| 2954 | Known Boards: Rumblestation Board |
| 2955 | Games: Rumblestation 15 in 1 |
| 2956 | |
| 2957 | In MESS: Supported. |
| 2958 | |
| 2959 | *************************************************************/ |
| 2960 | |
| 2961 | static WRITE8_HANDLER( mapper46_m_w ) |
| 2962 | { |
| 2963 | LOG_MMC(("mapper46_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 2964 | |
| 2965 | prg_bank[0] = (prg_bank[0] & 0x01) | ((data & 0x0f) << 1); |
| 2966 | vrom_bank[0] = (vrom_bank[0] & 0x07) | ((data & 0xf0) >> 1); |
| 2967 | prg32(space->machine, prg_bank[0]); |
| 2968 | chr8(space->machine, vrom_bank[0], CHRROM); |
| 2969 | } |
| 2970 | |
| 2971 | static WRITE8_HANDLER( mapper46_w ) |
| 2972 | { |
| 2973 | LOG_MMC(("mapper46_w, offset: %04x, data: %02x\n", offset, data)); |
| 2974 | |
| 2975 | prg_bank[0] = (prg_bank[0] & ~0x01) | (data & 0x01); |
| 2976 | vrom_bank[0] = (vrom_bank[0] & ~0x07) | ((data & 0x70) >> 4); |
| 2977 | prg32(space->machine, prg_bank[0]); |
| 2978 | chr8(space->machine, vrom_bank[0], CHRROM); |
| 2979 | } |
| 2980 | |
| 2981 | /************************************************************* |
| 2982 | |
| 2983 | Mapper 47 |
| 2984 | |
| 2985 | Known Boards: Custom QJ?? |
| 2986 | Games: Super Spike V'Ball + Nintendo World Cup |
| 2987 | |
| 2988 | In MESS: Supported. It also uses mapper4_irq. |
| 2989 | |
| 2990 | *************************************************************/ |
| 2991 | |
| 2992 | static WRITE8_HANDLER( mapper47_m_w ) |
| 2993 | { |
| 2994 | LOG_MMC(("mapper47_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 2995 | |
| 2996 | mmc_prg_base = (data & 0x01) << 4; |
| 2997 | mmc_prg_mask = 0x0f; |
| 2998 | mmc_chr_base = (data & 0x01) << 7; |
| 2999 | mmc_chr_mask = 0x7f; |
| 3000 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 3001 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 3002 | } |
| 3003 | |
| 3004 | /************************************************************* |
| 3005 | |
| 3006 | Mapper 48 |
| 3007 | |
| 3008 | Known Boards: Taito TC0190FMC PAL16R4 |
| 3009 | Games: Bakushou!! Jinsei Gekijou 3, Bubble Bobble 2, |
| 3010 | Captain Saver, Don Doko Don 2, Flintstones, Jetsons |
| 3011 | |
| 3012 | This is basically Mapper 33 + IRQ. Notably, IRQ works the |
| 3013 | same as MMC3 irq, BUT latch values are "inverted" (XOR'ed |
| 3014 | with 0xff) and there is a little delay (not implemented yet) |
| 3015 | We simply use MMC3 IRQ and XOR the value written in the |
| 3016 | register 0xc000 below |
| 3017 | |
| 3018 | In MESS: Supported. |
| 3019 | |
| 3020 | *************************************************************/ |
| 3021 | |
| 3022 | static WRITE8_HANDLER( mapper48_w ) |
| 3023 | { |
| 3024 | LOG_MMC(("mapper48_w, offset: %04x, data: %02x\n", offset, data)); |
| 3025 | |
| 3026 | switch (offset & 0x6003) |
| 3027 | { |
| 3028 | case 0x0000: |
| 3029 | prg8_89(space->machine, data); |
| 3030 | break; |
| 3031 | case 0x0001: |
| 3032 | prg8_ab(space->machine, data); |
| 3033 | break; |
| 3034 | case 0x0002: |
| 3035 | chr2_0(space->machine, data, CHRROM); |
| 3036 | break; |
| 3037 | case 0x0003: |
| 3038 | chr2_2(space->machine, data, CHRROM); |
| 3039 | break; |
| 3040 | case 0x2000: |
| 3041 | chr1_4(space->machine, data, CHRROM); |
| 3042 | break; |
| 3043 | case 0x2001: |
| 3044 | chr1_5(space->machine, data, CHRROM); |
| 3045 | break; |
| 3046 | case 0x2002: |
| 3047 | chr1_6(space->machine, data, CHRROM); |
| 3048 | break; |
| 3049 | case 0x2003: |
| 3050 | chr1_7(space->machine, data, CHRROM); |
| 3051 | break; |
| 3052 | case 0x4000: |
| 3053 | IRQ_count_latch = (0x100 - data) & 0xff; |
| 3054 | break; |
| 3055 | case 0x4001: |
| 3056 | IRQ_count = IRQ_count_latch; |
| 3057 | break; |
| 3058 | case 0x4002: |
| 3059 | IRQ_enable = 1; |
| 3060 | break; |
| 3061 | case 0x4003: |
| 3062 | IRQ_enable = 0; |
| 3063 | break; |
| 3064 | case 0x6000: |
| 3065 | set_nt_mirroring((data & 0x40) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3066 | break; |
| 3067 | } |
| 3068 | } |
| 3069 | |
| 3070 | /************************************************************* |
| 3071 | |
| 3072 | Mapper 49 |
| 3073 | |
| 3074 | Known Boards: Unknown Multigame Bootleg Board |
| 3075 | Games: Super HIK 4 in 1 |
| 3076 | |
| 3077 | In MESS: Supported. It also uses mapper4_irq. |
| 3078 | |
| 3079 | *************************************************************/ |
| 3080 | |
| 3081 | static WRITE8_HANDLER( mapper49_m_w ) |
| 3082 | { |
| 3083 | LOG_MMC(("mapper49_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3084 | |
| 3085 | /* mid writes only work when WRAM is enabled. not sure if I should |
| 3086 | change the condition to mmc_cmd2==0x80 (i.e. what is the effect of |
| 3087 | the read-only bit?) */ |
| 3088 | if (mmc_cmd2 & 0x80) |
| 3089 | { |
| 3090 | if (data & 0x01) /* if this is 0, then we have 32k PRG blocks */ |
| 3091 | { |
| 3092 | mmc_prg_base = (data & 0xc0) >> 2; |
| 3093 | mmc_prg_mask = 0x0f; |
| 3094 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 3095 | } |
| 3096 | else |
| 3097 | prg32(space->machine, (data & 0x30) >> 4); |
| 3098 | |
| 3099 | mmc_chr_base = (data & 0xc0) << 1; |
| 3100 | mmc_chr_mask = 0x7f; |
| 3101 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 3102 | } |
| 3103 | } |
| 3104 | |
| 3105 | /************************************************************* |
| 3106 | |
| 3107 | Mapper 50 |
| 3108 | |
| 3109 | Known Boards: Unknown Bootleg Board |
| 3110 | Games: Super Mario Bros. 2 Pirate (Jpn version of SMB2) |
| 3111 | |
| 3112 | This was marked as Alt. Levels. is it true? |
| 3113 | |
| 3114 | In MESS: Supported. |
| 3115 | |
| 3116 | *************************************************************/ |
| 3117 | |
| 3118 | static void mapper50_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 3119 | { |
| 3120 | if (IRQ_enable) |
| 3121 | { |
| 3122 | if (IRQ_count < 0x1000) |
| 3123 | { |
| 3124 | if ((0x1000 - IRQ_count) <= 114) |
| 3125 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 3126 | else |
| 3127 | IRQ_count += 114; |
| 3128 | } |
| 3129 | else |
| 3130 | IRQ_count += 114; |
| 3131 | |
| 3132 | IRQ_count &= 0xffff; // according to docs is 16bit counter -> it wraps only after 0xffff |
| 3133 | } |
| 3134 | } |
| 3135 | |
| 3136 | static WRITE8_HANDLER( mapper50_l_w ) |
| 3137 | { |
| 3138 | UINT8 prg; |
| 3139 | LOG_MMC(("mapper50_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 3140 | offset += 0x100; |
| 3141 | |
| 3142 | switch (offset & 0x160) |
| 3143 | { |
| 3144 | case 0x020: |
| 3145 | prg = (data & 0x08) | ((data & 0x06) >> 1) | ((data & 0x01) << 2); |
| 3146 | prg8_cd(space->machine, prg); |
| 3147 | break; |
| 3148 | case 0x120: |
| 3149 | IRQ_enable = data & 0x01; |
| 3150 | break; |
| 3151 | } |
| 3152 | } |
| 3153 | |
| 3154 | /* This goes to 0x4020-0x403f */ |
| 3155 | WRITE8_HANDLER( mapper50_add_w ) |
| 3156 | { |
| 3157 | UINT8 prg; |
| 3158 | LOG_MMC(("mapper50_add_w, offset: %04x, data: %02x\n", offset, data)); |
| 3159 | |
| 3160 | prg = (data & 0x08) | ((data & 0x06) >> 1) | ((data & 0x01) << 2); |
| 3161 | prg8_cd(space->machine, prg); |
| 3162 | } |
| 3163 | |
| 3164 | /************************************************************* |
| 3165 | |
| 3166 | Mapper 51 |
| 3167 | |
| 3168 | Known Boards: Unknown Multigame Bootleg Board |
| 3169 | Games: 11 in 1 Ball Games |
| 3170 | |
| 3171 | In MESS: Partially Supported. |
| 3172 | |
| 3173 | *************************************************************/ |
| 3174 | |
| 3175 | static void mapper51_set_banks( running_machine *machine ) |
| 3176 | { |
| 3177 | set_nt_mirroring((mapper51_reg[0] == 3) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3178 | |
| 3179 | if (mapper51_reg[0] & 0x01) |
| 3180 | { |
| 3181 | prg32(machine, mapper51_reg[1]); |
| 3182 | } |
| 3183 | else |
| 3184 | { |
| 3185 | prg16_89ab(machine, (mapper51_reg[1] << 1) | (mapper51_reg[0] >> 1)); |
| 3186 | prg16_cdef(machine, (mapper51_reg[1] << 1) | 0x07); |
| 3187 | } |
| 3188 | } |
| 3189 | |
| 3190 | static WRITE8_HANDLER( mapper51_m_w ) |
| 3191 | { |
| 3192 | LOG_MMC(("mapper51_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3193 | |
| 3194 | mapper51_reg[0] = ((data >> 1) & 0x01) | ((data >> 3) & 0x02); |
| 3195 | mapper51_set_banks(space->machine); |
| 3196 | } |
| 3197 | |
| 3198 | static WRITE8_HANDLER( mapper51_w ) |
| 3199 | { |
| 3200 | LOG_MMC(("mapper51_w, offset: %04x, data: %02x\n", offset, data)); |
| 3201 | |
| 3202 | switch (offset & 0x6000) |
| 3203 | { |
| 3204 | case 0x4000: // here we also update reg[0] upper bit |
| 3205 | mapper51_reg[0] = (mapper51_reg[0] & 0x01) | ((data >> 3) & 0x02); |
| 3206 | case 0x0000: |
| 3207 | case 0x2000: |
| 3208 | case 0x6000: |
| 3209 | mapper51_reg[1] = data & 0x0f; |
| 3210 | mapper51_set_banks(space->machine); |
| 3211 | break; |
| 3212 | } |
| 3213 | } |
| 3214 | |
| 3215 | /************************************************************* |
| 3216 | |
| 3217 | Mapper 52 |
| 3218 | |
| 3219 | Known Boards: Unknown Multigame Bootleg Board |
| 3220 | Games: Mario 7 in 1 |
| 3221 | |
| 3222 | MMC3 clone |
| 3223 | |
| 3224 | In MESS: Supported. |
| 3225 | |
| 3226 | *************************************************************/ |
| 3227 | |
| 3228 | static WRITE8_HANDLER( mapper52_m_w ) |
| 3229 | { |
| 3230 | UINT8 map52_helper1, map52_helper2; |
| 3231 | LOG_MMC(("mapper52_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 3232 | |
| 3233 | /* mid writes only work when WRAM is enabled. not sure if I should |
| 3234 | change the condition to mmc_cmd2==0x80 (i.e. what is the effect of |
| 3235 | the read-only bit?) and it only can happen once! */ |
| 3236 | if ((mmc_cmd2 & 0x80) && !map52_reg_written) |
| 3237 | { |
| 3238 | map52_helper1 = (data & 0x08); |
| 3239 | map52_helper2 = (data & 0x40); |
| 3240 | |
| 3241 | mmc_prg_base = map52_helper1 ? ((data & 0x07) << 4) : ((data & 0x06) << 4); |
| 3242 | mmc_prg_mask = map52_helper1 ? 0x0f : 0x1f; |
| 3243 | mmc_chr_base = ((data & 0x20) << 4) | ((data & 0x04) << 6) | (map52_helper2 ? ((data & 0x10) << 3) : 0); |
| 3244 | mmc_chr_mask = map52_helper2 ? 0x7f : 0xff; |
| 3245 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 3246 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 3247 | |
| 3248 | map52_reg_written = 1; |
| 3249 | } |
| 3250 | else |
| 3251 | nes.wram[offset] = data; |
| 3252 | } |
| 3253 | |
| 3254 | /************************************************************* |
| 3255 | |
| 3256 | Mapper 53 |
| 3257 | |
| 3258 | Known Boards: Unknown Multigame Bootleg Board |
| 3259 | Games: Supervision 16 in 1 |
| 3260 | |
| 3261 | In MESS: Unsupported (SRAM banks can go in mid-regions). |
| 3262 | |
| 3263 | *************************************************************/ |
| 3264 | |
| 3265 | /************************************************************* |
| 3266 | |
| 3267 | Mapper 54 |
| 3268 | |
| 3269 | Known Boards: Unknown Multigame Bootleg Board |
| 3270 | Games: [no games in nes.hsi] |
| 3271 | |
| 3272 | In MESS: Unsupported. |
| 3273 | |
| 3274 | *************************************************************/ |
| 3275 | |
| 3276 | /************************************************************* |
| 3277 | |
| 3278 | Mapper 55 |
| 3279 | |
| 3280 | Known Boards: Unknown Bootleg Board |
| 3281 | Games: [no games in nes.hsi] |
| 3282 | |
| 3283 | In MESS: Unsupported. |
| 3284 | |
| 3285 | *************************************************************/ |
| 3286 | |
| 3287 | /************************************************************* |
| 3288 | |
| 3289 | Mapper 56 |
| 3290 | |
| 3291 | Known Boards: Bootleg Board by Kaiser (KS202) |
| 3292 | Games: Super Mario Bros. 3 Pirate |
| 3293 | |
| 3294 | In MESS: Unsupported. |
| 3295 | |
| 3296 | *************************************************************/ |
| 3297 | |
| 3298 | /************************************************************* |
| 3299 | |
| 3300 | Mapper 57 |
| 3301 | |
| 3302 | Known Boards: Unknown Multigame Bootleg Board |
| 3303 | Games: 6 in 1, 54 in 1, 106 in 1 |
| 3304 | |
| 3305 | In MESS: Supported. |
| 3306 | |
| 3307 | *************************************************************/ |
| 3308 | |
| 3309 | static WRITE8_HANDLER( mapper57_w ) |
| 3310 | { |
| 3311 | LOG_MMC(("mapper57_w, offset: %04x, data: %02x\n", offset, data)); |
| 3312 | |
| 3313 | if (offset & 0x0800) |
| 3314 | { |
| 3315 | mmc_cmd2 = data; |
| 3316 | } |
| 3317 | else |
| 3318 | { |
| 3319 | mmc_cmd1 = data; |
| 3320 | } |
| 3321 | |
| 3322 | if (mmc_cmd2 & 0x80) |
| 3323 | { |
| 3324 | prg32(space->machine, 2 | (mmc_cmd2 >> 6)); |
| 3325 | } |
| 3326 | else |
| 3327 | { |
| 3328 | prg16_89ab(space->machine, (mmc_cmd2 >> 5) & 0x03); |
| 3329 | prg16_cdef(space->machine, (mmc_cmd2 >> 5) & 0x03); |
| 3330 | } |
| 3331 | |
| 3332 | set_nt_mirroring((mmc_cmd2 & 0x08) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3333 | |
| 3334 | chr8(space->machine, (mmc_cmd1 & 0x03) | (mmc_cmd2 & 0x07) | ((mmc_cmd2 & 0x10) >> 1), CHRROM); |
| 3335 | } |
| 3336 | |
| 3337 | /************************************************************* |
| 3338 | |
| 3339 | Mapper 58 |
| 3340 | |
| 3341 | Known Boards: Unknown Multigame Bootleg Board |
| 3342 | Games: 68 in 1, 73 in 1, 98 in 1 |
| 3343 | |
| 3344 | In MESS: Supported. |
| 3345 | |
| 3346 | *************************************************************/ |
| 3347 | |
| 3348 | static WRITE8_HANDLER( mapper58_w ) |
| 3349 | { |
| 3350 | UINT8 bank = (offset & 0x40) ? 0 : 1; |
| 3351 | LOG_MMC(("mapper58_w, offset: %04x, data: %02x\n", offset, data)); |
| 3352 | |
| 3353 | prg16_89ab(space->machine, offset & ~bank); |
| 3354 | prg16_cdef(space->machine, offset | bank); |
| 3355 | chr8(space->machine, offset >> 3, CHRROM); |
| 3356 | set_nt_mirroring((data & 0x80) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3357 | } |
| 3358 | |
| 3359 | /************************************************************* |
| 3360 | |
| 3361 | Mapper 59 |
| 3362 | |
| 3363 | Known Boards: Undocumented / Unused ?!? |
| 3364 | Games: ---------- |
| 3365 | |
| 3366 | In MESS: ---------- |
| 3367 | |
| 3368 | *************************************************************/ |
| 3369 | |
| 3370 | /************************************************************* |
| 3371 | |
| 3372 | Mapper 60 |
| 3373 | |
| 3374 | Known Boards: Unknown Multigame Bootleg Board |
| 3375 | Games: 4 in 1, 35 in 1 |
| 3376 | |
| 3377 | In MESS: Unsupported (these are reset-based and have dips). |
| 3378 | |
| 3379 | *************************************************************/ |
| 3380 | |
| 3381 | /************************************************************* |
| 3382 | |
| 3383 | Mapper 61 |
| 3384 | |
| 3385 | Known Boards: Bootleg Board by RCM |
| 3386 | Games: Tetris Family 9 in 1, 20 in 1 |
| 3387 | |
| 3388 | Simple Mapper: prg/chr/nt are swapped depending on the offset |
| 3389 | of writes in 0x8000-0xffff. offset&0x80 set NT mirroring, |
| 3390 | when (offset&0x30) is 0,3 prg32 is set; when it is 1,2 |
| 3391 | two 16k prg banks are set. See below for the values used in |
| 3392 | these banks. |
| 3393 | |
| 3394 | In MESS: Supported. |
| 3395 | |
| 3396 | *************************************************************/ |
| 3397 | |
| 3398 | static WRITE8_HANDLER( mapper61_w ) |
| 3399 | { |
| 3400 | LOG_MMC(("mapper61_w, offset: %04x, data: %02x\n", offset, data)); |
| 3401 | |
| 3402 | switch (offset & 0x30) |
| 3403 | { |
| 3404 | case 0x00: |
| 3405 | case 0x30: |
| 3406 | prg32(space->machine, offset & 0x0f); |
| 3407 | break; |
| 3408 | case 0x10: |
| 3409 | case 0x20: |
| 3410 | prg16_89ab(space->machine, ((offset & 0x0f) << 1) | ((offset & 0x20) >> 4)); |
| 3411 | prg16_cdef(space->machine, ((offset & 0x0f) << 1) | ((offset & 0x20) >> 4)); |
| 3412 | break; |
| 3413 | } |
| 3414 | set_nt_mirroring((offset & 0x80) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3415 | } |
| 3416 | |
| 3417 | /************************************************************* |
| 3418 | |
| 3419 | Mapper 62 |
| 3420 | |
| 3421 | Known Boards: Unknown Multigame Bootleg Board |
| 3422 | Games: Super 700 in 1 |
| 3423 | |
| 3424 | In MESS: Supported. |
| 3425 | |
| 3426 | *************************************************************/ |
| 3427 | |
| 3428 | static WRITE8_HANDLER( mapper62_w ) |
| 3429 | { |
| 3430 | LOG_MMC(("mapper62_w, offset :%04x, data: %02x\n", offset, data)); |
| 3431 | |
| 3432 | chr8(space->machine, ((offset & 0x1f) << 2) | (data & 0x03), CHRROM); |
| 3433 | |
| 3434 | if (offset & 0x20) |
| 3435 | { |
| 3436 | prg16_89ab(space->machine, (offset & 0x40) | ((offset >> 8) & 0x3f)); |
| 3437 | prg16_cdef(space->machine, (offset & 0x40) | ((offset >> 8) & 0x3f)); |
| 3438 | } |
| 3439 | else |
| 3440 | { |
| 3441 | prg32(space->machine, ((offset & 0x40) | ((offset >> 8) & 0x3f)) >> 1); |
| 3442 | } |
| 3443 | |
| 3444 | set_nt_mirroring((offset & 0x80) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3445 | } |
| 3446 | |
| 3447 | /************************************************************* |
| 3448 | |
| 3449 | Mapper 63 |
| 3450 | |
| 3451 | Known Boards: Unknown Multigame Bootleg Board |
| 3452 | Games: [no games in nes.hsi] |
| 3453 | |
| 3454 | In MESS: Unsupported. |
| 3455 | |
| 3456 | *************************************************************/ |
| 3457 | |
| 3458 | /************************************************************* |
| 3459 | |
| 3460 | Mapper 64 |
| 3461 | |
| 3462 | Known Boards: Tengen 800032 |
| 3463 | Games: Klax, Road Runner, Rolling Thunder, Shinobi, Skulls |
| 3464 | & Croosbones, Xybots |
| 3465 | |
| 3466 | In MESS: Partially Supported. It also uses mapper4_irq. |
| 3467 | |
| 3468 | *************************************************************/ |
| 3469 | |
| 3470 | static void mapper64_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 3471 | { |
| 3472 | if (!IRQ_mode) // we are in scanline mode! |
| 3473 | { |
| 3474 | if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE) |
| 3475 | { |
| 3476 | if (!IRQ_reset) |
| 3477 | { |
| 3478 | if (!IRQ_count) |
| 3479 | IRQ_count = IRQ_count_latch; |
| 3480 | else |
| 3481 | { |
| 3482 | IRQ_count--; |
| 3483 | if (IRQ_enable && !blanked && !IRQ_count) |
| 3484 | { |
| 3485 | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, |
| 3486 | video_screen_get_vpos(device->machine->primary_screen), video_screen_get_hpos(device->machine->primary_screen))); |
| 3487 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 3488 | } |
| 3489 | } |
| 3490 | } |
| 3491 | else |
| 3492 | { |
| 3493 | IRQ_reset = 0; |
| 3494 | IRQ_count = IRQ_count_latch + 1; |
| 3495 | } |
| 3496 | } |
| 3497 | } |
| 3498 | /* otherwise, we are in CPU cycles mode --> decrement count of 114 every scanline |
| 3499 | --> in the meanwhile anything can have happened to IRQ_reset and we would not know |
| 3500 | --> Skulls and Crossbones does not show anything!! */ |
| 3501 | else |
| 3502 | { |
| 3503 | // if (!IRQ_reset) |
| 3504 | { |
| 3505 | if (IRQ_count <= 114) |
| 3506 | IRQ_count = IRQ_count_latch; |
| 3507 | else |
| 3508 | { |
| 3509 | IRQ_count -= 114; |
| 3510 | if (IRQ_enable && !blanked && (IRQ_count <= 114)) |
| 3511 | { |
| 3512 | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, |
| 3513 | video_screen_get_vpos(device->machine->primary_screen), video_screen_get_hpos(device->machine->primary_screen))); |
| 3514 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 3515 | } |
| 3516 | } |
| 3517 | } |
| 3518 | // else |
| 3519 | // { |
| 3520 | // IRQ_reset = 0; |
| 3521 | // IRQ_count = IRQ_count_latch + 1; |
| 3522 | // } |
| 3523 | } |
| 3524 | } |
| 3525 | |
| 3526 | static void mapper64_set_prg( running_machine *machine ) |
| 3527 | { |
| 3528 | UINT8 prg_mode = mmc_cmd1 & 0x40; |
| 3529 | |
| 3530 | prg8_89(machine, prg_bank[prg_mode ? 2: 0]); |
| 3531 | prg8_ab(machine, prg_bank[prg_mode ? 0: 1]); |
| 3532 | prg8_cd(machine, prg_bank[prg_mode ? 1: 2]); |
| 3533 | } |
| 3534 | |
| 3535 | static void mapper64_set_chr( running_machine *machine ) |
| 3536 | { |
| 3537 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 3538 | |
| 3539 | if (mmc_cmd1 & 0x20) |
| 3540 | { |
| 3541 | chr1_x(machine, 0 ^ chr_page, vrom_bank[0], CHRROM); |
| 3542 | chr1_x(machine, 1 ^ chr_page, vrom_bank[8], CHRROM); |
| 3543 | chr1_x(machine, 2 ^ chr_page, vrom_bank[1], CHRROM); |
| 3544 | chr1_x(machine, 3 ^ chr_page, vrom_bank[9], CHRROM); |
| 3545 | } |
| 3546 | else |
| 3547 | { |
| 3548 | chr1_x(machine, 0 ^ chr_page, vrom_bank[0] & ~0x01, CHRROM); |
| 3549 | chr1_x(machine, 1 ^ chr_page, vrom_bank[0] | 0x01, CHRROM); |
| 3550 | chr1_x(machine, 2 ^ chr_page, vrom_bank[1] & ~0x01, CHRROM); |
| 3551 | chr1_x(machine, 3 ^ chr_page, vrom_bank[1] | 0x01, CHRROM); |
| 3552 | } |
| 3553 | |
| 3554 | chr1_x(machine, 4 ^ chr_page, vrom_bank[2], CHRROM); |
| 3555 | chr1_x(machine, 5 ^ chr_page, vrom_bank[3], CHRROM); |
| 3556 | chr1_x(machine, 6 ^ chr_page, vrom_bank[4], CHRROM); |
| 3557 | chr1_x(machine, 7 ^ chr_page, vrom_bank[5], CHRROM); |
| 3558 | } |
| 3559 | |
| 3560 | static WRITE8_HANDLER( mapper64_w ) |
| 3561 | { |
| 3562 | UINT8 map64_helper, cmd; |
| 3563 | LOG_MMC(("mapper64_w offset: %04x, data: %02x\n", offset, data)); |
| 3564 | |
| 3565 | switch (offset & 0x6001) |
| 3566 | { |
| 3567 | case 0x0000: |
| 3568 | map64_helper = mmc_cmd1 ^ data; |
| 3569 | mmc_cmd1 = data; |
| 3570 | |
| 3571 | /* Has PRG Mode changed? */ |
| 3572 | if (map64_helper & 0x40) |
| 3573 | mapper64_set_prg(space->machine); |
| 3574 | |
| 3575 | /* Has CHR Mode changed? */ |
| 3576 | if (map64_helper & 0xa0) |
| 3577 | mapper64_set_chr(space->machine); |
| 3578 | break; |
| 3579 | |
| 3580 | case 0x0001: |
| 3581 | cmd = mmc_cmd1 & 0x0f; |
| 3582 | switch (cmd) |
| 3583 | { |
| 3584 | case 0: case 1: |
| 3585 | case 2: case 3: |
| 3586 | case 4: case 5: |
| 3587 | vrom_bank[cmd] = data; |
| 3588 | mapper64_set_chr(space->machine); |
| 3589 | break; |
| 3590 | case 6: case 7: |
| 3591 | prg_bank[cmd - 6] = data; |
| 3592 | mapper64_set_prg(space->machine); |
| 3593 | break; |
| 3594 | case 8: case 9: |
| 3595 | vrom_bank[cmd - 2] = data; |
| 3596 | mapper64_set_chr(space->machine); |
| 3597 | break; |
| 3598 | case 0x0f: |
| 3599 | prg_bank[2] = data; |
| 3600 | mapper64_set_prg(space->machine); |
| 3601 | break; |
| 3602 | } |
| 3603 | break; |
| 3604 | |
| 3605 | case 0x2000: |
| 3606 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3607 | break; |
| 3608 | |
| 3609 | case 0x4000: |
| 3610 | IRQ_count_latch = data; |
| 3611 | break; |
| 3612 | |
| 3613 | case 0x4001: /* $c001 - IRQ scanline latch */ |
| 3614 | IRQ_mode = data & 0x01; |
| 3615 | IRQ_reset = 1; |
| 3616 | break; |
| 3617 | |
| 3618 | case 0x6000: |
| 3619 | IRQ_enable = 0; |
| 3620 | break; |
| 3621 | |
| 3622 | case 0x6001: |
| 3623 | IRQ_enable = 1; |
| 3624 | break; |
| 3625 | |
| 3626 | default: |
| 3627 | LOG_MMC(("Mapper 64 write. addr: %04x value: %02x\n", offset + 0x8000, data)); |
| 3628 | break; |
| 3629 | } |
| 3630 | } |
| 3631 | |
| 3632 | /************************************************************* |
| 3633 | |
| 3634 | Mapper 65 |
| 3635 | |
| 3636 | Known Boards: Irem H3001 |
| 3637 | Games: Daiku no Gen San 2 - Akage no Dan no Gyakushuu, |
| 3638 | Kaiketsu Yanchamaru 3, Spartan X 2 |
| 3639 | |
| 3640 | In MESS: Supported. |
| 3641 | |
| 3642 | *************************************************************/ |
| 3643 | |
| 3644 | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 3645 | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 3646 | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 3647 | static void irem_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 3648 | { |
| 3649 | if (IRQ_enable) |
| 3650 | { |
| 3651 | IRQ_count -= 114; |
| 3652 | |
| 3653 | if (IRQ_count <= 114) |
| 3654 | { |
| 3655 | IRQ_enable = 0; |
| 3656 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 3657 | } |
| 3658 | } |
| 3659 | } |
| 3660 | |
| 3661 | static WRITE8_HANDLER( mapper65_w ) |
| 3662 | { |
| 3663 | LOG_MMC(("mapper65_w, offset %04x, data: %02x\n", offset, data)); |
| 3664 | |
| 3665 | switch (offset & 0x7fff) |
| 3666 | { |
| 3667 | case 0x0000: |
| 3668 | prg8_89(space->machine, data); |
| 3669 | break; |
| 3670 | |
| 3671 | case 0x1001: |
| 3672 | set_nt_mirroring((data & 0x80) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 3673 | break; |
| 3674 | |
| 3675 | case 0x1003: |
| 3676 | IRQ_enable = data & 0x80; |
| 3677 | break; |
| 3678 | |
| 3679 | case 0x1004: |
| 3680 | IRQ_count = IRQ_count_latch; |
| 3681 | break; |
| 3682 | |
| 3683 | case 0x1005: |
| 3684 | IRQ_count_latch = (IRQ_count_latch & 0x00ff) | (data << 8); |
| 3685 | break; |
| 3686 | |
| 3687 | case 0x1006: |
| 3688 | IRQ_count_latch = (IRQ_count_latch & 0xff00) | data; |
| 3689 | break; |
| 3690 | |
| 3691 | case 0x2000: |
| 3692 | prg8_ab(space->machine, data); |
| 3693 | break; |
| 3694 | |
| 3695 | case 0x3000: |
| 3696 | case 0x3001: |
| 3697 | case 0x3002: |
| 3698 | case 0x3003: |
| 3699 | case 0x3004: |
| 3700 | case 0x3005: |
| 3701 | case 0x3006: |
| 3702 | case 0x3007: |
| 3703 | chr1_x(space->machine, offset & 0x07, data, CHRROM); |
| 3704 | break; |
| 3705 | |
| 3706 | case 0x4000: |
| 3707 | prg8_cd(space->machine, data); |
| 3708 | break; |
| 3709 | |
| 3710 | default: |
| 3711 | break; |
| 3712 | } |
| 3713 | } |
| 3714 | |
| 3715 | /************************************************************* |
| 3716 | |
| 3717 | Mapper 66 |
| 3718 | |
| 3719 | Known Boards: GNROM, GXROM, MHROM |
| 3720 | Games: Mobile Suit Z Gundam, Paris-Dakar Rally Special, |
| 3721 | Takahashi Meijin no Bugutte Honey |
| 3722 | |
| 3723 | In MESS: Supported. |
| 3724 | |
| 3725 | *************************************************************/ |
| 3726 | |
| 3727 | static WRITE8_HANDLER( mapper66_w ) |
| 3728 | { |
| 3729 | LOG_MMC(("mapper66_w, offset %04x, data: %02x\n", offset, data)); |
| 3730 | |
| 3731 | prg32(space->machine, (data & 0x30) >> 4); |
| 3732 | chr8(space->machine, data & 0x03, CHRROM); |
| 3733 | } |
| 3734 | |
| 3735 | /************************************************************* |
| 3736 | |
| 3737 | Mapper 67 |
| 3738 | |
| 3739 | Known Boards: Sunsoft 3 |
| 3740 | Games: Fantasy Zone 2, Mito Koumon |
| 3741 | |
| 3742 | In MESS: Supported. |
| 3743 | |
| 3744 | *************************************************************/ |
| 3745 | |
| 3746 | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 3747 | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 3748 | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 3749 | static void mapper67_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 3750 | { |
| 3751 | /* TODO: change to reflect the actual number of cycles spent: both using 114 or cycling 114,114,113 |
| 3752 | produces a 1-line glitch in Fantasy Zone 2: it really requires the counter to be updated each CPU cycle! */ |
| 3753 | if (IRQ_enable) |
| 3754 | { |
| 3755 | if (IRQ_count <= 114) |
| 3756 | { |
| 3757 | IRQ_enable = 0; |
| 3758 | IRQ_count = 0xffff; |
| 3759 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 3760 | } |
| 3761 | else |
| 3762 | IRQ_count -= 114; |
| 3763 | } |
| 3764 | } |
| 3765 | |
| 3766 | static WRITE8_HANDLER( mapper67_w ) |
| 3767 | { |
| 3768 | LOG_MMC(("mapper67_w, offset %04x, data: %02x\n", offset, data)); |
| 3769 | switch (offset & 0x7800) |
| 3770 | { |
| 3771 | case 0x0800: |
| 3772 | chr2_0(space->machine, data, CHRROM); |
| 3773 | break; |
| 3774 | case 0x1800: |
| 3775 | chr2_2(space->machine, data, CHRROM); |
| 3776 | break; |
| 3777 | case 0x2800: |
| 3778 | chr2_4(space->machine, data, CHRROM); |
| 3779 | break; |
| 3780 | case 0x3800: |
| 3781 | chr2_6(space->machine, data, CHRROM); |
| 3782 | break; |
| 3783 | case 0x4000: |
| 3784 | case 0x4800: |
| 3785 | IRQ_toggle ^= 1; |
| 3786 | if (IRQ_toggle) |
| 3787 | IRQ_count = (IRQ_count & 0x00ff) | (data << 8); |
| 3788 | else |
| 3789 | IRQ_count = (IRQ_count & 0xff00) | data; |
| 3790 | break; |
| 3791 | case 0x5800: |
| 3792 | IRQ_enable = data & 0x10; |
| 3793 | IRQ_toggle = 0; |
| 3794 | break; |
| 3795 | case 0x6800: |
| 3796 | switch (data & 3) |
| 3797 | { |
| 3798 | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 3799 | case 0x01: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 3800 | case 0x02: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 3801 | case 0x03: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 3802 | } |
| 3803 | break; |
| 3804 | case 0x7800: |
| 3805 | prg16_89ab(space->machine, data); |
| 3806 | break; |
| 3807 | default: |
| 3808 | LOG_MMC(("mapper67_w uncaught offset: %04x, data: %02x\n", offset, data)); |
| 3809 | break; |
| 3810 | } |
| 3811 | } |
| 3812 | |
| 3813 | /************************************************************* |
| 3814 | |
| 3815 | Mapper 68 |
| 3816 | |
| 3817 | Known Boards: Sunsoft 4, Sunsoft with DCS, NTBROM, Tengen 800042 |
| 3818 | Games: After Burner, After Burner II, Maharaja |
| 3819 | |
| 3820 | In MESS: Supported. |
| 3821 | |
| 3822 | *************************************************************/ |
| 3823 | |
| 3824 | static void mapper68_mirror( running_machine *machine, int m68_mirror, int m0, int m1 ) |
| 3825 | { |
| 3826 | switch (m68_mirror) |
| 3827 | { |
| 3828 | case 0x00: |
| 3829 | set_nt_mirroring(PPU_MIRROR_HORZ); |
| 3830 | break; |
| 3831 | case 0x01: |
| 3832 | set_nt_mirroring(PPU_MIRROR_VERT); |
| 3833 | break; |
| 3834 | case 0x02: |
| 3835 | set_nt_mirroring(PPU_MIRROR_LOW); |
| 3836 | break; |
| 3837 | case 0x03: |
| 3838 | set_nt_mirroring(PPU_MIRROR_HIGH); |
| 3839 | break; |
| 3840 | case 0x10: |
| 3841 | set_nt_page(0, ROM, m0 | 0x80, 0); |
| 3842 | set_nt_page(1, ROM, m1 | 0x80, 0); |
| 3843 | set_nt_page(2, ROM, m0 | 0x80, 0); |
| 3844 | set_nt_page(3, ROM, m1 | 0x80, 0); |
| 3845 | break; |
| 3846 | case 0x11: |
| 3847 | set_nt_page(0, ROM, m0 | 0x80, 0); |
| 3848 | set_nt_page(1, ROM, m0 | 0x80, 0); |
| 3849 | set_nt_page(2, ROM, m1 | 0x80, 0); |
| 3850 | set_nt_page(3, ROM, m1 | 0x80, 0); |
| 3851 | break; |
| 3852 | case 0x12: |
| 3853 | set_nt_page(0, ROM, m0 | 0x80, 0); |
| 3854 | set_nt_page(1, ROM, m0 | 0x80, 0); |
| 3855 | set_nt_page(2, ROM, m0 | 0x80, 0); |
| 3856 | set_nt_page(3, ROM, m0 | 0x80, 0); |
| 3857 | break; |
| 3858 | case 0x13: |
| 3859 | set_nt_page(0, ROM, m1 | 0x80, 0); |
| 3860 | set_nt_page(1, ROM, m1 | 0x80, 0); |
| 3861 | set_nt_page(2, ROM, m1 | 0x80, 0); |
| 3862 | set_nt_page(3, ROM, m1 | 0x80, 0); |
| 3863 | break; |
| 3864 | } |
| 3865 | } |
| 3866 | |
| 3867 | static WRITE8_HANDLER( mapper68_w ) |
| 3868 | { |
| 3869 | LOG_MMC(("mapper68_w, offset %04x, data: %02x\n", offset, data)); |
| 3870 | |
| 3871 | switch (offset & 0x7000) |
| 3872 | { |
| 3873 | case 0x0000: |
| 3874 | chr2_0(space->machine, data, CHRROM); |
| 3875 | break; |
| 3876 | case 0x1000: |
| 3877 | chr2_2(space->machine, data, CHRROM); |
| 3878 | break; |
| 3879 | case 0x2000: |
| 3880 | chr2_4(space->machine, data, CHRROM); |
| 3881 | break; |
| 3882 | case 0x3000: |
| 3883 | chr2_6(space->machine, data, CHRROM); |
| 3884 | break; |
| 3885 | case 0x4000: |
| 3886 | m0 = data & 0x7f; |
| 3887 | mapper68_mirror(space->machine, m68_mirror, m0, m1); |
| 3888 | break; |
| 3889 | case 0x5000: |
| 3890 | m1 = data & 0x7f; |
| 3891 | mapper68_mirror(space->machine, m68_mirror, m0, m1); |
| 3892 | break; |
| 3893 | case 0x6000: |
| 3894 | m68_mirror = data & 0x13; |
| 3895 | mapper68_mirror(space->machine, m68_mirror, m0, m1); |
| 3896 | break; |
| 3897 | case 0x7000: |
| 3898 | prg16_89ab(space->machine, data); |
| 3899 | break; |
| 3900 | default: |
| 3901 | LOG_MMC(("mapper68_w uncaught offset: %04x, data: %02x\n", offset, data)); |
| 3902 | break; |
| 3903 | } |
| 3904 | } |
| 3905 | |
| 3906 | /************************************************************* |
| 3907 | |
| 3908 | Mapper 69 |
| 3909 | |
| 3910 | Known Boards: JLROM, JSROM, Sunsoft 5B, Sunsoft FME7 and |
| 3911 | Custom |
| 3912 | Games: Barcode World, Batman - Return of the Joker, Gimmick! |
| 3913 | |
| 3914 | In MESS: Supported. |
| 3915 | |
| 3916 | *************************************************************/ |
| 3917 | |
| 3918 | /* Here, IRQ counter decrements every CPU cycle. Since we update it every scanline, |
| 3919 | we need to decrement it by 114 (Each scanline consists of 341 dots and, on NTSC, |
| 3920 | there are 3 dots to every 1 CPU cycle, hence 114 is the number of cycles per scanline ) */ |
| 3921 | static void mapper69_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 3922 | { |
| 3923 | /* TODO: change to reflect the actual number of cycles spent */ |
| 3924 | if ((IRQ_enable & 0x80) && (IRQ_enable & 0x01)) |
| 3925 | { |
| 3926 | if (IRQ_count <= 114) |
| 3927 | { |
| 3928 | IRQ_count = 0xffff; |
| 3929 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 3930 | } |
| 3931 | else |
| 3932 | IRQ_count -= 114; |
| 3933 | } |
| 3934 | else if (IRQ_enable & 0x01) // if enable bit is not set, only decrement the counter! |
| 3935 | { |
| 3936 | if (IRQ_count <= 114) |
| 3937 | IRQ_count = 0xffff; |
| 3938 | else |
| 3939 | IRQ_count -= 114; |
| 3940 | } |
| 3941 | } |
| 3942 | |
| 3943 | static WRITE8_HANDLER( mapper69_w ) |
| 3944 | { |
| 3945 | LOG_MMC(("mapper69_w, offset %04x, data: %02x\n", offset, data)); |
| 3946 | |
| 3947 | switch (offset & 0x6000) |
| 3948 | { |
| 3949 | case 0x0000: |
| 3950 | mmc_cmd1 = data & 0x0f; |
| 3951 | break; |
| 3952 | |
| 3953 | case 0x2000: |
| 3954 | switch (mmc_cmd1) |
| 3955 | { |
| 3956 | case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: |
| 3957 | chr1_x(space->machine, mmc_cmd1, data, CHRROM); |
| 3958 | break; |
| 3959 | |
| 3960 | /* TODO: deal properly with bankswitching/write-protecting the mid-mapper area */ |
| 3961 | case 8: |
| 3962 | if (!(data & 0x40)) |
| 3963 | prg8_67(space->machine, data & 0x3f); |
| 3964 | else if (data & 0x80) |
| 3965 | memory_set_bankptr(space->machine, 5, &nes.wram[(data & 0x3f) * 0x2000]); |
| 3966 | break; |
| 3967 | |
| 3968 | case 9: |
| 3969 | prg8_89(space->machine, data); |
| 3970 | break; |
| 3971 | case 0x0a: |
| 3972 | prg8_ab(space->machine, data); |
| 3973 | break; |
| 3974 | case 0x0b: |
| 3975 | prg8_cd(space->machine, data); |
| 3976 | break; |
| 3977 | case 0x0c: |
| 3978 | switch (data & 0x03) |
| 3979 | { |
| 3980 | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 3981 | case 0x01: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 3982 | case 0x02: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 3983 | case 0x03: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 3984 | } |
| 3985 | break; |
| 3986 | case 0x0d: |
| 3987 | IRQ_enable = data; |
| 3988 | break; |
| 3989 | case 0x0e: |
| 3990 | IRQ_count = (IRQ_count & 0xff00) | data; |
| 3991 | break; |
| 3992 | case 0x0f: |
| 3993 | IRQ_count = (IRQ_count & 0x00ff) | (data << 8); |
| 3994 | break; |
| 3995 | } |
| 3996 | break; |
| 3997 | |
| 3998 | /* Here we would have sound command for Sunsoft 5b variant */ |
| 3999 | // case 0x4000: |
| 4000 | // case 0x6000: |
| 4001 | |
| 4002 | default: |
| 4003 | logerror("mapper69_w uncaught %04x value: %02x\n", offset + 0x8000, data); |
| 4004 | break; |
| 4005 | } |
| 4006 | } |
| 4007 | |
| 4008 | /************************************************************* |
| 4009 | |
| 4010 | Mapper 70 |
| 4011 | |
| 4012 | Known Boards: Discrete Logic Board |
| 4013 | Games: Space Shadow, Family Trainer Manhattan Police, |
| 4014 | Kamen Rider Club |
| 4015 | |
| 4016 | Same board as mapper 152, but no NT mirroring |
| 4017 | |
| 4018 | In MESS: Supported. |
| 4019 | |
| 4020 | *************************************************************/ |
| 4021 | |
| 4022 | |
| 4023 | static WRITE8_HANDLER( mapper70_w ) |
| 4024 | { |
| 4025 | LOG_MMC(("mapper70_w, offset: %04x, data: %02x\n", offset, data)); |
| 4026 | |
| 4027 | // we lack bus emulation |
| 4028 | prg16_89ab(space->machine, (data >> 4) & 0x07); |
| 4029 | chr8(space->machine, data, CHRROM); |
| 4030 | } |
| 4031 | |
| 4032 | /************************************************************* |
| 4033 | |
| 4034 | Mapper 71 |
| 4035 | |
| 4036 | Known Boards: Camerica Boards (BF9093, BF9097, BF909X, ALGNV11) |
| 4037 | Games: Linus Spacehead's Cosmic Crusade, Micro Machines, |
| 4038 | Mig-29, Stunt Kids |
| 4039 | |
| 4040 | We currently do not emulate NT mirroring for BF9097 board |
| 4041 | (missing in BF9093). As a result Fire Hawk is broken. |
| 4042 | |
| 4043 | In MESS: Partially Supported. |
| 4044 | |
| 4045 | *************************************************************/ |
| 4046 | |
| 4047 | static WRITE8_HANDLER( mapper71_w ) |
| 4048 | { |
| 4049 | LOG_MMC(("mapper71_w offset: %04x, data: %02x\n", offset, data)); |
| 4050 | |
| 4051 | switch (offset & 0x7000) |
| 4052 | { |
| 4053 | case 0x0000: |
| 4054 | case 0x1000: |
| 4055 | if (nes.crc_hack) |
| 4056 | set_nt_mirroring((data & 0x10) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 4057 | break; |
| 4058 | case 0x4000: |
| 4059 | case 0x5000: |
| 4060 | case 0x6000: |
| 4061 | case 0x7000: |
| 4062 | prg16_89ab(space->machine, data); |
| 4063 | break; |
| 4064 | } |
| 4065 | } |
| 4066 | |
| 4067 | /************************************************************* |
| 4068 | |
| 4069 | Mapper 72 |
| 4070 | |
| 4071 | Known Boards: Jaleco JF17, JF26 and JF28 |
| 4072 | Games: Moero!! Juudou Warriors, Moero!! Pro Tennis, Pinball |
| 4073 | Quest Jpn |
| 4074 | |
| 4075 | In MESS: Supported. |
| 4076 | |
| 4077 | *************************************************************/ |
| 4078 | |
| 4079 | static WRITE8_HANDLER( mapper72_w ) |
| 4080 | { |
| 4081 | LOG_MMC(("mapper72_w, offset %04x, data: %02x\n", offset, data)); |
| 4082 | |
| 4083 | if (data & 0x80) |
| 4084 | prg16_89ab(space->machine, data & 0x0f); |
| 4085 | if (data & 0x40) |
| 4086 | chr8(space->machine, data & 0x0f, CHRROM); |
| 4087 | |
| 4088 | } |
| 4089 | |
| 4090 | /************************************************************* |
| 4091 | |
| 4092 | Mapper 73 |
| 4093 | |
| 4094 | Known Boards: Konami VRC3 |
| 4095 | Games: Salamander |
| 4096 | |
| 4097 | In MESS: Supported. It also uses konami_irq. |
| 4098 | |
| 4099 | *************************************************************/ |
| 4100 | |
| 4101 | static WRITE8_HANDLER( mapper73_w ) |
| 4102 | { |
| 4103 | switch (offset & 0x7000) |
| 4104 | { |
| 4105 | case 0x0000: |
| 4106 | case 0x1000: |
| 4107 | /* dunno which address controls these */ |
| 4108 | IRQ_count_latch = data; |
| 4109 | IRQ_enable_latch = data; |
| 4110 | break; |
| 4111 | case 0x2000: |
| 4112 | IRQ_enable = data; |
| 4113 | break; |
| 4114 | case 0x3000: |
| 4115 | IRQ_count &= ~0x0f; |
| 4116 | IRQ_count |= data & 0x0f; |
| 4117 | break; |
| 4118 | case 0x4000: |
| 4119 | IRQ_count &= ~0xf0; |
| 4120 | IRQ_count |= (data & 0x0f) << 4; |
| 4121 | break; |
| 4122 | case 0x7000: |
| 4123 | prg16_89ab(space->machine, data); |
| 4124 | break; |
| 4125 | default: |
| 4126 | logerror("mapper73_w uncaught, offset %04x, data: %02x\n", offset, data); |
| 4127 | break; |
| 4128 | } |
| 4129 | } |
| 4130 | |
| 4131 | |
| 4132 | /************************************************************* |
| 4133 | |
| 4134 | Mapper 74 |
| 4135 | |
| 4136 | Known Boards: Type A by Waixing |
| 4137 | Games: Columbus - Ougon no Yoake (C), Ji Jia Zhan Shi, |
| 4138 | Jia A Fung Yun, Wei Luo Chuan Qi |
| 4139 | |
| 4140 | This mapper is quite similar to MMC3, but with two differences: |
| 4141 | mirroring is not the same, and when VROM banks 8,9 are accessed |
| 4142 | they point to CHRRAM and not CHRROM. |
| 4143 | |
| 4144 | In MESS: Supported |
| 4145 | |
| 4146 | *************************************************************/ |
| 4147 | |
| 4148 | /* MIRROR_LOW and MIRROR_HIGH are swapped! */ |
| 4149 | static void waixing_set_mirror( UINT8 nt ) |
| 4150 | { |
| 4151 | switch (nt) |
| 4152 | { |
| 4153 | case 0: |
| 4154 | case 1: |
| 4155 | set_nt_mirroring(nt ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4156 | break; |
| 4157 | case 2: |
| 4158 | set_nt_mirroring(PPU_MIRROR_LOW); |
| 4159 | break; |
| 4160 | case 3: |
| 4161 | set_nt_mirroring(PPU_MIRROR_HIGH); |
| 4162 | break; |
| 4163 | default: |
| 4164 | LOG_MMC(("Mapper set NT to invalid value %02x", nt)); |
| 4165 | break; |
| 4166 | } |
| 4167 | } |
| 4168 | |
| 4169 | static void mapper74_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 4170 | { |
| 4171 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 4172 | UINT8 chr_src[6]; |
| 4173 | int i; |
| 4174 | |
| 4175 | for (i = 0; i < 6; i++) |
| 4176 | chr_src[i] = ((vrom_bank[i] == 8) || (vrom_bank[i] == 9)) ? CHRRAM : CHRROM; |
| 4177 | |
| 4178 | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 4179 | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 4180 | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| 4181 | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr_src[1]); |
| 4182 | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr_src[2]); |
| 4183 | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr_src[3]); |
| 4184 | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr_src[4]); |
| 4185 | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr_src[5]); |
| 4186 | } |
| 4187 | |
| 4188 | static WRITE8_HANDLER( mapper74_w ) |
| 4189 | { |
| 4190 | UINT8 MMC3_helper, cmd; |
| 4191 | LOG_MMC(("mapper74_w, offset: %04x, data: %02x\n", offset, data)); |
| 4192 | |
| 4193 | switch (offset & 0x6001) |
| 4194 | { |
| 4195 | case 0x0000: |
| 4196 | MMC3_helper = mmc_cmd1 ^ data; |
| 4197 | mmc_cmd1 = data; |
| 4198 | |
| 4199 | /* Has PRG Mode changed? */ |
| 4200 | if (MMC3_helper & 0x40) |
| 4201 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 4202 | |
| 4203 | /* Has CHR Mode changed? */ |
| 4204 | if (MMC3_helper & 0x80) |
| 4205 | mapper74_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 4206 | break; |
| 4207 | |
| 4208 | case 0x0001: |
| 4209 | cmd = mmc_cmd1 & 0x07; |
| 4210 | switch (cmd) |
| 4211 | { |
| 4212 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 4213 | case 2: case 3: case 4: case 5: |
| 4214 | vrom_bank[cmd] = data; |
| 4215 | mapper74_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 4216 | break; |
| 4217 | case 6: |
| 4218 | case 7: |
| 4219 | prg_bank[cmd - 6] = data; |
| 4220 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 4221 | break; |
| 4222 | } |
| 4223 | break; |
| 4224 | |
| 4225 | case 0x2000: |
| 4226 | waixing_set_mirror(data); //maybe data & 0x03? |
| 4227 | break; |
| 4228 | |
| 4229 | case 0x2001: |
| 4230 | break; |
| 4231 | |
| 4232 | default: |
| 4233 | mapper4_w(space, offset, data); |
| 4234 | break; |
| 4235 | } |
| 4236 | } |
| 4237 | |
| 4238 | /************************************************************* |
| 4239 | |
| 4240 | Mapper 75 |
| 4241 | |
| 4242 | Known Boards: Komani VRC1 and Jaleco JF20, JF22 |
| 4243 | Games: Exciting Boxing, Ganbare Goemon!, Tetsuwan Atom |
| 4244 | |
| 4245 | In MESS: Supported. |
| 4246 | |
| 4247 | *************************************************************/ |
| 4248 | |
| 4249 | static WRITE8_HANDLER( mapper75_w ) |
| 4250 | { |
| 4251 | LOG_MMC(("mapper75_w, offset: %04x, data: %02x\n", offset, data)); |
| 4252 | |
| 4253 | switch (offset & 0x7000) |
| 4254 | { |
| 4255 | case 0x0000: |
| 4256 | prg8_89(space->machine, data); |
| 4257 | break; |
| 4258 | case 0x1000: |
| 4259 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4260 | vrom_bank[0] = (vrom_bank[0] & 0x0f) | ((data & 0x02) << 3); |
| 4261 | vrom_bank[1] = (vrom_bank[1] & 0x0f) | ((data & 0x04) << 2); |
| 4262 | chr4_0(space->machine, vrom_bank[0], CHRROM); |
| 4263 | chr4_4(space->machine, vrom_bank[1], CHRROM); |
| 4264 | break; |
| 4265 | case 0x2000: |
| 4266 | prg8_ab(space->machine, data); |
| 4267 | break; |
| 4268 | case 0x4000: |
| 4269 | prg8_cd(space->machine, data); |
| 4270 | break; |
| 4271 | case 0x6000: |
| 4272 | vrom_bank[0] = (vrom_bank[0] & 0x10) | (data & 0x0f); |
| 4273 | chr4_0(space->machine, vrom_bank[0], CHRROM); |
| 4274 | break; |
| 4275 | case 0x7000: |
| 4276 | vrom_bank[1] = (vrom_bank[1] & 0x10) | (data & 0x0f); |
| 4277 | chr4_4(space->machine, vrom_bank[1], CHRROM); |
| 4278 | break; |
| 4279 | } |
| 4280 | } |
| 4281 | |
| 4282 | /************************************************************* |
| 4283 | |
| 4284 | Mapper 76 |
| 4285 | |
| 4286 | Known Boards: Namcot 3446 |
| 4287 | Games: Digital Devil Monogatari - Megami Tensei |
| 4288 | |
| 4289 | In MESS: Supported. |
| 4290 | |
| 4291 | *************************************************************/ |
| 4292 | |
| 4293 | static WRITE8_HANDLER( mapper76_w ) |
| 4294 | { |
| 4295 | LOG_MMC(("mapper76_w, offset: %04x, data: %02x\n", offset, data)); |
| 4296 | |
| 4297 | switch (offset & 0x7001) |
| 4298 | { |
| 4299 | case 0: |
| 4300 | mmc_cmd1 = data; |
| 4301 | break; |
| 4302 | case 1: |
| 4303 | { |
| 4304 | switch (mmc_cmd1 & 0x07) |
| 4305 | { |
| 4306 | case 2: chr2_0(space->machine, data, CHRROM); break; |
| 4307 | case 3: chr2_2(space->machine, data, CHRROM); break; |
| 4308 | case 4: chr2_4(space->machine, data, CHRROM); break; |
| 4309 | case 5: chr2_6(space->machine, data, CHRROM); break; |
| 4310 | case 6: |
| 4311 | (mmc_cmd1 & 0x40) ? prg8_cd(space->machine, data) : prg8_89(space->machine, data); |
| 4312 | break; |
| 4313 | case 7: prg8_ab(space->machine, data); break; |
| 4314 | default: logerror("mapper76 unsupported command: %02x, data: %02x\n", mmc_cmd1, data); break; |
| 4315 | } |
| 4316 | } |
| 4317 | case 0x2000: |
| 4318 | set_nt_mirroring((data & 1) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 4319 | break; |
| 4320 | default: |
| 4321 | logerror("mapper76 unmapped write, offset: %04x, data: %02x\n", offset, data); |
| 4322 | break; |
| 4323 | } |
| 4324 | } |
| 4325 | |
| 4326 | /************************************************************* |
| 4327 | |
| 4328 | Mapper 77 |
| 4329 | |
| 4330 | Known Boards: Irem LROG017 |
| 4331 | Games: Napoleon Senki |
| 4332 | |
| 4333 | In MESS: Partially Supported (it needs 4-screen mirroring). |
| 4334 | |
| 4335 | *************************************************************/ |
| 4336 | |
| 4337 | static WRITE8_HANDLER( mapper77_w ) |
| 4338 | { |
| 4339 | LOG_MMC(("mapper77_w, offset: %04x, data: %02x\n", offset, data)); |
| 4340 | |
| 4341 | prg32(space->machine, data & 0x0f); |
| 4342 | chr2_0(space->machine, (data >> 4), CHRROM); |
| 4343 | } |
| 4344 | |
| 4345 | /************************************************************* |
| 4346 | |
| 4347 | Mapper 78 |
| 4348 | |
| 4349 | Known Boards: Jaleco JF16 and Irem |
| 4350 | Games: Holy Diver, Portopia Renzoku Satsujin Jiken, |
| 4351 | Uchuusen - Cosmo Carrier |
| 4352 | |
| 4353 | A crc check is required to support Cosmo Carrier (which uses |
| 4354 | a slightly different board) |
| 4355 | |
| 4356 | In MESS: Supported. |
| 4357 | |
| 4358 | *************************************************************/ |
| 4359 | |
| 4360 | static WRITE8_HANDLER( mapper78_w ) |
| 4361 | { |
| 4362 | LOG_MMC(("mapper78_w, offset: %04x, data: %02x\n", offset, data)); |
| 4363 | |
| 4364 | if (nes.crc_hack) // Jaleco JF16 board has different mirroring even if uses same mapper number :( |
| 4365 | set_nt_mirroring((data & 0x08) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 4366 | else |
| 4367 | set_nt_mirroring((data & 0x08) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 4368 | |
| 4369 | chr8(space->machine, (data & 0xf0) >> 4, CHRROM); |
| 4370 | prg16_89ab(space->machine, data & 0x07); |
| 4371 | } |
| 4372 | |
| 4373 | /************************************************************* |
| 4374 | |
| 4375 | Mapper 79 |
| 4376 | |
| 4377 | Known Boards: NINA03, NINA06 by AVE |
| 4378 | Games: Krazy Kreatures, Poke Block, Puzzle, Pyramid, |
| 4379 | Solitaire, Ultimate League Soccer |
| 4380 | |
| 4381 | In MESS: Supported. |
| 4382 | |
| 4383 | *************************************************************/ |
| 4384 | |
| 4385 | static WRITE8_HANDLER( mapper79_l_w ) |
| 4386 | { |
| 4387 | LOG_MMC(("mapper79_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 4388 | |
| 4389 | if (!(offset & 0x0100)) |
| 4390 | { |
| 4391 | prg32(space->machine, data >> 3); |
| 4392 | chr8(space->machine, data, CHRROM); |
| 4393 | } |
| 4394 | } |
| 4395 | |
| 4396 | /************************************************************* |
| 4397 | |
| 4398 | Mapper 80 |
| 4399 | |
| 4400 | Known Boards: Taito X1-005 Ver. A |
| 4401 | Games: Bakushou!! Jinsei Gekijou 2, Kyonshiizu 2, Minelvaton |
| 4402 | Saga, Taito Grand Prix |
| 4403 | |
| 4404 | Registers are at 0x7ef0-0x7eff. first six ones choose chr |
| 4405 | (2x2k + 4x1k) banks, the seventh sets NT mirroring, the |
| 4406 | remaining ones chose prg banks. |
| 4407 | |
| 4408 | In MESS: Supported. |
| 4409 | |
| 4410 | *************************************************************/ |
| 4411 | |
| 4412 | static WRITE8_HANDLER( mapper80_m_w ) |
| 4413 | { |
| 4414 | LOG_MMC(("mapper80_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 4415 | |
| 4416 | switch (offset) |
| 4417 | { |
| 4418 | case 0x1ef0: |
| 4419 | chr2_0(space->machine, (data & 0x7f) >> 1, CHRROM); |
| 4420 | break; |
| 4421 | case 0x1ef1: |
| 4422 | chr2_2(space->machine, (data & 0x7f) >> 1, CHRROM); |
| 4423 | break; |
| 4424 | case 0x1ef2: |
| 4425 | chr1_4(space->machine, data, CHRROM); |
| 4426 | break; |
| 4427 | case 0x1ef3: |
| 4428 | chr1_5(space->machine, data, CHRROM); |
| 4429 | break; |
| 4430 | case 0x1ef4: |
| 4431 | chr1_6(space->machine, data, CHRROM); |
| 4432 | break; |
| 4433 | case 0x1ef5: |
| 4434 | chr1_7(space->machine, data, CHRROM); |
| 4435 | break; |
| 4436 | case 0x1ef6: |
| 4437 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 4438 | break; |
| 4439 | case 0x1efa: |
| 4440 | case 0x1efb: |
| 4441 | prg8_89(space->machine, data); |
| 4442 | break; |
| 4443 | case 0x1efc: |
| 4444 | case 0x1efd: |
| 4445 | prg8_ab(space->machine, data); |
| 4446 | break; |
| 4447 | case 0x1efe: |
| 4448 | case 0x1eff: |
| 4449 | prg8_cd(space->machine, data); |
| 4450 | break; |
| 4451 | default: |
| 4452 | logerror("mapper80_m_w uncaught addr: %04x, value: %02x\n", offset + 0x6000, data); |
| 4453 | break; |
| 4454 | } |
| 4455 | } |
| 4456 | |
| 4457 | /************************************************************* |
| 4458 | |
| 4459 | Mapper 81 |
| 4460 | |
| 4461 | Known Boards: Undocumented / Unused ?!? |
| 4462 | Games: ---------- |
| 4463 | |
| 4464 | In MESS: ---------- |
| 4465 | |
| 4466 | *************************************************************/ |
| 4467 | |
| 4468 | /************************************************************* |
| 4469 | |
| 4470 | Mapper 82 |
| 4471 | |
| 4472 | Known Boards: Taito X1-017 |
| 4473 | Games: Kyuukyoku Harikiri Koushien, Kyuukyoku Harikiri |
| 4474 | Stadium, SD Keiji - Blader |
| 4475 | |
| 4476 | In MESS: Supported. |
| 4477 | |
| 4478 | *************************************************************/ |
| 4479 | |
| 4480 | static WRITE8_HANDLER( mapper82_m_w ) |
| 4481 | { |
| 4482 | LOG_MMC(("mapper82_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 4483 | |
| 4484 | switch (offset) |
| 4485 | { |
| 4486 | case 0x1ef0: |
| 4487 | if (mmc_cmd1) |
| 4488 | chr2_4(space->machine, data >> 1, CHRROM); |
| 4489 | else |
| 4490 | chr2_0(space->machine, data >> 1, CHRROM); |
| 4491 | break; |
| 4492 | case 0x1ef1: |
| 4493 | if (mmc_cmd1) |
| 4494 | chr2_6(space->machine, data, CHRROM); |
| 4495 | else |
| 4496 | chr2_2(space->machine, data, CHRROM); |
| 4497 | break; |
| 4498 | case 0x1ef2: |
| 4499 | chr1_x(space->machine, 4 ^ mmc_cmd1, data, CHRROM); |
| 4500 | break; |
| 4501 | case 0x1ef3: |
| 4502 | chr1_x(space->machine, 5 ^ mmc_cmd1, data, CHRROM); |
| 4503 | break; |
| 4504 | case 0x1ef4: |
| 4505 | chr1_x(space->machine, 6 ^ mmc_cmd1, data, CHRROM); |
| 4506 | break; |
| 4507 | case 0x1ef5: |
| 4508 | chr1_x(space->machine, 7 ^ mmc_cmd1, data, CHRROM); |
| 4509 | break; |
| 4510 | case 0x1ef6: |
| 4511 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 4512 | mmc_cmd1 = ((data & 0x02) << 1); |
| 4513 | break; |
| 4514 | |
| 4515 | case 0x1efa: |
| 4516 | prg8_89(space->machine, data >> 2); |
| 4517 | break; |
| 4518 | case 0x1efb: |
| 4519 | prg8_ab(space->machine, data >> 2); |
| 4520 | break; |
| 4521 | case 0x1efc: |
| 4522 | prg8_cd(space->machine, data >> 2); |
| 4523 | break; |
| 4524 | default: |
| 4525 | logerror("mapper82_m_w uncaught addr: %04x, value: %02x\n", offset + 0x6000, data); |
| 4526 | break; |
| 4527 | } |
| 4528 | } |
| 4529 | |
| 4530 | /************************************************************* |
| 4531 | |
| 4532 | Mapper 83 |
| 4533 | |
| 4534 | Known Boards: Unknown Multigame Bootleg Board |
| 4535 | Games: Dragon Ball Party, Fatal Fury 2, Street Blaster II |
| 4536 | Pro, World Heroes 2 |
| 4537 | |
| 4538 | In MESS: Supported. |
| 4539 | |
| 4540 | *************************************************************/ |
| 4541 | |
| 4542 | static WRITE8_HANDLER( mapper83_l_w ) |
| 4543 | { |
| 4544 | mapper83_low_reg[offset & 0x03] = data; |
| 4545 | } |
| 4546 | |
| 4547 | static READ8_HANDLER( mapper83_l_r ) |
| 4548 | { |
| 4549 | return mapper83_low_reg[offset & 0x03]; |
| 4550 | } |
| 4551 | |
| 4552 | static void mapper83_set_prg( running_machine *machine ) |
| 4553 | { |
| 4554 | prg16_89ab(machine, mapper83_reg[8] & 0x3f); |
| 4555 | prg16_cdef(machine, (mapper83_reg[8] & 0x30) | 0x0f); |
| 4556 | } |
| 4557 | |
| 4558 | static void mapper83_set_chr( running_machine *machine ) |
| 4559 | { |
| 4560 | chr1_0(machine, mapper83_reg[0] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 4561 | chr1_1(machine, mapper83_reg[1] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 4562 | chr1_2(machine, mapper83_reg[2] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 4563 | chr1_3(machine, mapper83_reg[3] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 4564 | chr1_4(machine, mapper83_reg[4] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 4565 | chr1_5(machine, mapper83_reg[5] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 4566 | chr1_6(machine, mapper83_reg[6] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 4567 | chr1_7(machine, mapper83_reg[7] | ((mapper83_reg[8] & 0x30) << 4), CHRROM); |
| 4568 | } |
| 4569 | |
| 4570 | static WRITE8_HANDLER( mapper83_w ) |
| 4571 | { |
| 4572 | LOG_MMC(("mapper83_w, offset: %04x, data: %02x\n", offset, data)); |
| 4573 | |
| 4574 | switch (offset) |
| 4575 | { |
| 4576 | case 0x0000: |
| 4577 | case 0x3000: |
| 4578 | case 0x30ff: |
| 4579 | case 0x31ff: |
| 4580 | mapper83_reg[8] = data; |
| 4581 | mapper83_set_prg(space->machine); |
| 4582 | mapper83_set_chr(space->machine); |
| 4583 | break; |
| 4584 | case 0x0100: |
| 4585 | switch (data & 0x03) |
| 4586 | { |
| 4587 | case 0: |
| 4588 | set_nt_mirroring(PPU_MIRROR_VERT); |
| 4589 | break; |
| 4590 | case 1: |
| 4591 | set_nt_mirroring(PPU_MIRROR_HORZ); |
| 4592 | break; |
| 4593 | case 2: |
| 4594 | set_nt_mirroring(PPU_MIRROR_LOW); |
| 4595 | break; |
| 4596 | case 3: |
| 4597 | set_nt_mirroring(PPU_MIRROR_HIGH); |
| 4598 | break; |
| 4599 | } |
| 4600 | break; |
| 4601 | case 0x0200: |
| 4602 | IRQ_count = (IRQ_count & 0xff00) | data; |
| 4603 | break; |
| 4604 | case 0x0201: |
| 4605 | IRQ_enable = 1; |
| 4606 | IRQ_count = (data << 8) | (IRQ_count & 0xff); |
| 4607 | break; |
| 4608 | case 0x0300: |
| 4609 | prg8_89(space->machine, data); |
| 4610 | break; |
| 4611 | case 0x0301: |
| 4612 | prg8_ab(space->machine, data); |
| 4613 | break; |
| 4614 | case 0x0302: |
| 4615 | prg8_cd(space->machine, data); |
| 4616 | break; |
| 4617 | case 0x0310: |
| 4618 | case 0x0311: |
| 4619 | case 0x0312: |
| 4620 | case 0x0313: |
| 4621 | case 0x0314: |
| 4622 | case 0x0315: |
| 4623 | case 0x0316: |
| 4624 | case 0x0317: |
| 4625 | mapper83_reg[offset - 0x0310] = data; |
| 4626 | mapper83_set_chr(space->machine); |
| 4627 | break; |
| 4628 | case 0x0318: |
| 4629 | mapper83_reg[9] = data; |
| 4630 | mapper83_set_prg(space->machine); |
| 4631 | break; |
| 4632 | } |
| 4633 | } |
| 4634 | |
| 4635 | /************************************************************* |
| 4636 | |
| 4637 | Mapper 84 |
| 4638 | |
| 4639 | Known Boards: Undocumented / Unused ?!? |
| 4640 | Games: ---------- |
| 4641 | |
| 4642 | In MESS: ---------- |
| 4643 | |
| 4644 | *************************************************************/ |
| 4645 | |
| 4646 | /************************************************************* |
| 4647 | |
| 4648 | Mapper 85 |
| 4649 | |
| 4650 | Known Boards: Konami VRC7 |
| 4651 | Games: Lagrange Point, Tiny Toon Adventures 2 |
| 4652 | |
| 4653 | In MESS: Supported. It also uses konami_irq. |
| 4654 | |
| 4655 | *************************************************************/ |
| 4656 | |
| 4657 | static WRITE8_HANDLER( konami_vrc7_w ) |
| 4658 | { |
| 4659 | UINT8 bank; |
| 4660 | LOG_MMC(("konami_vrc7_w, offset: %04x, data: %02x\n", offset, data)); |
| 4661 | |
| 4662 | switch (offset & 0x7018) |
| 4663 | { |
| 4664 | case 0x0000: |
| 4665 | prg8_89(space->machine, data); |
| 4666 | break; |
| 4667 | case 0x0008: |
| 4668 | case 0x0010: |
| 4669 | case 0x0018: |
| 4670 | prg8_ab(space->machine, data); |
| 4671 | break; |
| 4672 | |
| 4673 | case 0x1000: |
| 4674 | prg8_cd(space->machine, data); |
| 4675 | break; |
| 4676 | |
| 4677 | /* TODO: there are sound regs in here */ |
| 4678 | |
| 4679 | case 0x2000: |
| 4680 | case 0x2008: |
| 4681 | case 0x2010: |
| 4682 | case 0x2018: |
| 4683 | case 0x3000: |
| 4684 | case 0x3008: |
| 4685 | case 0x3010: |
| 4686 | case 0x3018: |
| 4687 | case 0x4000: |
| 4688 | case 0x4008: |
| 4689 | case 0x4010: |
| 4690 | case 0x4018: |
| 4691 | case 0x5000: |
| 4692 | case 0x5008: |
| 4693 | case 0x5010: |
| 4694 | case 0x5018: |
| 4695 | bank = ((offset & 0x7000) - 0x2000) / 0x0800 + ((offset & 0x0018) ? 1 : 0); |
| 4696 | chr1_x(space->machine, bank, data, mmc_chr_source); |
| 4697 | break; |
| 4698 | |
| 4699 | case 0x6000: |
| 4700 | switch (data & 0x03) |
| 4701 | { |
| 4702 | case 0x00: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 4703 | case 0x01: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 4704 | case 0x02: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 4705 | case 0x03: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 4706 | } |
| 4707 | break; |
| 4708 | case 0x6008: case 0x6010: case 0x6018: |
| 4709 | IRQ_count_latch = data; |
| 4710 | break; |
| 4711 | case 0x7000: |
| 4712 | IRQ_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 4713 | IRQ_enable = data & 0x02; |
| 4714 | IRQ_enable_latch = data & 0x01; |
| 4715 | if (data & 0x02) |
| 4716 | IRQ_count = IRQ_count_latch; |
| 4717 | break; |
| 4718 | case 0x7008: case 0x7010: case 0x7018: |
| 4719 | IRQ_enable = IRQ_enable_latch; |
| 4720 | break; |
| 4721 | |
| 4722 | default: |
| 4723 | logerror("konami_vrc7_w uncaught addr: %04x value: %02x\n", offset + 0x8000, data); |
| 4724 | break; |
| 4725 | } |
| 4726 | } |
| 4727 | |
| 4728 | /************************************************************* |
| 4729 | |
| 4730 | Mapper 86 |
| 4731 | |
| 4732 | Known Boards: Jaleco JF13 |
| 4733 | Games: Moero Pro Yakyuu |
| 4734 | |
| 4735 | In MESS: Supported. |
| 4736 | |
| 4737 | *************************************************************/ |
| 4738 | |
| 4739 | static WRITE8_HANDLER( mapper86_m_w ) |
| 4740 | { |
| 4741 | LOG_MMC(("mapper86_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 4742 | |
| 4743 | if (offset == 0) |
| 4744 | { |
| 4745 | prg32(space->machine, (data >> 4) & 0x03); |
| 4746 | chr8(space->machine, ((data >> 4) & 0x04) | (data & 0x03), CHRROM); |
| 4747 | } |
| 4748 | } |
| 4749 | |
| 4750 | /************************************************************* |
| 4751 | |
| 4752 | Mapper 87 |
| 4753 | |
| 4754 | Known Boards: Jaleco JF05, JF06, JF07, JF08, JF09, JF10 and |
| 4755 | Discrete Logic Board |
| 4756 | Games: The Goonies, Hyper Olympics, Jajamaru no Daibouken, |
| 4757 | Legend of Kage, Twin Bee |
| 4758 | |
| 4759 | In MESS: Supported. |
| 4760 | |
| 4761 | *************************************************************/ |
| 4762 | |
| 4763 | static WRITE8_HANDLER( mapper87_m_w ) |
| 4764 | { |
| 4765 | LOG_MMC(("mapper87_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 4766 | |
| 4767 | chr8(space->machine, ((data & 0x02) >> 1) | ((data & 0x01) << 1), CHRROM); |
| 4768 | } |
| 4769 | |
| 4770 | /************************************************************* |
| 4771 | |
| 4772 | Mapper 88 |
| 4773 | |
| 4774 | Known Boards: Namcot 3433 & 3443 |
| 4775 | Games: Dragon Spirit - Aratanaru Densetsu, Namcot Mahjong, Quinty |
| 4776 | |
| 4777 | In MESS: Supported. |
| 4778 | |
| 4779 | *************************************************************/ |
| 4780 | |
| 4781 | static WRITE8_HANDLER( mapper88_w ) |
| 4782 | { |
| 4783 | LOG_MMC(("mapper88_w, offset: %04x, data: %02x\n", offset, data)); |
| 4784 | |
| 4785 | switch (offset & 1) |
| 4786 | { |
| 4787 | case 0: |
| 4788 | mmc_cmd1 = data & 7; |
| 4789 | break; |
| 4790 | case 1: |
| 4791 | switch (mmc_cmd1) |
| 4792 | { |
| 4793 | case 0: chr2_0(space->machine, data >> 1, CHRROM); break; |
| 4794 | case 1: chr2_2(space->machine, data >> 1, CHRROM); break; |
| 4795 | case 2: chr1_4(space->machine, data | 0x40, CHRROM); break; |
| 4796 | case 3: chr1_5(space->machine, data | 0x40, CHRROM); break; |
| 4797 | case 4: chr1_6(space->machine, data | 0x40, CHRROM); break; |
| 4798 | case 5: chr1_7(space->machine, data | 0x40, CHRROM); break; |
| 4799 | case 6: prg8_89(space->machine,data); break; |
| 4800 | case 7: prg8_ab(space->machine,data); break; |
| 4801 | } |
| 4802 | break; |
| 4803 | } |
| 4804 | } |
| 4805 | |
| 4806 | /************************************************************* |
| 4807 | |
| 4808 | Mapper 89 |
| 4809 | |
| 4810 | Known Boards: Sunsoft 2B |
| 4811 | Games: Tenka no Goikenban - Mito Koumon |
| 4812 | |
| 4813 | In MESS: Supported. |
| 4814 | |
| 4815 | *************************************************************/ |
| 4816 | |
| 4817 | static WRITE8_HANDLER( mapper89_w ) |
| 4818 | { |
| 4819 | UINT8 map89_helper; |
| 4820 | LOG_MMC(("mapper89_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 4821 | |
| 4822 | map89_helper = (data & 0x07) | ((data & 0x80) ? 0x08 : 0x00); |
| 4823 | |
| 4824 | prg16_89ab(space->machine, (data >> 4) & 0x07); |
| 4825 | chr8(space->machine, map89_helper, CHRROM); |
| 4826 | set_nt_mirroring((data & 0x08) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 4827 | } |
| 4828 | |
| 4829 | /************************************************************* |
| 4830 | |
| 4831 | Mapper 90 |
| 4832 | |
| 4833 | Known Boards: Type A by J.Y. Company |
| 4834 | Games: Aladdin, Final Fight 3, Super Mario World, Tekken 2 |
| 4835 | |
| 4836 | In MESS: Unsupported. |
| 4837 | |
| 4838 | *************************************************************/ |
| 4839 | |
| 4840 | /************************************************************* |
| 4841 | |
| 4842 | Mapper 91 |
| 4843 | |
| 4844 | Known Boards: Unknown Bootleg Board |
| 4845 | Games: Mortal Kombat II, Street Fighter III, Super Mario |
| 4846 | Kart Rider |
| 4847 | |
| 4848 | This board uses an IRQ system very similar to MMC3. We indeed |
| 4849 | use mapper4_irq, but there is some small glitch! |
| 4850 | |
| 4851 | In MESS: Supported. |
| 4852 | |
| 4853 | *************************************************************/ |
| 4854 | |
| 4855 | static WRITE8_HANDLER( mapper91_m_w ) |
| 4856 | { |
| 4857 | LOG_MMC(("mapper91_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 4858 | |
| 4859 | switch (offset & 0x1000) |
| 4860 | { |
| 4861 | case 0x0000: |
| 4862 | switch (offset & 0x03) |
| 4863 | { |
| 4864 | case 0x00: chr2_0(space->machine, data, CHRROM); break; |
| 4865 | case 0x01: chr2_2(space->machine, data, CHRROM); break; |
| 4866 | case 0x02: chr2_4(space->machine, data, CHRROM); break; |
| 4867 | case 0x03: chr2_6(space->machine, data, CHRROM); break; |
| 4868 | } |
| 4869 | break; |
| 4870 | case 0x1000: |
| 4871 | switch (offset & 0x03) |
| 4872 | { |
| 4873 | case 0x00: prg8_89(space->machine, data); break; |
| 4874 | case 0x01: prg8_ab(space->machine, data); break; |
| 4875 | case 0x02: IRQ_enable = 0; IRQ_count = 0; break; |
| 4876 | case 0x03: IRQ_enable = 1; IRQ_count = 7; break; |
| 4877 | } |
| 4878 | break; |
| 4879 | default: |
| 4880 | logerror("mapper91_m_w uncaught addr: %04x value: %02x\n", offset + 0x6000, data); |
| 4881 | break; |
| 4882 | } |
| 4883 | } |
| 4884 | |
| 4885 | /************************************************************* |
| 4886 | |
| 4887 | Mapper 92 |
| 4888 | |
| 4889 | Known Boards: Jaleco JF19 & JF21 |
| 4890 | Games: Moero Pro Soccer, Moero Pro Yakyuu '88 |
| 4891 | |
| 4892 | In MESS: Supported (no samples). |
| 4893 | |
| 4894 | *************************************************************/ |
| 4895 | |
| 4896 | static WRITE8_HANDLER( mapper92_w ) |
| 4897 | { |
| 4898 | LOG_MMC(("mapper92_w, offset %04x, data: %02x\n", offset, data)); |
| 4899 | |
| 4900 | if(data & 0x80) |
| 4901 | prg16_cdef(space->machine, data & 0x0f); |
| 4902 | if(data & 0x40) |
| 4903 | chr8(space->machine, data & 0x0f, CHRROM); |
| 4904 | } |
| 4905 | |
| 4906 | /************************************************************* |
| 4907 | |
| 4908 | Mapper 93 |
| 4909 | |
| 4910 | Known Boards: Sunsoft 2A |
| 4911 | Games: Shanghai, Fantasy Zone |
| 4912 | |
| 4913 | Very similar to mapper 89, but no NT mirroring for data&8 |
| 4914 | and only CHRRAM present |
| 4915 | |
| 4916 | In MESS: Supported. |
| 4917 | |
| 4918 | *************************************************************/ |
| 4919 | |
| 4920 | static WRITE8_HANDLER( mapper93_w ) |
| 4921 | { |
| 4922 | LOG_MMC(("mapper93_w %04x:%02x\n", offset, data)); |
| 4923 | |
| 4924 | prg16_89ab(space->machine, data >> 4); |
| 4925 | } |
| 4926 | |
| 4927 | /************************************************************* |
| 4928 | |
| 4929 | Mapper 94 |
| 4930 | |
| 4931 | Known Boards: UN1ROM |
| 4932 | Games: Senjou no Okami |
| 4933 | |
| 4934 | Writes to 0x8000-0xffff set 16k prg bank at 0x8000. The |
| 4935 | bank at 0xc000 is always set to the last one. |
| 4936 | |
| 4937 | In MESS: Supported. |
| 4938 | |
| 4939 | *************************************************************/ |
| 4940 | |
| 4941 | static WRITE8_HANDLER( mapper94_w ) |
| 4942 | { |
| 4943 | LOG_MMC(("mapper94_w %04x:%02x\n", offset, data)); |
| 4944 | |
| 4945 | prg16_89ab(space->machine, data >> 2); |
| 4946 | } |
| 4947 | |
| 4948 | /************************************************************* |
| 4949 | |
| 4950 | Mapper 95 |
| 4951 | |
| 4952 | Known Boards: Namcot 3425 |
| 4953 | Games: Dragon Buster |
| 4954 | |
| 4955 | Quite similar to other Namco boards, but with a peculiar |
| 4956 | NT mirroring. |
| 4957 | |
| 4958 | In MESS: Supported. |
| 4959 | |
| 4960 | *************************************************************/ |
| 4961 | |
| 4962 | static WRITE8_HANDLER( mapper95_w ) |
| 4963 | { |
| 4964 | LOG_MMC(("mapper95_w, offset: %04x, data: %02x\n", offset, data)); |
| 4965 | |
| 4966 | switch (offset & 1) |
| 4967 | { |
| 4968 | case 0: |
| 4969 | { |
| 4970 | mmc_cmd1 = data; |
| 4971 | break; |
| 4972 | } |
| 4973 | case 1: |
| 4974 | { |
| 4975 | switch (mmc_cmd1 & 0x07) |
| 4976 | { |
| 4977 | case 0: |
| 4978 | case 1: |
| 4979 | chr2_x(space->machine, mmc_cmd1 ? 2 : 0, (data >> 1) & 0x1f, CHRROM); |
| 4980 | break; |
| 4981 | case 2: |
| 4982 | case 3: |
| 4983 | case 4: |
| 4984 | case 5: |
| 4985 | chr1_x(space->machine, 2 + mmc_cmd1, data & 0x1f, CHRROM); |
| 4986 | mapper95_reg[mmc_cmd1 - 2] = data & 0x20; |
| 4987 | if (!(mmc_cmd1 & 0x80)) |
| 4988 | { |
| 4989 | set_nt_page(0, CIRAM, mapper95_reg[0] ? 1 : 0, 1); |
| 4990 | set_nt_page(1, CIRAM, mapper95_reg[1] ? 1 : 0, 1); |
| 4991 | set_nt_page(2, CIRAM, mapper95_reg[2] ? 1 : 0, 1); |
| 4992 | set_nt_page(3, CIRAM, mapper95_reg[3] ? 1 : 0, 1); |
| 4993 | } |
| 4994 | else |
| 4995 | set_nt_mirroring(PPU_MIRROR_HORZ); |
| 4996 | break; |
| 4997 | case 6: |
| 4998 | prg8_89(space->machine,data & 0x1f); |
| 4999 | break; |
| 5000 | case 7: |
| 5001 | prg8_ab(space->machine,data & 0x1f); |
| 5002 | break; |
| 5003 | } |
| 5004 | break; |
| 5005 | } |
| 5006 | } |
| 5007 | } |
| 5008 | |
| 5009 | /************************************************************* |
| 5010 | |
| 5011 | Mapper 96 |
| 5012 | |
| 5013 | Known Boards: Bandai Oeka Kids Board |
| 5014 | Games: Oeka Kids - Anpanman no Hiragana Daisuki, Oeka |
| 5015 | Kids - Anpanman to Oekaki Shiyou!! |
| 5016 | |
| 5017 | In MESS: Preliminary Support. |
| 5018 | |
| 5019 | *************************************************************/ |
| 5020 | |
| 5021 | static WRITE8_HANDLER( mapper96_w ) |
| 5022 | { |
| 5023 | LOG_MMC(("mapper96_w, offset: %04x, data: %02x\n", offset, data)); |
| 5024 | |
| 5025 | prg32(space->machine, data); |
| 5026 | } |
| 5027 | |
| 5028 | /************************************************************* |
| 5029 | |
| 5030 | Mapper 97 |
| 5031 | |
| 5032 | Known Boards: Irem Board |
| 5033 | Games: Kaiketsu Yanchamaru |
| 5034 | |
| 5035 | In MESS: Supported. |
| 5036 | |
| 5037 | *************************************************************/ |
| 5038 | |
| 5039 | static WRITE8_HANDLER( mapper97_w ) |
| 5040 | { |
| 5041 | LOG_MMC(("mapper97_w, offset: %04x, data: %02x\n", offset, data)); |
| 5042 | |
| 5043 | if (offset < 0x4000) |
| 5044 | { |
| 5045 | set_nt_mirroring((data & 0x80) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 5046 | prg16_cdef(space->machine, data & 0x0f); |
| 5047 | } |
| 5048 | } |
| 5049 | |
| 5050 | /************************************************************* |
| 5051 | |
| 5052 | Mapper 98 |
| 5053 | |
| 5054 | Known Boards: Undocumented / Unused ?!? |
| 5055 | Games: ---------- |
| 5056 | |
| 5057 | In MESS: ---------- |
| 5058 | |
| 5059 | *************************************************************/ |
| 5060 | |
| 5061 | /************************************************************* |
| 5062 | |
| 5063 | Mapper 99 |
| 5064 | |
| 5065 | Known Boards: VS. System |
| 5066 | Games: most Vs. games |
| 5067 | |
| 5068 | In MESS: Unsupported, low priority (you should use MAME) |
| 5069 | |
| 5070 | *************************************************************/ |
| 5071 | |
| 5072 | /************************************************************* |
| 5073 | |
| 5074 | Mapper 100 |
| 5075 | |
| 5076 | Known Boards: Undocumented / Unused ?!? |
| 5077 | Games: ---------- |
| 5078 | |
| 5079 | In MESS: ---------- |
| 5080 | |
| 5081 | *************************************************************/ |
| 5082 | |
| 5083 | /************************************************************* |
| 5084 | |
| 5085 | Mapper 101 |
| 5086 | |
| 5087 | Known Boards: ??? |
| 5088 | Games: Urusei Yatsura Alt |
| 5089 | |
| 5090 | In MESS: Supported. |
| 5091 | |
| 5092 | *************************************************************/ |
| 5093 | |
| 5094 | static WRITE8_HANDLER( mapper101_m_w ) |
| 5095 | { |
| 5096 | LOG_MMC(("mapper101_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 5097 | |
| 5098 | chr8(space->machine, data, CHRROM); |
| 5099 | } |
| 5100 | |
| 5101 | static WRITE8_HANDLER( mapper101_w ) |
| 5102 | { |
| 5103 | LOG_MMC(("mapper101_w, offset: %04x, data: %02x\n", offset, data)); |
| 5104 | |
| 5105 | /* ??? */ |
| 5106 | } |
| 5107 | |
| 5108 | /************************************************************* |
| 5109 | |
| 5110 | Mapper 102 |
| 5111 | |
| 5112 | Known Boards: Undocumented / Unused ?!? |
| 5113 | Games: ---------- |
| 5114 | |
| 5115 | In MESS: ---------- |
| 5116 | |
| 5117 | *************************************************************/ |
| 5118 | |
| 5119 | /************************************************************* |
| 5120 | |
| 5121 | Mapper 103 |
| 5122 | |
| 5123 | Known Boards: Unknown Bootleg Board (2708) |
| 5124 | Games: Doki Doki Panic (FDS Conversion) |
| 5125 | |
| 5126 | In MESS: Unsupported. Need reads from 0x6000 |
| 5127 | |
| 5128 | *************************************************************/ |
| 5129 | |
| 5130 | /************************************************************* |
| 5131 | |
| 5132 | Mapper 104 |
| 5133 | |
| 5134 | Known Boards: Camerica Golden Five |
| 5135 | Games: Pegasus 5 in 1 |
| 5136 | |
| 5137 | In MESS: Supported. |
| 5138 | |
| 5139 | *************************************************************/ |
| 5140 | |
| 5141 | static WRITE8_HANDLER( mapper104_w ) |
| 5142 | { |
| 5143 | LOG_MMC(("mapper104_w, offset: %04x, data: %02x\n", offset, data)); |
| 5144 | |
| 5145 | if (offset < 0x4000) |
| 5146 | { |
| 5147 | if (data & 0x08) |
| 5148 | { |
| 5149 | prg_bank[0] = ((data & 0x07) << 4) | (prg_bank[0] & 0x0f); |
| 5150 | prg16_89ab(space->machine, prg_bank[0]); |
| 5151 | prg16_cdef(space->machine, ((data & 0x07) << 4) | 0x0f); |
| 5152 | } |
| 5153 | |
| 5154 | } |
| 5155 | else |
| 5156 | { |
| 5157 | prg_bank[0] = (prg_bank[0] & 0x70) | (data & 0x0f); |
| 5158 | prg16_89ab(space->machine, prg_bank[0]); |
| 5159 | } |
| 5160 | } |
| 5161 | |
| 5162 | /************************************************************* |
| 5163 | |
| 5164 | Mapper 105 |
| 5165 | |
| 5166 | Known Boards: Custom Board |
| 5167 | Games: Nintendo World Championships 1990 |
| 5168 | |
| 5169 | In MESS: Unsupported. |
| 5170 | |
| 5171 | *************************************************************/ |
| 5172 | |
| 5173 | /************************************************************* |
| 5174 | |
| 5175 | Mapper 106 |
| 5176 | |
| 5177 | Known Boards: Unknown Bootleg Board |
| 5178 | Games: Super Mario Bros. 3 Pirate |
| 5179 | |
| 5180 | In MESS: Supported. |
| 5181 | |
| 5182 | *************************************************************/ |
| 5183 | |
| 5184 | static void mapper106_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 5185 | { |
| 5186 | if (IRQ_enable) |
| 5187 | { |
| 5188 | if ((0xffff - IRQ_count) < 114) |
| 5189 | { |
| 5190 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 5191 | IRQ_enable = 0; |
| 5192 | } |
| 5193 | |
| 5194 | IRQ_count = (IRQ_count + 114) & 0xffff; |
| 5195 | } |
| 5196 | } |
| 5197 | |
| 5198 | static WRITE8_HANDLER( mapper106_w ) |
| 5199 | { |
| 5200 | LOG_MMC(("mapper106_w, offset: %04x, data: %02x\n", offset, data)); |
| 5201 | switch (offset & 0x0f) |
| 5202 | { |
| 5203 | case 0x00: |
| 5204 | case 0x02: |
| 5205 | chr1_x(space->machine, offset & 0x07, data & 0xfe, CHRROM); |
| 5206 | break; |
| 5207 | case 0x01: |
| 5208 | case 0x03: |
| 5209 | chr1_x(space->machine, offset & 0x07, data | 0x01, CHRROM); |
| 5210 | break; |
| 5211 | case 0x04: case 0x05: |
| 5212 | case 0x06: case 0x07: |
| 5213 | chr1_x(space->machine, offset & 0x07, data, CHRROM); |
| 5214 | break; |
| 5215 | case 0x08: |
| 5216 | prg8_89(space->machine, data | 0x10); |
| 5217 | break; |
| 5218 | case 0x09: |
| 5219 | prg8_ab(space->machine, data); |
| 5220 | break; |
| 5221 | case 0x0a: |
| 5222 | prg8_cd(space->machine, data); |
| 5223 | break; |
| 5224 | case 0x0b: |
| 5225 | prg8_ef(space->machine, data | 0x10); |
| 5226 | break; |
| 5227 | case 0x0c: |
| 5228 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 5229 | break; |
| 5230 | case 0x0d: |
| 5231 | IRQ_count = 0; |
| 5232 | IRQ_enable = 0; |
| 5233 | break; |
| 5234 | case 0x0e: |
| 5235 | IRQ_count = (IRQ_count & 0xff00) | data; |
| 5236 | break; |
| 5237 | case 0x0f: |
| 5238 | IRQ_count = (IRQ_count & 0x00ff) | (data << 8); |
| 5239 | IRQ_enable = 1; |
| 5240 | break; |
| 5241 | } |
| 5242 | } |
| 5243 | |
| 5244 | /************************************************************* |
| 5245 | |
| 5246 | Mapper 107 |
| 5247 | |
| 5248 | Known Boards: Bootleg Board by Magic Series |
| 5249 | Games: Magic Dragon |
| 5250 | |
| 5251 | Very simple mapper: writes to 0x8000-0xffff set prg32 and chr8 |
| 5252 | banks |
| 5253 | |
| 5254 | In MESS: Supported. |
| 5255 | |
| 5256 | *************************************************************/ |
| 5257 | |
| 5258 | static WRITE8_HANDLER( mapper107_w ) |
| 5259 | { |
| 5260 | LOG_MMC(("mapper107_w, offset: %04x, data: %02x\n", offset, data)); |
| 5261 | |
| 5262 | prg32(space->machine, data >> 1); |
| 5263 | chr8(space->machine, data, CHRROM); |
| 5264 | } |
| 5265 | |
| 5266 | /************************************************************* |
| 5267 | |
| 5268 | Mapper 108 |
| 5269 | |
| 5270 | Known Boards: Bootleg Board by Whirlwind |
| 5271 | Games: Meikyuu Jiin Dababa (FDS Conversion) |
| 5272 | |
| 5273 | Simple mapper: reads in 0x6000-0x7fff return wram, writes to |
| 5274 | 0x8fff set prg8_89 to the bank corresponding to data |
| 5275 | |
| 5276 | In MESS: Unsupported. Needs to read from 0x6000. |
| 5277 | |
| 5278 | *************************************************************/ |
| 5279 | |
| 5280 | /************************************************************* |
| 5281 | |
| 5282 | Mapper 109 |
| 5283 | |
| 5284 | Known Boards: Undocumented / Unused ?!? |
| 5285 | Games: ---------- |
| 5286 | |
| 5287 | In MESS: ---------- |
| 5288 | |
| 5289 | *************************************************************/ |
| 5290 | |
| 5291 | /************************************************************* |
| 5292 | |
| 5293 | Mapper 110 |
| 5294 | |
| 5295 | Known Boards: Undocumented / Unused ?!? |
| 5296 | Games: ---------- |
| 5297 | |
| 5298 | In MESS: ---------- |
| 5299 | |
| 5300 | *************************************************************/ |
| 5301 | |
| 5302 | /************************************************************* |
| 5303 | |
| 5304 | Mapper 111 |
| 5305 | |
| 5306 | Known Boards: ??? |
| 5307 | Games: Ninja Ryukenden (C) |
| 5308 | |
| 5309 | No info avaliable |
| 5310 | |
| 5311 | In MESS: Unsupported. |
| 5312 | |
| 5313 | *************************************************************/ |
| 5314 | |
| 5315 | /************************************************************* |
| 5316 | |
| 5317 | Mapper 112 |
| 5318 | |
| 5319 | Known Boards: Bootleg Board NTDEC ASDER |
| 5320 | Games: Cobra Mission, Fighting Hero III, Huang Di, Master |
| 5321 | Shooter |
| 5322 | |
| 5323 | In MESS: Supported. |
| 5324 | |
| 5325 | *************************************************************/ |
| 5326 | |
| 5327 | static WRITE8_HANDLER( mapper112_w ) |
| 5328 | { |
| 5329 | LOG_MMC(("mapper112_w, offset: %04x, data: %02x\n", offset, data)); |
| 5330 | |
| 5331 | switch (offset) |
| 5332 | { |
| 5333 | case 0x0000: |
| 5334 | mmc_cmd1 = data & 0x07; |
| 5335 | break; |
| 5336 | case 0x2000: |
| 5337 | switch (mmc_cmd1) |
| 5338 | { |
| 5339 | case 0: |
| 5340 | prg8_89(space->machine, data); |
| 5341 | break; |
| 5342 | case 1: |
| 5343 | prg8_ab(space->machine, data); |
| 5344 | break; |
| 5345 | case 2: |
| 5346 | data &= 0xfe; |
| 5347 | chr1_0(space->machine, data, CHRROM); |
| 5348 | chr1_1(space->machine, data + 1, CHRROM); |
| 5349 | break; |
| 5350 | case 3: |
| 5351 | data &= 0xfe; |
| 5352 | chr1_2(space->machine, data, CHRROM); |
| 5353 | chr1_3(space->machine, data + 1, CHRROM); |
| 5354 | break; |
| 5355 | case 4: |
| 5356 | chr1_4(space->machine, data, CHRROM); |
| 5357 | break; |
| 5358 | case 5: |
| 5359 | chr1_5(space->machine, data, CHRROM); |
| 5360 | break; |
| 5361 | case 6: |
| 5362 | chr1_6(space->machine, data, CHRROM); |
| 5363 | break; |
| 5364 | case 7: |
| 5365 | chr1_7(space->machine, data, CHRROM); |
| 5366 | break; |
| 5367 | } |
| 5368 | break; |
| 5369 | case 0x6000: |
| 5370 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 5371 | break; |
| 5372 | } |
| 5373 | } |
| 5374 | |
| 5375 | /************************************************************* |
| 5376 | |
| 5377 | Mapper 113 |
| 5378 | |
| 5379 | Known Boards: Bootleg Board by HES (also used by others) |
| 5380 | Games: AV Hanafuda Club, AV Soccer, Papillon, Sidewinder, |
| 5381 | Total Funpack |
| 5382 | |
| 5383 | In MESS: Supported. |
| 5384 | |
| 5385 | *************************************************************/ |
| 5386 | |
| 5387 | static WRITE8_HANDLER( mapper113_l_w ) |
| 5388 | { |
| 5389 | LOG_MMC(("mapper113_w, offset: %04x, data: %02x\n", offset, data)); |
| 5390 | |
| 5391 | if (!(offset & 0x100)) |
| 5392 | { |
| 5393 | prg32(space->machine, (data & 0x38) >> 3); |
| 5394 | chr8(space->machine, (data & 0x07) | ((data & 0x40) >> 3), CHRROM); |
| 5395 | if (nes.crc_hack) // this breaks AV Soccer but it is needed by HES 6-in-1! |
| 5396 | set_nt_mirroring((data & 0x80) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 5397 | } |
| 5398 | } |
| 5399 | |
| 5400 | /************************************************************* |
| 5401 | |
| 5402 | Mapper 114 |
| 5403 | |
| 5404 | Known Boards: Unknown Bootleg Board |
| 5405 | Games: The Lion King |
| 5406 | |
| 5407 | MMC3 clone. |
| 5408 | |
| 5409 | In MESS: Supported. |
| 5410 | |
| 5411 | *************************************************************/ |
| 5412 | |
| 5413 | static WRITE8_HANDLER( mapper114_m_w ) |
| 5414 | { |
| 5415 | LOG_MMC(("mapper114_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 5416 | |
| 5417 | map114_reg = data; |
| 5418 | |
| 5419 | if (map114_reg & 0x80) |
| 5420 | { |
| 5421 | prg16_89ab(space->machine, data & 0x1f); |
| 5422 | prg16_cdef(space->machine, data & 0x1f); |
| 5423 | } |
| 5424 | else |
| 5425 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 5426 | |
| 5427 | } |
| 5428 | |
| 5429 | static WRITE8_HANDLER( mapper114_w ) |
| 5430 | { |
| 5431 | static const UINT8 conv_table[8] = {0, 3, 1, 5, 6, 7, 2, 4}; |
| 5432 | LOG_MMC(("mapper114_w, offset: %04x, data: %02x\n", offset, data)); |
| 5433 | |
| 5434 | if (offset < 0x6000) |
| 5435 | { |
| 5436 | switch (offset & 0x6000) |
| 5437 | { |
| 5438 | case 0x0000: |
| 5439 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 5440 | break; |
| 5441 | case 0x2000: |
| 5442 | map114_reg_enabled = 1; |
| 5443 | data = (data & 0xc0) | conv_table[data & 0x07]; |
| 5444 | mapper4_w(space, 0x8000, data); |
| 5445 | break; |
| 5446 | case 0x4000: |
| 5447 | if (map114_reg_enabled && (map114_reg & 0x80) == 0) |
| 5448 | { |
| 5449 | map114_reg_enabled = 0; |
| 5450 | mapper4_w(space, 0x8001, data); |
| 5451 | } |
| 5452 | break; |
| 5453 | } |
| 5454 | } |
| 5455 | else |
| 5456 | { |
| 5457 | switch (offset & 0x03) |
| 5458 | { |
| 5459 | case 0x02: |
| 5460 | mapper4_w(space, 0xe000, data); |
| 5461 | break; |
| 5462 | case 0x03: |
| 5463 | mapper4_w(space, 0xe001, data); |
| 5464 | mapper4_w(space, 0xc000, data); |
| 5465 | mapper4_w(space, 0xc001, data); |
| 5466 | break; |
| 5467 | } |
| 5468 | } |
| 5469 | } |
| 5470 | |
| 5471 | /************************************************************* |
| 5472 | |
| 5473 | Mapper 115 (formerly 248) |
| 5474 | |
| 5475 | Known Boards: Unknown Bootleg Board by Kasing |
| 5476 | Games: AV Jiu Ji Mahjong, Bao Qing Tian, Thunderbolt 2, |
| 5477 | Shisen Mahjong 2 |
| 5478 | |
| 5479 | MMC3 clone |
| 5480 | |
| 5481 | In MESS: Supported |
| 5482 | |
| 5483 | *************************************************************/ |
| 5484 | |
| 5485 | static void mapper115_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 5486 | { |
| 5487 | if (mapper115_reg[0] & 0x80) |
| 5488 | prg32(machine, mapper115_reg[0] >> 1); |
| 5489 | else |
| 5490 | mapper4_set_prg(machine, prg_base, prg_mask); |
| 5491 | } |
| 5492 | |
| 5493 | static WRITE8_HANDLER( mapper115_m_w ) |
| 5494 | { |
| 5495 | LOG_MMC(("mapper115_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 5496 | |
| 5497 | switch (offset & 0x01) |
| 5498 | { |
| 5499 | case 0x00: |
| 5500 | mapper115_reg[0] = data; |
| 5501 | mapper115_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 5502 | break; |
| 5503 | case 0x01: |
| 5504 | mmc_chr_base = (data & 0x01) ? 0x100 : 0x000; |
| 5505 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 5506 | break; |
| 5507 | } |
| 5508 | } |
| 5509 | |
| 5510 | static WRITE8_HANDLER( mapper115_w ) |
| 5511 | { |
| 5512 | UINT8 map115_helper, cmd; |
| 5513 | LOG_MMC(("mapper115_w, offset: %04x, data: %02x\n", offset, data)); |
| 5514 | |
| 5515 | switch (offset & 0x6001) |
| 5516 | { |
| 5517 | case 0x0000: |
| 5518 | map115_helper = mmc_cmd1 ^ data; |
| 5519 | mmc_cmd1 = data; |
| 5520 | |
| 5521 | /* Has PRG Mode changed? */ |
| 5522 | if (map115_helper & 0x40) |
| 5523 | mapper115_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 5524 | |
| 5525 | /* Has CHR Mode changed? */ |
| 5526 | if (map115_helper & 0x80) |
| 5527 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 5528 | break; |
| 5529 | |
| 5530 | case 0x0001: |
| 5531 | cmd = mmc_cmd1 & 0x07; |
| 5532 | switch (cmd) |
| 5533 | { |
| 5534 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 5535 | case 2: case 3: case 4: case 5: |
| 5536 | vrom_bank[cmd] = data; |
| 5537 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 5538 | break; |
| 5539 | case 6: |
| 5540 | case 7: |
| 5541 | prg_bank[cmd - 6] = data; |
| 5542 | mapper115_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 5543 | break; |
| 5544 | } |
| 5545 | break; |
| 5546 | |
| 5547 | default: |
| 5548 | mapper4_w(space, offset, data); |
| 5549 | break; |
| 5550 | } |
| 5551 | } |
| 5552 | |
| 5553 | /************************************************************* |
| 5554 | |
| 5555 | Mapper 116 |
| 5556 | |
| 5557 | Known Boards: Unknown Bootleg Board (Someri?!?) |
| 5558 | Games: AV Mei Shao Nv Zhan Shi, Chuugoku Taitei |
| 5559 | |
| 5560 | In MESS: Unsupported. |
| 5561 | |
| 5562 | *************************************************************/ |
| 5563 | |
| 5564 | /************************************************************* |
| 5565 | |
| 5566 | Mapper 117 |
| 5567 | |
| 5568 | Known Boards: Bootleg Board by Future Media |
| 5569 | Games: Crayon Shin-chan (C), San Guo Zhi 4 - Chi Bi Feng Yun |
| 5570 | |
| 5571 | In MESS: Unsupported. |
| 5572 | |
| 5573 | *************************************************************/ |
| 5574 | |
| 5575 | static void mapper117_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 5576 | { |
| 5577 | // if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE) |
| 5578 | { |
| 5579 | if (IRQ_enable && IRQ_count) |
| 5580 | { |
| 5581 | IRQ_count--; |
| 5582 | if (!IRQ_count) |
| 5583 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 5584 | } |
| 5585 | } |
| 5586 | } |
| 5587 | |
| 5588 | static WRITE8_HANDLER( mapper117_w ) |
| 5589 | { |
| 5590 | LOG_MMC(("mapper117_w, offset: %04x, data: %02x\n", offset, data)); |
| 5591 | |
| 5592 | switch (offset) |
| 5593 | { |
| 5594 | case 0x0000: |
| 5595 | prg8_89(space->machine, data); |
| 5596 | break; |
| 5597 | case 0x0001: |
| 5598 | prg8_ab(space->machine, data); |
| 5599 | break; |
| 5600 | case 0x0002: |
| 5601 | prg8_cd(space->machine, data); |
| 5602 | break; |
| 5603 | case 0x0003: |
| 5604 | prg8_ef(space->machine, data); |
| 5605 | break; |
| 5606 | case 0x2000: |
| 5607 | case 0x2001: |
| 5608 | case 0x2002: |
| 5609 | case 0x2003: |
| 5610 | case 0x2004: |
| 5611 | case 0x2005: |
| 5612 | case 0x2006: |
| 5613 | case 0x2007: |
| 5614 | chr1_x(space->machine, offset & 0x07, data, CHRROM); |
| 5615 | break; |
| 5616 | |
| 5617 | case 0x5000: |
| 5618 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 5619 | break; |
| 5620 | |
| 5621 | case 0x4001: |
| 5622 | IRQ_count_latch = data; |
| 5623 | break; |
| 5624 | case 0x4002: |
| 5625 | // IRQ cleared |
| 5626 | break; |
| 5627 | case 0x4003: |
| 5628 | IRQ_count = IRQ_count_latch; |
| 5629 | break; |
| 5630 | case 0x6000: |
| 5631 | IRQ_enable = data & 0x01; |
| 5632 | break; |
| 5633 | } |
| 5634 | } |
| 5635 | |
| 5636 | /************************************************************* |
| 5637 | |
| 5638 | Mapper 118 |
| 5639 | |
| 5640 | Known Boards: TKSROM, TLSROM |
| 5641 | Games: Armadillo, Play Action Football, Pro Hockey, RPG |
| 5642 | Jinsei Game, Y's 3 |
| 5643 | |
| 5644 | In MESS: Supported. It also uses mapper4_irq. |
| 5645 | |
| 5646 | *************************************************************/ |
| 5647 | |
| 5648 | static void mapper118_set_mirror( void ) |
| 5649 | { |
| 5650 | if (mmc_cmd1 & 0x80) |
| 5651 | { |
| 5652 | set_nt_page(0, CIRAM, (vrom_bank[2] & 0x80) >> 7, 1); |
| 5653 | set_nt_page(1, CIRAM, (vrom_bank[3] & 0x80) >> 7, 1); |
| 5654 | set_nt_page(2, CIRAM, (vrom_bank[4] & 0x80) >> 7, 1); |
| 5655 | set_nt_page(3, CIRAM, (vrom_bank[5] & 0x80) >> 7, 1); |
| 5656 | } |
| 5657 | else |
| 5658 | { |
| 5659 | set_nt_page(0, CIRAM, (vrom_bank[0] & 0x80) >> 7, 1); |
| 5660 | set_nt_page(1, CIRAM, (vrom_bank[0] & 0x80) >> 7, 1); |
| 5661 | set_nt_page(2, CIRAM, (vrom_bank[1] & 0x80) >> 7, 1); |
| 5662 | set_nt_page(3, CIRAM, (vrom_bank[1] & 0x80) >> 7, 1); |
| 5663 | } |
| 5664 | } |
| 5665 | |
| 5666 | static WRITE8_HANDLER( mapper118_w ) |
| 5667 | { |
| 5668 | UINT8 MMC3_helper, cmd; |
| 5669 | LOG_MMC(("mapper118_w, offset: %04x, data: %02x\n", offset, data)); |
| 5670 | |
| 5671 | switch (offset & 0x6001) |
| 5672 | { |
| 5673 | case 0x0000: |
| 5674 | MMC3_helper = mmc_cmd1 ^ data; |
| 5675 | mmc_cmd1 = data; |
| 5676 | |
| 5677 | /* Has PRG Mode changed? */ |
| 5678 | if (MMC3_helper & 0x40) |
| 5679 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 5680 | |
| 5681 | /* Has CHR Mode changed? */ |
| 5682 | if (MMC3_helper & 0x80) |
| 5683 | { |
| 5684 | mapper118_set_mirror(); |
| 5685 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 5686 | } |
| 5687 | break; |
| 5688 | |
| 5689 | case 0x0001: |
| 5690 | cmd = mmc_cmd1 & 0x07; |
| 5691 | switch (cmd) |
| 5692 | { |
| 5693 | case 0: case 1: |
| 5694 | case 2: case 3: case 4: case 5: |
| 5695 | vrom_bank[cmd] = data; |
| 5696 | mapper118_set_mirror(); |
| 5697 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 5698 | break; |
| 5699 | case 6: |
| 5700 | case 7: |
| 5701 | prg_bank[cmd - 6] = data; |
| 5702 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 5703 | break; |
| 5704 | } |
| 5705 | break; |
| 5706 | |
| 5707 | case 0x2000: |
| 5708 | break; |
| 5709 | |
| 5710 | default: |
| 5711 | mapper4_w(space, offset, data); |
| 5712 | break; |
| 5713 | } |
| 5714 | } |
| 5715 | |
| 5716 | /************************************************************* |
| 5717 | |
| 5718 | Mapper 119 |
| 5719 | |
| 5720 | Known Boards: TQROM |
| 5721 | Games: Pin Bot, High Speed |
| 5722 | |
| 5723 | In MESS: Supported. It also uses mapper4_irq. |
| 5724 | |
| 5725 | *************************************************************/ |
| 5726 | |
| 5727 | static void mapper119_set_chr( running_machine *machine ) |
| 5728 | { |
| 5729 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 5730 | UINT8 chr_src[6], chr_mask[6]; |
| 5731 | int i; |
| 5732 | |
| 5733 | for (i = 0; i < 6; i++) |
| 5734 | { |
| 5735 | chr_src[i] = (vrom_bank[i] & 0x40) ? CHRRAM : CHRROM; |
| 5736 | chr_mask[i] = (vrom_bank[i] & 0x40) ? 0x07 : 0x3f; |
| 5737 | } |
| 5738 | |
| 5739 | chr1_x(machine, chr_page ^ 0, ((vrom_bank[0] & ~0x01) & chr_mask[0]), chr_src[0]); |
| 5740 | chr1_x(machine, chr_page ^ 1, ((vrom_bank[0] | 0x01) & chr_mask[0]), chr_src[0]); |
| 5741 | chr1_x(machine, chr_page ^ 2, ((vrom_bank[1] & ~0x01) & chr_mask[1]), chr_src[1]); |
| 5742 | chr1_x(machine, chr_page ^ 3, ((vrom_bank[1] | 0x01) & chr_mask[1]), chr_src[1]); |
| 5743 | chr1_x(machine, chr_page ^ 4, (vrom_bank[2] & chr_mask[2]), chr_src[2]); |
| 5744 | chr1_x(machine, chr_page ^ 5, (vrom_bank[3] & chr_mask[3]), chr_src[3]); |
| 5745 | chr1_x(machine, chr_page ^ 6, (vrom_bank[4] & chr_mask[4]), chr_src[4]); |
| 5746 | chr1_x(machine, chr_page ^ 7, (vrom_bank[5] & chr_mask[5]), chr_src[5]); |
| 5747 | } |
| 5748 | |
| 5749 | static WRITE8_HANDLER( mapper119_w ) |
| 5750 | { |
| 5751 | UINT8 MMC3_helper, cmd; |
| 5752 | LOG_MMC(("mapper119_w, offset: %04x, data: %02x\n", offset, data)); |
| 5753 | |
| 5754 | switch (offset & 0x6001) |
| 5755 | { |
| 5756 | case 0x0000: |
| 5757 | MMC3_helper = mmc_cmd1 ^ data; |
| 5758 | mmc_cmd1 = data; |
| 5759 | |
| 5760 | /* Has PRG Mode changed? */ |
| 5761 | if (MMC3_helper & 0x40) |
| 5762 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 5763 | |
| 5764 | /* Has CHR Mode changed? */ |
| 5765 | if (MMC3_helper & 0x80) |
| 5766 | mapper119_set_chr(space->machine); |
| 5767 | break; |
| 5768 | case 0x0001: /* $8001 */ |
| 5769 | cmd = mmc_cmd1 & 0x07; |
| 5770 | switch (cmd) |
| 5771 | { |
| 5772 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 5773 | case 2: case 3: case 4: case 5: |
| 5774 | vrom_bank[cmd] = data; |
| 5775 | mapper119_set_chr(space->machine); |
| 5776 | break; |
| 5777 | case 6: |
| 5778 | case 7: |
| 5779 | prg_bank[cmd - 6] = data; |
| 5780 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 5781 | break; |
| 5782 | } |
| 5783 | break; |
| 5784 | |
| 5785 | default: |
| 5786 | mapper4_w(space, offset, data); |
| 5787 | break; |
| 5788 | } |
| 5789 | } |
| 5790 | |
| 5791 | /************************************************************* |
| 5792 | |
| 5793 | Mapper 120 |
| 5794 | |
| 5795 | Known Boards: Unknown Bootleg Board |
| 5796 | Games: Tobidase Daisakusen (FDS Conversion) |
| 5797 | |
| 5798 | In MESS: Unsupported. |
| 5799 | |
| 5800 | *************************************************************/ |
| 5801 | |
| 5802 | /************************************************************* |
| 5803 | |
| 5804 | Mapper 121 |
| 5805 | |
| 5806 | Known Boards: Bootleg Board |
| 5807 | Games: The Panda Prince |
| 5808 | |
| 5809 | MMC3 clone |
| 5810 | |
| 5811 | In MESS: Supported. |
| 5812 | |
| 5813 | *************************************************************/ |
| 5814 | |
| 5815 | static WRITE8_HANDLER( mapper121_l_w ) |
| 5816 | { |
| 5817 | LOG_MMC(("mapper12_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 5818 | offset += 0x100; |
| 5819 | |
| 5820 | if (!(offset < 0x1000)) |
| 5821 | { |
| 5822 | switch (data & 0x03) |
| 5823 | { |
| 5824 | case 0x00: |
| 5825 | case 0x03: |
| 5826 | mapper121_reg[2] = 0x00; |
| 5827 | break; |
| 5828 | case 0x01: |
| 5829 | mapper121_reg[2] = 0x83; |
| 5830 | break; |
| 5831 | case 0x02: |
| 5832 | mapper121_reg[2] = 0x42; |
| 5833 | break; |
| 5834 | } |
| 5835 | } |
| 5836 | } |
| 5837 | |
| 5838 | static READ8_HANDLER( mapper121_l_r ) |
| 5839 | { |
| 5840 | LOG_MMC(("mapper12_l_r, offset: %04x\n", offset)); |
| 5841 | offset += 0x100; |
| 5842 | |
| 5843 | if (!(offset < 0x1000)) |
| 5844 | return mapper121_reg[2]; |
| 5845 | else |
| 5846 | return 0; |
| 5847 | } |
| 5848 | |
| 5849 | static void mapper121_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 5850 | { |
| 5851 | UINT8 prg_flip = (mmc_cmd1 & 0x40) ? 2 : 0; |
| 5852 | UINT8 new_bank2, new_bank3; |
| 5853 | |
| 5854 | new_bank2 = mapper121_reg[0] ? mapper121_reg[0] : prg_bank[2 ^ prg_flip]; |
| 5855 | new_bank3 = mapper121_reg[1] ? mapper121_reg[1] : prg_bank[3]; |
| 5856 | |
| 5857 | prg8_89(machine, prg_base | (prg_bank[0 ^ prg_flip] & prg_mask)); |
| 5858 | prg8_ab(machine, prg_base | (prg_bank[1] & prg_mask)); |
| 5859 | prg8_cd(machine, prg_base | (new_bank2 & prg_mask)); |
| 5860 | prg8_ef(machine, prg_base | (new_bank3 & prg_mask)); |
| 5861 | } |
| 5862 | |
| 5863 | static WRITE8_HANDLER( mapper121_w ) |
| 5864 | { |
| 5865 | UINT8 MMC3_helper, cmd; |
| 5866 | LOG_MMC(("mapper121_w, offset: %04x, data: %02x\n", offset, data)); |
| 5867 | |
| 5868 | if ((offset < 0x2000) && (offset & 0x03) == 0x03) |
| 5869 | { |
| 5870 | switch (data) |
| 5871 | { |
| 5872 | case 0x20: |
| 5873 | mapper121_reg[1] = 0x13; |
| 5874 | break; |
| 5875 | case 0x26: |
| 5876 | mapper121_reg[1] = 0x08; |
| 5877 | break; |
| 5878 | case 0x28: |
| 5879 | mapper121_reg[0] = 0x0c; |
| 5880 | break; |
| 5881 | case 0x29: |
| 5882 | mapper121_reg[1] = 0x1b; |
| 5883 | break; |
| 5884 | case 0xab: |
| 5885 | mapper121_reg[1] = 0x07; |
| 5886 | break; |
| 5887 | case 0xec: |
| 5888 | case 0xef: |
| 5889 | mapper121_reg[1] = 0x0d; |
| 5890 | break; |
| 5891 | case 0xff: |
| 5892 | mapper121_reg[1] = 0x09; |
| 5893 | break; |
| 5894 | default: |
| 5895 | mapper121_reg[0] = 0x0; |
| 5896 | mapper121_reg[1] = 0x0; |
| 5897 | break; |
| 5898 | } |
| 5899 | } |
| 5900 | else |
| 5901 | { |
| 5902 | switch (offset & 0x6001) |
| 5903 | { |
| 5904 | case 0x0000: |
| 5905 | MMC3_helper = mmc_cmd1 ^ data; |
| 5906 | mmc_cmd1 = data; |
| 5907 | |
| 5908 | /* Has PRG Mode changed? */ |
| 5909 | if (MMC3_helper & 0x40) |
| 5910 | mapper121_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 5911 | |
| 5912 | /* Has CHR Mode changed? */ |
| 5913 | if (MMC3_helper & 0x80) |
| 5914 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 5915 | break; |
| 5916 | |
| 5917 | case 0x0001: |
| 5918 | cmd = mmc_cmd1 & 0x07; |
| 5919 | switch (cmd) |
| 5920 | { |
| 5921 | case 0: case 1: |
| 5922 | case 2: case 3: case 4: case 5: |
| 5923 | vrom_bank[cmd] = data; |
| 5924 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 5925 | break; |
| 5926 | case 6: |
| 5927 | case 7: |
| 5928 | prg_bank[cmd - 6] = data; |
| 5929 | mapper121_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 5930 | break; |
| 5931 | } |
| 5932 | break; |
| 5933 | |
| 5934 | default: |
| 5935 | mapper4_w(space, offset, data); |
| 5936 | break; |
| 5937 | } |
| 5938 | } |
| 5939 | mapper121_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 5940 | } |
| 5941 | |
| 5942 | /************************************************************* |
| 5943 | |
| 5944 | Mapper 122 |
| 5945 | |
| 5946 | Known Boards: Undocumented / Unused ?!? |
| 5947 | Games: ---------- |
| 5948 | |
| 5949 | In MESS: ---------- |
| 5950 | |
| 5951 | *************************************************************/ |
| 5952 | |
| 5953 | /************************************************************* |
| 5954 | |
| 5955 | Mapper 123 |
| 5956 | |
| 5957 | Known Boards: Bootleg Board ??? |
| 5958 | Games: [no games in nes.hsi] |
| 5959 | |
| 5960 | In MESS: Unsupported. |
| 5961 | |
| 5962 | *************************************************************/ |
| 5963 | |
| 5964 | /************************************************************* |
| 5965 | |
| 5966 | Mapper 124 |
| 5967 | |
| 5968 | Known Boards: Undocumented / Unused ?!? |
| 5969 | Games: ---------- |
| 5970 | |
| 5971 | In MESS: ---------- |
| 5972 | |
| 5973 | *************************************************************/ |
| 5974 | |
| 5975 | /************************************************************* |
| 5976 | |
| 5977 | Mapper 125 |
| 5978 | |
| 5979 | Known Boards: Undocumented / Unused ?!? |
| 5980 | Games: ---------- |
| 5981 | |
| 5982 | In MESS: ---------- |
| 5983 | |
| 5984 | *************************************************************/ |
| 5985 | |
| 5986 | /************************************************************* |
| 5987 | |
| 5988 | Mapper 126 |
| 5989 | |
| 5990 | Known Boards: Unknown Multigame Bootleg Board |
| 5991 | Games: [no games in nes.hsi] |
| 5992 | |
| 5993 | In MESS: Unsupported. |
| 5994 | |
| 5995 | *************************************************************/ |
| 5996 | |
| 5997 | /************************************************************* |
| 5998 | |
| 5999 | Mapper 127 |
| 6000 | |
| 6001 | Known Boards: Undocumented / Unused ?!? |
| 6002 | Games: ---------- |
| 6003 | |
| 6004 | In MESS: ---------- |
| 6005 | |
| 6006 | *************************************************************/ |
| 6007 | |
| 6008 | /************************************************************* |
| 6009 | |
| 6010 | Mapper 128 |
| 6011 | |
| 6012 | Known Boards: Undocumented / Unused ?!? |
| 6013 | Games: ---------- |
| 6014 | |
| 6015 | In MESS: ---------- |
| 6016 | |
| 6017 | *************************************************************/ |
| 6018 | |
| 6019 | /************************************************************* |
| 6020 | |
| 6021 | Mapper 129 |
| 6022 | |
| 6023 | Known Boards: Undocumented / Unused ?!? |
| 6024 | Games: ---------- |
| 6025 | |
| 6026 | In MESS: ---------- |
| 6027 | |
| 6028 | *************************************************************/ |
| 6029 | |
| 6030 | /************************************************************* |
| 6031 | |
| 6032 | Mapper 130 |
| 6033 | |
| 6034 | Known Boards: Undocumented / Unused ?!? |
| 6035 | Games: ---------- |
| 6036 | |
| 6037 | In MESS: ---------- |
| 6038 | |
| 6039 | *************************************************************/ |
| 6040 | |
| 6041 | /************************************************************* |
| 6042 | |
| 6043 | Mapper 131 |
| 6044 | |
| 6045 | Known Boards: Undocumented / Unused ?!? |
| 6046 | Games: ---------- |
| 6047 | |
| 6048 | In MESS: ---------- |
| 6049 | |
| 6050 | *************************************************************/ |
| 6051 | |
| 6052 | /************************************************************* |
| 6053 | |
| 6054 | Mapper 132 |
| 6055 | |
| 6056 | Known Boards: Bootleg Board by TXC (T22211A) |
| 6057 | Games: Creatom |
| 6058 | |
| 6059 | Info from NEStopia: this mapper features write to four |
| 6060 | registers (0x4100-0x4103). The third one is used to select |
| 6061 | PRG and CHR banks. |
| 6062 | |
| 6063 | In MESS: Supported. |
| 6064 | |
| 6065 | *************************************************************/ |
| 6066 | |
| 6067 | static WRITE8_HANDLER( mapper132_l_w ) |
| 6068 | { |
| 6069 | LOG_MMC(("mapper132_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6070 | |
| 6071 | if (offset < 4) |
| 6072 | txc_reg[offset & 0x03] = data; |
| 6073 | } |
| 6074 | |
| 6075 | static READ8_HANDLER( mapper132_l_r ) |
| 6076 | { |
| 6077 | LOG_MMC(("mapper132_l_r, offset: %04x\n", offset)); |
| 6078 | |
| 6079 | if (offset == 0x0000) |
| 6080 | return (txc_reg[1] ^ txc_reg[2]) | 0x40; |
| 6081 | else |
| 6082 | return 0x00; |
| 6083 | } |
| 6084 | |
| 6085 | static WRITE8_HANDLER( mapper132_w ) |
| 6086 | { |
| 6087 | LOG_MMC(("mapper132_w, offset: %04x, data: %02x\n", offset, data)); |
| 6088 | |
| 6089 | prg32(space->machine, txc_reg[2] >> 2); |
| 6090 | chr8(space->machine, txc_reg[2], CHRROM); |
| 6091 | } |
| 6092 | |
| 6093 | /************************************************************* |
| 6094 | |
| 6095 | Mapper 133 |
| 6096 | |
| 6097 | Known Boards: Bootleg Board by Sachen (SA72008) |
| 6098 | Games: Jovial Race, Qi Wang |
| 6099 | |
| 6100 | In MESS: Supported. |
| 6101 | |
| 6102 | *************************************************************/ |
| 6103 | |
| 6104 | static WRITE8_HANDLER( mapper133_l_w ) |
| 6105 | { |
| 6106 | LOG_MMC(("mapper133_l_w %04x:%02x\n", offset, data)); |
| 6107 | |
| 6108 | prg32(space->machine, data >> 2); |
| 6109 | chr8(space->machine, data, CHRROM); |
| 6110 | } |
| 6111 | |
| 6112 | static WRITE8_HANDLER( mapper133_m_w ) |
| 6113 | { |
| 6114 | LOG_MMC(("mapper133_l_w %04x:%02x\n", offset, data)); |
| 6115 | |
| 6116 | mapper133_l_w(space, offset & 0xff, data); // offset does not really count for this mapper |
| 6117 | } |
| 6118 | |
| 6119 | /************************************************************* |
| 6120 | |
| 6121 | Mapper 134 |
| 6122 | |
| 6123 | Known Boards: Unknown Multigame Bootleg Board (4646B) |
| 6124 | Games: 2 in 1 - Family Kid & Aladdin 4 |
| 6125 | |
| 6126 | MMC3 clone |
| 6127 | |
| 6128 | In MESS: Supported. |
| 6129 | |
| 6130 | *************************************************************/ |
| 6131 | |
| 6132 | static WRITE8_HANDLER( mapper134_m_w ) |
| 6133 | { |
| 6134 | LOG_MMC(("mapper134_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6135 | |
| 6136 | if (offset == 0x01) |
| 6137 | { |
| 6138 | mmc_prg_base = (data & 0x02) << 4; |
| 6139 | mmc_prg_mask = 0x1f; |
| 6140 | mmc_chr_base = (data & 0x20) << 3; |
| 6141 | mmc_chr_mask = 0xff; |
| 6142 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 6143 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 6144 | } |
| 6145 | } |
| 6146 | |
| 6147 | /************************************************************* |
| 6148 | |
| 6149 | Mapper 135 |
| 6150 | |
| 6151 | Known Boards: Undocumented / Unused ?!? |
| 6152 | Games: ---------- |
| 6153 | |
| 6154 | In MESS: ---------- |
| 6155 | |
| 6156 | *************************************************************/ |
| 6157 | |
| 6158 | /************************************************************* |
| 6159 | |
| 6160 | Mapper 136 |
| 6161 | |
| 6162 | Known Boards: Bootleg Board by Sachen (TCU02) |
| 6163 | Games: Mei Loi Siu Ji |
| 6164 | |
| 6165 | In MESS: Supported. |
| 6166 | |
| 6167 | *************************************************************/ |
| 6168 | |
| 6169 | static WRITE8_HANDLER( mapper136_l_w ) |
| 6170 | { |
| 6171 | LOG_MMC(("mapper136_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6172 | |
| 6173 | if ((offset & 0x103) == 0x002) |
| 6174 | { |
| 6175 | mmc_cmd1 = (data & 0x30) | ((data + 3) & 0x0f); |
| 6176 | chr8(space->machine, mmc_cmd1, CHRROM); |
| 6177 | } |
| 6178 | } |
| 6179 | |
| 6180 | static READ8_HANDLER( mapper136_l_r ) |
| 6181 | { |
| 6182 | LOG_MMC(("mapper136_l_r, offset: %04x\n", offset)); |
| 6183 | |
| 6184 | if ((offset & 0x103) == 0x000) |
| 6185 | return mmc_cmd1 | 0x40; |
| 6186 | else |
| 6187 | return 0x00; |
| 6188 | } |
| 6189 | |
| 6190 | /************************************************************* |
| 6191 | |
| 6192 | Mapper 137 |
| 6193 | |
| 6194 | Known Boards: Bootleg Board by Sachen (8259D) |
| 6195 | Games: The Great Wall |
| 6196 | |
| 6197 | In MESS: Supported. |
| 6198 | |
| 6199 | *************************************************************/ |
| 6200 | |
| 6201 | static void sachen_set_mirror( UINT8 nt ) // used by mappers 137, 138, 139, 141 |
| 6202 | { |
| 6203 | switch (nt) |
| 6204 | { |
| 6205 | case 0: |
| 6206 | case 1: |
| 6207 | set_nt_mirroring(nt ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 6208 | break; |
| 6209 | case 2: |
| 6210 | set_nt_page(0, CIRAM, 0, 1); |
| 6211 | set_nt_page(1, CIRAM, 1, 1); |
| 6212 | set_nt_page(2, CIRAM, 1, 1); |
| 6213 | set_nt_page(3, CIRAM, 1, 1); |
| 6214 | break; |
| 6215 | case 3: |
| 6216 | set_nt_mirroring(PPU_MIRROR_LOW); |
| 6217 | break; |
| 6218 | default: |
| 6219 | LOG_MMC(("Mapper set NT to invalid value %02x", nt)); |
| 6220 | break; |
| 6221 | } |
| 6222 | } |
| 6223 | |
| 6224 | static WRITE8_HANDLER( mapper137_l_w ) |
| 6225 | { |
| 6226 | LOG_MMC(("mapper137_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6227 | |
| 6228 | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 6229 | if (!(offset & 0x100)) |
| 6230 | { |
| 6231 | if (!(offset & 0x01)) |
| 6232 | mmc_cmd1 = data & 0x07; |
| 6233 | else |
| 6234 | { |
| 6235 | sachen_reg[mmc_cmd1] = data; |
| 6236 | |
| 6237 | switch (mmc_cmd1) |
| 6238 | { |
| 6239 | case 0x05: |
| 6240 | prg32(space->machine, data); |
| 6241 | break; |
| 6242 | case 0x07: |
| 6243 | sachen_set_mirror((data & 0x01) ? 0 : (data >> 1) & 0x03); |
| 6244 | break; |
| 6245 | default: |
| 6246 | if (mmc_chr_source == CHRROM) |
| 6247 | { |
| 6248 | chr1_0(space->machine, (sachen_reg[0] & 0x07), CHRROM); |
| 6249 | chr1_1(space->machine, (sachen_reg[1] & 0x07) | (sachen_reg[4] << 4 & 0x10), CHRROM); |
| 6250 | chr1_2(space->machine, (sachen_reg[2] & 0x07) | (sachen_reg[4] << 3 & 0x10), CHRROM); |
| 6251 | chr1_3(space->machine, (sachen_reg[3] & 0x07) | (sachen_reg[4] << 2 & 0x10) | (sachen_reg[6] << 3 & 0x08), CHRROM); |
| 6252 | } |
| 6253 | break; |
| 6254 | } |
| 6255 | } |
| 6256 | } |
| 6257 | } |
| 6258 | |
| 6259 | static WRITE8_HANDLER( mapper137_m_w ) |
| 6260 | { |
| 6261 | LOG_MMC(("mapper137_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6262 | |
| 6263 | mapper137_l_w(space, (offset + 0x100) & 0xfff, data); |
| 6264 | } |
| 6265 | |
| 6266 | /************************************************************* |
| 6267 | |
| 6268 | Mapper 138 |
| 6269 | |
| 6270 | Known Boards: Bootleg Board by Sachen (8259B) |
| 6271 | Games: Silver Eagle |
| 6272 | |
| 6273 | In MESS: Supported. |
| 6274 | |
| 6275 | *************************************************************/ |
| 6276 | |
| 6277 | static WRITE8_HANDLER( mapper138_l_w ) |
| 6278 | { |
| 6279 | UINT8 bank_helper1 = 0, bank_helper2 = 0; |
| 6280 | LOG_MMC(("mapper138_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6281 | |
| 6282 | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 6283 | if (!(offset & 0x100)) |
| 6284 | { |
| 6285 | if (!(offset & 0x01)) |
| 6286 | mmc_cmd1 = data & 0x07; |
| 6287 | else |
| 6288 | { |
| 6289 | sachen_reg[mmc_cmd1] = data; |
| 6290 | |
| 6291 | switch (mmc_cmd1) |
| 6292 | { |
| 6293 | case 0x05: |
| 6294 | prg32(space->machine, data); |
| 6295 | break; |
| 6296 | case 0x07: |
| 6297 | sachen_set_mirror((data & 0x01) ? 0 : (data >> 1) & 0x03); |
| 6298 | break; |
| 6299 | default: |
| 6300 | if (mmc_chr_source == CHRROM) |
| 6301 | { |
| 6302 | bank_helper1 = sachen_reg[7] & 0x01; |
| 6303 | bank_helper2 = (sachen_reg[4] & 0x07) << 3; |
| 6304 | chr2_0(space->machine, ((sachen_reg[bank_helper1 ? 0 : 0] & 0x07) | bank_helper2), CHRROM); |
| 6305 | chr2_2(space->machine, ((sachen_reg[bank_helper1 ? 0 : 1] & 0x07) | bank_helper2), CHRROM); |
| 6306 | chr2_4(space->machine, ((sachen_reg[bank_helper1 ? 0 : 2] & 0x07) | bank_helper2), CHRROM); |
| 6307 | chr2_6(space->machine, ((sachen_reg[bank_helper1 ? 0 : 3] & 0x07) | bank_helper2), CHRROM); |
| 6308 | } |
| 6309 | break; |
| 6310 | } |
| 6311 | } |
| 6312 | } |
| 6313 | } |
| 6314 | |
| 6315 | static WRITE8_HANDLER( mapper138_m_w ) |
| 6316 | { |
| 6317 | LOG_MMC(("mapper138_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6318 | |
| 6319 | mapper138_l_w(space, (offset + 0x100) & 0xfff, data); |
| 6320 | } |
| 6321 | |
| 6322 | /************************************************************* |
| 6323 | |
| 6324 | Mapper 139 |
| 6325 | |
| 6326 | Known Boards: Bootleg Board by Sachen (8259C) |
| 6327 | Games: Final Combat, Hell Fighter, Mahjong Companion, |
| 6328 | |
| 6329 | In MESS: Supported. |
| 6330 | |
| 6331 | *************************************************************/ |
| 6332 | |
| 6333 | static WRITE8_HANDLER( mapper139_l_w ) |
| 6334 | { |
| 6335 | UINT8 bank_helper1 = 0, bank_helper2 = 0; |
| 6336 | LOG_MMC(("mapper139_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6337 | |
| 6338 | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 6339 | if (!(offset & 0x100)) |
| 6340 | { |
| 6341 | if (!(offset & 0x01)) |
| 6342 | mmc_cmd1 = data & 0x07; |
| 6343 | else |
| 6344 | { |
| 6345 | sachen_reg[mmc_cmd1] = data; |
| 6346 | |
| 6347 | switch (mmc_cmd1) |
| 6348 | { |
| 6349 | case 0x05: |
| 6350 | prg32(space->machine, data); |
| 6351 | break; |
| 6352 | case 0x07: |
| 6353 | sachen_set_mirror((data & 0x01) ? 0 : (data >> 1) & 0x03); |
| 6354 | break; |
| 6355 | default: |
| 6356 | if (mmc_chr_source == CHRROM) |
| 6357 | { |
| 6358 | bank_helper1 = sachen_reg[7] & 0x01; |
| 6359 | bank_helper2 = (sachen_reg[4] & 0x07) << 3; |
| 6360 | chr2_0(space->machine, ((sachen_reg[bank_helper1 ? 0 : 0] & 0x07) | bank_helper2) << 2, CHRROM); |
| 6361 | chr2_2(space->machine, ((sachen_reg[bank_helper1 ? 0 : 1] & 0x07) | bank_helper2) << 2 | 0x01, CHRROM); |
| 6362 | chr2_4(space->machine, ((sachen_reg[bank_helper1 ? 0 : 2] & 0x07) | bank_helper2) << 2 | 0x02, CHRROM) ; |
| 6363 | chr2_6(space->machine, ((sachen_reg[bank_helper1 ? 0 : 3] & 0x07) | bank_helper2) << 2 | 0x03, CHRROM); |
| 6364 | } |
| 6365 | break; |
| 6366 | } |
| 6367 | } |
| 6368 | } |
| 6369 | } |
| 6370 | |
| 6371 | static WRITE8_HANDLER( mapper139_m_w ) |
| 6372 | { |
| 6373 | LOG_MMC(("mapper139_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6374 | |
| 6375 | mapper139_l_w(space, (offset + 0x100) & 0xfff, data); |
| 6376 | } |
| 6377 | |
| 6378 | /************************************************************* |
| 6379 | |
| 6380 | Mapper 140 |
| 6381 | |
| 6382 | Known Boards: Jaleco JF11, JF12, JF14 |
| 6383 | Games: Bio Senshi Dan, Mississippi Satsujin Jiken |
| 6384 | |
| 6385 | Writes to 0x6000-0x7fff set both prg32 and chr8 banks |
| 6386 | |
| 6387 | In MESS: Supported. |
| 6388 | |
| 6389 | *************************************************************/ |
| 6390 | |
| 6391 | static WRITE8_HANDLER( mapper_140_m_w ) |
| 6392 | { |
| 6393 | chr8(space->machine, data & 0x0f, CHRROM); |
| 6394 | prg32(space->machine, (data >> 4) & 0x03); |
| 6395 | } |
| 6396 | |
| 6397 | /************************************************************* |
| 6398 | |
| 6399 | Mapper 141 |
| 6400 | |
| 6401 | Known Boards: Bootleg Board by Sachen (8259A) |
| 6402 | Games: Po Po Team, Poker Mahjong, Q Boy, Rockball, |
| 6403 | Super Cartridge (several versions), Super Pang (1 & 2) |
| 6404 | |
| 6405 | In MESS: Supported. |
| 6406 | |
| 6407 | *************************************************************/ |
| 6408 | |
| 6409 | static WRITE8_HANDLER( mapper141_l_w ) |
| 6410 | { |
| 6411 | UINT8 bank_helper1 = 0, bank_helper2 = 0; |
| 6412 | LOG_MMC(("mapper141_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6413 | |
| 6414 | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 6415 | if (!(offset & 0x100)) |
| 6416 | { |
| 6417 | if (!(offset & 0x01)) |
| 6418 | mmc_cmd1 = data & 0x07; |
| 6419 | else |
| 6420 | { |
| 6421 | sachen_reg[mmc_cmd1] = data; |
| 6422 | |
| 6423 | switch (mmc_cmd1) |
| 6424 | { |
| 6425 | case 0x05: |
| 6426 | prg32(space->machine, data); |
| 6427 | break; |
| 6428 | case 0x07: |
| 6429 | sachen_set_mirror((data & 0x01) ? 0 : (data >> 1) & 0x03); |
| 6430 | break; |
| 6431 | default: |
| 6432 | if (mmc_chr_source == CHRROM) |
| 6433 | { |
| 6434 | bank_helper1 = sachen_reg[7] & 0x01; |
| 6435 | bank_helper2 = (sachen_reg[4] & 0x07) << 3; |
| 6436 | chr2_0(space->machine, ((sachen_reg[bank_helper1 ? 0 : 0] & 0x07) | bank_helper2) << 1, mmc_chr_source); |
| 6437 | chr2_2(space->machine, ((sachen_reg[bank_helper1 ? 0 : 1] & 0x07) | bank_helper2) << 1 | 0x01, mmc_chr_source); |
| 6438 | chr2_4(space->machine, ((sachen_reg[bank_helper1 ? 0 : 2] & 0x07) | bank_helper2) << 1, mmc_chr_source); |
| 6439 | chr2_6(space->machine, ((sachen_reg[bank_helper1 ? 0 : 3] & 0x07) | bank_helper2) << 1 | 0x01, mmc_chr_source); |
| 6440 | } |
| 6441 | break; |
| 6442 | } |
| 6443 | } |
| 6444 | } |
| 6445 | } |
| 6446 | |
| 6447 | static WRITE8_HANDLER( mapper141_m_w ) |
| 6448 | { |
| 6449 | LOG_MMC(("mapper141_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6450 | |
| 6451 | mapper141_l_w(space, (offset + 0x100) & 0xfff, data); |
| 6452 | } |
| 6453 | |
| 6454 | /************************************************************* |
| 6455 | |
| 6456 | Mapper 142 |
| 6457 | |
| 6458 | Known Boards: Bootleg Board by Kaiser (KS7032) |
| 6459 | Games: Super Mario Bros. 2 (by Kaiser), Pipe 5 (by Sachen?) |
| 6460 | |
| 6461 | In MESS: Unsupported. Requires reads from 0x6000-0x7fff. |
| 6462 | |
| 6463 | *************************************************************/ |
| 6464 | |
| 6465 | /************************************************************* |
| 6466 | |
| 6467 | Mapper 143 |
| 6468 | |
| 6469 | Known Boards: Bootleg Board by Sachen (TCA01) |
| 6470 | Games: Dancing Blocks, Magic Mathematic |
| 6471 | |
| 6472 | In MESS: Supported. |
| 6473 | |
| 6474 | *************************************************************/ |
| 6475 | |
| 6476 | static READ8_HANDLER( mapper143_l_r ) |
| 6477 | { |
| 6478 | LOG_MMC(("mapper143_l_r, offset: %04x\n", offset)); |
| 6479 | |
| 6480 | /* the address is read only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 6481 | if (!(offset & 0x100)) |
| 6482 | return (~offset & 0x3f) | 0x40; |
| 6483 | else |
| 6484 | return 0x00; |
| 6485 | } |
| 6486 | |
| 6487 | /************************************************************* |
| 6488 | |
| 6489 | Mapper 144 |
| 6490 | |
| 6491 | Known Boards: Bootleg Board by AGCI (50282) |
| 6492 | Games: Death Race |
| 6493 | |
| 6494 | Just like mapper 11, except bit 0 taken from ROM and 0x8000 |
| 6495 | ignored? |
| 6496 | |
| 6497 | In MESS: Supported. |
| 6498 | |
| 6499 | *************************************************************/ |
| 6500 | |
| 6501 | static WRITE8_HANDLER( mapper144_w ) |
| 6502 | { |
| 6503 | LOG_MMC(("mapper144_w, offset: %04x, data: %02x\n", offset, data)); |
| 6504 | |
| 6505 | if ((offset & 0x7fff) == 0) |
| 6506 | return; |
| 6507 | |
| 6508 | data = data | (memory_read_byte(space, offset) & 1); |
| 6509 | |
| 6510 | chr8(space->machine, data >> 4, CHRROM); |
| 6511 | prg32(space->machine, data & 0x07); |
| 6512 | } |
| 6513 | |
| 6514 | /************************************************************* |
| 6515 | |
| 6516 | Mapper 145 |
| 6517 | |
| 6518 | Known Boards: Bootleg Board by Sachen (SA72007) |
| 6519 | Games: Sidewinder |
| 6520 | |
| 6521 | Simple mapper: writes to 0x4100 set chr8 banks. |
| 6522 | |
| 6523 | In MESS: Supported. |
| 6524 | |
| 6525 | *************************************************************/ |
| 6526 | |
| 6527 | static WRITE8_HANDLER( mapper145_l_w ) |
| 6528 | { |
| 6529 | LOG_MMC(("mapper145_l_w %04x:%02x\n", offset, data)); |
| 6530 | |
| 6531 | /* only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 6532 | if (!(offset & 0x100)) |
| 6533 | chr8(space->machine, data >> 7, CHRROM); |
| 6534 | } |
| 6535 | |
| 6536 | /************************************************************* |
| 6537 | |
| 6538 | Mapper 146 |
| 6539 | |
| 6540 | Known Boards: Bootleg Board by Sachen (SA0161M) |
| 6541 | Games: Galactic Crusader, Lucky 777, Metal Fighter, |
| 6542 | Millionaire, Pyramid II |
| 6543 | |
| 6544 | This is basically the same as Nina-006 (Mapper 79) |
| 6545 | |
| 6546 | In MESS: Supported. It shares the handler with mapper 79 |
| 6547 | |
| 6548 | *************************************************************/ |
| 6549 | |
| 6550 | /************************************************************* |
| 6551 | |
| 6552 | Mapper 147 |
| 6553 | |
| 6554 | Known Boards: Bootleg Board by Sachen (TCU01) |
| 6555 | Games: Challenge of the Dragon, Chinese Kungfu |
| 6556 | |
| 6557 | Simple mapper: writes to 0x4102 set pgr32 and chr8 banks. |
| 6558 | |
| 6559 | In MESS: Supported. |
| 6560 | |
| 6561 | *************************************************************/ |
| 6562 | |
| 6563 | static WRITE8_HANDLER( mapper147_l_w ) |
| 6564 | { |
| 6565 | LOG_MMC(("mapper147_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6566 | |
| 6567 | if ((offset & 0x103) == 0x002) |
| 6568 | { |
| 6569 | prg32(space->machine, ((data >> 6) & 0x02) | ((data >> 2) & 0x01)); |
| 6570 | chr8(space->machine, data >> 3, CHRROM); |
| 6571 | } |
| 6572 | } |
| 6573 | |
| 6574 | static WRITE8_HANDLER( mapper147_m_w ) |
| 6575 | { |
| 6576 | LOG_MMC(("mapper147_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6577 | |
| 6578 | mapper147_l_w(space, (offset + 0x100) & 0xfff, data); |
| 6579 | } |
| 6580 | |
| 6581 | static WRITE8_HANDLER( mapper147_w ) |
| 6582 | { |
| 6583 | LOG_MMC(("mapper147_w, offset: %04x, data: %02x\n", offset, data)); |
| 6584 | |
| 6585 | mapper147_l_w(space, (offset + 0x100) & 0xfff, data); |
| 6586 | } |
| 6587 | |
| 6588 | /************************************************************* |
| 6589 | |
| 6590 | Mapper 148 |
| 6591 | |
| 6592 | Known Boards: Bootleg Board by Sachen (SA0037) |
| 6593 | Games: Mahjong World, Shisen Mahjong |
| 6594 | |
| 6595 | Very simple mapper: writes to 0x8000-0xffff set pgr32 and chr8 |
| 6596 | banks |
| 6597 | |
| 6598 | In MESS: Supported. |
| 6599 | |
| 6600 | *************************************************************/ |
| 6601 | |
| 6602 | static WRITE8_HANDLER( mapper148_w ) |
| 6603 | { |
| 6604 | LOG_MMC(("mapper148_w, offset: %04x, data: %02x\n", offset, data)); |
| 6605 | |
| 6606 | prg32(space->machine, data >> 3 & 0x01); |
| 6607 | chr8(space->machine, data & 0x07, CHRROM); |
| 6608 | } |
| 6609 | |
| 6610 | /************************************************************* |
| 6611 | |
| 6612 | Mapper 149 |
| 6613 | |
| 6614 | Known Boards: Bootleg Board by Sachen (SA0036) |
| 6615 | Games: Taiwan Mahjong 16 |
| 6616 | |
| 6617 | Very simple mapper: writes to 0x8000-0xffff set chr8 banks |
| 6618 | |
| 6619 | In MESS: Supported. |
| 6620 | |
| 6621 | *************************************************************/ |
| 6622 | |
| 6623 | static WRITE8_HANDLER( mapper149_w ) |
| 6624 | { |
| 6625 | LOG_MMC(("mapper149_w, offset: %04x, data: %02x\n", offset, data)); |
| 6626 | |
| 6627 | chr8(space->machine, data >> 7, CHRROM); |
| 6628 | } |
| 6629 | |
| 6630 | /************************************************************* |
| 6631 | |
| 6632 | Mapper 150 |
| 6633 | |
| 6634 | Known Boards: Bootleg Board by Sachen (74SL374B) |
| 6635 | Games: Chess Academy, Chinese Checkers Jpn, Mahjong Academy, |
| 6636 | Olympic IQ, Poker II, Tasac |
| 6637 | |
| 6638 | In MESS: Supported. |
| 6639 | |
| 6640 | *************************************************************/ |
| 6641 | |
| 6642 | static WRITE8_HANDLER( mapper150_l_w ) |
| 6643 | { |
| 6644 | LOG_MMC(("mapper150_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6645 | |
| 6646 | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 6647 | if (!(offset & 0x100)) |
| 6648 | { |
| 6649 | if (!(offset & 0x01)) |
| 6650 | mmc_cmd1 = data & 0x07; |
| 6651 | else |
| 6652 | { |
| 6653 | switch (mmc_cmd1) |
| 6654 | { |
| 6655 | case 0x02: |
| 6656 | vrom_bank[0] = (vrom_bank[0] & ~0x08) | ((data << 3) & 0x08); |
| 6657 | chr8(space->machine, vrom_bank[0], CHRROM); |
| 6658 | prg32(space->machine, data & 0x01); |
| 6659 | break; |
| 6660 | case 0x04: |
| 6661 | vrom_bank[0] = (vrom_bank[0] & ~0x04) | ((data << 2) & 0x04); |
| 6662 | chr8(space->machine, vrom_bank[0], CHRROM); |
| 6663 | break; |
| 6664 | case 0x05: |
| 6665 | prg32(space->machine, data & 0x07); |
| 6666 | break; |
| 6667 | case 0x06: |
| 6668 | vrom_bank[0] = (vrom_bank[0] & ~0x03) | (data << 0 & 0x03); |
| 6669 | chr8(space->machine, vrom_bank[0], CHRROM); |
| 6670 | break; |
| 6671 | case 0x07: |
| 6672 | sachen_set_mirror((data >> 1) & 0x03); |
| 6673 | break; |
| 6674 | default: |
| 6675 | break; |
| 6676 | } |
| 6677 | } |
| 6678 | } |
| 6679 | } |
| 6680 | |
| 6681 | static READ8_HANDLER( mapper150_l_r ) |
| 6682 | { |
| 6683 | LOG_MMC(("mapper150_l_r, offset: %04x", offset)); |
| 6684 | |
| 6685 | /* read happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 6686 | if (!(offset & 0x100)) |
| 6687 | return (~mmc_cmd1 & 0x3f) /* ^ dips*/; // we would need to check the Dips here |
| 6688 | else |
| 6689 | return 0; |
| 6690 | } |
| 6691 | |
| 6692 | static WRITE8_HANDLER( mapper150_m_w ) |
| 6693 | { |
| 6694 | LOG_MMC(("mapper150_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6695 | |
| 6696 | mapper150_l_w(space, (offset + 0x100) & 0xfff, data); |
| 6697 | } |
| 6698 | |
| 6699 | /************************************************************* |
| 6700 | |
| 6701 | Mapper 151 |
| 6702 | |
| 6703 | Known Boards: Konami VS System |
| 6704 | Games: Goonies VS, VS TKO Boxing |
| 6705 | |
| 6706 | In MESS: Unsupported, low priority (you should use MAME) |
| 6707 | |
| 6708 | *************************************************************/ |
| 6709 | |
| 6710 | /************************************************************* |
| 6711 | |
| 6712 | Mapper 152 |
| 6713 | |
| 6714 | Known Boards: Discrete Logic Mapper |
| 6715 | Games: Arkanoid 2, Gegege no Kitarou 2, Pocket Zaurus |
| 6716 | |
| 6717 | In MESS: Supported. |
| 6718 | |
| 6719 | *************************************************************/ |
| 6720 | |
| 6721 | static WRITE8_HANDLER( mapper152_w ) |
| 6722 | { |
| 6723 | LOG_MMC(("mapper152_w, offset: %04x, data: %02x\n", offset, data)); |
| 6724 | |
| 6725 | // we lack bus emulation |
| 6726 | set_nt_mirroring((data & 0x80) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 6727 | prg16_89ab(space->machine, (data >> 4) & 0x07); |
| 6728 | chr8(space->machine, data, CHRROM); |
| 6729 | } |
| 6730 | |
| 6731 | /************************************************************* |
| 6732 | |
| 6733 | Mapper 153 |
| 6734 | |
| 6735 | Known Boards: Bandai Board |
| 6736 | Games: Dragon Ball, Dragon Ball 3, Famicom Jump, Famicom |
| 6737 | Jump II |
| 6738 | |
| 6739 | This mapper should be exactly like Mapper 16, but with |
| 6740 | SRAM in place of EEPROM. Hence, writes to 0x6000-0x7fff |
| 6741 | go to SRAM (not sure if there exist boards with no SRAM |
| 6742 | and no EEPROM... investigate!) |
| 6743 | Famicom Jump II uses a different board (or uses the same |
| 6744 | board in a very different way) |
| 6745 | |
| 6746 | In MESS: Supported. |
| 6747 | |
| 6748 | *************************************************************/ |
| 6749 | |
| 6750 | static void mapper153_set_prg( running_machine *machine ) |
| 6751 | { |
| 6752 | UINT8 mmc_helper = 0; |
| 6753 | int i; |
| 6754 | |
| 6755 | for (i = 0; i < 8; i++) |
| 6756 | mmc_helper |= ((map153_reg[i] & 0x01) << 4); |
| 6757 | |
| 6758 | map153_bank_latch = mmc_helper | (map153_bank_latch & 0x0f); |
| 6759 | |
| 6760 | prg16_89ab(machine, map153_bank_latch); |
| 6761 | prg16_cdef(machine, mmc_helper | 0x0f); |
| 6762 | } |
| 6763 | |
| 6764 | static WRITE8_HANDLER( mapper153_m_w ) |
| 6765 | { |
| 6766 | LOG_MMC(("mapper153_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 6767 | |
| 6768 | if (nes.crc_hack) // Famicom Jump II uses a different board |
| 6769 | { |
| 6770 | switch (offset & 0x0f) // there is no CHRROM and prg banking works differently |
| 6771 | { |
| 6772 | case 0: case 1: |
| 6773 | case 2: case 3: |
| 6774 | case 4: case 5: |
| 6775 | case 6: case 7: |
| 6776 | map153_reg[offset & 0x07] = data; |
| 6777 | mapper153_set_prg(space->machine); |
| 6778 | break; |
| 6779 | case 8: |
| 6780 | map153_bank_latch = (data & 0x0f) | (map153_bank_latch & 0x10); |
| 6781 | prg16_89ab(space->machine, map153_bank_latch); |
| 6782 | break; |
| 6783 | default: |
| 6784 | mapper16_m_w(space, offset & 0x0f, data); |
| 6785 | break; |
| 6786 | } |
| 6787 | } |
| 6788 | else |
| 6789 | mapper16_m_w(space, offset, data); |
| 6790 | } |
| 6791 | |
| 6792 | static WRITE8_HANDLER( mapper153_w ) |
| 6793 | { |
| 6794 | LOG_MMC(("mapper153_w, offset: %04x, data: %02x\n", offset, data)); |
| 6795 | |
| 6796 | mapper153_m_w(space, offset, data); |
| 6797 | } |
| 6798 | |
| 6799 | /************************************************************* |
| 6800 | |
| 6801 | Mapper 154 |
| 6802 | |
| 6803 | Known Boards: Namcot 34xx |
| 6804 | Games: Devil Man |
| 6805 | |
| 6806 | Acts like mapper 88, but writes to 0x8000 set NT mirroring |
| 6807 | |
| 6808 | In MESS: Supported. |
| 6809 | |
| 6810 | *************************************************************/ |
| 6811 | |
| 6812 | static WRITE8_HANDLER( mapper154_w ) |
| 6813 | { |
| 6814 | LOG_MMC(("mapper154_w, offset: %04x, data: %02x\n", offset, data)); |
| 6815 | switch (offset & 1) |
| 6816 | { |
| 6817 | case 0: |
| 6818 | set_nt_mirroring((data & 0x40) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW); |
| 6819 | mmc_cmd1 = data & 7; |
| 6820 | break; |
| 6821 | case 1: |
| 6822 | switch (mmc_cmd1) |
| 6823 | { |
| 6824 | case 0: chr2_0(space->machine, data >> 1, CHRROM); break; |
| 6825 | case 1: chr2_2(space->machine, data >> 1, CHRROM); break; |
| 6826 | case 2: chr1_4(space->machine, data | 0x40, CHRROM); break; |
| 6827 | case 3: chr1_5(space->machine, data | 0x40, CHRROM); break; |
| 6828 | case 4: chr1_6(space->machine, data | 0x40, CHRROM); break; |
| 6829 | case 5: chr1_7(space->machine, data | 0x40, CHRROM); break; |
| 6830 | case 6: prg8_89(space->machine, data); break; |
| 6831 | case 7: prg8_ab(space->machine, data); break; |
| 6832 | } |
| 6833 | break; |
| 6834 | } |
| 6835 | } |
| 6836 | |
| 6837 | /************************************************************* |
| 6838 | |
| 6839 | Mapper 155 |
| 6840 | |
| 6841 | Known Boards: SKROM |
| 6842 | Games: Tatakae!! Rahmen Man - Sakuretsu Choujin 102 Gei |
| 6843 | |
| 6844 | This is basically MMC1 with a different way to handle WRAM |
| 6845 | (this difference is not emulated yet, since we don't fully |
| 6846 | emulate WRAM in MMC1 either) |
| 6847 | |
| 6848 | In MESS: Supported (as complete as MMC1). |
| 6849 | |
| 6850 | *************************************************************/ |
| 6851 | |
| 6852 | /************************************************************* |
| 6853 | |
| 6854 | Mapper 156 |
| 6855 | |
| 6856 | Known Boards: Bootleg Board by Open Corp (DAOU306) |
| 6857 | Games: Metal Force (K)? |
| 6858 | |
| 6859 | In MESS: Supported. |
| 6860 | |
| 6861 | *************************************************************/ |
| 6862 | |
| 6863 | static WRITE8_HANDLER( mapper156_w ) |
| 6864 | { |
| 6865 | LOG_MMC(("mapper156_w, offset: %04x, data: %02x\n", offset, data)); |
| 6866 | |
| 6867 | switch (offset) |
| 6868 | { |
| 6869 | case 0x4000: |
| 6870 | chr1_0(space->machine, data, CHRROM); |
| 6871 | break; |
| 6872 | case 0x4001: |
| 6873 | chr1_1(space->machine, data, CHRROM); |
| 6874 | break; |
| 6875 | case 0x4002: |
| 6876 | chr1_2(space->machine, data, CHRROM); |
| 6877 | break; |
| 6878 | case 0x4003: |
| 6879 | chr1_3(space->machine, data, CHRROM); |
| 6880 | break; |
| 6881 | case 0x4008: |
| 6882 | chr1_4(space->machine, data, CHRROM); |
| 6883 | break; |
| 6884 | case 0x4009: |
| 6885 | chr1_5(space->machine, data, CHRROM); |
| 6886 | break; |
| 6887 | case 0x400a: |
| 6888 | chr1_6(space->machine, data, CHRROM); |
| 6889 | break; |
| 6890 | case 0x400b: |
| 6891 | chr1_7(space->machine, data, CHRROM); |
| 6892 | break; |
| 6893 | case 0x4010: |
| 6894 | prg16_89ab(space->machine, data); |
| 6895 | break; |
| 6896 | } |
| 6897 | } |
| 6898 | |
| 6899 | /************************************************************* |
| 6900 | |
| 6901 | Mapper 157 |
| 6902 | |
| 6903 | Known Boards: Bandai Datach Board |
| 6904 | Games: Datach Games |
| 6905 | |
| 6906 | This mapper is basically Mapper 16 + Datach reader. We |
| 6907 | currently do not support the Barcode reader. |
| 6908 | |
| 6909 | In MESS: Partially supported. Needs reads from 0x6000-0x7fff |
| 6910 | for the Datach barcode reader |
| 6911 | |
| 6912 | *************************************************************/ |
| 6913 | |
| 6914 | /************************************************************* |
| 6915 | |
| 6916 | Mapper 158 |
| 6917 | |
| 6918 | Known Boards: Tengen 800037 |
| 6919 | Games: Alien Syndrome |
| 6920 | |
| 6921 | In MESS: Very preliminary support. |
| 6922 | |
| 6923 | *************************************************************/ |
| 6924 | |
| 6925 | // probably wrong... |
| 6926 | static void mapper158_set_mirror( running_machine *machine ) |
| 6927 | { |
| 6928 | UINT8 nt_mode = mmc_cmd1 & 0x80; |
| 6929 | |
| 6930 | set_nt_page(0, ROM, vrom_bank[nt_mode ? 2 : 0], 0); |
| 6931 | set_nt_page(1, ROM, vrom_bank[nt_mode ? 3 : 0], 0); |
| 6932 | set_nt_page(2, ROM, vrom_bank[nt_mode ? 4 : 1], 0); |
| 6933 | set_nt_page(3, ROM, vrom_bank[nt_mode ? 5 : 1], 0); |
| 6934 | } |
| 6935 | |
| 6936 | static WRITE8_HANDLER( mapper158_w ) |
| 6937 | { |
| 6938 | UINT8 map158_helper, cmd; |
| 6939 | LOG_MMC(("mapper158_w offset: %04x, data: %02x\n", offset, data)); |
| 6940 | |
| 6941 | switch (offset & 0x6001) |
| 6942 | { |
| 6943 | case 0x0000: |
| 6944 | map158_helper = mmc_cmd1 ^ data; |
| 6945 | mmc_cmd1 = data; |
| 6946 | |
| 6947 | /* Has PRG Mode changed? */ |
| 6948 | if (map158_helper & 0x40) |
| 6949 | mapper64_set_prg(space->machine); |
| 6950 | |
| 6951 | /* Has CHR Mode changed? */ |
| 6952 | if (map158_helper & 0xa0) |
| 6953 | { |
| 6954 | mapper64_set_chr(space->machine); |
| 6955 | mapper158_set_mirror(space->machine); |
| 6956 | } |
| 6957 | break; |
| 6958 | |
| 6959 | case 0x0001: |
| 6960 | cmd = mmc_cmd1 & 0x0f; |
| 6961 | switch (cmd) |
| 6962 | { |
| 6963 | case 0: case 1: |
| 6964 | case 2: case 3: |
| 6965 | case 4: case 5: |
| 6966 | vrom_bank[cmd] = data; |
| 6967 | mapper64_set_chr(space->machine); |
| 6968 | mapper158_set_mirror(space->machine); |
| 6969 | break; |
| 6970 | case 6: case 7: |
| 6971 | prg_bank[cmd - 6] = data; |
| 6972 | mapper64_set_prg(space->machine); |
| 6973 | break; |
| 6974 | case 8: case 9: |
| 6975 | vrom_bank[cmd - 2] = data; |
| 6976 | mapper64_set_chr(space->machine); |
| 6977 | mapper158_set_mirror(space->machine); |
| 6978 | break; |
| 6979 | case 0x0f: |
| 6980 | prg_bank[2] = data; |
| 6981 | mapper64_set_prg(space->machine); |
| 6982 | break; |
| 6983 | } |
| 6984 | break; |
| 6985 | |
| 6986 | case 0x2000: |
| 6987 | break; |
| 6988 | |
| 6989 | default: |
| 6990 | mapper64_w(space, offset, data); |
| 6991 | break; |
| 6992 | } |
| 6993 | } |
| 6994 | |
| 6995 | /************************************************************* |
| 6996 | |
| 6997 | Mapper 159 |
| 6998 | |
| 6999 | Known Boards: Bandai Board |
| 7000 | Games: Dragon Ball Z, Magical Taruruuto-kun, SD Gundam Gaiden |
| 7001 | |
| 7002 | This is exactly like Mapper 16, but with different EEPROM I/O. |
| 7003 | At the moment we don't support EEPROM in either mapper. |
| 7004 | |
| 7005 | In MESS: Supported. |
| 7006 | |
| 7007 | *************************************************************/ |
| 7008 | |
| 7009 | /************************************************************* |
| 7010 | |
| 7011 | Mapper 160 |
| 7012 | |
| 7013 | Known Boards: Undocumented / Unused ?!? |
| 7014 | Games: ---------- |
| 7015 | |
| 7016 | In MESS: ---------- |
| 7017 | |
| 7018 | *************************************************************/ |
| 7019 | |
| 7020 | /************************************************************* |
| 7021 | |
| 7022 | Mapper 161 |
| 7023 | |
| 7024 | Known Boards: Undocumented / Unused ?!? |
| 7025 | Games: ---------- |
| 7026 | |
| 7027 | In MESS: ---------- |
| 7028 | |
| 7029 | *************************************************************/ |
| 7030 | |
| 7031 | /************************************************************* |
| 7032 | |
| 7033 | Mapper 162 |
| 7034 | |
| 7035 | Known Boards: Undocumented / Unused ?!? |
| 7036 | Games: ---------- |
| 7037 | |
| 7038 | In MESS: ---------- |
| 7039 | |
| 7040 | *************************************************************/ |
| 7041 | |
| 7042 | /************************************************************* |
| 7043 | |
| 7044 | Mapper 163 |
| 7045 | |
| 7046 | Known Boards: Bootleg Board by Nanjing |
| 7047 | Games: Diablo, Final Fantasy VII, Harvest Moon, He Xin Wei |
| 7048 | Ji, Yu-Gi-Oh, Zelda - Shen Qi De Mao Zi and other |
| 7049 | |
| 7050 | In MESS: Unsupported. |
| 7051 | |
| 7052 | *************************************************************/ |
| 7053 | |
| 7054 | /************************************************************* |
| 7055 | |
| 7056 | Mapper 164 |
| 7057 | |
| 7058 | Known Boards: Bootleg Board by Waixing |
| 7059 | Games: Darkseed, Digital Dragon, Final Fantasy V, Pocket |
| 7060 | Monster Red |
| 7061 | |
| 7062 | In MESS: Supported. |
| 7063 | |
| 7064 | *************************************************************/ |
| 7065 | |
| 7066 | static WRITE8_HANDLER( mapper164_l_w ) |
| 7067 | { |
| 7068 | LOG_MMC(("mapper164_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7069 | offset += 0x4100; /* the checks work better on addresses */ |
| 7070 | |
| 7071 | if (0x5000 == (offset & 0x7300)) |
| 7072 | prg32(space->machine, data); |
| 7073 | } |
| 7074 | |
| 7075 | static WRITE8_HANDLER( mapper164_w ) |
| 7076 | { |
| 7077 | LOG_MMC(("mapper164_w, offset: %04x, data: %02x\n", offset, data)); |
| 7078 | if ((offset & 0x7300) == 0x5000) |
| 7079 | prg32(space->machine, data); |
| 7080 | } |
| 7081 | |
| 7082 | /************************************************************* |
| 7083 | |
| 7084 | Mapper 165 |
| 7085 | |
| 7086 | Known Boards: Bootleg Board by Waixing |
| 7087 | Games: Fire Emblem (C), Fire Emblem Gaiden (C) |
| 7088 | |
| 7089 | MMC3 clone |
| 7090 | |
| 7091 | In MESS: Unsupported. |
| 7092 | |
| 7093 | *************************************************************/ |
| 7094 | |
| 7095 | /************************************************************* |
| 7096 | |
| 7097 | Mapper 166 |
| 7098 | |
| 7099 | Known Boards: Bootleg Board by Subor (Type 1) |
| 7100 | Games: Subor v1.0 (R) |
| 7101 | |
| 7102 | In MESS: Supported. |
| 7103 | |
| 7104 | *************************************************************/ |
| 7105 | |
| 7106 | static WRITE8_HANDLER( mapper166_w ) |
| 7107 | { |
| 7108 | UINT8 map166_helper1, map166_helper2; |
| 7109 | LOG_MMC(("mapper166_w, offset: %04x, data: %02x\n", offset, data)); |
| 7110 | |
| 7111 | subor_reg[(offset >> 13) & 0x03] = data; |
| 7112 | map166_helper1 = ((subor_reg[0] ^ subor_reg[1]) << 1) & 0x20; |
| 7113 | map166_helper2 = ((subor_reg[2] ^ subor_reg[3]) << 0) & 0x1f; |
| 7114 | |
| 7115 | if (subor_reg[1] & 0x08) |
| 7116 | { |
| 7117 | map166_helper1 += map166_helper2 & 0xfe; |
| 7118 | map166_helper2 = map166_helper1; |
| 7119 | map166_helper2 += 1; |
| 7120 | } |
| 7121 | else if (subor_reg[1] & 0x04) |
| 7122 | { |
| 7123 | map166_helper2 += map166_helper1; |
| 7124 | map166_helper1 = 0x1f; |
| 7125 | } |
| 7126 | else |
| 7127 | { |
| 7128 | map166_helper1 += map166_helper2; |
| 7129 | map166_helper2 = 0x07; |
| 7130 | } |
| 7131 | |
| 7132 | prg16_89ab(space->machine, map166_helper1); |
| 7133 | prg16_cdef(space->machine, map166_helper2); |
| 7134 | } |
| 7135 | |
| 7136 | /************************************************************* |
| 7137 | |
| 7138 | Mapper 167 |
| 7139 | |
| 7140 | Known Boards: Bootleg Board by Subor (Type 0) |
| 7141 | Games: Subor v4.0 (C), English Word Blaster |
| 7142 | |
| 7143 | Basically the same as 166, except for the initial prg |
| 7144 | bank and a couple of bits in the choice of prg banks |
| 7145 | |
| 7146 | In MESS: Supported. |
| 7147 | |
| 7148 | *************************************************************/ |
| 7149 | |
| 7150 | static WRITE8_HANDLER( mapper167_w ) |
| 7151 | { |
| 7152 | UINT8 map167_helper1, map167_helper2; |
| 7153 | LOG_MMC(("mapper167_w, offset: %04x, data: %02x\n", offset, data)); |
| 7154 | |
| 7155 | subor_reg[(offset >> 13) & 0x03] = data; |
| 7156 | map167_helper1 = ((subor_reg[0] ^ subor_reg[1]) << 1) & 0x20; |
| 7157 | map167_helper2 = ((subor_reg[2] ^ subor_reg[3]) << 0) & 0x1f; |
| 7158 | |
| 7159 | if (subor_reg[1] & 0x08) |
| 7160 | { |
| 7161 | map167_helper1 += map167_helper2 & 0xfe; |
| 7162 | map167_helper2 = map167_helper1; |
| 7163 | map167_helper1 += 1; |
| 7164 | } |
| 7165 | else if (subor_reg[1] & 0x04) |
| 7166 | { |
| 7167 | map167_helper2 += map167_helper1; |
| 7168 | map167_helper1 = 0x1f; |
| 7169 | } |
| 7170 | else |
| 7171 | { |
| 7172 | map167_helper1 += map167_helper2; |
| 7173 | map167_helper2 = 0x20; |
| 7174 | } |
| 7175 | |
| 7176 | prg16_89ab(space->machine, map167_helper1); |
| 7177 | prg16_cdef(space->machine, map167_helper2); |
| 7178 | } |
| 7179 | |
| 7180 | /************************************************************* |
| 7181 | |
| 7182 | Mapper 168 |
| 7183 | |
| 7184 | Known Boards: ??? |
| 7185 | Games: Racermate Challenger II |
| 7186 | |
| 7187 | No info at all are available. |
| 7188 | |
| 7189 | In MESS: Unsupported. |
| 7190 | |
| 7191 | *************************************************************/ |
| 7192 | |
| 7193 | /************************************************************* |
| 7194 | |
| 7195 | Mapper 169 |
| 7196 | |
| 7197 | Known Boards: Undocumented / Unused ?!? |
| 7198 | Games: ---------- |
| 7199 | |
| 7200 | In MESS: ---------- |
| 7201 | |
| 7202 | *************************************************************/ |
| 7203 | |
| 7204 | /************************************************************* |
| 7205 | |
| 7206 | Mapper 170 |
| 7207 | |
| 7208 | Known Boards: Bootleg Board by Fujiya |
| 7209 | Games: [no games in nes.hsi] |
| 7210 | |
| 7211 | In MESS: Unsupported. |
| 7212 | |
| 7213 | *************************************************************/ |
| 7214 | |
| 7215 | /************************************************************* |
| 7216 | |
| 7217 | Mapper 171 |
| 7218 | |
| 7219 | Known Boards: Bootleg Board by Kaiser (KS7058) |
| 7220 | Games: Tui Do Woo Ma Jeung |
| 7221 | |
| 7222 | Writes to 0xf000-0xffff set 4k chr banks. Namely, if |
| 7223 | offset&0x80 is 0 the lower 4k are set, if it is 1 the |
| 7224 | upper 4k are set. |
| 7225 | |
| 7226 | In MESS: Supported. |
| 7227 | |
| 7228 | *************************************************************/ |
| 7229 | |
| 7230 | static WRITE8_HANDLER( mapper171_w ) |
| 7231 | { |
| 7232 | LOG_MMC(("mapper171_w, offset: %04x, data: %02x\n", offset, data)); |
| 7233 | |
| 7234 | switch (offset & 0x7080) |
| 7235 | { |
| 7236 | case 0x7000: |
| 7237 | chr4_0(space->machine, data, CHRROM); |
| 7238 | break; |
| 7239 | case 0x7080: |
| 7240 | chr4_4(space->machine, data, CHRROM); |
| 7241 | break; |
| 7242 | } |
| 7243 | } |
| 7244 | |
| 7245 | /************************************************************* |
| 7246 | |
| 7247 | Mapper 172 |
| 7248 | |
| 7249 | Known Boards: Bootleg Board by TXC (T22211B) |
| 7250 | Games: 1991 Du Ma Racing |
| 7251 | |
| 7252 | This mapper is basically the same as 132. Only difference is |
| 7253 | in the way CHR banks are selected (see below) |
| 7254 | |
| 7255 | In MESS: Supported. It shares low handlers with board T22211A |
| 7256 | (mapper 132) |
| 7257 | |
| 7258 | *************************************************************/ |
| 7259 | |
| 7260 | static WRITE8_HANDLER( mapper172_w ) |
| 7261 | { |
| 7262 | LOG_MMC(("mapper172_w, offset: %04x, data: %02x\n", offset, data)); |
| 7263 | |
| 7264 | prg32(space->machine, txc_reg[2] >> 2); |
| 7265 | chr8(space->machine, (((data ^ txc_reg[2]) >> 3) & 0x02) | (((data ^ txc_reg[2]) >> 5) & 0x01), CHRROM); |
| 7266 | } |
| 7267 | |
| 7268 | /************************************************************* |
| 7269 | |
| 7270 | Mapper 173 |
| 7271 | |
| 7272 | Known Boards: Bootleg Board by TXC (T22211C) |
| 7273 | Games: Mahjong Block, Xiao Ma Li |
| 7274 | |
| 7275 | This mapper is basically the same as 132 too. Only difference is |
| 7276 | in 0x4100 reads which expect also bit 0 to be set |
| 7277 | |
| 7278 | In MESS: Supported. It shares write handlers with board T22211A |
| 7279 | (mapper 132) |
| 7280 | |
| 7281 | *************************************************************/ |
| 7282 | |
| 7283 | static READ8_HANDLER( mapper173_l_r ) |
| 7284 | { |
| 7285 | LOG_MMC(("mapper173_l_r, offset: %04x\n", offset)); |
| 7286 | |
| 7287 | if (offset == 0x0000) |
| 7288 | return (txc_reg[1] ^ txc_reg[2]) | 0x41; |
| 7289 | else |
| 7290 | return 0x00; |
| 7291 | } |
| 7292 | |
| 7293 | /************************************************************* |
| 7294 | |
| 7295 | Mapper 174 |
| 7296 | |
| 7297 | Known Boards: Undocumented / Unused ?!? |
| 7298 | Games: ---------- |
| 7299 | |
| 7300 | In MESS: ---------- |
| 7301 | |
| 7302 | *************************************************************/ |
| 7303 | |
| 7304 | /************************************************************* |
| 7305 | |
| 7306 | Mapper 175 |
| 7307 | |
| 7308 | Known Boards: Bootleg Board by Kaiser (KS7022) |
| 7309 | Games: 15 in 1 |
| 7310 | |
| 7311 | In MESS: Unsupported. Requires reads from 0xfffc (according to |
| 7312 | NEStopia). |
| 7313 | |
| 7314 | *************************************************************/ |
| 7315 | |
| 7316 | /************************************************************* |
| 7317 | |
| 7318 | Mapper 176 |
| 7319 | |
| 7320 | Known Boards: Unknown Bootleg Board |
| 7321 | Games: Shu Qi Yu - Zhi Li Xiao Zhuan Yuan |
| 7322 | |
| 7323 | Very simple mapper: writes to 0x5ff1 set prg32 (to data>>1), |
| 7324 | while writes to 0x5ff2 set chr8 |
| 7325 | |
| 7326 | In MESS: Supported. |
| 7327 | |
| 7328 | *************************************************************/ |
| 7329 | |
| 7330 | static WRITE8_HANDLER( mapper176_l_w ) |
| 7331 | { |
| 7332 | LOG_MMC(("mapper176_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7333 | |
| 7334 | switch (offset) |
| 7335 | { |
| 7336 | case 0x1ef1: /* 0x5ff1 */ |
| 7337 | prg32(space->machine, data >> 1); |
| 7338 | break; |
| 7339 | case 0x1ef2: /* 0x5ff2 */ |
| 7340 | chr8(space->machine, data, CHRROM); |
| 7341 | break; |
| 7342 | } |
| 7343 | } |
| 7344 | |
| 7345 | /************************************************************* |
| 7346 | |
| 7347 | Mapper 177 |
| 7348 | |
| 7349 | Known Boards: Bootleg Board by Henggedianzi |
| 7350 | Games: Mei Guo Fu Hao, Shang Gu Shen Jian , Wang Zi Fu |
| 7351 | Chou Ji, Xing He Zhan Shi |
| 7352 | |
| 7353 | Writes to 0x8000-0xffff set prg32. Moreover, data&0x20 sets |
| 7354 | NT mirroring. |
| 7355 | |
| 7356 | In MESS: Supported. |
| 7357 | |
| 7358 | *************************************************************/ |
| 7359 | |
| 7360 | static WRITE8_HANDLER( mapper177_w ) |
| 7361 | { |
| 7362 | LOG_MMC(("mapper177_w, offset: %04x, data: %02x\n", offset, data)); |
| 7363 | |
| 7364 | prg32(space->machine, data); |
| 7365 | set_nt_mirroring(((data & 0x20) >> 5) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 7366 | } |
| 7367 | |
| 7368 | /************************************************************* |
| 7369 | |
| 7370 | Mapper 178 |
| 7371 | |
| 7372 | Known Boards: Bootleg Board by Waixing |
| 7373 | Games: Fan Kong Jing Ying, San Guo Zhong Lie Zhuan, Xing |
| 7374 | Ji Zheng Ba |
| 7375 | |
| 7376 | In MESS: Supported. |
| 7377 | |
| 7378 | *************************************************************/ |
| 7379 | |
| 7380 | static WRITE8_HANDLER( mapper178_l_w ) |
| 7381 | { |
| 7382 | LOG_MMC(("mapper178_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7383 | |
| 7384 | switch (offset) |
| 7385 | { |
| 7386 | case 0x700: |
| 7387 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 7388 | break; |
| 7389 | case 0x701: |
| 7390 | mmc_cmd1 = (mmc_cmd1 & 0x0c) | ((data >> 1) & 0x03); |
| 7391 | prg32(space->machine, mmc_cmd1); |
| 7392 | break; |
| 7393 | case 0x702: |
| 7394 | mmc_cmd1 = (mmc_cmd1 & 0x03) | ((data << 2) & 0x0c); |
| 7395 | break; |
| 7396 | } |
| 7397 | } |
| 7398 | |
| 7399 | /************************************************************* |
| 7400 | |
| 7401 | Mapper 179 |
| 7402 | |
| 7403 | Known Boards: Bootleg Board by Henggedianzi |
| 7404 | Games: Xing He Zhan Shi |
| 7405 | |
| 7406 | Writes to 0x5000-0x5fff set prg32 banks, writes to 0x8000- |
| 7407 | 0xffff set NT mirroring |
| 7408 | |
| 7409 | In MESS: Supported. |
| 7410 | |
| 7411 | *************************************************************/ |
| 7412 | |
| 7413 | static WRITE8_HANDLER( mapper179_l_w ) |
| 7414 | { |
| 7415 | LOG_MMC(("mapper179_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7416 | offset += 0x4100; |
| 7417 | |
| 7418 | if (offset & 0x5000) |
| 7419 | prg32(space->machine, data >> 1); |
| 7420 | } |
| 7421 | |
| 7422 | static WRITE8_HANDLER( mapper179_w ) |
| 7423 | { |
| 7424 | LOG_MMC(("mapper179_w, offset: %04x, data: %02x\n", offset, data)); |
| 7425 | |
| 7426 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 7427 | } |
| 7428 | |
| 7429 | /************************************************************* |
| 7430 | |
| 7431 | Mapper 180 |
| 7432 | |
| 7433 | Known Boards: Nihon Bussan UNROM |
| 7434 | Games: Crazy Climber Jpn |
| 7435 | |
| 7436 | Very simple mapper: prg16_89ab is always set to bank 0, |
| 7437 | while prg16_cdef is set by writes to 0x8000-0xffff. The game |
| 7438 | uses a custim controller. |
| 7439 | |
| 7440 | In MESS: Supported. |
| 7441 | |
| 7442 | *************************************************************/ |
| 7443 | |
| 7444 | static WRITE8_HANDLER( mapper180_w ) |
| 7445 | { |
| 7446 | LOG_MMC(("mapper180_w, offset: %04x, data: %02x\n", offset, data)); |
| 7447 | |
| 7448 | prg16_cdef(space->machine, data & 0x07); |
| 7449 | } |
| 7450 | |
| 7451 | /************************************************************* |
| 7452 | |
| 7453 | Mapper 181 |
| 7454 | |
| 7455 | Known Boards: Undocumented / Unused ?!? |
| 7456 | Games: ---------- |
| 7457 | |
| 7458 | In MESS: ---------- |
| 7459 | |
| 7460 | *************************************************************/ |
| 7461 | |
| 7462 | /************************************************************* |
| 7463 | |
| 7464 | Mapper 182 |
| 7465 | |
| 7466 | Known Boards: Bootleg Board by Hosenkan |
| 7467 | Games: Pocahontas, Super Donkey Kong |
| 7468 | |
| 7469 | In MESS: Supported. |
| 7470 | |
| 7471 | *************************************************************/ |
| 7472 | |
| 7473 | static WRITE8_HANDLER( mapper182_w ) |
| 7474 | { |
| 7475 | LOG_MMC(("mapper182_w, offset: %04x, data: %02x\n", offset, data)); |
| 7476 | |
| 7477 | switch (offset & 0x7003) |
| 7478 | { |
| 7479 | case 0x0001: |
| 7480 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 7481 | break; |
| 7482 | case 0x2000: |
| 7483 | mmc_cmd1 = data; |
| 7484 | break; |
| 7485 | case 0x4000: |
| 7486 | switch (mmc_cmd1) |
| 7487 | { |
| 7488 | case 0: |
| 7489 | chr2_0(space->machine, data >> 1, CHRROM); |
| 7490 | break; |
| 7491 | case 1: |
| 7492 | chr1_5(space->machine, data, CHRROM); |
| 7493 | break; |
| 7494 | case 2: |
| 7495 | chr2_2(space->machine, data >> 1, CHRROM); |
| 7496 | break; |
| 7497 | case 3: |
| 7498 | chr1_7(space->machine, data, CHRROM); |
| 7499 | break; |
| 7500 | case 4: |
| 7501 | prg8_89(space->machine, data); |
| 7502 | break; |
| 7503 | case 5: |
| 7504 | prg8_ab(space->machine, data); |
| 7505 | break; |
| 7506 | case 6: |
| 7507 | chr1_4(space->machine, data, CHRROM); |
| 7508 | break; |
| 7509 | case 7: |
| 7510 | chr1_6(space->machine, data, CHRROM); |
| 7511 | break; |
| 7512 | } |
| 7513 | break; |
| 7514 | case 0x6003: |
| 7515 | if (data) |
| 7516 | { |
| 7517 | IRQ_count = data; |
| 7518 | IRQ_enable = 1; |
| 7519 | } |
| 7520 | else |
| 7521 | IRQ_enable = 0; |
| 7522 | break; |
| 7523 | } |
| 7524 | } |
| 7525 | |
| 7526 | /************************************************************* |
| 7527 | |
| 7528 | Mapper 183 |
| 7529 | |
| 7530 | Known Boards: Unknown Bootleg Board |
| 7531 | Games: Shui Guan Pipe |
| 7532 | |
| 7533 | In MESS: Unsupported. |
| 7534 | |
| 7535 | *************************************************************/ |
| 7536 | |
| 7537 | /************************************************************* |
| 7538 | |
| 7539 | Mapper 184 |
| 7540 | |
| 7541 | Known Boards: Sunsoft 1 |
| 7542 | Games: Atlantis no Nazo, Kanshakudama Nage Kantarou no |
| 7543 | Toukaidou Gojuusan Tsugi, Wing of Madoola |
| 7544 | |
| 7545 | Very simple mapper: writes to 0x6000-0x7fff set chr banks |
| 7546 | (lower bits set chr4_0, higher ones set chr4_4) |
| 7547 | |
| 7548 | In MESS: Supported. |
| 7549 | |
| 7550 | *************************************************************/ |
| 7551 | |
| 7552 | static WRITE8_HANDLER( mapper184_m_w ) |
| 7553 | { |
| 7554 | LOG_MMC(("mapper184_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 7555 | |
| 7556 | chr4_0(space->machine, data & 0x0f, CHRROM); |
| 7557 | chr4_4(space->machine, data >> 4, CHRROM); |
| 7558 | } |
| 7559 | |
| 7560 | /************************************************************* |
| 7561 | |
| 7562 | Mapper 185 |
| 7563 | |
| 7564 | Known Boards: CNROM |
| 7565 | Games: B-Wings, Mighty Bomb Jack, Seicross, Spy vs. Spy |
| 7566 | |
| 7567 | In MESS: Very Preliminar Support. We act like it is mapper 3 |
| 7568 | but we need to emulate the read back from 0x8000-0xfff! |
| 7569 | |
| 7570 | *************************************************************/ |
| 7571 | |
| 7572 | static WRITE8_HANDLER( mapper185_w ) |
| 7573 | { |
| 7574 | LOG_MMC(("mapper3_w offset: %04x, data: %02x\n", offset, data)); |
| 7575 | |
| 7576 | chr8(space->machine, data, CHRROM); |
| 7577 | } |
| 7578 | |
| 7579 | /************************************************************* |
| 7580 | |
| 7581 | Mapper 186 |
| 7582 | |
| 7583 | Known Boards: Bootleg Board by Fukutake |
| 7584 | Games: Study Box |
| 7585 | |
| 7586 | In MESS: Unsupported. Needs reads from 0x6000-0x7fff. |
| 7587 | |
| 7588 | *************************************************************/ |
| 7589 | |
| 7590 | /************************************************************* |
| 7591 | |
| 7592 | Mapper 187 |
| 7593 | |
| 7594 | Known Boards: Unknown Bootleg Board |
| 7595 | Games: The King of Fighters 96, Sonic 3D Blast 6, Street |
| 7596 | Fighter Zero 2 |
| 7597 | |
| 7598 | MMC3 clone |
| 7599 | |
| 7600 | In MESS: Preliminary Support. |
| 7601 | |
| 7602 | *************************************************************/ |
| 7603 | |
| 7604 | static void mapper187_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 7605 | { |
| 7606 | UINT8 prg_flip = (mmc_cmd1 & 0x40) ? 2 : 0; |
| 7607 | |
| 7608 | if (!(mapper187_reg[0] & 0x80)) |
| 7609 | { |
| 7610 | prg8_89(machine, prg_base | (prg_bank[0 ^ prg_flip] & prg_mask)); |
| 7611 | prg8_ab(machine, prg_base | (prg_bank[1] & prg_mask)); |
| 7612 | prg8_cd(machine, prg_base | (prg_bank[2 ^ prg_flip] & prg_mask)); |
| 7613 | prg8_ef(machine, prg_base | (prg_bank[3] & prg_mask)); |
| 7614 | } |
| 7615 | } |
| 7616 | |
| 7617 | static void mapper187_set_chr( running_machine *machine, UINT8 chr, int chr_base, int chr_mask ) |
| 7618 | { |
| 7619 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 7620 | UINT8 new_base[8]; |
| 7621 | int i; |
| 7622 | |
| 7623 | for (i = 0; i < 8; i++) |
| 7624 | new_base[i] = ((i & 0x04) == chr_page)? (chr_base | 0x100) : chr_base; |
| 7625 | |
| 7626 | chr1_x(machine, chr_page ^ 0, new_base[0] | ((vrom_bank[0] & ~0x01) & chr_mask), chr); |
| 7627 | chr1_x(machine, chr_page ^ 1, new_base[1] | ((vrom_bank[0] | 0x01) & chr_mask), chr); |
| 7628 | chr1_x(machine, chr_page ^ 2, new_base[2] | ((vrom_bank[1] & ~0x01) & chr_mask), chr); |
| 7629 | chr1_x(machine, chr_page ^ 3, new_base[3] | ((vrom_bank[1] | 0x01) & chr_mask), chr); |
| 7630 | chr1_x(machine, chr_page ^ 4, new_base[4] | (vrom_bank[2] & chr_mask), chr); |
| 7631 | chr1_x(machine, chr_page ^ 5, new_base[5] | (vrom_bank[3] & chr_mask), chr); |
| 7632 | chr1_x(machine, chr_page ^ 6, new_base[6] | (vrom_bank[4] & chr_mask), chr); |
| 7633 | chr1_x(machine, chr_page ^ 7, new_base[7] | (vrom_bank[5] & chr_mask), chr); |
| 7634 | } |
| 7635 | |
| 7636 | static WRITE8_HANDLER( mapper187_l_w ) |
| 7637 | { |
| 7638 | UINT8 new_bank; |
| 7639 | LOG_MMC(("mapper187_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7640 | offset += 0x100; |
| 7641 | |
| 7642 | if (offset == 0x1000) |
| 7643 | { |
| 7644 | switch (data & 0x03) |
| 7645 | { |
| 7646 | case 0x00: |
| 7647 | case 0x01: |
| 7648 | mapper187_reg[1] = 0x83; |
| 7649 | break; |
| 7650 | case 0x02: |
| 7651 | mapper187_reg[1] = 0x42; |
| 7652 | break; |
| 7653 | case 0x03: |
| 7654 | mapper187_reg[1] = 0x00; |
| 7655 | break; |
| 7656 | } |
| 7657 | } |
| 7658 | |
| 7659 | if (!(offset <= 0x1000)) |
| 7660 | { |
| 7661 | mapper187_reg[0] = data; |
| 7662 | |
| 7663 | if (mapper187_reg[0] & 0x80) |
| 7664 | { |
| 7665 | new_bank = (mapper187_reg[0] & 0x1f); |
| 7666 | |
| 7667 | if (mapper187_reg[0] & 0x20) |
| 7668 | prg32(space->machine, new_bank >> 2); |
| 7669 | else |
| 7670 | { |
| 7671 | prg16_89ab(space->machine, new_bank); |
| 7672 | prg16_cdef(space->machine, new_bank); |
| 7673 | } |
| 7674 | } |
| 7675 | else |
| 7676 | mapper187_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 7677 | } |
| 7678 | } |
| 7679 | |
| 7680 | static READ8_HANDLER( mapper187_l_r ) |
| 7681 | { |
| 7682 | LOG_MMC(("mapper187_l_r, offset: %04x\n", offset)); |
| 7683 | offset += 0x100; |
| 7684 | |
| 7685 | if (!(offset < 0x1000)) |
| 7686 | return mapper187_reg[1]; |
| 7687 | else |
| 7688 | return 0; |
| 7689 | } |
| 7690 | |
| 7691 | static WRITE8_HANDLER( mapper187_w ) |
| 7692 | { |
| 7693 | UINT8 MMC3_helper, cmd; |
| 7694 | LOG_MMC(("mapper187_w, offset: %04x, data: %02x\n", offset, data)); |
| 7695 | |
| 7696 | switch (offset & 0x6003) |
| 7697 | { |
| 7698 | case 0x0000: |
| 7699 | mapper187_reg[2] = 1; |
| 7700 | MMC3_helper = mmc_cmd1 ^ data; |
| 7701 | mmc_cmd1 = data; |
| 7702 | |
| 7703 | /* Has PRG Mode changed? */ |
| 7704 | if (MMC3_helper & 0x40) |
| 7705 | mapper187_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 7706 | |
| 7707 | /* Has CHR Mode changed? */ |
| 7708 | if (MMC3_helper & 0x80) |
| 7709 | mapper187_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 7710 | break; |
| 7711 | |
| 7712 | case 0x0001: |
| 7713 | if (mapper187_reg[2]) |
| 7714 | { |
| 7715 | cmd = mmc_cmd1 & 0x07; |
| 7716 | switch (cmd) |
| 7717 | { |
| 7718 | case 0: case 1: |
| 7719 | case 2: case 3: case 4: case 5: |
| 7720 | vrom_bank[cmd] = data; |
| 7721 | mapper187_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 7722 | break; |
| 7723 | case 6: |
| 7724 | case 7: |
| 7725 | prg_bank[cmd - 6] = data; |
| 7726 | mapper187_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 7727 | break; |
| 7728 | } |
| 7729 | } |
| 7730 | break; |
| 7731 | |
| 7732 | case 0x0002: |
| 7733 | break; |
| 7734 | |
| 7735 | case 0x0003: |
| 7736 | mapper187_reg[2] = 0; |
| 7737 | |
| 7738 | if (data == 0x28) |
| 7739 | prg8_cd(space->machine, 0x17); |
| 7740 | else if (data == 0x2a) |
| 7741 | prg8_ab(space->machine, 0x0f); |
| 7742 | break; |
| 7743 | |
| 7744 | default: |
| 7745 | mapper4_w(space, offset, data); |
| 7746 | break; |
| 7747 | } |
| 7748 | } |
| 7749 | |
| 7750 | /************************************************************* |
| 7751 | |
| 7752 | Mapper 188 |
| 7753 | |
| 7754 | Known Boards: Bandai Karaoke Board |
| 7755 | Games: Karaoke Studio |
| 7756 | |
| 7757 | In MESS: Partially Supported (missing mic support) |
| 7758 | |
| 7759 | *************************************************************/ |
| 7760 | |
| 7761 | static WRITE8_HANDLER( mapper188_w ) |
| 7762 | { |
| 7763 | LOG_MMC(("mapper188_w, offset: %04x, data: %02x\n", offset, data)); |
| 7764 | |
| 7765 | prg16_89ab(space->machine, data ^ 0x08); |
| 7766 | } |
| 7767 | |
| 7768 | /************************************************************* |
| 7769 | |
| 7770 | Mapper 189 |
| 7771 | |
| 7772 | Known Boards: Bootleg Board by TXC |
| 7773 | Games: Master Fighter II, Master Fighter 3, Thunder Warrior |
| 7774 | |
| 7775 | MMC3 clone |
| 7776 | |
| 7777 | In MESS: Supported. |
| 7778 | |
| 7779 | *************************************************************/ |
| 7780 | |
| 7781 | static WRITE8_HANDLER( mapper189_l_w ) |
| 7782 | { |
| 7783 | LOG_MMC(("mapper189_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 7784 | |
| 7785 | prg32(space->machine, (data >> 4) | data); |
| 7786 | } |
| 7787 | |
| 7788 | static WRITE8_HANDLER( mapper189_m_w ) |
| 7789 | { |
| 7790 | LOG_MMC(("mapper189_m_w, offset: %04x, data: %04x\n", offset, data)); |
| 7791 | |
| 7792 | mapper189_l_w(space, offset & 0xff, data); // offset does not really count for this mapper |
| 7793 | } |
| 7794 | |
| 7795 | /* This is like mapper4 but with no PRG bankswitch (beacuse it is handled by low writes) */ |
| 7796 | static WRITE8_HANDLER( mapper189_w ) |
| 7797 | { |
| 7798 | UINT8 MMC3_helper, cmd; |
| 7799 | LOG_MMC(("mapper189_w, offset: %04x, data: %02x\n", offset, data)); |
| 7800 | |
| 7801 | switch (offset & 0x6001) |
| 7802 | { |
| 7803 | case 0x0000: |
| 7804 | MMC3_helper = mmc_cmd1 ^ data; |
| 7805 | mmc_cmd1 = data; |
| 7806 | |
| 7807 | /* Has CHR Mode changed? */ |
| 7808 | if (MMC3_helper & 0x80) |
| 7809 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 7810 | break; |
| 7811 | |
| 7812 | case 0x0001: |
| 7813 | cmd = mmc_cmd1 & 0x07; |
| 7814 | switch (cmd) |
| 7815 | { |
| 7816 | case 0: case 1: |
| 7817 | case 2: case 3: case 4: case 5: |
| 7818 | vrom_bank[cmd] = data; |
| 7819 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 7820 | break; |
| 7821 | } |
| 7822 | break; |
| 7823 | |
| 7824 | default: |
| 7825 | mapper4_w(space, offset, data); |
| 7826 | break; |
| 7827 | } |
| 7828 | } |
| 7829 | |
| 7830 | /************************************************************* |
| 7831 | |
| 7832 | Mapper 190 |
| 7833 | |
| 7834 | Known Boards: Undocumented / Unused ?!? |
| 7835 | Games: ---------- |
| 7836 | |
| 7837 | In MESS: ---------- |
| 7838 | |
| 7839 | *************************************************************/ |
| 7840 | |
| 7841 | /************************************************************* |
| 7842 | |
| 7843 | Mapper 191 |
| 7844 | |
| 7845 | Known Boards: Type B by Waixing |
| 7846 | Games: Sugoro Quest (C) |
| 7847 | |
| 7848 | MMC3 clone. This is a minor modification of Mapper 74, |
| 7849 | in the sense that it is the same board except for the |
| 7850 | CHRRAM pages. |
| 7851 | |
| 7852 | In MESS: Supported. |
| 7853 | |
| 7854 | *************************************************************/ |
| 7855 | |
| 7856 | static void mapper191_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 7857 | { |
| 7858 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 7859 | UINT8 chr_src[6]; |
| 7860 | int i; |
| 7861 | |
| 7862 | for (i = 0; i < 6; i++) |
| 7863 | chr_src[i] = (vrom_bank[i] & 0x80) ? CHRRAM : CHRROM; |
| 7864 | |
| 7865 | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 7866 | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 7867 | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| 7868 | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr_src[1]); |
| 7869 | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr_src[2]); |
| 7870 | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr_src[3]); |
| 7871 | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr_src[4]); |
| 7872 | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr_src[5]); |
| 7873 | } |
| 7874 | |
| 7875 | static WRITE8_HANDLER( mapper191_w ) |
| 7876 | { |
| 7877 | UINT8 MMC3_helper, cmd; |
| 7878 | LOG_MMC(("mapper191_w, offset: %04x, data: %02x\n", offset, data)); |
| 7879 | |
| 7880 | switch (offset & 0x6001) |
| 7881 | { |
| 7882 | case 0x0000: |
| 7883 | MMC3_helper = mmc_cmd1 ^ data; |
| 7884 | mmc_cmd1 = data; |
| 7885 | |
| 7886 | /* Has PRG Mode changed? */ |
| 7887 | if (MMC3_helper & 0x40) |
| 7888 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 7889 | |
| 7890 | /* Has CHR Mode changed? */ |
| 7891 | if (MMC3_helper & 0x80) |
| 7892 | mapper191_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 7893 | break; |
| 7894 | |
| 7895 | case 0x0001: |
| 7896 | cmd = mmc_cmd1 & 0x07; |
| 7897 | switch (cmd) |
| 7898 | { |
| 7899 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 7900 | case 2: case 3: case 4: case 5: |
| 7901 | vrom_bank[cmd] = data; |
| 7902 | mapper191_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 7903 | break; |
| 7904 | case 6: |
| 7905 | case 7: |
| 7906 | prg_bank[cmd - 6] = data; |
| 7907 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 7908 | break; |
| 7909 | } |
| 7910 | break; |
| 7911 | |
| 7912 | default: |
| 7913 | mapper74_w(space, offset, data); |
| 7914 | break; |
| 7915 | } |
| 7916 | } |
| 7917 | |
| 7918 | /************************************************************* |
| 7919 | |
| 7920 | Mapper 192 |
| 7921 | |
| 7922 | Known Boards: Type C by Waixing |
| 7923 | Games: Ying Lie Qun Xia Zhuan, Young Chivalry |
| 7924 | |
| 7925 | MMC3 clone. This is a minor modification of Mapper 74, |
| 7926 | in the sense that it is the same board except for the |
| 7927 | CHRRAM pages. |
| 7928 | |
| 7929 | In MESS: Supported. |
| 7930 | |
| 7931 | *************************************************************/ |
| 7932 | |
| 7933 | static void mapper192_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 7934 | { |
| 7935 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 7936 | UINT8 chr_src[6]; |
| 7937 | int i; |
| 7938 | |
| 7939 | for (i = 0; i < 6; i++) |
| 7940 | chr_src[i] = ((vrom_bank[i] == 0x08) || (vrom_bank[i] == 0x09) || (vrom_bank[i] == 0x0a) || (vrom_bank[i] == 0x0b)) ? CHRRAM : CHRROM; |
| 7941 | |
| 7942 | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 7943 | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 7944 | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| 7945 | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr_src[1]); |
| 7946 | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr_src[2]); |
| 7947 | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr_src[3]); |
| 7948 | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr_src[4]); |
| 7949 | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr_src[5]); |
| 7950 | } |
| 7951 | |
| 7952 | static WRITE8_HANDLER( mapper192_w ) |
| 7953 | { |
| 7954 | UINT8 MMC3_helper, cmd; |
| 7955 | LOG_MMC(("mapper192_w, offset: %04x, data: %02x\n", offset, data)); |
| 7956 | |
| 7957 | switch (offset & 0x6001) |
| 7958 | { |
| 7959 | case 0x0000: |
| 7960 | MMC3_helper = mmc_cmd1 ^ data; |
| 7961 | mmc_cmd1 = data; |
| 7962 | |
| 7963 | /* Has PRG Mode changed? */ |
| 7964 | if (MMC3_helper & 0x40) |
| 7965 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 7966 | |
| 7967 | /* Has CHR Mode changed? */ |
| 7968 | if (MMC3_helper & 0x80) |
| 7969 | mapper192_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 7970 | break; |
| 7971 | |
| 7972 | case 0x0001: |
| 7973 | cmd = mmc_cmd1 & 0x07; |
| 7974 | switch (cmd) |
| 7975 | { |
| 7976 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 7977 | case 2: case 3: case 4: case 5: |
| 7978 | vrom_bank[cmd] = data; |
| 7979 | mapper192_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 7980 | break; |
| 7981 | case 6: |
| 7982 | case 7: |
| 7983 | prg_bank[cmd - 6] = data; |
| 7984 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 7985 | break; |
| 7986 | } |
| 7987 | break; |
| 7988 | |
| 7989 | default: |
| 7990 | mapper74_w(space, offset, data); |
| 7991 | break; |
| 7992 | } |
| 7993 | } |
| 7994 | |
| 7995 | /************************************************************* |
| 7996 | |
| 7997 | Mapper 193 |
| 7998 | |
| 7999 | Known Boards: Bootleg Board by NTDEC |
| 8000 | Games: Fighting Hero |
| 8001 | |
| 8002 | Very simple mapper: writes to 0x6000-0x7fff swap PRG and |
| 8003 | CHR banks. |
| 8004 | |
| 8005 | In MESS: Supported. |
| 8006 | |
| 8007 | *************************************************************/ |
| 8008 | |
| 8009 | static WRITE8_HANDLER( mapper193_m_w ) |
| 8010 | { |
| 8011 | LOG_MMC(("mapper193_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 8012 | |
| 8013 | switch (offset & 0x03) |
| 8014 | { |
| 8015 | case 0: |
| 8016 | chr4_0(space->machine, data >> 2, CHRROM); |
| 8017 | break; |
| 8018 | case 1: |
| 8019 | chr2_4(space->machine, data >> 1, CHRROM); |
| 8020 | break; |
| 8021 | case 2: |
| 8022 | chr2_6(space->machine, data >> 1 , CHRROM); |
| 8023 | break; |
| 8024 | case 3: |
| 8025 | prg8_89(space->machine, data); |
| 8026 | break; |
| 8027 | } |
| 8028 | } |
| 8029 | |
| 8030 | /************************************************************* |
| 8031 | |
| 8032 | Mapper 194 |
| 8033 | |
| 8034 | Known Boards: Type D by Waixing |
| 8035 | Games: Super Robot Taisen (C) |
| 8036 | |
| 8037 | MMC3 clone. This is a minor modification of Mapper 74, |
| 8038 | in the sense that it is the same board except for the |
| 8039 | CHRRAM pages. |
| 8040 | |
| 8041 | In MESS: Supported. |
| 8042 | |
| 8043 | *************************************************************/ |
| 8044 | |
| 8045 | static void mapper194_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 8046 | { |
| 8047 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 8048 | UINT8 chr_src[6]; |
| 8049 | int i; |
| 8050 | |
| 8051 | for (i = 0; i < 6; i++) |
| 8052 | chr_src[i] = (vrom_bank[i] < 0x02) ? CHRRAM : CHRROM; |
| 8053 | |
| 8054 | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 8055 | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 8056 | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| 8057 | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr_src[1]); |
| 8058 | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr_src[2]); |
| 8059 | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr_src[3]); |
| 8060 | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr_src[4]); |
| 8061 | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr_src[5]); |
| 8062 | } |
| 8063 | |
| 8064 | static WRITE8_HANDLER( mapper194_w ) |
| 8065 | { |
| 8066 | UINT8 MMC3_helper, cmd; |
| 8067 | LOG_MMC(("mapper194_w, offset: %04x, data: %02x\n", offset, data)); |
| 8068 | |
| 8069 | switch (offset & 0x6001) |
| 8070 | { |
| 8071 | case 0x0000: |
| 8072 | MMC3_helper = mmc_cmd1 ^ data; |
| 8073 | mmc_cmd1 = data; |
| 8074 | |
| 8075 | /* Has PRG Mode changed? */ |
| 8076 | if (MMC3_helper & 0x40) |
| 8077 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8078 | |
| 8079 | /* Has CHR Mode changed? */ |
| 8080 | if (MMC3_helper & 0x80) |
| 8081 | mapper194_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8082 | break; |
| 8083 | |
| 8084 | case 0x0001: |
| 8085 | cmd = mmc_cmd1 & 0x07; |
| 8086 | switch (cmd) |
| 8087 | { |
| 8088 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 8089 | case 2: case 3: case 4: case 5: |
| 8090 | vrom_bank[cmd] = data; |
| 8091 | mapper194_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8092 | break; |
| 8093 | case 6: |
| 8094 | case 7: |
| 8095 | prg_bank[cmd - 6] = data; |
| 8096 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8097 | break; |
| 8098 | } |
| 8099 | break; |
| 8100 | |
| 8101 | default: |
| 8102 | mapper74_w(space, offset, data); |
| 8103 | break; |
| 8104 | } |
| 8105 | } |
| 8106 | |
| 8107 | /************************************************************* |
| 8108 | |
| 8109 | Mapper 195 |
| 8110 | |
| 8111 | Known Boards: Type E by Waixing |
| 8112 | Games: Captain Tsubasa Vol. II (C), Chaos World, God |
| 8113 | Slayer (C), Zu Qiu Xiao Jiang |
| 8114 | |
| 8115 | MMC3 clone. This is a minor modification of Mapper 74, |
| 8116 | in the sense that it is the same board except for the |
| 8117 | CHRRAM pages. |
| 8118 | |
| 8119 | In MESS: Supported. |
| 8120 | |
| 8121 | *************************************************************/ |
| 8122 | |
| 8123 | static void mapper195_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 8124 | { |
| 8125 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 8126 | UINT8 chr_src[6]; |
| 8127 | int i; |
| 8128 | |
| 8129 | for (i = 0; i < 6; i++) |
| 8130 | chr_src[i] = (vrom_bank[i] < 0x04) ? CHRRAM : CHRROM; |
| 8131 | |
| 8132 | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr_src[0]); |
| 8133 | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr_src[0]); |
| 8134 | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr_src[1]); |
| 8135 | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr_src[1]); |
| 8136 | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr_src[2]); |
| 8137 | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr_src[3]); |
| 8138 | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr_src[4]); |
| 8139 | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr_src[5]); |
| 8140 | } |
| 8141 | |
| 8142 | static WRITE8_HANDLER( mapper195_w ) |
| 8143 | { |
| 8144 | UINT8 MMC3_helper, cmd; |
| 8145 | LOG_MMC(("mapper195_w, offset: %04x, data: %02x\n", offset, data)); |
| 8146 | |
| 8147 | switch (offset & 0x6001) |
| 8148 | { |
| 8149 | case 0x0000: |
| 8150 | MMC3_helper = mmc_cmd1 ^ data; |
| 8151 | mmc_cmd1 = data; |
| 8152 | |
| 8153 | /* Has PRG Mode changed? */ |
| 8154 | if (MMC3_helper & 0x40) |
| 8155 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8156 | |
| 8157 | /* Has CHR Mode changed? */ |
| 8158 | if (MMC3_helper & 0x80) |
| 8159 | mapper195_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8160 | break; |
| 8161 | |
| 8162 | case 0x0001: |
| 8163 | cmd = mmc_cmd1 & 0x07; |
| 8164 | switch (cmd) |
| 8165 | { |
| 8166 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 8167 | case 2: case 3: case 4: case 5: |
| 8168 | vrom_bank[cmd] = data; |
| 8169 | mapper195_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8170 | break; |
| 8171 | case 6: |
| 8172 | case 7: |
| 8173 | prg_bank[cmd - 6] = data; |
| 8174 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8175 | break; |
| 8176 | } |
| 8177 | break; |
| 8178 | |
| 8179 | default: |
| 8180 | mapper74_w(space, offset, data); |
| 8181 | break; |
| 8182 | } |
| 8183 | } |
| 8184 | |
| 8185 | /************************************************************* |
| 8186 | |
| 8187 | Mapper 196 |
| 8188 | |
| 8189 | Known Boards: Unknown Bootleg Board |
| 8190 | Games: Super Mario Bros. 11, Super Mario Bros. 17 |
| 8191 | |
| 8192 | This acts basically like a MMC3 with different use of write |
| 8193 | address. |
| 8194 | |
| 8195 | In MESS: Supported. |
| 8196 | |
| 8197 | *************************************************************/ |
| 8198 | |
| 8199 | static WRITE8_HANDLER( mapper196_w ) |
| 8200 | { |
| 8201 | LOG_MMC(("mapper196_w, offset: %04x, data: %02x\n", offset, data)); |
| 8202 | |
| 8203 | mapper4_w(space, (offset & 0x6000) | ((offset & 0x04) >> 2), data); |
| 8204 | } |
| 8205 | |
| 8206 | /************************************************************* |
| 8207 | |
| 8208 | Mapper 197 |
| 8209 | |
| 8210 | Known Boards: Unknown Bootleg Board |
| 8211 | Games: Super Fighter III |
| 8212 | |
| 8213 | MMC3 clone |
| 8214 | |
| 8215 | In MESS: Supported. |
| 8216 | |
| 8217 | *************************************************************/ |
| 8218 | |
| 8219 | static void mapper197_set_chr( running_machine *machine, UINT8 chr_source, int chr_base, int chr_mask ) |
| 8220 | { |
| 8221 | chr4_0(machine, chr_base | ((vrom_bank[0] >> 1) & chr_mask), chr_source); |
| 8222 | chr2_4(machine, chr_base | (vrom_bank[1] & chr_mask), chr_source); |
| 8223 | chr2_6(machine, chr_base | (vrom_bank[2] & chr_mask), chr_source); |
| 8224 | } |
| 8225 | |
| 8226 | static WRITE8_HANDLER( mapper197_w ) |
| 8227 | { |
| 8228 | UINT8 MMC3_helper, cmd; |
| 8229 | LOG_MMC(("mapper197_w, offset: %04x, data: %02x\n", offset, data)); |
| 8230 | |
| 8231 | switch (offset & 0x6001) |
| 8232 | { |
| 8233 | case 0x0000: |
| 8234 | MMC3_helper = mmc_cmd1 ^ data; |
| 8235 | mmc_cmd1 = data; |
| 8236 | |
| 8237 | /* Has PRG Mode changed? */ |
| 8238 | if (MMC3_helper & 0x40) |
| 8239 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8240 | |
| 8241 | /* Has CHR Mode changed? */ |
| 8242 | if (MMC3_helper & 0x80) |
| 8243 | mapper197_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 8244 | break; |
| 8245 | |
| 8246 | case 0x0001: |
| 8247 | cmd = mmc_cmd1 & 0x0f; |
| 8248 | switch (cmd) |
| 8249 | { |
| 8250 | case 0: case 2: case 4: |
| 8251 | vrom_bank[cmd >> 1] = data; |
| 8252 | mapper197_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 8253 | break; |
| 8254 | case 6: |
| 8255 | case 7: |
| 8256 | prg_bank[cmd - 6] = data; |
| 8257 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8258 | break; |
| 8259 | } |
| 8260 | break; |
| 8261 | |
| 8262 | default: |
| 8263 | mapper4_w(space, offset, data); |
| 8264 | break; |
| 8265 | } |
| 8266 | } |
| 8267 | |
| 8268 | /************************************************************* |
| 8269 | |
| 8270 | Mapper 198 |
| 8271 | |
| 8272 | Known Boards: Type F by Waixing |
| 8273 | Games: Tenchi wo Kurau II (C) |
| 8274 | |
| 8275 | MMC3 clone. |
| 8276 | |
| 8277 | In MESS: Preliminary support. |
| 8278 | |
| 8279 | *************************************************************/ |
| 8280 | |
| 8281 | static void mapper198_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 8282 | { |
| 8283 | UINT8 prg_flip = (mmc_cmd1 & 0x40) ? 2 : 0; |
| 8284 | |
| 8285 | prg8_89(machine, prg_base | (prg_bank[0 ^ prg_flip] & prg_mask)); |
| 8286 | prg8_ab(machine, prg_base | (prg_bank[1] & prg_mask)); |
| 8287 | prg8_cd(machine, prg_base | (prg_bank[2 ^ prg_flip] & prg_mask)); |
| 8288 | prg8_ef(machine, prg_base | (prg_bank[3] & prg_mask)); |
| 8289 | } |
| 8290 | |
| 8291 | static WRITE8_HANDLER( mapper198_w ) |
| 8292 | { |
| 8293 | UINT8 MMC3_helper, cmd; |
| 8294 | LOG_MMC(("mapper198_w, offset: %04x, data: %02x\n", offset, data)); |
| 8295 | |
| 8296 | switch (offset & 0x6001) |
| 8297 | { |
| 8298 | case 0x0000: |
| 8299 | MMC3_helper = mmc_cmd1 ^ data; |
| 8300 | mmc_cmd1 = data; |
| 8301 | |
| 8302 | /* Has PRG Mode changed? */ |
| 8303 | if (MMC3_helper & 0x40) |
| 8304 | mapper198_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8305 | |
| 8306 | /* Has CHR Mode changed? */ |
| 8307 | if (MMC3_helper & 0x80) |
| 8308 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 8309 | break; |
| 8310 | |
| 8311 | case 0x0001: |
| 8312 | cmd = mmc_cmd1 & 0x07; |
| 8313 | switch (cmd) |
| 8314 | { |
| 8315 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 8316 | case 2: case 3: case 4: case 5: |
| 8317 | vrom_bank[cmd] = data; |
| 8318 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 8319 | break; |
| 8320 | case 6: |
| 8321 | case 7: |
| 8322 | prg_bank[cmd - 6] = data & ((data > 0x3f) ? 0x4f : 0x3f); |
| 8323 | mapper198_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8324 | break; |
| 8325 | } |
| 8326 | break; |
| 8327 | |
| 8328 | default: |
| 8329 | mapper74_w(space, offset, data); |
| 8330 | break; |
| 8331 | } |
| 8332 | } |
| 8333 | |
| 8334 | /************************************************************* |
| 8335 | |
| 8336 | Mapper 199 |
| 8337 | |
| 8338 | Known Boards: Type G by Waixing |
| 8339 | Games: San Guo Zhi 2, Dragon Ball Z Gaiden (C), Dragon |
| 8340 | Ball Z II (C) |
| 8341 | |
| 8342 | MMC3 clone |
| 8343 | |
| 8344 | In MESS: Supported. |
| 8345 | |
| 8346 | *************************************************************/ |
| 8347 | |
| 8348 | static void mapper199_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 8349 | { |
| 8350 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 8351 | UINT8 chr_src[8]; |
| 8352 | int i; |
| 8353 | |
| 8354 | for (i = 0; i < 8; i++) |
| 8355 | chr_src[i] = (vrom_bank[i] < 0x08) ? CHRRAM : CHRROM; |
| 8356 | |
| 8357 | chr1_x(machine, chr_page ^ 0, chr_base | (vrom_bank[0] & chr_mask), chr_src[0]); |
| 8358 | chr1_x(machine, chr_page ^ 1, chr_base | (vrom_bank[6] & chr_mask), chr_src[6]); |
| 8359 | chr1_x(machine, chr_page ^ 2, chr_base | (vrom_bank[1] & chr_mask), chr_src[1]); |
| 8360 | chr1_x(machine, chr_page ^ 3, chr_base | (vrom_bank[7] & chr_mask), chr_src[7]); |
| 8361 | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr_src[2]); |
| 8362 | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr_src[3]); |
| 8363 | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr_src[4]); |
| 8364 | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr_src[5]); |
| 8365 | } |
| 8366 | |
| 8367 | static WRITE8_HANDLER( mapper199_w ) |
| 8368 | { |
| 8369 | UINT8 MMC3_helper, cmd; |
| 8370 | LOG_MMC(("mapper199_w, offset: %04x, data: %02x\n", offset, data)); |
| 8371 | |
| 8372 | switch (offset & 0x6001) |
| 8373 | { |
| 8374 | case 0x0000: |
| 8375 | MMC3_helper = mmc_cmd1 ^ data; |
| 8376 | mmc_cmd1 = data; |
| 8377 | |
| 8378 | /* Has PRG Mode changed? */ |
| 8379 | if (MMC3_helper & 0x40) |
| 8380 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8381 | |
| 8382 | /* Has CHR Mode changed? */ |
| 8383 | if (MMC3_helper & 0x80) |
| 8384 | mapper199_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8385 | break; |
| 8386 | |
| 8387 | case 0x0001: |
| 8388 | cmd = mmc_cmd1 & 0x0f; |
| 8389 | switch (cmd) |
| 8390 | { |
| 8391 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 8392 | case 2: case 3: case 4: case 5: |
| 8393 | vrom_bank[cmd] = data; |
| 8394 | mapper199_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8395 | break; |
| 8396 | case 6: |
| 8397 | case 7: |
| 8398 | case 8: |
| 8399 | case 9: |
| 8400 | prg_bank[cmd - 6] = data; |
| 8401 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8402 | break; |
| 8403 | case 0x0a: case 0x0b: |
| 8404 | vrom_bank[cmd - 4] = data; |
| 8405 | mapper199_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 8406 | break; |
| 8407 | } |
| 8408 | break; |
| 8409 | |
| 8410 | default: |
| 8411 | mapper4_w(space, offset, data); |
| 8412 | break; |
| 8413 | } |
| 8414 | } |
| 8415 | |
| 8416 | /************************************************************* |
| 8417 | |
| 8418 | Mapper 200 |
| 8419 | |
| 8420 | Known Boards: Unknown Bootleg Multigame Board |
| 8421 | Games: 36 in 1, 1200 in 1 |
| 8422 | |
| 8423 | In MESS: Supported. |
| 8424 | |
| 8425 | *************************************************************/ |
| 8426 | |
| 8427 | static WRITE8_HANDLER( mapper200_w ) |
| 8428 | { |
| 8429 | LOG_MMC(("mapper200_w, offset: %04x, data: %02x\n", offset, data)); |
| 8430 | |
| 8431 | prg16_89ab(space->machine, offset & 0x07); |
| 8432 | prg16_cdef(space->machine, offset & 0x07); |
| 8433 | chr8(space->machine, offset & 0x07, CHRROM); |
| 8434 | |
| 8435 | set_nt_mirroring((offset & 0x08) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 8436 | } |
| 8437 | |
| 8438 | /************************************************************* |
| 8439 | |
| 8440 | Mapper 201 |
| 8441 | |
| 8442 | Known Boards: Unknown Bootleg Multigame Board |
| 8443 | Games: 8 in 1, 21 in 1 |
| 8444 | |
| 8445 | In MESS: Supported. |
| 8446 | |
| 8447 | *************************************************************/ |
| 8448 | |
| 8449 | static WRITE8_HANDLER( mapper201_w ) |
| 8450 | { |
| 8451 | LOG_MMC(("mapper201_w, offset: %04x, data: %02x\n", offset, data)); |
| 8452 | |
| 8453 | prg32(space->machine, offset & 0x03); |
| 8454 | chr8(space->machine, offset & 0x03, CHRROM); |
| 8455 | } |
| 8456 | |
| 8457 | /************************************************************* |
| 8458 | |
| 8459 | Mapper 202 |
| 8460 | |
| 8461 | Known Boards: Unknown Bootleg Multigame Board |
| 8462 | Games: 150 in 1 |
| 8463 | |
| 8464 | In MESS: Supported. |
| 8465 | |
| 8466 | *************************************************************/ |
| 8467 | |
| 8468 | static WRITE8_HANDLER( mapper202_w ) |
| 8469 | { |
| 8470 | int bank = (offset >> 1) & 0x07; |
| 8471 | |
| 8472 | LOG_MMC(("mapper202_w, offset: %04x, data: %02x\n", offset, data)); |
| 8473 | |
| 8474 | prg16_89ab(space->machine, bank); |
| 8475 | prg16_cdef(space->machine, bank + (((bank & 0x06) == 0x06) ? 1 : 0)); |
| 8476 | chr8(space->machine, bank, CHRROM); |
| 8477 | |
| 8478 | set_nt_mirroring((offset & 0x01) ? PPU_MIRROR_HORZ: PPU_MIRROR_VERT); |
| 8479 | } |
| 8480 | |
| 8481 | /************************************************************* |
| 8482 | |
| 8483 | Mapper 203 |
| 8484 | |
| 8485 | Known Boards: Unknown Bootleg Multigame Board |
| 8486 | Games: 35 in 1 |
| 8487 | |
| 8488 | In MESS: Supported. |
| 8489 | |
| 8490 | *************************************************************/ |
| 8491 | |
| 8492 | static WRITE8_HANDLER( mapper203_w ) |
| 8493 | { |
| 8494 | LOG_MMC(("mapper203_w, offset: %04x, data: %02x\n", offset, data)); |
| 8495 | |
| 8496 | prg16_89ab(space->machine, (data >> 2) & 0x03); |
| 8497 | prg16_cdef(space->machine, (data >> 2) & 0x03); |
| 8498 | chr8(space->machine, data & 0x03, CHRROM); |
| 8499 | } |
| 8500 | |
| 8501 | /************************************************************* |
| 8502 | |
| 8503 | Mapper 204 |
| 8504 | |
| 8505 | Known Boards: Unknown Bootleg Multigame Board |
| 8506 | Games: 64 in 1 |
| 8507 | |
| 8508 | In MESS: Supported. |
| 8509 | |
| 8510 | *************************************************************/ |
| 8511 | |
| 8512 | static WRITE8_HANDLER( mapper204_w ) |
| 8513 | { |
| 8514 | int bank = (offset >> 1) & (offset >> 2) & 0x01; |
| 8515 | |
| 8516 | LOG_MMC(("mapper204_w, offset: %04x, data: %02x\n", offset, data)); |
| 8517 | |
| 8518 | prg16_89ab(space->machine, offset & ~bank); |
| 8519 | prg16_cdef(space->machine, offset | bank); |
| 8520 | chr8(space->machine, offset & ~bank, CHRROM); |
| 8521 | |
| 8522 | set_nt_mirroring((offset & 0x10) ? PPU_MIRROR_HORZ: PPU_MIRROR_VERT); |
| 8523 | } |
| 8524 | |
| 8525 | /************************************************************* |
| 8526 | |
| 8527 | Mapper 205 |
| 8528 | |
| 8529 | Known Boards: Unknown Bootleg Multigame Board |
| 8530 | Games: 3 in 1, 15 in 1 |
| 8531 | |
| 8532 | MMC3 clone |
| 8533 | |
| 8534 | In MESS: Supported. |
| 8535 | |
| 8536 | *************************************************************/ |
| 8537 | |
| 8538 | static WRITE8_HANDLER( mapper205_m_w ) |
| 8539 | { |
| 8540 | LOG_MMC(("mapper205_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 8541 | |
| 8542 | if (offset & 0x0800) |
| 8543 | { |
| 8544 | mmc_prg_base = (data & 0x03) << 4; |
| 8545 | mmc_prg_mask = (data & 0x02) ? 0x0f : 0x1f; |
| 8546 | mmc_chr_base = (data & 0x03) << 7; |
| 8547 | mmc_chr_mask = (data & 0x02) ? 0x7f : 0xff; |
| 8548 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8549 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 8550 | } |
| 8551 | } |
| 8552 | |
| 8553 | /************************************************************* |
| 8554 | |
| 8555 | Mapper 206 |
| 8556 | |
| 8557 | Known Boards: Namcot 34x3 boards, DEROM, DE1ROM, DRROM and |
| 8558 | Tengen 800002, 800004, 800030 boards |
| 8559 | Games: Babel no Tou, Dragon Buster II, Family Circuit, |
| 8560 | Family Tennis, Fantasy Zone, Gauntlet, Karnov, |
| 8561 | Mappy Land, Pac-Mania, R.B.I. Baseball, Super Sprint |
| 8562 | |
| 8563 | In MESS: Supported. |
| 8564 | |
| 8565 | *************************************************************/ |
| 8566 | |
| 8567 | static WRITE8_HANDLER( mapper206_w ) |
| 8568 | { |
| 8569 | if ((offset & 0x6001) == 0x2000) |
| 8570 | return; |
| 8571 | |
| 8572 | mapper4_w(space, offset, data); |
| 8573 | } |
| 8574 | |
| 8575 | /************************************************************* |
| 8576 | |
| 8577 | Mapper 207 |
| 8578 | |
| 8579 | Known Boards: Taito X1-005 Ver. B |
| 8580 | Games: Fudou Myouou Den |
| 8581 | |
| 8582 | Very similar to mapper 80, but with a very particular NT |
| 8583 | mirroring procedure (see below) |
| 8584 | |
| 8585 | In MESS: Supported. |
| 8586 | |
| 8587 | *************************************************************/ |
| 8588 | |
| 8589 | static WRITE8_HANDLER( mapper207_m_w ) |
| 8590 | { |
| 8591 | LOG_MMC(("mapper207_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 8592 | |
| 8593 | switch (offset) |
| 8594 | { |
| 8595 | case 0x1ef0: |
| 8596 | set_nt_page(0, CIRAM, (data & 0x80) ? 1 : 0, 1); |
| 8597 | set_nt_page(1, CIRAM, (data & 0x80) ? 1 : 0, 1); |
| 8598 | /* Switch 2k VROM at $0000 */ |
| 8599 | chr2_0(space->machine, (data & 0x7f) >> 1, CHRROM); |
| 8600 | break; |
| 8601 | case 0x1ef1: |
| 8602 | set_nt_page(2, CIRAM, (data & 0x80) ? 1 : 0, 1); |
| 8603 | set_nt_page(3, CIRAM, (data & 0x80) ? 1 : 0, 1); |
| 8604 | /* Switch 2k VROM at $0000 */ |
| 8605 | chr2_2(space->machine, (data & 0x7f) >> 1, CHRROM); |
| 8606 | break; |
| 8607 | case 0x1ef2: |
| 8608 | /* Switch 1k VROM at $1000 */ |
| 8609 | chr1_4(space->machine, data, CHRROM); |
| 8610 | break; |
| 8611 | case 0x1ef3: |
| 8612 | /* Switch 1k VROM at $1400 */ |
| 8613 | chr1_5(space->machine, data, CHRROM); |
| 8614 | break; |
| 8615 | case 0x1ef4: |
| 8616 | /* Switch 1k VROM at $1800 */ |
| 8617 | chr1_6(space->machine, data, CHRROM); |
| 8618 | break; |
| 8619 | case 0x1ef5: |
| 8620 | /* Switch 1k VROM at $1c00 */ |
| 8621 | chr1_7(space->machine, data, CHRROM); |
| 8622 | break; |
| 8623 | case 0x1efa: |
| 8624 | case 0x1efb: |
| 8625 | /* Switch 8k ROM at $8000 */ |
| 8626 | prg8_89(space->machine, data); |
| 8627 | break; |
| 8628 | case 0x1efc: |
| 8629 | case 0x1efd: |
| 8630 | /* Switch 8k ROM at $a000 */ |
| 8631 | prg8_ab(space->machine, data); |
| 8632 | break; |
| 8633 | case 0x1efe: |
| 8634 | case 0x1eff: |
| 8635 | /* Switch 8k ROM at $c000 */ |
| 8636 | prg8_cd(space->machine, data); |
| 8637 | break; |
| 8638 | default: |
| 8639 | logerror("mapper207_m_w uncaught addr: %04x, value: %02x\n", offset + 0x6000, data); |
| 8640 | break; |
| 8641 | } |
| 8642 | } |
| 8643 | |
| 8644 | /************************************************************* |
| 8645 | |
| 8646 | Mapper 208 |
| 8647 | |
| 8648 | Known Boards: 37017 (?) by Gouder |
| 8649 | Games: Street Fighter IV |
| 8650 | |
| 8651 | MMC3 clone. It also requires reads from 0x5000-0x7fff. |
| 8652 | |
| 8653 | In MESS: Preliminary Support. |
| 8654 | |
| 8655 | *************************************************************/ |
| 8656 | |
| 8657 | static WRITE8_HANDLER( mapper208_l_w ) |
| 8658 | { |
| 8659 | static const UINT8 conv_table[256] = |
| 8660 | { |
| 8661 | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x49,0x19,0x09,0x59,0x49,0x19,0x09, |
| 8662 | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x51,0x41,0x11,0x01,0x51,0x41,0x11,0x01, |
| 8663 | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x49,0x19,0x09,0x59,0x49,0x19,0x09, |
| 8664 | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x51,0x41,0x11,0x01,0x51,0x41,0x11,0x01, |
| 8665 | 0x00,0x10,0x40,0x50,0x00,0x10,0x40,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 8666 | 0x08,0x18,0x48,0x58,0x08,0x18,0x48,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 8667 | 0x00,0x10,0x40,0x50,0x00,0x10,0x40,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 8668 | 0x08,0x18,0x48,0x58,0x08,0x18,0x48,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 8669 | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x58,0x48,0x18,0x08,0x58,0x48,0x18,0x08, |
| 8670 | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x50,0x40,0x10,0x00,0x50,0x40,0x10,0x00, |
| 8671 | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x58,0x48,0x18,0x08,0x58,0x48,0x18,0x08, |
| 8672 | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x50,0x40,0x10,0x00,0x50,0x40,0x10,0x00, |
| 8673 | 0x01,0x11,0x41,0x51,0x01,0x11,0x41,0x51,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 8674 | 0x09,0x19,0x49,0x59,0x09,0x19,0x49,0x59,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 8675 | 0x01,0x11,0x41,0x51,0x01,0x11,0x41,0x51,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 8676 | 0x09,0x19,0x49,0x59,0x09,0x19,0x49,0x59,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
| 8677 | }; |
| 8678 | |
| 8679 | LOG_MMC(("mapper208_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 8680 | |
| 8681 | if (!(offset < 0x1700)) |
| 8682 | map208_reg[offset & 0x03] = data ^ conv_table[map208_reg[4]]; |
| 8683 | else if (!(offset < 0xf00)) |
| 8684 | map208_reg[4] = data; |
| 8685 | else if (!(offset < 0x700)) |
| 8686 | prg32(space->machine, ((data >> 3) & 0x02) | (data & 0x01)); |
| 8687 | } |
| 8688 | |
| 8689 | static READ8_HANDLER( mapper208_l_r ) |
| 8690 | { |
| 8691 | LOG_MMC(("mapper208_l_r, offset: %04x\n", offset)); |
| 8692 | |
| 8693 | if (!(offset < 0x1700)) |
| 8694 | return map208_reg[offset & 0x03]; |
| 8695 | |
| 8696 | return 0x00; |
| 8697 | } |
| 8698 | |
| 8699 | /* This is like mapper4 but with no PRG bankswitch (beacuse it is handled by low writes) */ |
| 8700 | // replace with map189_w... they are the same!! |
| 8701 | static WRITE8_HANDLER( mapper208_w ) |
| 8702 | { |
| 8703 | UINT8 MMC3_helper, cmd; |
| 8704 | LOG_MMC(("mapper208_w, offset: %04x, data: %02x\n", offset, data)); |
| 8705 | |
| 8706 | switch (offset & 0x6001) |
| 8707 | { |
| 8708 | case 0x0000: |
| 8709 | MMC3_helper = mmc_cmd1 ^ data; |
| 8710 | mmc_cmd1 = data; |
| 8711 | |
| 8712 | /* Has CHR Mode changed? */ |
| 8713 | if (MMC3_helper & 0x80) |
| 8714 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 8715 | break; |
| 8716 | |
| 8717 | case 0x0001: |
| 8718 | cmd = mmc_cmd1 & 0x07; |
| 8719 | switch (cmd) |
| 8720 | { |
| 8721 | case 0: case 1: |
| 8722 | case 2: case 3: case 4: case 5: |
| 8723 | vrom_bank[cmd] = data; |
| 8724 | mapper4_set_chr(space->machine, mmc_chr_source, mmc_chr_base, mmc_chr_mask); |
| 8725 | break; |
| 8726 | } |
| 8727 | break; |
| 8728 | |
| 8729 | default: |
| 8730 | mapper4_w(space, offset, data); |
| 8731 | break; |
| 8732 | } |
| 8733 | } |
| 8734 | |
| 8735 | /************************************************************* |
| 8736 | |
| 8737 | Mapper 209 |
| 8738 | |
| 8739 | Known Boards: Type B by J.Y. Company |
| 8740 | Games: Power Rangers 3, Power Rangers 4, Shin Samurai |
| 8741 | Spirits 2 |
| 8742 | |
| 8743 | In MESS: Unsupported. |
| 8744 | |
| 8745 | *************************************************************/ |
| 8746 | |
| 8747 | /************************************************************* |
| 8748 | |
| 8749 | Mapper 210 |
| 8750 | |
| 8751 | Known Boards: Undocumented / Unused ?!? |
| 8752 | Games: ---------- |
| 8753 | |
| 8754 | For some emulators, this is the same as Mapper 19 but it |
| 8755 | has hardwired mirroring and no additional sound hardware. |
| 8756 | Initializing Mirroring to Vertical in Mapper 19 seems to |
| 8757 | fix all glitches in 'so-called' Mapper 210 games, so there |
| 8758 | seems to be no reason to have this duplicate mapper (at |
| 8759 | least until we emulate additional sound hardware... if sound |
| 8760 | writes would create conflicts, we might consider to split the |
| 8761 | mapper in two variants) |
| 8762 | |
| 8763 | In MESS: ---------- |
| 8764 | |
| 8765 | *************************************************************/ |
| 8766 | |
| 8767 | /************************************************************* |
| 8768 | |
| 8769 | Mapper 211 |
| 8770 | |
| 8771 | Known Boards: Type C by J.Y. Company |
| 8772 | Games: Tiny Toon Adventures 6, Donkey Kong Country 4 |
| 8773 | |
| 8774 | In MESS: Unsupported. |
| 8775 | |
| 8776 | *************************************************************/ |
| 8777 | |
| 8778 | /************************************************************* |
| 8779 | |
| 8780 | Mapper 212 |
| 8781 | |
| 8782 | Known Boards: Unknown Bootleg Multigame Board |
| 8783 | Games: 100000 in 1, Super HIK 300 in 1, 1997 in 1 |
| 8784 | |
| 8785 | In MESS: Supported. |
| 8786 | |
| 8787 | *************************************************************/ |
| 8788 | |
| 8789 | static WRITE8_HANDLER( mapper212_w ) |
| 8790 | { |
| 8791 | LOG_MMC(("mapper212_w, offset: %04x, data: %02x\n", offset, data)); |
| 8792 | |
| 8793 | set_nt_mirroring((offset & 0x08) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 8794 | chr8(space->machine, offset, CHRROM); |
| 8795 | |
| 8796 | if (offset < 0x4000) |
| 8797 | { |
| 8798 | prg16_89ab(space->machine, offset); |
| 8799 | prg16_cdef(space->machine, offset); |
| 8800 | } |
| 8801 | else |
| 8802 | prg32(space->machine, offset >> 1); |
| 8803 | } |
| 8804 | |
| 8805 | /************************************************************* |
| 8806 | |
| 8807 | Mapper 213 |
| 8808 | |
| 8809 | Known Boards: Unknown Bootleg Multigame Board |
| 8810 | Games: 9999999 in 1 |
| 8811 | |
| 8812 | In MESS: Supported. |
| 8813 | |
| 8814 | *************************************************************/ |
| 8815 | |
| 8816 | static WRITE8_HANDLER( mapper213_w ) |
| 8817 | { |
| 8818 | LOG_MMC(("mapper213_w, offset: %04x, data: %02x\n", offset, data)); |
| 8819 | |
| 8820 | prg32(space->machine, offset >> 1); |
| 8821 | chr8(space->machine, offset >> 3, CHRROM); |
| 8822 | } |
| 8823 | |
| 8824 | /************************************************************* |
| 8825 | |
| 8826 | Mapper 214 |
| 8827 | |
| 8828 | Known Boards: Unknown Bootleg Multigame Board |
| 8829 | Games: Super Gun 20 in 1 |
| 8830 | |
| 8831 | In MESS: Supported. |
| 8832 | |
| 8833 | *************************************************************/ |
| 8834 | |
| 8835 | static WRITE8_HANDLER( mapper214_w ) |
| 8836 | { |
| 8837 | LOG_MMC(("mapper214_w, offset: %04x, data: %02x\n", offset, data)); |
| 8838 | |
| 8839 | prg16_89ab(space->machine, offset >> 2); |
| 8840 | prg16_cdef(space->machine, offset >> 2); |
| 8841 | chr8(space->machine, offset, CHRROM); |
| 8842 | } |
| 8843 | |
| 8844 | /************************************************************* |
| 8845 | |
| 8846 | Mapper 215 |
| 8847 | |
| 8848 | Known Boards: Unknown Bootleg Board by Super Game |
| 8849 | Games: Boogerman, Mortal Kombat III |
| 8850 | |
| 8851 | MMC3 clone. Also, it probably needs a hack to support both |
| 8852 | variants (Boogerman & MK3). |
| 8853 | |
| 8854 | In MESS: Preliminary support. |
| 8855 | |
| 8856 | *************************************************************/ |
| 8857 | |
| 8858 | // remove mask & base parameters! |
| 8859 | static void mapper215_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 8860 | { |
| 8861 | if (map215_reg[0] & 0x80) |
| 8862 | { |
| 8863 | prg16_89ab(machine, (map215_reg[0] & 0xf0) | (map215_reg[1] & 0x10)); |
| 8864 | prg16_cdef(machine, (map215_reg[0] & 0xf0) | (map215_reg[1] & 0x10)); |
| 8865 | } |
| 8866 | else |
| 8867 | { |
| 8868 | mmc_prg_base = (map215_reg[1] & 0x08) ? 0x20 : (map215_reg[1] & 0x10); |
| 8869 | mmc_prg_mask = (map215_reg[1] & 0x08) ? 0x1f : 0x0f; |
| 8870 | |
| 8871 | mapper4_set_prg(machine, mmc_prg_base, mmc_prg_mask); |
| 8872 | } |
| 8873 | } |
| 8874 | |
| 8875 | static void mapper215_set_chr( running_machine *machine, UINT8 chr ) |
| 8876 | { |
| 8877 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 8878 | int chr_base = (map215_reg[1] & 0x04) ? 0x100 : ((map215_reg[1] & 0x10) << 3); |
| 8879 | int chr_mask = (map215_reg[1] & 0x04) ? 0xff : 0x7f; |
| 8880 | |
| 8881 | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr); |
| 8882 | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr); |
| 8883 | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr); |
| 8884 | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr); |
| 8885 | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr); |
| 8886 | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr); |
| 8887 | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr); |
| 8888 | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr); |
| 8889 | } |
| 8890 | |
| 8891 | static WRITE8_HANDLER( mapper215_l_w ) |
| 8892 | { |
| 8893 | LOG_MMC(("mapper215_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 8894 | offset += 0x100; |
| 8895 | |
| 8896 | if (offset == 0x1000) |
| 8897 | { |
| 8898 | map215_reg[0] = data; |
| 8899 | mapper215_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8900 | } |
| 8901 | else if (offset == 0x1001) |
| 8902 | { |
| 8903 | map215_reg[1] = data; |
| 8904 | mapper215_set_chr(space->machine, mmc_chr_source); |
| 8905 | } |
| 8906 | else if (offset == 0x1007) |
| 8907 | { |
| 8908 | mmc_cmd1 = 0; |
| 8909 | map215_reg[2] = data; |
| 8910 | mapper215_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8911 | mapper215_set_chr(space->machine, mmc_chr_source); |
| 8912 | } |
| 8913 | } |
| 8914 | |
| 8915 | static WRITE8_HANDLER( mapper215_w ) |
| 8916 | { |
| 8917 | UINT8 MMC3_helper, cmd; |
| 8918 | static const UINT8 conv_table[8] = {0,2,5,3,6,1,7,4}; |
| 8919 | LOG_MMC(("mapper215_w, offset: %04x, data: %02x\n", offset, data)); |
| 8920 | |
| 8921 | if (!map215_reg[2]) // in this case we act like MMC3, only with alt prg/chr handlers |
| 8922 | { |
| 8923 | switch (offset & 0x6001) |
| 8924 | { |
| 8925 | case 0x0000: |
| 8926 | MMC3_helper = mmc_cmd1 ^ data; |
| 8927 | mmc_cmd1 = data; |
| 8928 | |
| 8929 | /* Has PRG Mode changed? */ |
| 8930 | if (MMC3_helper & 0x40) |
| 8931 | mapper215_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8932 | |
| 8933 | /* Has CHR Mode changed? */ |
| 8934 | if (MMC3_helper & 0x80) |
| 8935 | mapper215_set_chr(space->machine, mmc_chr_source); |
| 8936 | break; |
| 8937 | |
| 8938 | case 0x0001: |
| 8939 | cmd = mmc_cmd1 & 0x07; |
| 8940 | switch (cmd) |
| 8941 | { |
| 8942 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 8943 | case 2: case 3: case 4: case 5: |
| 8944 | vrom_bank[cmd] = data; |
| 8945 | mapper215_set_chr(space->machine, mmc_chr_source); |
| 8946 | break; |
| 8947 | case 6: |
| 8948 | case 7: |
| 8949 | prg_bank[cmd - 6] = data; |
| 8950 | mapper215_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8951 | break; |
| 8952 | } |
| 8953 | break; |
| 8954 | |
| 8955 | default: |
| 8956 | mapper4_w(space, offset, data); |
| 8957 | break; |
| 8958 | } |
| 8959 | } |
| 8960 | else |
| 8961 | { |
| 8962 | switch (offset & 0x6001) |
| 8963 | { |
| 8964 | case 0x0000: |
| 8965 | break; |
| 8966 | |
| 8967 | case 0x0001: |
| 8968 | cmd = mmc_cmd1 & 0x07; |
| 8969 | if (map215_reg[3] && ((map215_reg[0] & 0x80) == 0 || cmd < 6)) // if we use the prg16 banks and cmd=6,7 DON'T enter! |
| 8970 | { |
| 8971 | map215_reg[3] = 0; |
| 8972 | switch (cmd) |
| 8973 | { |
| 8974 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 8975 | case 2: case 3: case 4: case 5: |
| 8976 | vrom_bank[cmd] = data; |
| 8977 | mapper215_set_chr(space->machine, mmc_chr_source); |
| 8978 | break; |
| 8979 | case 6: |
| 8980 | case 7: |
| 8981 | prg_bank[cmd - 6] = data; |
| 8982 | mapper215_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8983 | break; |
| 8984 | } |
| 8985 | } |
| 8986 | break; |
| 8987 | |
| 8988 | case 0x2000: |
| 8989 | data = (data & 0xc0) | conv_table[data & 0x07]; |
| 8990 | MMC3_helper = mmc_cmd1 ^ data; |
| 8991 | mmc_cmd1 = data; |
| 8992 | |
| 8993 | /* Has PRG Mode changed? */ |
| 8994 | if (MMC3_helper & 0x40) |
| 8995 | mapper215_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 8996 | |
| 8997 | /* Has CHR Mode changed? */ |
| 8998 | if (MMC3_helper & 0x80) |
| 8999 | mapper215_set_chr(space->machine, mmc_chr_source); |
| 9000 | |
| 9001 | map215_reg[3] = 1; |
| 9002 | break; |
| 9003 | |
| 9004 | // case 0x2001: |
| 9005 | // mapper4_w(space, 0x4001, data); |
| 9006 | // break; |
| 9007 | |
| 9008 | case 0x4000: |
| 9009 | set_nt_mirroring(((data >> 7) | data) & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9010 | break; |
| 9011 | |
| 9012 | case 0x4001: |
| 9013 | mapper4_w(space, 0x6001, data); |
| 9014 | break; |
| 9015 | |
| 9016 | // case 0x6000: |
| 9017 | // mapper4_w(space, 0x6000, data); |
| 9018 | // break; |
| 9019 | |
| 9020 | case 0x6001: |
| 9021 | mapper4_w(space, 0x4000, data); |
| 9022 | mapper4_w(space, 0x4001, data); |
| 9023 | break; |
| 9024 | |
| 9025 | default: |
| 9026 | mapper4_w(space, offset, data); |
| 9027 | break; |
| 9028 | } |
| 9029 | } |
| 9030 | } |
| 9031 | |
| 9032 | /************************************************************* |
| 9033 | |
| 9034 | Mapper 216 |
| 9035 | |
| 9036 | Known Boards: Unknown Bootleg Board by RCM |
| 9037 | Games: Bonza, Magic Jewelry 2 |
| 9038 | |
| 9039 | Very simple mapper: writes to 0x8000-0xffff sets prg32 |
| 9040 | to offset and chr8 to offset>>1 (when chrrom is present) |
| 9041 | |
| 9042 | In MESS: Supported. |
| 9043 | |
| 9044 | *************************************************************/ |
| 9045 | |
| 9046 | static WRITE8_HANDLER( mapper216_w ) |
| 9047 | { |
| 9048 | LOG_MMC(("mapper216_w, offset: %04x, data: %02x\n", offset, data)); |
| 9049 | |
| 9050 | prg32(space->machine, offset); |
| 9051 | chr8(space->machine, offset >> 1, mmc_chr_source); |
| 9052 | } |
| 9053 | |
| 9054 | /************************************************************* |
| 9055 | |
| 9056 | Mapper 217 |
| 9057 | |
| 9058 | Known Boards: Unknown Bootleg Multigame Board |
| 9059 | Games: Golden Card 6 in 1 |
| 9060 | |
| 9061 | MMC3 clone |
| 9062 | |
| 9063 | In MESS: Supported. |
| 9064 | |
| 9065 | *************************************************************/ |
| 9066 | |
| 9067 | // remove mask & base parameters! |
| 9068 | static void mapper217_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 9069 | { |
| 9070 | mmc_prg_base = (map217_reg[1] & 0x08) ? 0 : (map217_reg[1] & 0x10); |
| 9071 | mmc_prg_mask = (map217_reg[1] & 0x08) ? 0x1f : 0x0f; |
| 9072 | |
| 9073 | mmc_prg_base |= ((map217_reg[1] & 0x03) << 5); |
| 9074 | |
| 9075 | mapper4_set_prg(machine, mmc_prg_base, mmc_prg_mask); |
| 9076 | } |
| 9077 | |
| 9078 | static void mapper217_set_chr( running_machine *machine, UINT8 chr ) |
| 9079 | { |
| 9080 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 9081 | int chr_base = (map217_reg[1] & 0x08) ? 0x00 : ((map217_reg[1] & 0x10) << 3); |
| 9082 | int chr_mask = (map217_reg[1] & 0x08) ? 0xff : 0x7f; |
| 9083 | |
| 9084 | chr_base |= ((map217_reg[1] & 0x03) << 8); |
| 9085 | |
| 9086 | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), chr); |
| 9087 | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), chr); |
| 9088 | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), chr); |
| 9089 | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), chr); |
| 9090 | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), chr); |
| 9091 | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), chr); |
| 9092 | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), chr); |
| 9093 | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), chr); |
| 9094 | } |
| 9095 | |
| 9096 | static WRITE8_HANDLER( mapper217_l_w ) |
| 9097 | { |
| 9098 | UINT8 bank; |
| 9099 | LOG_MMC(("mapper217_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 9100 | offset += 0x100; |
| 9101 | |
| 9102 | if (offset == 0x1000) |
| 9103 | { |
| 9104 | map217_reg[0] = data; |
| 9105 | if (data & 0x80) |
| 9106 | { |
| 9107 | bank = (data & 0x0f) | ((map217_reg[1] & 0x03) << 4); |
| 9108 | prg16_89ab(space->machine, bank); |
| 9109 | prg16_cdef(space->machine, bank); |
| 9110 | } |
| 9111 | else |
| 9112 | mapper217_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9113 | } |
| 9114 | else if (offset == 0x1001) |
| 9115 | { |
| 9116 | map217_reg[1] = data; |
| 9117 | mapper217_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9118 | } |
| 9119 | else if (offset == 0x1007) |
| 9120 | { |
| 9121 | map217_reg[2] = data; |
| 9122 | } |
| 9123 | } |
| 9124 | |
| 9125 | static WRITE8_HANDLER( mapper217_w ) |
| 9126 | { |
| 9127 | UINT8 MMC3_helper, cmd; |
| 9128 | static const UINT8 conv_table[8] = {0, 6, 3, 7, 5, 2, 4, 1}; |
| 9129 | LOG_MMC(("mapper217_w, offset: %04x, data: %02x\n", offset, data)); |
| 9130 | |
| 9131 | if (!map217_reg[2]) // in this case we act like MMC3, only with alt prg/chr handlers |
| 9132 | { |
| 9133 | switch (offset & 0x6001) |
| 9134 | { |
| 9135 | case 0x0000: |
| 9136 | MMC3_helper = mmc_cmd1 ^ data; |
| 9137 | mmc_cmd1 = data; |
| 9138 | |
| 9139 | /* Has PRG Mode changed? */ |
| 9140 | if (MMC3_helper & 0x40) |
| 9141 | mapper217_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9142 | |
| 9143 | /* Has CHR Mode changed? */ |
| 9144 | if (MMC3_helper & 0x80) |
| 9145 | mapper217_set_chr(space->machine, mmc_chr_source); |
| 9146 | break; |
| 9147 | |
| 9148 | case 0x0001: |
| 9149 | cmd = mmc_cmd1 & 0x07; |
| 9150 | switch (cmd) |
| 9151 | { |
| 9152 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 9153 | case 2: case 3: case 4: case 5: |
| 9154 | vrom_bank[cmd] = data; |
| 9155 | mapper217_set_chr(space->machine, mmc_chr_source); |
| 9156 | break; |
| 9157 | case 6: |
| 9158 | case 7: |
| 9159 | prg_bank[cmd - 6] = data; |
| 9160 | mapper217_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9161 | break; |
| 9162 | } |
| 9163 | break; |
| 9164 | |
| 9165 | default: |
| 9166 | mapper4_w(space, offset, data); |
| 9167 | break; |
| 9168 | } |
| 9169 | } |
| 9170 | else |
| 9171 | { |
| 9172 | switch (offset & 0x6001) |
| 9173 | { |
| 9174 | case 0x0000: |
| 9175 | mapper4_w(space, 0xc000, data); |
| 9176 | break; |
| 9177 | |
| 9178 | case 0x0001: |
| 9179 | data = (data & 0xc0) | conv_table[data & 0x07]; |
| 9180 | MMC3_helper = mmc_cmd1 ^ data; |
| 9181 | mmc_cmd1 = data; |
| 9182 | |
| 9183 | /* Has PRG Mode changed? */ |
| 9184 | if (MMC3_helper & 0x40) |
| 9185 | mapper217_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9186 | |
| 9187 | /* Has CHR Mode changed? */ |
| 9188 | if (MMC3_helper & 0x80) |
| 9189 | mapper217_set_chr(space->machine, mmc_chr_source); |
| 9190 | |
| 9191 | map217_reg[3] = 1; |
| 9192 | break; |
| 9193 | |
| 9194 | case 0x2000: |
| 9195 | cmd = mmc_cmd1 & 0x07; |
| 9196 | if (map217_reg[3]) |
| 9197 | { |
| 9198 | map217_reg[3] = 0; |
| 9199 | switch (cmd) |
| 9200 | { |
| 9201 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 9202 | case 2: case 3: case 4: case 5: |
| 9203 | vrom_bank[cmd] = data; |
| 9204 | mapper217_set_chr(space->machine, mmc_chr_source); |
| 9205 | break; |
| 9206 | case 6: |
| 9207 | case 7: |
| 9208 | prg_bank[cmd - 6] = data; |
| 9209 | mapper217_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9210 | break; |
| 9211 | } |
| 9212 | } |
| 9213 | break; |
| 9214 | |
| 9215 | |
| 9216 | case 0x2001: |
| 9217 | set_nt_mirroring(data & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9218 | break; |
| 9219 | |
| 9220 | default: |
| 9221 | mapper4_w(space, offset, data); |
| 9222 | break; |
| 9223 | } |
| 9224 | } |
| 9225 | } |
| 9226 | |
| 9227 | /************************************************************* |
| 9228 | |
| 9229 | Mapper 218 |
| 9230 | |
| 9231 | Known Boards: Undocumented / Unused ?!? |
| 9232 | Games: ---------- |
| 9233 | |
| 9234 | In MESS: ---------- |
| 9235 | |
| 9236 | *************************************************************/ |
| 9237 | |
| 9238 | /************************************************************* |
| 9239 | |
| 9240 | Mapper 219 |
| 9241 | |
| 9242 | Known Boards: A9746?? |
| 9243 | Games: [no games in nes.hsi] |
| 9244 | |
| 9245 | MMC3 clone according to NEStopia |
| 9246 | |
| 9247 | In MESS: Unsupported. |
| 9248 | |
| 9249 | *************************************************************/ |
| 9250 | |
| 9251 | /************************************************************* |
| 9252 | |
| 9253 | Mapper 220 |
| 9254 | |
| 9255 | Known Boards: ??? |
| 9256 | Games: Summer Carnival '92 - Recca US ?? (MMC3 for nestopia) |
| 9257 | |
| 9258 | In MESS: Unsupported. |
| 9259 | |
| 9260 | *************************************************************/ |
| 9261 | |
| 9262 | /************************************************************* |
| 9263 | |
| 9264 | Mapper 221 |
| 9265 | |
| 9266 | Known Boards: Unknown Bootleg Board, N625092 |
| 9267 | Games: 400 in 1, 700 in 1, 1000 in 1 |
| 9268 | |
| 9269 | In MESS: Supported. |
| 9270 | |
| 9271 | *************************************************************/ |
| 9272 | |
| 9273 | static void mapper221_set_prg( running_machine *machine, UINT8 reg1, UINT8 reg2 ) |
| 9274 | { |
| 9275 | UINT8 map221_helper1, map221_helper2; |
| 9276 | |
| 9277 | map221_helper1 = !(reg1 & 0x01) ? reg2 : |
| 9278 | (reg1 & 0x80) ? reg2 : (reg2 & 0x06) | 0x00; |
| 9279 | map221_helper2 = !(reg1 & 0x01) ? reg2 : |
| 9280 | (reg1 & 0x80) ? 0x07 : (reg2 & 0x06) | 0x01; |
| 9281 | |
| 9282 | prg16_89ab(machine, map221_helper1 | ((reg1 & 0x70) >> 1)); |
| 9283 | prg16_cdef(machine, map221_helper2 | ((reg1 & 0x70) >> 1)); |
| 9284 | } |
| 9285 | |
| 9286 | static WRITE8_HANDLER( mapper221_w ) |
| 9287 | { |
| 9288 | LOG_MMC(("mapper221_w, offset: %04x, data: %02x\n", offset, data)); |
| 9289 | |
| 9290 | if (offset < 0x4000) |
| 9291 | { |
| 9292 | set_nt_mirroring(offset & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9293 | offset = (offset >> 1) & 0xff; |
| 9294 | |
| 9295 | if (mmc_cmd1 != offset) |
| 9296 | { |
| 9297 | mmc_cmd1 = offset; |
| 9298 | mapper221_set_prg(space->machine, mmc_cmd1, mmc_cmd2); |
| 9299 | } |
| 9300 | } |
| 9301 | else |
| 9302 | { |
| 9303 | offset &= 0x07; |
| 9304 | |
| 9305 | if (mmc_cmd2 != offset) |
| 9306 | { |
| 9307 | mmc_cmd2 = offset; |
| 9308 | mapper221_set_prg(space->machine, mmc_cmd1, mmc_cmd2); |
| 9309 | } |
| 9310 | } |
| 9311 | } |
| 9312 | |
| 9313 | /************************************************************* |
| 9314 | |
| 9315 | Mapper 222 |
| 9316 | |
| 9317 | Known Boards: Unknown Bootleg Board |
| 9318 | Games: Dragon Ninja (Bootleg), Super Mario Bros. 8 |
| 9319 | |
| 9320 | In MESS: Unsupported. |
| 9321 | |
| 9322 | *************************************************************/ |
| 9323 | |
| 9324 | /* Scanline based IRQ ? */ |
| 9325 | static void mapper222_irq( const device_config *device, int scanline, int vblank, int blanked ) |
| 9326 | { |
| 9327 | if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE) |
| 9328 | { |
| 9329 | if (!IRQ_count || ++IRQ_count < 240) |
| 9330 | return; |
| 9331 | |
| 9332 | IRQ_count = 0; |
| 9333 | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, |
| 9334 | video_screen_get_vpos(device->machine->primary_screen), video_screen_get_hpos(device->machine->primary_screen))); |
| 9335 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 9336 | } |
| 9337 | } |
| 9338 | |
| 9339 | static WRITE8_HANDLER( mapper222_w ) |
| 9340 | { |
| 9341 | UINT8 bank; |
| 9342 | LOG_MMC(("mapper222_w, offset: %04x, data: %02x\n", offset, data)); |
| 9343 | |
| 9344 | switch (offset & 0x7003) |
| 9345 | { |
| 9346 | case 0x0000: |
| 9347 | prg8_89(space->machine, data); |
| 9348 | break; |
| 9349 | case 0x1000: |
| 9350 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9351 | break; |
| 9352 | case 0x2000: |
| 9353 | prg8_ab(space->machine, data); |
| 9354 | break; |
| 9355 | case 0x3000: |
| 9356 | case 0x3002: |
| 9357 | case 0x4000: |
| 9358 | case 0x4002: |
| 9359 | case 0x5000: |
| 9360 | case 0x5002: |
| 9361 | case 0x6000: |
| 9362 | case 0x6002: |
| 9363 | bank = ((offset & 0x7000) - 0x3000) / 0x0800 + ((offset & 0x0002) >> 3); |
| 9364 | chr1_x(space->machine, bank, data, CHRROM); |
| 9365 | break; |
| 9366 | case 0x7000: |
| 9367 | IRQ_count = data; |
| 9368 | break; |
| 9369 | } |
| 9370 | } |
| 9371 | |
| 9372 | /************************************************************* |
| 9373 | |
| 9374 | Mapper 223 |
| 9375 | |
| 9376 | Known Boards: Type I by Waixing |
| 9377 | Games: [no games in nes.hsi] Tang Mu Li Xian Ji? |
| 9378 | |
| 9379 | MMC3 clone according to NEStopia |
| 9380 | |
| 9381 | In MESS: Unsupported. |
| 9382 | |
| 9383 | *************************************************************/ |
| 9384 | |
| 9385 | /************************************************************* |
| 9386 | |
| 9387 | Mapper 224 |
| 9388 | |
| 9389 | Known Boards: Type J by Waixing |
| 9390 | Games: [no games in nes.hsi] Ying Xiong Chuan Qi? |
| 9391 | |
| 9392 | MMC3 clone according to NEStopia |
| 9393 | |
| 9394 | In MESS: Unsupported. |
| 9395 | |
| 9396 | *************************************************************/ |
| 9397 | |
| 9398 | /************************************************************* |
| 9399 | |
| 9400 | Mapper 225 |
| 9401 | |
| 9402 | Known Boards: Unknown Bootleg Multigame Board |
| 9403 | Games: 72 in 1, 115 in 1 and other multigame carts |
| 9404 | |
| 9405 | In MESS: Supported. |
| 9406 | |
| 9407 | *************************************************************/ |
| 9408 | |
| 9409 | static WRITE8_HANDLER( mapper225_w ) |
| 9410 | { |
| 9411 | int hi_bank; |
| 9412 | int size_16; |
| 9413 | int bank; |
| 9414 | |
| 9415 | LOG_MMC(("mapper225_w, offset: %04x, data: %02x\n", offset, data)); |
| 9416 | |
| 9417 | chr8(space->machine, offset, CHRROM); |
| 9418 | set_nt_mirroring((offset & 0x2000) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9419 | |
| 9420 | hi_bank = offset & 0x40; |
| 9421 | size_16 = offset & 0x1000; |
| 9422 | bank = (offset & 0xf80) >> 7; |
| 9423 | if (size_16) |
| 9424 | { |
| 9425 | bank <<= 1; |
| 9426 | if (hi_bank) |
| 9427 | bank ++; |
| 9428 | |
| 9429 | prg16_89ab(space->machine, bank); |
| 9430 | prg16_cdef(space->machine, bank); |
| 9431 | } |
| 9432 | else |
| 9433 | prg32(space->machine, bank); |
| 9434 | } |
| 9435 | |
| 9436 | /************************************************************* |
| 9437 | |
| 9438 | Mapper 226 |
| 9439 | |
| 9440 | Known Boards: Unknown Bootleg Multigame Board |
| 9441 | Games: 76 in 1, Super 42 in 1 |
| 9442 | |
| 9443 | In MESS: Supported. |
| 9444 | |
| 9445 | *************************************************************/ |
| 9446 | |
| 9447 | static WRITE8_HANDLER( mapper226_w ) |
| 9448 | { |
| 9449 | int hi_bank; |
| 9450 | int size_16; |
| 9451 | int bank; |
| 9452 | |
| 9453 | LOG_MMC(("mapper226_w, offset: %04x, data: %02x\n", offset, data)); |
| 9454 | |
| 9455 | if (offset & 0x01) |
| 9456 | { |
| 9457 | mmc_cmd2 = data; |
| 9458 | } |
| 9459 | else |
| 9460 | { |
| 9461 | mmc_cmd1 = data; |
| 9462 | } |
| 9463 | |
| 9464 | set_nt_mirroring((mmc_cmd1 & 0x40) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9465 | |
| 9466 | hi_bank = mmc_cmd1 & 0x01; |
| 9467 | size_16 = mmc_cmd1 & 0x20; |
| 9468 | bank = ((mmc_cmd1 & 0x1e) >> 1) | ((mmc_cmd1 & 0x80) >> 3) | ((mmc_cmd2 & 0x01) << 5); |
| 9469 | |
| 9470 | if (size_16) |
| 9471 | { |
| 9472 | bank <<= 1; |
| 9473 | if (hi_bank) |
| 9474 | bank ++; |
| 9475 | |
| 9476 | prg16_89ab(space->machine, bank); |
| 9477 | prg16_cdef(space->machine, bank); |
| 9478 | } |
| 9479 | else |
| 9480 | prg32(space->machine, bank); |
| 9481 | } |
| 9482 | |
| 9483 | /************************************************************* |
| 9484 | |
| 9485 | Mapper 227 |
| 9486 | |
| 9487 | Known Boards: Unknown Bootleg Multigame Board |
| 9488 | Games: 1200 in 1, 295 in 1, 76 in 1 |
| 9489 | |
| 9490 | In MESS: Supported. |
| 9491 | |
| 9492 | *************************************************************/ |
| 9493 | |
| 9494 | static WRITE8_HANDLER( mapper227_w ) |
| 9495 | { |
| 9496 | int hi_bank; |
| 9497 | int size_32; |
| 9498 | int bank; |
| 9499 | |
| 9500 | LOG_MMC(("mapper227_w, offset: %04x, data: %02x\n", offset, data)); |
| 9501 | |
| 9502 | hi_bank = offset & 0x04; |
| 9503 | size_32 = offset & 0x01; |
| 9504 | bank = ((offset & 0x78) >> 3) | ((offset & 0x0100) >> 4); |
| 9505 | if (!size_32) |
| 9506 | { |
| 9507 | bank <<= 1; |
| 9508 | if (hi_bank) |
| 9509 | bank ++; |
| 9510 | |
| 9511 | prg16_89ab(space->machine, bank); |
| 9512 | prg16_cdef(space->machine, bank); |
| 9513 | } |
| 9514 | else |
| 9515 | prg32(space->machine, bank); |
| 9516 | |
| 9517 | if (!(offset & 0x80)) |
| 9518 | { |
| 9519 | if (offset & 0x200) |
| 9520 | prg16_cdef(space->machine, ((bank << 1) & 0x38) + 7); |
| 9521 | else |
| 9522 | prg16_cdef(space->machine, ((bank << 1) & 0x38)); |
| 9523 | } |
| 9524 | |
| 9525 | set_nt_mirroring((offset & 0x02) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9526 | } |
| 9527 | |
| 9528 | /************************************************************* |
| 9529 | |
| 9530 | Mapper 228 |
| 9531 | |
| 9532 | Known Boards: Bootleg Board by Active Enterprise |
| 9533 | Games: Action 52, Cheetah Men II |
| 9534 | |
| 9535 | In MESS: Partially Supported. |
| 9536 | |
| 9537 | *************************************************************/ |
| 9538 | |
| 9539 | static WRITE8_HANDLER( mapper228_w ) |
| 9540 | { |
| 9541 | int prg_bank, prg_chip, chr_bank; |
| 9542 | UINT8 prg_mode; |
| 9543 | LOG_MMC(("mapper228_w, offset: %04x, data: %02x\n", offset, data)); |
| 9544 | |
| 9545 | set_nt_mirroring((offset & 0x2000) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9546 | |
| 9547 | chr_bank = (data & 0x03) | ((offset & 0x0f) << 2); |
| 9548 | chr8(space->machine, chr_bank, CHRROM); |
| 9549 | |
| 9550 | prg_bank = (offset & 0x7c0) >> 6; |
| 9551 | prg_chip = (offset & 0x1800) >> 11; |
| 9552 | prg_mode = offset & 0x20; |
| 9553 | |
| 9554 | switch (prg_chip) |
| 9555 | { |
| 9556 | case 0: break; // we are already at the correct bank |
| 9557 | case 1: prg_bank |= 0x10; break; // chip 1 starts at block 16 |
| 9558 | case 2: break; // chip 2 was an empty socket |
| 9559 | case 3: prg_bank |= 0x20; break; // chip 3 starts at block 32 |
| 9560 | } |
| 9561 | |
| 9562 | if (prg_mode) |
| 9563 | { |
| 9564 | prg16_89ab(space->machine, prg_bank); |
| 9565 | prg16_cdef(space->machine, prg_bank); |
| 9566 | } |
| 9567 | else |
| 9568 | prg32(space->machine, prg_bank >> 1); |
| 9569 | } |
| 9570 | |
| 9571 | /************************************************************* |
| 9572 | |
| 9573 | Mapper 229 |
| 9574 | |
| 9575 | Known Boards: Unknown Bootleg Multigame Board |
| 9576 | Games: 31 in 1 |
| 9577 | |
| 9578 | In MESS: Supported. |
| 9579 | |
| 9580 | *************************************************************/ |
| 9581 | |
| 9582 | static WRITE8_HANDLER( mapper229_w ) |
| 9583 | { |
| 9584 | LOG_MMC(("mapper229_w, offset: %04x, data: %02x\n", offset, data)); |
| 9585 | |
| 9586 | set_nt_mirroring((offset & 0x20) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9587 | chr8(space->machine, offset, CHRROM); |
| 9588 | |
| 9589 | if ((offset & 0x1e) == 0) |
| 9590 | { |
| 9591 | prg16_89ab(space->machine, 0); |
| 9592 | prg16_89ab(space->machine, 1); |
| 9593 | } |
| 9594 | else |
| 9595 | { |
| 9596 | prg16_89ab(space->machine, offset & 0x1f); |
| 9597 | prg16_89ab(space->machine, offset & 0x1f); |
| 9598 | } |
| 9599 | } |
| 9600 | |
| 9601 | /************************************************************* |
| 9602 | |
| 9603 | Mapper 230 |
| 9604 | |
| 9605 | Known Boards: Unknown Bootleg Multigame Board |
| 9606 | Games: 22 in 1 |
| 9607 | |
| 9608 | In MESS: Partially Supported. It would need a reset |
| 9609 | to work (not possible yet) |
| 9610 | |
| 9611 | *************************************************************/ |
| 9612 | |
| 9613 | static WRITE8_HANDLER( mapper230_w ) |
| 9614 | { |
| 9615 | LOG_MMC(("mapper230_w, offset: %04x, data: %02x\n", offset, data)); |
| 9616 | |
| 9617 | if (1) // this should flip at reset |
| 9618 | { |
| 9619 | prg16_89ab(space->machine, data & 0x07); |
| 9620 | } |
| 9621 | else |
| 9622 | { |
| 9623 | if (data & 0x20) |
| 9624 | { |
| 9625 | prg16_89ab(space->machine, (data & 0x1f) + 8); |
| 9626 | prg16_cdef(space->machine, (data & 0x1f) + 8); |
| 9627 | } |
| 9628 | else |
| 9629 | { |
| 9630 | prg16_89ab(space->machine, (data & 0x1f) + 8); |
| 9631 | prg16_cdef(space->machine, (data & 0x1f) + 9); |
| 9632 | } |
| 9633 | set_nt_mirroring((data & 0x40) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 9634 | } |
| 9635 | } |
| 9636 | |
| 9637 | /************************************************************* |
| 9638 | |
| 9639 | Mapper 231 |
| 9640 | |
| 9641 | Known Boards: Unknown Bootleg Multigame Board |
| 9642 | Games: 20 in 1 |
| 9643 | |
| 9644 | In MESS: Supported. |
| 9645 | |
| 9646 | *************************************************************/ |
| 9647 | |
| 9648 | static WRITE8_HANDLER( mapper231_w ) |
| 9649 | { |
| 9650 | LOG_MMC(("mapper231_w, offset: %04x, data: %02x\n", offset, data)); |
| 9651 | |
| 9652 | set_nt_mirroring((offset & 0x80) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9653 | |
| 9654 | prg16_89ab(space->machine, (offset & 0x1e)); |
| 9655 | prg16_cdef(space->machine, (offset & 0x1e) | ((offset & 0x20) ? 1 : 0)); |
| 9656 | } |
| 9657 | |
| 9658 | /************************************************************* |
| 9659 | |
| 9660 | Mapper 232 |
| 9661 | |
| 9662 | Known Boards: Camerica BF9096 & ALGQV11 Boards |
| 9663 | Games: Quattro Adventure, Quattro Arcade, Quattro Sports |
| 9664 | |
| 9665 | Writes to 0x8000-0x9fff set prg block to (data&0x18)>>1, |
| 9666 | writes to 0xa000-0xbfff set prg page to data&3. selected |
| 9667 | prg are: prg16_89ab = block|page, prg_cdef = 3|page. |
| 9668 | For more info on the hardware to bypass the NES lockout, see |
| 9669 | Kevtris' Camerica Mappers documentation. |
| 9670 | |
| 9671 | In MESS: Supported. |
| 9672 | |
| 9673 | *************************************************************/ |
| 9674 | |
| 9675 | static void mapper232_set_prg( running_machine *machine ) |
| 9676 | { |
| 9677 | prg16_89ab(machine, (mmc_cmd2 & 0x03) | ((mmc_cmd1 & 0x18) >> 1)); |
| 9678 | prg16_cdef(machine, 0x03 | ((mmc_cmd1 & 0x18) >> 1)); |
| 9679 | } |
| 9680 | |
| 9681 | static WRITE8_HANDLER( mapper232_w ) |
| 9682 | { |
| 9683 | LOG_MMC(("mapper232_w, offset: %04x, data: %02x\n", offset, data)); |
| 9684 | |
| 9685 | if (offset < 0x2000) |
| 9686 | mmc_cmd1 = data; |
| 9687 | else |
| 9688 | mmc_cmd2 = data; |
| 9689 | |
| 9690 | mapper232_set_prg(space->machine); |
| 9691 | } |
| 9692 | |
| 9693 | /************************************************************* |
| 9694 | |
| 9695 | Mapper 233 |
| 9696 | |
| 9697 | Known Boards: Unknown Bootleg Multigame Board |
| 9698 | Games: Super 22 in 1 |
| 9699 | |
| 9700 | In MESS: Unsupported. Banking depends on dipswitch, so we |
| 9701 | need to implement these... |
| 9702 | |
| 9703 | *************************************************************/ |
| 9704 | |
| 9705 | /************************************************************* |
| 9706 | |
| 9707 | Mapper 234 |
| 9708 | |
| 9709 | Known Boards: Bootleg Board by AVE (D1012) |
| 9710 | Games: Maxi 15 Eur |
| 9711 | |
| 9712 | In MESS: Unsupported. Needs to read from 0xff80-0xffff. |
| 9713 | |
| 9714 | *************************************************************/ |
| 9715 | |
| 9716 | /************************************************************* |
| 9717 | |
| 9718 | Mapper 235 |
| 9719 | |
| 9720 | Known Boards: Unknown Bootleg Board by Golden Game |
| 9721 | Games: 260 in 1, 150 in 1 |
| 9722 | |
| 9723 | In MESS: Unsupported. |
| 9724 | |
| 9725 | *************************************************************/ |
| 9726 | |
| 9727 | /************************************************************* |
| 9728 | |
| 9729 | Mapper 236 |
| 9730 | |
| 9731 | Known Boards: Unknown Bootleg Multigame Board |
| 9732 | Games: a 800 in 1 multigame cart present in NEStopia db. |
| 9733 | |
| 9734 | No info available. |
| 9735 | |
| 9736 | In MESS: Unsupported. |
| 9737 | |
| 9738 | *************************************************************/ |
| 9739 | |
| 9740 | /************************************************************* |
| 9741 | |
| 9742 | Mapper 237 |
| 9743 | |
| 9744 | Known Boards: Undocumented / Unused ?!? |
| 9745 | Games: ---------- |
| 9746 | |
| 9747 | In MESS: ---------- |
| 9748 | |
| 9749 | *************************************************************/ |
| 9750 | |
| 9751 | /************************************************************* |
| 9752 | |
| 9753 | Mapper 238 |
| 9754 | |
| 9755 | Known Boards: Unknown Bootleg Board, 6035052 |
| 9756 | Games: Contra Fighter |
| 9757 | |
| 9758 | MMC3 simple clone. |
| 9759 | |
| 9760 | In MESS: Unsupported. Needs to read from 0x6000-0x7fff (for |
| 9761 | protection). It also needs to read in 0x4020-0x40ff. |
| 9762 | |
| 9763 | *************************************************************/ |
| 9764 | |
| 9765 | /************************************************************* |
| 9766 | |
| 9767 | Mapper 239 |
| 9768 | |
| 9769 | Known Boards: Undocumented / Unused ?!? |
| 9770 | Games: ---------- |
| 9771 | |
| 9772 | In MESS: ---------- |
| 9773 | |
| 9774 | *************************************************************/ |
| 9775 | |
| 9776 | /************************************************************* |
| 9777 | |
| 9778 | Mapper 240 |
| 9779 | |
| 9780 | Known Boards: Bootleg Board by C&E |
| 9781 | Games: Jing Ke Xin Zhuan, Sheng Huo Lie Zhuan |
| 9782 | |
| 9783 | Simple Mapper: writes to 0x4020-0x5fff sets prg32 to |
| 9784 | data>>4 and chr8 to data&f. We currently do not map |
| 9785 | writes to 0x4020-0x40ff (to do: verify if this produces |
| 9786 | issues) |
| 9787 | |
| 9788 | In MESS: Supported. |
| 9789 | |
| 9790 | *************************************************************/ |
| 9791 | |
| 9792 | static WRITE8_HANDLER( mapper240_l_w ) |
| 9793 | { |
| 9794 | LOG_MMC(("mapper240_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 9795 | |
| 9796 | prg32(space->machine, data >> 4); |
| 9797 | chr8(space->machine, data & 0x0f, CHRROM); |
| 9798 | } |
| 9799 | |
| 9800 | /************************************************************* |
| 9801 | |
| 9802 | Mapper 241 |
| 9803 | |
| 9804 | Known Boards: Bootleg Board by TXC |
| 9805 | Games: Commandos, Journey to the West, Ma Bu Mi Zhen & |
| 9806 | Qu Wei Cheng Yu Wu, Si Lu Chuan Qi |
| 9807 | |
| 9808 | Simple Mapper: writes to 0x8000-0xffff sets the prg32 bank. |
| 9809 | Not sure if returning 0x50 for reads in 0x4100-0x5000 is correct. |
| 9810 | |
| 9811 | In MESS: Supported. |
| 9812 | |
| 9813 | *************************************************************/ |
| 9814 | |
| 9815 | static READ8_HANDLER( mapper241_l_r ) |
| 9816 | { |
| 9817 | return 0x50; |
| 9818 | } |
| 9819 | |
| 9820 | static WRITE8_HANDLER( mapper241_w ) |
| 9821 | { |
| 9822 | LOG_MMC(("mapper241_w, offset: %04x, data: %02x\n", offset, data)); |
| 9823 | |
| 9824 | prg32(space->machine, data); |
| 9825 | } |
| 9826 | |
| 9827 | /************************************************************* |
| 9828 | |
| 9829 | Mapper 242 |
| 9830 | |
| 9831 | Known Boards: Bootleg Board by Waixing |
| 9832 | Games: Wai Xing Zhan Shi, Dragon Quest VIII |
| 9833 | |
| 9834 | Simple mapper: writes to 0x8000-0xffff sets prg32 banks to |
| 9835 | (offset>>3)&f. written data&3 sets the mirroring (with |
| 9836 | switched high/low compared to the standard one). However, |
| 9837 | a second variant DQ8 and requires no NT mirroring. |
| 9838 | |
| 9839 | A crc check is required to support Dragon Quest VIII (which |
| 9840 | uses a slightly different board) |
| 9841 | |
| 9842 | In MESS: Supported. |
| 9843 | |
| 9844 | *************************************************************/ |
| 9845 | |
| 9846 | static WRITE8_HANDLER( mapper242_w ) |
| 9847 | { |
| 9848 | LOG_MMC(("mapper242_w, offset: %04x, data: %02x\n", offset, data)); |
| 9849 | |
| 9850 | prg32(space->machine, offset >> 3); |
| 9851 | |
| 9852 | if (!nes.crc_hack) // DQ8 board does not have this / Zan Shi does |
| 9853 | { |
| 9854 | switch (data & 0x03) |
| 9855 | { |
| 9856 | case 0: set_nt_mirroring(PPU_MIRROR_VERT); break; |
| 9857 | case 1: set_nt_mirroring(PPU_MIRROR_HORZ); break; |
| 9858 | case 2: set_nt_mirroring(PPU_MIRROR_LOW); break; |
| 9859 | case 3: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 9860 | } |
| 9861 | } |
| 9862 | } |
| 9863 | |
| 9864 | /************************************************************* |
| 9865 | |
| 9866 | Mapper 243 |
| 9867 | |
| 9868 | Known Boards: Bootleg Board by Sachen (74SL374A) |
| 9869 | Games: Poker III |
| 9870 | |
| 9871 | The board is similar to the one of mapper 150. |
| 9872 | |
| 9873 | In MESS: Supported. |
| 9874 | |
| 9875 | *************************************************************/ |
| 9876 | |
| 9877 | static WRITE8_HANDLER( mapper243_l_w ) |
| 9878 | { |
| 9879 | LOG_MMC(("mapper243_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 9880 | |
| 9881 | /* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */ |
| 9882 | if (!(offset & 0x100)) |
| 9883 | { |
| 9884 | if (!(offset & 0x01)) |
| 9885 | mmc_cmd1 = data; |
| 9886 | else |
| 9887 | { |
| 9888 | switch (mmc_cmd1 & 0x07) |
| 9889 | { |
| 9890 | case 0x00: |
| 9891 | prg32(space->machine, 0); |
| 9892 | chr8(space->machine, 3, CHRROM); |
| 9893 | break; |
| 9894 | case 0x02: |
| 9895 | vrom_bank[0] = (vrom_bank[0] & ~0x08) | (data << 3 & 0x08); |
| 9896 | chr8(space->machine, vrom_bank[0], CHRROM); |
| 9897 | break; |
| 9898 | case 0x04: |
| 9899 | vrom_bank[0] = (vrom_bank[0] & ~0x01) | (data << 0 & 0x01); |
| 9900 | chr8(space->machine, vrom_bank[0], CHRROM); |
| 9901 | break; |
| 9902 | case 0x05: |
| 9903 | prg32(space->machine, data & 0x01); |
| 9904 | break; |
| 9905 | case 0x06: |
| 9906 | vrom_bank[0] = (vrom_bank[0] & ~0x06) | (data << 1 & 0x06); |
| 9907 | chr8(space->machine, vrom_bank[0], CHRROM); |
| 9908 | break; |
| 9909 | case 0x07: |
| 9910 | set_nt_mirroring(data & 0x01 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 9911 | break; |
| 9912 | default: |
| 9913 | break; |
| 9914 | } |
| 9915 | } |
| 9916 | } |
| 9917 | } |
| 9918 | |
| 9919 | /************************************************************* |
| 9920 | |
| 9921 | Mapper 244 |
| 9922 | |
| 9923 | Known Boards: Unknown Bootleg Board by C&E |
| 9924 | Games: Decathlon |
| 9925 | |
| 9926 | Pretty simple mapper: writes to 0x8065-0x80a4 set prg32 to |
| 9927 | data & 3; writes to 0x80a5-0x80e4 set chr8 to data & 7 |
| 9928 | |
| 9929 | In MESS: Supported. |
| 9930 | |
| 9931 | *************************************************************/ |
| 9932 | |
| 9933 | static WRITE8_HANDLER( mapper244_w ) |
| 9934 | { |
| 9935 | LOG_MMC(("mapper244_w, offset: %04x, data: %02x\n", offset, data)); |
| 9936 | |
| 9937 | if (offset < 0x0065) |
| 9938 | return; |
| 9939 | if (offset < 0x00a5) |
| 9940 | { |
| 9941 | prg32(space->machine, (offset - 0x0065) & 0x03); |
| 9942 | return; |
| 9943 | } |
| 9944 | if (offset < 0x00e5) |
| 9945 | { |
| 9946 | chr8(space->machine, (offset - 0x00a5) & 0x07, CHRROM); |
| 9947 | } |
| 9948 | } |
| 9949 | |
| 9950 | /************************************************************* |
| 9951 | |
| 9952 | Mapper 245 |
| 9953 | |
| 9954 | Known Boards: Type H by Waixing |
| 9955 | Games: Ying Xiong Yuan Yi Jing Chuan Qi, Yong Zhe Dou E |
| 9956 | Long - Dragon Quest VII |
| 9957 | |
| 9958 | MMC3 clone. More info to come. |
| 9959 | |
| 9960 | In MESS: Supported. |
| 9961 | |
| 9962 | *************************************************************/ |
| 9963 | |
| 9964 | static WRITE8_HANDLER( mapper245_w ) |
| 9965 | { |
| 9966 | UINT8 cmd, map245_helper; |
| 9967 | LOG_MMC(("mapper245_w, offset: %04x, data: %02x\n", offset, data)); |
| 9968 | |
| 9969 | switch (offset & 0x6001) |
| 9970 | { |
| 9971 | case 0x0001: |
| 9972 | cmd = mmc_cmd1 & 0x0f; |
| 9973 | switch (cmd) |
| 9974 | { |
| 9975 | case 0: // in this case we set prg_base in addition to vrom_bank! |
| 9976 | mmc_prg_base = (data << 5) & 0x40; |
| 9977 | mmc_prg_mask = 0x3f; |
| 9978 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9979 | case 1: case 2: case 3: case 4: case 5: |
| 9980 | vrom_bank[cmd] = data; |
| 9981 | if (nes.chr_chunks > 0) |
| 9982 | mapper4_set_chr(space->machine, CHRROM, mmc_chr_base, mmc_chr_mask); |
| 9983 | else // according to Disch's docs, mmc_cmd1&0x80 swaps 4k CHRRAM banks |
| 9984 | { |
| 9985 | map245_helper = /*(mmc_cmd1 & 0x80) ? 1 : */0; |
| 9986 | chr4_0(space->machine, 0 ^ map245_helper, CHRRAM); |
| 9987 | chr4_4(space->machine, 1 ^ map245_helper, CHRRAM); |
| 9988 | } |
| 9989 | break; |
| 9990 | case 6: |
| 9991 | case 7: |
| 9992 | prg_bank[cmd - 6] = data; |
| 9993 | mapper4_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 9994 | break; |
| 9995 | } |
| 9996 | break; |
| 9997 | |
| 9998 | case 0x2001: |
| 9999 | break; |
| 10000 | |
| 10001 | default: |
| 10002 | mapper4_w(space, offset, data); |
| 10003 | break; |
| 10004 | } |
| 10005 | } |
| 10006 | |
| 10007 | /************************************************************* |
| 10008 | |
| 10009 | Mapper 246 |
| 10010 | |
| 10011 | Known Boards: Unknown Bootleg Board by C&E |
| 10012 | Games: Fong Shen Bang - Zhu Lu Zhi Zhan |
| 10013 | |
| 10014 | Simple mapper: writes to 0x6000-0x67ff set PRG and CHR banks. |
| 10015 | Namely, 0x6000->0x6003 select resp. prg8_89, prg8_ab, prg8_cd |
| 10016 | and prg8_ef. 0x6004->0x6007 select resp. crh2_0, chr2_2, |
| 10017 | chr2_4 and chr2_6. In 0x6800-0x7fff lies WRAM. |
| 10018 | |
| 10019 | In MESS: Supported. |
| 10020 | |
| 10021 | *************************************************************/ |
| 10022 | |
| 10023 | static WRITE8_HANDLER( mapper246_m_w ) |
| 10024 | { |
| 10025 | LOG_MMC(("mapper246_m_w, offset: %04x, data: %02x\n", offset, data)); |
| 10026 | |
| 10027 | if (offset < 0x0800) |
| 10028 | { |
| 10029 | switch (offset & 0x0007) |
| 10030 | { |
| 10031 | case 0x0000: |
| 10032 | prg8_89(space->machine, data); |
| 10033 | break; |
| 10034 | case 0x0001: |
| 10035 | prg8_ab(space->machine, data); |
| 10036 | break; |
| 10037 | case 0x0002: |
| 10038 | prg8_cd(space->machine, data); |
| 10039 | break; |
| 10040 | case 0x0003: |
| 10041 | prg8_ef(space->machine, data); |
| 10042 | break; |
| 10043 | case 0x0004: |
| 10044 | chr2_0(space->machine, data, CHRROM); |
| 10045 | break; |
| 10046 | case 0x0005: |
| 10047 | chr2_2(space->machine, data, CHRROM); |
| 10048 | break; |
| 10049 | case 0x0006: |
| 10050 | chr2_4(space->machine, data, CHRROM); |
| 10051 | break; |
| 10052 | case 0x0007: |
| 10053 | chr2_6(space->machine, data, CHRROM); |
| 10054 | break; |
| 10055 | } |
| 10056 | } |
| 10057 | else |
| 10058 | nes.wram[offset] = data; |
| 10059 | } |
| 10060 | |
| 10061 | /************************************************************* |
| 10062 | |
| 10063 | Mapper 247 |
| 10064 | |
| 10065 | Known Boards: Undocumented / Unused ?!? |
| 10066 | Games: ---------- |
| 10067 | |
| 10068 | In MESS: ---------- |
| 10069 | |
| 10070 | *************************************************************/ |
| 10071 | |
| 10072 | /************************************************************* |
| 10073 | |
| 10074 | Mapper 248 |
| 10075 | |
| 10076 | Known Boards: Undocumented / Unused ?!? |
| 10077 | Games: ---------- |
| 10078 | |
| 10079 | In MESS: ---------- |
| 10080 | |
| 10081 | *************************************************************/ |
| 10082 | |
| 10083 | /************************************************************* |
| 10084 | |
| 10085 | Mapper 249 |
| 10086 | |
| 10087 | Known Boards: Waixing with Security Chip |
| 10088 | Games: Duo Bao Xiao Ying Hao - Guang Ming yu An Hei Chuan Shuo, |
| 10089 | Myth Struggle, San Shi Liu Ji, Shui Hu Zhuan |
| 10090 | |
| 10091 | MMC3 clone |
| 10092 | |
| 10093 | In MESS: Partially Supported. |
| 10094 | |
| 10095 | *************************************************************/ |
| 10096 | |
| 10097 | static void mapper249_set_prg( running_machine *machine, int prg_base, int prg_mask ) |
| 10098 | { |
| 10099 | int i; |
| 10100 | |
| 10101 | if (map249_reg) |
| 10102 | { |
| 10103 | for (i = 0; i < 4; i ++) // should this apply only to bank[0],bank[1]? |
| 10104 | { |
| 10105 | prg_bank[i] = ((prg_bank[i] & 0x01)) | ((prg_bank[i] >> 3) & 0x02) | |
| 10106 | ((prg_bank[i] >> 1) & 0x04) | ((prg_bank[i] << 2) & 0x18); |
| 10107 | } |
| 10108 | } |
| 10109 | |
| 10110 | mapper4_set_prg(machine, prg_base, prg_mask); |
| 10111 | } |
| 10112 | |
| 10113 | static void mapper249_set_chr( running_machine *machine, int chr_base, int chr_mask ) |
| 10114 | { |
| 10115 | UINT8 chr_page = (mmc_cmd1 & 0x80) >> 5; |
| 10116 | int i; |
| 10117 | |
| 10118 | if (map249_reg) |
| 10119 | { |
| 10120 | for (i = 0; i < 6; i ++) |
| 10121 | { |
| 10122 | vrom_bank[i] = ((vrom_bank[i] & 0x03)) | ((vrom_bank[i] >> 1) & 0x04) | |
| 10123 | ((vrom_bank[i] >> 4) & 0x08) | ((vrom_bank[i] >> 2) & 0x10) | |
| 10124 | ((vrom_bank[i] << 3) & 0x20) | ((vrom_bank[i] << 2) & 0xc0); |
| 10125 | } |
| 10126 | } |
| 10127 | |
| 10128 | chr1_x(machine, chr_page ^ 0, chr_base | ((vrom_bank[0] & ~0x01) & chr_mask), mmc_chr_source); |
| 10129 | chr1_x(machine, chr_page ^ 1, chr_base | ((vrom_bank[0] | 0x01) & chr_mask), mmc_chr_source); |
| 10130 | chr1_x(machine, chr_page ^ 2, chr_base | ((vrom_bank[1] & ~0x01) & chr_mask), mmc_chr_source); |
| 10131 | chr1_x(machine, chr_page ^ 3, chr_base | ((vrom_bank[1] | 0x01) & chr_mask), mmc_chr_source); |
| 10132 | chr1_x(machine, chr_page ^ 4, chr_base | (vrom_bank[2] & chr_mask), mmc_chr_source); |
| 10133 | chr1_x(machine, chr_page ^ 5, chr_base | (vrom_bank[3] & chr_mask), mmc_chr_source); |
| 10134 | chr1_x(machine, chr_page ^ 6, chr_base | (vrom_bank[4] & chr_mask), mmc_chr_source); |
| 10135 | chr1_x(machine, chr_page ^ 7, chr_base | (vrom_bank[5] & chr_mask), mmc_chr_source); |
| 10136 | } |
| 10137 | |
| 10138 | static WRITE8_HANDLER( mapper249_l_w ) |
| 10139 | { |
| 10140 | LOG_MMC(("mapper249_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 10141 | |
| 10142 | offset += 0x100; |
| 10143 | |
| 10144 | if (offset == 0x1000) |
| 10145 | { |
| 10146 | map249_reg = data & 0x02; |
| 10147 | mapper249_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 10148 | mapper249_set_chr(space->machine, mmc_prg_base, mmc_prg_mask); |
| 10149 | } |
| 10150 | } |
| 10151 | |
| 10152 | static WRITE8_HANDLER( mapper249_w ) |
| 10153 | { |
| 10154 | UINT8 MMC3_helper, cmd; |
| 10155 | LOG_MMC(("mapper249_w, offset: %04x, data: %02x\n", offset, data)); |
| 10156 | |
| 10157 | switch (offset & 0x6001) |
| 10158 | { |
| 10159 | case 0x0000: |
| 10160 | MMC3_helper = mmc_cmd1 ^ data; |
| 10161 | mmc_cmd1 = data; |
| 10162 | |
| 10163 | /* Has PRG Mode changed? */ |
| 10164 | if (MMC3_helper & 0x40) |
| 10165 | mapper249_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 10166 | |
| 10167 | /* Has CHR Mode changed? */ |
| 10168 | if (MMC3_helper & 0x80) |
| 10169 | mapper249_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 10170 | break; |
| 10171 | |
| 10172 | case 0x0001: |
| 10173 | cmd = mmc_cmd1 & 0x07; |
| 10174 | switch (cmd) |
| 10175 | { |
| 10176 | case 0: case 1: // these do not need to be separated: we take care of them in set_chr! |
| 10177 | case 2: case 3: case 4: case 5: |
| 10178 | vrom_bank[cmd] = data; |
| 10179 | mapper249_set_chr(space->machine, mmc_chr_base, mmc_chr_mask); |
| 10180 | break; |
| 10181 | case 6: |
| 10182 | case 7: |
| 10183 | prg_bank[cmd - 6] = data; |
| 10184 | mapper249_set_prg(space->machine, mmc_prg_base, mmc_prg_mask); |
| 10185 | break; |
| 10186 | } |
| 10187 | break; |
| 10188 | |
| 10189 | default: |
| 10190 | mapper4_w(space, offset, data); |
| 10191 | break; |
| 10192 | } |
| 10193 | } |
| 10194 | |
| 10195 | /************************************************************* |
| 10196 | |
| 10197 | Mapper 250 |
| 10198 | |
| 10199 | Known Boards: Unknown Bootleg Board by Nitra |
| 10200 | Games: Time Diver Avenger |
| 10201 | |
| 10202 | This acts basically like a MMC3 with different use of write |
| 10203 | address. |
| 10204 | |
| 10205 | In MESS: Supported. |
| 10206 | |
| 10207 | *************************************************************/ |
| 10208 | |
| 10209 | static WRITE8_HANDLER( mapper250_w ) |
| 10210 | { |
| 10211 | LOG_MMC(("mapper250_w, offset: %04x, data: %02x\n", offset, data)); |
| 10212 | |
| 10213 | mapper4_w(space, (offset & 0x6000) | ((offset & 0x400) >> 10), offset & 0xff); |
| 10214 | } |
| 10215 | |
| 10216 | /************************************************************* |
| 10217 | |
| 10218 | Mapper 251 |
| 10219 | |
| 10220 | Known Boards: Undocumented |
| 10221 | Games: Super 8-in-1 99 King Fighter |
| 10222 | |
| 10223 | In MESS: Unsupported. |
| 10224 | |
| 10225 | *************************************************************/ |
| 10226 | |
| 10227 | /************************************************************* |
| 10228 | |
| 10229 | Mapper 252 |
| 10230 | |
| 10231 | Known Boards: Unknown Bootleg Board by Waixing |
| 10232 | Games: San Guo Zhi |
| 10233 | |
| 10234 | This board uses Konami IRQ |
| 10235 | |
| 10236 | In MESS: Unsupported. |
| 10237 | |
| 10238 | *************************************************************/ |
| 10239 | |
| 10240 | static WRITE8_HANDLER( mapper252_w ) |
| 10241 | { |
| 10242 | UINT8 mmc_helper, bank; |
| 10243 | LOG_MMC(("mapper252_w, offset: %04x, data: %02x\n", offset, data)); |
| 10244 | |
| 10245 | switch (offset & 0x7000) |
| 10246 | { |
| 10247 | case 0x0000: |
| 10248 | prg8_89(space->machine, data); |
| 10249 | break; |
| 10250 | case 0x2000: |
| 10251 | prg8_ab(space->machine, data); |
| 10252 | break; |
| 10253 | case 0x3000: |
| 10254 | case 0x4000: |
| 10255 | case 0x5000: |
| 10256 | case 0x6000: |
| 10257 | bank = ((offset & 0x7000) - 0x3000) / 0x0800 + ((offset & 0x0008) >> 3); |
| 10258 | mmc_helper = offset & 0x04; |
| 10259 | if (mmc_helper) |
| 10260 | vrom_bank[bank] = (vrom_bank[bank] & 0x0f) | ((data & 0x0f) << 4); |
| 10261 | else |
| 10262 | vrom_bank[bank] = (vrom_bank[bank] & 0xf0) | (data & 0x0f); |
| 10263 | chr1_x(space->machine, bank, vrom_bank[bank], CHRROM); |
| 10264 | break; |
| 10265 | case 0xf000: |
| 10266 | switch (offset & 0x0c) |
| 10267 | { |
| 10268 | case 0x00: |
| 10269 | IRQ_count_latch = (IRQ_count_latch & 0xf0) | (data & 0x0f); |
| 10270 | break; |
| 10271 | case 0x04: |
| 10272 | IRQ_count_latch = (IRQ_count_latch & 0x0f) | ((data & 0x0f) << 4); |
| 10273 | break; |
| 10274 | case 0x08: |
| 10275 | IRQ_enable = data & 0x02; |
| 10276 | IRQ_enable_latch = data & 0x01; |
| 10277 | if (data & 0x02) |
| 10278 | IRQ_count = IRQ_count_latch; |
| 10279 | break; |
| 10280 | case 0x0c: |
| 10281 | IRQ_enable = IRQ_enable_latch; |
| 10282 | break; |
| 10283 | } |
| 10284 | break; |
| 10285 | } |
| 10286 | } |
| 10287 | |
| 10288 | /************************************************************* |
| 10289 | |
| 10290 | Mapper 253 |
| 10291 | |
| 10292 | Known Boards: Undocumented |
| 10293 | Games: Shen Hua Jian Yun III ? |
| 10294 | |
| 10295 | In MESS: Unsupported. |
| 10296 | |
| 10297 | *************************************************************/ |
| 10298 | |
| 10299 | /************************************************************* |
| 10300 | |
| 10301 | Mapper 254 |
| 10302 | |
| 10303 | Known Boards: Unknown Bootleg Board |
| 10304 | Games: Pikachu Y2K |
| 10305 | |
| 10306 | MMC3 simple clone. |
| 10307 | |
| 10308 | In MESS: Unsupported. Needs to read from 0x6000-0x7fff (for |
| 10309 | protection). |
| 10310 | |
| 10311 | *************************************************************/ |
| 10312 | |
| 10313 | /************************************************************* |
| 10314 | |
| 10315 | Mapper 255 |
| 10316 | |
| 10317 | Known Boards: Unknown Bootleg Board |
| 10318 | Games: 110 in 1 |
| 10319 | |
| 10320 | In MESS: Preliminary support. |
| 10321 | |
| 10322 | *************************************************************/ |
| 10323 | |
| 10324 | static WRITE8_HANDLER( mapper255_w ) |
| 10325 | { |
| 10326 | UINT8 map255_helper1 = (offset >> 12) ? 0 : 1; |
| 10327 | UINT8 map255_helper2 = ((offset >> 8) & 0x40) | ((offset >> 6) & 0x3f); |
| 10328 | |
| 10329 | LOG_MMC(("mapper255_w, offset: %04x, data: %02x\n", offset, data)); |
| 10330 | |
| 10331 | set_nt_mirroring((offset & 0x2000) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT); |
| 10332 | prg16_89ab(space->machine, map255_helper1 & ~map255_helper2); |
| 10333 | prg16_cdef(space->machine, map255_helper1 | map255_helper2); |
| 10334 | chr8(space->machine, ((offset >> 8) & 0x40) | (offset & 0x3f), CHRROM); |
| 10335 | } |
| 10336 | |
| 10337 | |
| 10338 | |
| 10339 | /************************************************************* |
| 10340 | |
| 10341 | mmc_list |
| 10342 | |
| 10343 | Supported mappers and corresponding handlers |
| 10344 | |
| 10345 | *************************************************************/ |
| 10346 | |
| 10347 | static const mmc mmc_list[] = |
| 10348 | { |
| 10349 | /* INES DESC LOW_W, LOW_R, MED_W, HIGH_W, PPU_latch, scanline CB, hblank CB */ |
| 10350 | { 0, "No Mapper", NULL, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 10351 | { 1, "MMC1", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL }, |
| 10352 | { 2, "Ux-ROM", NULL, NULL, NULL, mapper2_w, NULL, NULL, NULL }, |
| 10353 | { 3, "Cx-ROM", NULL, NULL, NULL, mapper3_w, NULL, NULL, NULL }, |
| 10354 | { 4, "MMC3", NULL, NULL, NULL, mapper4_w, NULL, NULL, mapper4_irq }, |
| 10355 | { 5, "MMC5", mapper5_l_w, mapper5_l_r, NULL, mapper5_w, NULL, NULL, mapper5_irq }, |
| 10356 | { 6, "FFE F4xxxx", mapper6_l_w, NULL, NULL, mapper6_w, NULL, NULL, ffe_irq }, |
| 10357 | { 7, "Ax-ROM", NULL, NULL, NULL, mapper7_w, NULL, NULL, NULL }, |
| 10358 | { 8, "FFE F3xxxx", NULL, NULL, NULL, mapper8_w, NULL, NULL, NULL }, |
| 10359 | { 9, "MMC2", NULL, NULL, NULL, mapper9_w, mapper9_latch, NULL, NULL}, |
| 10360 | { 10, "MMC4", NULL, NULL, NULL, mapper10_w, mapper9_latch, NULL, NULL }, |
| 10361 | { 11, "Color Dreams", NULL, NULL, NULL, mapper11_w, NULL, NULL, NULL }, |
| 10362 | { 12, "Rex Soft DBZ5", mapper12_l_w, mapper12_l_r, NULL, mapper12_w, NULL, NULL, mapper4_irq }, |
| 10363 | { 13, "CP-ROM", NULL, NULL, NULL, mapper13_w, NULL, NULL, NULL }, |
| 10364 | { 14, "Rex Soft SL1632", NULL, NULL, NULL, mapper14_w, NULL, NULL, mapper4_irq }, |
| 10365 | { 15, "100-in-1", NULL, NULL, NULL, mapper15_w, NULL, NULL, NULL }, |
| 10366 | { 16, "Bandai LZ93D50 - 24C02", NULL, NULL, mapper16_m_w, mapper16_w, NULL,NULL, bandai_irq }, |
| 10367 | { 17, "FFE F8xxx", mapper17_l_w, NULL, NULL, NULL, NULL, NULL, ffe_irq }, |
| 10368 | { 18, "Jaleco SS88006", NULL, NULL, NULL, mapper18_w, NULL, NULL, jaleco_irq }, |
| 10369 | { 19, "Namcot 106 + N106", mapper19_l_w, mapper19_l_r, NULL, mapper19_w, NULL, NULL, namcot_irq }, |
| 10370 | { 20, "Famicom Disk System", NULL, NULL, NULL, NULL, NULL, NULL, fds_irq }, |
| 10371 | { 21, "Konami VRC 4", NULL, NULL, NULL, konami_vrc4_w, NULL, NULL, konami_irq }, |
| 10372 | { 22, "Konami VRC 2a", NULL, NULL, NULL, konami_vrc2a_w, NULL, NULL, NULL }, |
| 10373 | { 23, "Konami VRC 2b", NULL, NULL, NULL, konami_vrc2b_w, NULL, NULL, konami_irq }, |
| 10374 | { 24, "Konami VRC 6a", NULL, NULL, NULL, konami_vrc6a_w, NULL, NULL, konami_irq }, |
| 10375 | { 25, "Konami VRC 4", NULL, NULL, NULL, konami_vrc4_w, NULL, NULL, konami_irq }, |
| 10376 | { 26, "Konami VRC 6b", NULL, NULL, NULL, konami_vrc6b_w, NULL, NULL, konami_irq }, |
| 10377 | // 27 World Hero |
| 10378 | // 28, 29, 30, 31 Unused |
| 10379 | { 32, "Irem G-101", NULL, NULL, NULL, mapper32_w, NULL, NULL, NULL }, |
| 10380 | { 33, "Taito TC0190FMC", NULL, NULL, NULL, mapper33_w, NULL, NULL, NULL }, |
| 10381 | { 34, "Nina-001", NULL, NULL, mapper34_m_w, mapper34_w, NULL, NULL, NULL }, |
| 10382 | // 35 Unused |
| 10383 | { 36, "TXC Policeman", NULL, NULL, NULL, mapper36_w, NULL, NULL, NULL }, |
| 10384 | { 37, "ZZ Board", NULL, NULL, mapper37_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 10385 | { 38, "Crime Buster", NULL, NULL, mapper38_m_w, NULL, NULL, NULL, NULL }, |
| 10386 | { 39, "Subor Study n Game", NULL, NULL, NULL, mapper39_w, NULL, NULL, NULL }, |
| 10387 | { 40, "SMB2 JPN (bootleg)", NULL, NULL, NULL, mapper40_w, NULL, NULL, mapper40_irq }, |
| 10388 | { 41, "Caltron 6-in-1", NULL, NULL, mapper41_m_w, mapper41_w, NULL, NULL, NULL }, |
| 10389 | { 42, "Mario Baby", NULL, NULL, NULL, mapper42_w, NULL, NULL, NULL }, |
| 10390 | { 43, "150-in-1", NULL, NULL, NULL, mapper43_w, NULL, NULL, NULL }, |
| 10391 | { 44, "SuperBig 7-in-1", NULL, NULL, NULL, mapper44_w, NULL, NULL, mapper4_irq }, |
| 10392 | { 45, "X-in-1 MMC3", NULL, NULL, mapper45_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 10393 | { 46, "Rumblestation", NULL, NULL, mapper46_m_w, mapper46_w, NULL, NULL, NULL }, |
| 10394 | { 47, "QJ Board", NULL, NULL, mapper47_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 10395 | { 48, "Taito TC0190FMC PAL16R4", NULL, NULL, NULL, mapper48_w, NULL, NULL, mapper4_irq }, |
| 10396 | { 49, "Super HIK 4-in-1", NULL, NULL, mapper49_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 10397 | { 50, "SMB2 JPN (bootleg 2)", mapper50_l_w, NULL, NULL, NULL, NULL, NULL, mapper50_irq }, |
| 10398 | { 51, "Ballgames 11-in-1", NULL, NULL, mapper51_m_w, mapper51_w, NULL, NULL, NULL }, |
| 10399 | { 52, "Mario 7-in-1", NULL, NULL, mapper52_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 10400 | // 53 Supervision 16-in-1 |
| 10401 | // 54 Novel Diamond X-in-1 |
| 10402 | // 55 Genius SMB |
| 10403 | // 56 Kaiser KS202 |
| 10404 | { 57, "GKA 6-in-1", NULL, NULL, NULL, mapper57_w, NULL, NULL, NULL }, |
| 10405 | { 58, "GKB X-in-1", NULL, NULL, NULL, mapper58_w, NULL, NULL, NULL }, |
| 10406 | // 59 Unused |
| 10407 | // 60 4-in-1 Reset based |
| 10408 | { 61, "Tetris Family 20-in-1", NULL, NULL, NULL, mapper61_w, NULL, NULL, NULL }, |
| 10409 | { 62, "Super 700-in-1", NULL, NULL, NULL, mapper62_w, NULL, NULL, NULL }, |
| 10410 | // 63 CH001 X-in-1 |
| 10411 | { 64, "Tengen 800032", NULL, NULL, NULL, mapper64_w, NULL, NULL, mapper64_irq }, |
| 10412 | { 65, "Irem H3001", NULL, NULL, NULL, mapper65_w, NULL, NULL, irem_irq }, |
| 10413 | { 66, "Gx-ROM", NULL, NULL, NULL, mapper66_w, NULL, NULL, NULL }, |
| 10414 | { 67, "SunSoft 3", NULL, NULL, NULL, mapper67_w, NULL, NULL, mapper67_irq }, |
| 10415 | { 68, "SunSoft 4", NULL, NULL, NULL, mapper68_w, NULL, NULL, NULL }, |
| 10416 | { 69, "SunSoft FME", NULL, NULL, NULL, mapper69_w, NULL, NULL, mapper69_irq }, |
| 10417 | { 70, "74161/32 Bandai", NULL, NULL, NULL, mapper70_w, NULL, NULL, NULL }, |
| 10418 | { 71, "Camerica", NULL, NULL, NULL, mapper71_w, NULL, NULL, NULL }, |
| 10419 | { 72, "74161/32 Jaleco", NULL, NULL, NULL, mapper72_w, NULL, NULL, NULL }, |
| 10420 | { 73, "Konami VRC 3", NULL, NULL, NULL, mapper73_w, NULL, NULL, konami_irq }, |
| 10421 | { 74, "Waixing Type A", NULL, NULL, NULL, mapper74_w, NULL, NULL, mapper4_irq }, |
| 10422 | { 75, "Konami VRC 1", NULL, NULL, NULL, mapper75_w, NULL, NULL, NULL }, |
| 10423 | { 76, "Namco 3446", NULL, NULL, NULL, mapper76_w, NULL, NULL, NULL }, |
| 10424 | { 77, "Irem LROG017", NULL, NULL, NULL, mapper77_w, NULL, NULL, NULL }, |
| 10425 | { 78, "Irem Holy Diver", NULL, NULL, NULL, mapper78_w, NULL, NULL, NULL }, |
| 10426 | { 79, "Nina-03", mapper79_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 10427 | { 80, "Taito X1-005 Ver. A", NULL, NULL, mapper80_m_w, NULL, NULL, NULL, NULL }, |
| 10428 | // 81 Unused |
| 10429 | { 82, "Taito X1-017", NULL, NULL, mapper82_m_w, NULL, NULL, NULL, NULL }, |
| 10430 | { 83, "Cony", mapper83_l_w, mapper83_l_r, NULL, mapper83_w, NULL, NULL, NULL }, |
| 10431 | { 84, "Pasofami hacked images?", NULL, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 10432 | { 85, "Konami VRC 7", NULL, NULL, NULL, konami_vrc7_w, NULL, NULL, konami_irq }, |
| 10433 | { 86, "Jaleco JF13", NULL, NULL, mapper86_m_w, NULL, NULL, NULL, NULL }, |
| 10434 | { 87, "74139/74", NULL, NULL, mapper87_m_w, NULL, NULL, NULL, NULL }, |
| 10435 | { 88, "Namcot 34x3", NULL, NULL, NULL, mapper88_w, NULL, NULL, NULL }, |
| 10436 | { 89, "Sunsoft 2b", NULL, NULL, NULL, mapper89_w, NULL, NULL, NULL }, |
| 10437 | // 90 JY Company Type A |
| 10438 | { 91, "HK-SF3 (bootleg)", NULL, NULL, mapper91_m_w, NULL, NULL, NULL, mapper4_irq }, |
| 10439 | { 92, "Jaleco JF19 / JF21", NULL, NULL, NULL, mapper92_w, NULL, NULL, NULL }, |
| 10440 | { 93, "Sunsoft 2A", NULL, NULL, NULL, mapper93_w, NULL, NULL, NULL }, |
| 10441 | { 94, "Capcom LS161", NULL, NULL, NULL, mapper94_w, NULL, NULL, NULL }, |
| 10442 | { 95, "Namcot 3425", NULL, NULL, NULL, mapper95_w, NULL, NULL, NULL }, |
| 10443 | { 96, "Bandai OekaKids", NULL, NULL, NULL, mapper96_w, NULL, NULL, NULL }, |
| 10444 | { 97, "Irem Kaiketsu", NULL, NULL, NULL, mapper97_w, NULL, NULL, NULL }, |
| 10445 | // 98 Unused |
| 10446 | // 99 VS. system |
| 10447 | // 100 images hacked to work with nesticle? |
| 10448 | { 101, "Jaleco?? LS161", NULL, NULL, mapper101_m_w, mapper101_w, NULL, NULL, NULL }, |
| 10449 | // 102 Unused |
| 10450 | // 103 Bootleg cart 2708 |
| 10451 | { 104, "Golden Five", NULL, NULL, NULL, mapper104_w, NULL, NULL, NULL }, |
| 10452 | // 105 Nintendo World Championship |
| 10453 | { 106, "SMB3 (bootleg)", NULL, NULL, NULL, mapper106_w, NULL, NULL, mapper106_irq }, |
| 10454 | { 107, "Magic Dragon", NULL, NULL, NULL, mapper107_w, NULL, NULL, NULL }, |
| 10455 | // 108 Whirlwind |
| 10456 | // 109, 110 Unused |
| 10457 | // 111 Ninja Ryuukenden Chinese? |
| 10458 | { 112, "Asder", NULL, NULL, NULL, mapper112_w, NULL, NULL, NULL }, |
| 10459 | { 113, "Sachen/Hacker/Nina", mapper113_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 10460 | { 114, "The Lion King", NULL, NULL, mapper114_m_w, mapper114_w, NULL, NULL, mapper4_irq }, |
| 10461 | { 115, "Kasing", NULL, NULL, mapper115_m_w, mapper115_w, NULL, NULL, mapper4_irq }, |
| 10462 | // 116 Someri Team |
| 10463 | { 117, "Future Media", NULL, NULL, NULL, mapper117_w, NULL, NULL, mapper117_irq }, |
| 10464 | { 118, "TKS-ROM / TLS-ROM", NULL, NULL, NULL, mapper118_w, NULL, NULL, mapper4_irq }, |
| 10465 | { 119, "TQ-ROM", NULL, NULL, NULL, mapper119_w, NULL, NULL, mapper4_irq }, |
| 10466 | // 120 FDS bootleg |
| 10467 | { 121, "K - Panda Prince", mapper121_l_w, mapper121_l_r, NULL, mapper121_w, NULL, NULL, mapper4_irq }, |
| 10468 | // 122 Unused |
| 10469 | // 123 K H2288 |
| 10470 | // 124, 125 Unused |
| 10471 | // 126 Powerjoy 84-in-1 |
| 10472 | // 127, 128, 129, 130, 131 Unused |
| 10473 | { 132, "TXC T22211A", mapper132_l_w, mapper132_l_r, NULL, mapper132_w, NULL, NULL, NULL }, |
| 10474 | { 133, "Sachen SA72008", mapper133_l_w, NULL, mapper133_m_w, NULL, NULL, NULL, NULL }, |
| 10475 | { 134, "Family 4646B", NULL, NULL, mapper134_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 10476 | // 135 Unused |
| 10477 | { 136, "Sachen TCU02", mapper136_l_w, mapper136_l_r, NULL, NULL, NULL, NULL, NULL }, |
| 10478 | { 137, "Sachen 8259D", mapper137_l_w, NULL, mapper137_m_w, NULL, NULL, NULL, NULL }, |
| 10479 | { 138, "Sachen 8259B", mapper138_l_w, NULL, mapper138_m_w, NULL, NULL, NULL, NULL }, |
| 10480 | { 139, "Sachen 8259C", mapper139_l_w, NULL, mapper139_m_w, NULL, NULL, NULL, NULL }, |
| 10481 | { 140, "Jaleco JF11", NULL, NULL, mapper_140_m_w, NULL, NULL, NULL, NULL }, |
| 10482 | { 141, "Sachen 8259A", mapper141_l_w, NULL, mapper141_m_w, NULL, NULL, NULL, NULL }, |
| 10483 | // 142 Kaiser KS7032 |
| 10484 | { 143, "Sachen TCA01", NULL, mapper143_l_r, NULL, NULL, NULL, NULL, NULL }, |
| 10485 | { 144, "AGCI 50282", NULL, NULL, NULL, mapper144_w, NULL, NULL, NULL }, //Death Race only |
| 10486 | { 145, "Sachen SA72007", mapper145_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 10487 | { 146, "Sachen SA-016-1M", mapper79_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, // basically same as Mapper 79 (Nina006) |
| 10488 | { 147, "Sachen TCU01", mapper147_l_w, NULL, mapper147_m_w, mapper147_w, NULL, NULL, NULL }, |
| 10489 | { 148, "Sachen SA0037", NULL, NULL, NULL, mapper148_w, NULL, NULL, NULL }, |
| 10490 | { 149, "Sachen SA0036", NULL, NULL, NULL, mapper149_w, NULL, NULL, NULL }, |
| 10491 | { 150, "Sachen 74LS374B", mapper150_l_w, mapper150_l_r, mapper150_m_w, NULL, NULL, NULL, NULL }, |
| 10492 | // 151 Konami VS. system |
| 10493 | { 152, "Taito 74161/161", NULL, NULL, NULL, mapper152_w, NULL, NULL, NULL }, |
| 10494 | { 153, "Bandai LZ93D50", NULL, NULL, mapper153_m_w, mapper153_w, NULL,NULL, bandai_irq }, |
| 10495 | { 154, "Namcot 34xx", NULL, NULL, NULL, mapper154_w, NULL, NULL, NULL }, |
| 10496 | { 155, "SK-ROM", NULL, NULL, NULL, mapper1_w, NULL, NULL, NULL }, // diff compared to MMC1 concern WRAM (unsupported for MMC1 as well, atm) |
| 10497 | { 156, "Open Corp. DAOU36", NULL, NULL, NULL, mapper156_w, NULL, NULL, NULL }, |
| 10498 | { 157, "Bandai Datach Board", NULL, NULL, mapper16_m_w, mapper16_w, NULL,NULL, bandai_irq }, // no Datach Reader -> we fall back to mapper 16 |
| 10499 | { 158, "Tengen T800037", NULL, NULL, NULL, mapper158_w, NULL, NULL, mapper64_irq }, |
| 10500 | { 159, "Bandai LZ93D50 - 24C01", NULL, NULL, mapper16_m_w, mapper16_w, NULL,NULL, bandai_irq }, |
| 10501 | // 160, 161, 162 Unused |
| 10502 | // 163 Nanjing |
| 10503 | { 164, "Final Fantasy V", mapper164_l_w, NULL, NULL, mapper164_w, NULL, NULL, NULL }, |
| 10504 | // 165 Waixing SH2 |
| 10505 | { 166, "Subor Board Type 1", NULL, NULL, NULL, mapper166_w, NULL, NULL, NULL }, |
| 10506 | { 167, "Subor Board Type 2", NULL, NULL, NULL, mapper167_w, NULL, NULL, NULL }, |
| 10507 | // 168 Racermate Challenger II |
| 10508 | // 169 Unused |
| 10509 | // 170 Fujiya |
| 10510 | { 171, "Kaiser KS7058", NULL, NULL, NULL, mapper171_w, NULL, NULL, NULL }, |
| 10511 | { 172, "TXC T22211B", mapper132_l_w, mapper132_l_r, NULL, mapper172_w, NULL, NULL, NULL }, |
| 10512 | { 173, "TXC T22211C", mapper132_l_w, mapper173_l_r, NULL, mapper132_w, NULL, NULL, NULL }, |
| 10513 | // 174 Unused |
| 10514 | // 175 Kaiser KS7022 |
| 10515 | { 176, "Zhi Li Xiao Zhuan Yuan", mapper176_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 10516 | { 177, "Henggedianzi Board", NULL, NULL, NULL, mapper177_w, NULL, NULL, NULL }, |
| 10517 | { 178, "San Guo Zhong Lie Zhuan", mapper178_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 10518 | { 179, "Xing He Zhan Shi", mapper179_l_w, NULL, NULL, mapper179_w, NULL, NULL, NULL }, |
| 10519 | { 180, "Nihon Bussan UN-ROM", NULL, NULL, NULL, mapper180_w, NULL, NULL, NULL }, |
| 10520 | // 181 Unused |
| 10521 | { 182, "Hosenkan", NULL, NULL, NULL, mapper182_w, NULL, NULL, mapper4_irq }, |
| 10522 | // 183 FDS bootleg |
| 10523 | { 184, "Sunsoft 1", NULL, NULL, mapper184_m_w, NULL, NULL, NULL, NULL }, |
| 10524 | { 185, "CN-ROM", NULL, NULL, NULL, mapper185_w, NULL, NULL, NULL }, |
| 10525 | // 186 Fukutake |
| 10526 | { 187, "King of Fighters 96", mapper187_l_w, mapper187_l_r, NULL, mapper187_w, NULL, NULL, mapper4_irq }, |
| 10527 | { 188, "Bandai Karaoke", NULL, NULL, NULL, mapper188_w, NULL, NULL, NULL }, |
| 10528 | { 189, "TXC TW Board", mapper189_l_w, NULL, mapper189_m_w, mapper189_w, NULL, NULL, mapper4_irq }, |
| 10529 | // 190 Unused |
| 10530 | { 191, "Waixing Type B", NULL, NULL, NULL, mapper191_w, NULL, NULL, mapper4_irq }, |
| 10531 | { 192, "Waixing Type C", NULL, NULL, NULL, mapper192_w, NULL, NULL, mapper4_irq }, |
| 10532 | { 193, "Fighting Hero", NULL, NULL, mapper193_m_w, NULL, NULL, NULL, NULL }, |
| 10533 | { 194, "Waixing Type D", NULL, NULL, NULL, mapper194_w, NULL, NULL, mapper4_irq }, |
| 10534 | { 195, "Waixing Type E", NULL, NULL, NULL, mapper195_w, NULL, NULL, mapper4_irq }, |
| 10535 | { 196, "Super Mario Bros. 11", NULL, NULL, NULL, mapper196_w, NULL, NULL, mapper4_irq }, |
| 10536 | { 197, "Super Fighter 3", NULL, NULL, NULL, mapper197_w, NULL, NULL, mapper4_irq }, |
| 10537 | { 198, "Waixing Type F", NULL, NULL, NULL, mapper198_w, NULL, NULL, mapper4_irq }, |
| 10538 | { 199, "Waixing Type G", NULL, NULL, NULL, mapper199_w, NULL, NULL, mapper4_irq }, |
| 10539 | { 200, "36-in-1", NULL, NULL, NULL, mapper200_w, NULL, NULL, NULL }, |
| 10540 | { 201, "21-in-1", NULL, NULL, NULL, mapper201_w, NULL, NULL, NULL }, |
| 10541 | { 202, "150-in-1", NULL, NULL, NULL, mapper202_w, NULL, NULL, NULL }, |
| 10542 | { 203, "35-in-1", NULL, NULL, NULL, mapper203_w, NULL, NULL, NULL }, |
| 10543 | { 204, "64-in-1", NULL, NULL, NULL, mapper204_w, NULL, NULL, NULL }, |
| 10544 | { 205, "15-in-1", NULL, NULL, mapper205_m_w, mapper4_w, NULL, NULL, mapper4_irq }, |
| 10545 | { 206, "MIMIC-1", NULL, NULL, NULL, mapper206_w, NULL, NULL, mapper4_irq }, |
| 10546 | { 207, "Taito X1-005 Ver. B", NULL, NULL, mapper207_m_w, NULL, NULL, NULL, NULL }, |
| 10547 | { 208, "Gouder G3717", mapper208_l_w, mapper208_l_r, NULL, mapper208_w, NULL, NULL, mapper4_irq }, |
| 10548 | // 209 JY Company Type B |
| 10549 | // 210 Some emu uses this as Mapper 19 without some features |
| 10550 | // 211 JY Company Type C |
| 10551 | { 212, "Super HIK 300-in-1", NULL, NULL, NULL, mapper212_w, NULL, NULL, NULL }, |
| 10552 | { 213, "9999999-in-1", NULL, NULL, NULL, mapper213_w, NULL, NULL, NULL }, |
| 10553 | { 214, "Super Gun 20-in-1", NULL, NULL, NULL, mapper214_w, NULL, NULL, NULL }, |
| 10554 | { 215, "Super Game Boogerman", mapper215_l_w, NULL, NULL, mapper215_w, NULL, NULL, mapper4_irq }, |
| 10555 | { 216, "RCM GS2015", NULL, NULL, NULL, mapper216_w, NULL, NULL, NULL }, |
| 10556 | { 217, "Golden Card 6-in-1", mapper217_l_w, NULL, NULL, mapper217_w, NULL, NULL, mapper4_irq }, |
| 10557 | // 218 Unused |
| 10558 | // 219 Bootleg a9746 |
| 10559 | // 220 Summer Carnival '92?? |
| 10560 | { 221, "X-in-1 (N625092)", NULL, NULL, NULL, mapper221_w, NULL, NULL, NULL }, |
| 10561 | { 222, "Dragonninja Bootleg", NULL, NULL, NULL, mapper222_w, NULL, NULL, mapper222_irq }, |
| 10562 | // 223 Waixing Type I |
| 10563 | // 224 Waixing Type J |
| 10564 | { 225, "72-in-1 bootleg", NULL, NULL, NULL, mapper225_w, NULL, NULL, NULL }, |
| 10565 | { 226, "76-in-1 bootleg", NULL, NULL, NULL, mapper226_w, NULL, NULL, NULL }, |
| 10566 | { 227, "1200-in-1 bootleg", NULL, NULL, NULL, mapper227_w, NULL, NULL, NULL }, |
| 10567 | { 228, "Action 52", NULL, NULL, NULL, mapper228_w, NULL, NULL, NULL }, |
| 10568 | { 229, "31-in-1", NULL, NULL, NULL, mapper229_w, NULL, NULL, NULL }, |
| 10569 | { 230, "22-in-1", NULL, NULL, NULL, mapper230_w, NULL, NULL, NULL }, |
| 10570 | { 231, "20-in-1", NULL, NULL, NULL, mapper231_w, NULL, NULL, NULL }, |
| 10571 | { 232, "Quattro", NULL, NULL, mapper232_w, mapper232_w, NULL, NULL, NULL }, |
| 10572 | // 233 Super 22 Games |
| 10573 | // 234 AVE Maxi 15 |
| 10574 | // 235 Golden Game x-in-1 |
| 10575 | // 236 Game 800-in-1 |
| 10576 | // 237 Unused |
| 10577 | // 238 Bootleg 6035052 |
| 10578 | // 239 Unused |
| 10579 | { 240, "Jing Ke Xin Zhuan", mapper240_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 10580 | { 241, "Education 18-in-1", NULL, mapper241_l_r, NULL, mapper241_w, NULL, NULL, NULL }, |
| 10581 | { 242, "Wai Xing Zhan Shi", NULL, NULL, NULL, mapper242_w, NULL, NULL, NULL }, |
| 10582 | { 243, "Sachen 74LS374A", mapper243_l_w, NULL, NULL, NULL, NULL, NULL, NULL }, |
| 10583 | { 244, "Decathlon", NULL, NULL, NULL, mapper244_w, NULL, NULL, NULL }, |
| 10584 | { 245, "Waixing Type H", NULL, NULL, NULL, mapper245_w, NULL, NULL, mapper4_irq }, |
| 10585 | { 246, "Fong Shen Bang", NULL, NULL, mapper246_m_w, NULL, NULL, NULL, NULL }, |
| 10586 | // 247, 248 Unused |
| 10587 | { 249, "Waixing Security Board", mapper249_l_w, NULL, NULL, mapper249_w, NULL, NULL, mapper4_irq }, |
| 10588 | { 250, "Time Diver Avenger", NULL, NULL, NULL, mapper250_w, NULL, NULL, mapper4_irq }, |
| 10589 | // 251 Shen Hua Jian Yun III?? |
| 10590 | { 252, "Waixing San Guo Zhi", NULL, NULL, NULL, mapper252_w, NULL, NULL, konami_irq }, |
| 10591 | // 253 Super 8-in-1 99 King Fighter?? |
| 10592 | // 254 Pikachu Y2K |
| 10593 | { 255, "110-in-1", NULL, NULL, NULL, mapper255_w, NULL, NULL, NULL }, |
| 10594 | }; |
| 10595 | |
| 10596 | |
| 10597 | const mmc *nes_mapper_lookup( int mapper ) |
| 10598 | { |
| 10599 | int i; |
| 10600 | for (i = 0; i < sizeof(mmc_list) / sizeof(mmc_list[0]); i++) |
| 10601 | { |
| 10602 | if (mmc_list[i].iNesMapper == nes.mapper) |
| 10603 | return &mmc_list[i]; |
| 10604 | } |
| 10605 | return NULL; |
| 10606 | } |