src/mess/machine/nes_pcb.c
| r8290 | r8291 | |
| 136 | 136 | { "NES-NTBROM", STD_NXROM }, |
| 137 | 137 | /* NxROM boards by other manufacturer (this board was mainly used by Sunsoft?) */ |
| 138 | 138 | { "SUNSOFT-4", STD_NXROM }, |
| 139 | | { "SUNSOFT-DCS", STD_NXROM }, |
| 139 | { "SUNSOFT-DCS", SUNSOFT_DCS }, |
| 140 | 140 | { "TENGEN-800042", STD_NXROM }, |
| 141 | 141 | // |
| 142 | 142 | /* Nintendo JxROM */ |
| r8290 | r8291 | |
| 201 | 201 | /* SxROM boards by other manufacturer */ |
| 202 | 202 | { "KONAMI-SLROM", STD_SXROM }, |
| 203 | 203 | { "VIRGIN-SNROM", STD_SXROM }, |
| 204 | | /* FIXME: Made up board for 2 MMC1A games (i.e. no WRAM disable bit) */ |
| 205 | | { "HVC-SJROM-A", STD_SXROM_A }, |
| 206 | | { "HVC-SKROM-A", STD_SXROM_A }, |
| 207 | 204 | // |
| 208 | 205 | /* Nintendo TxROM */ |
| 209 | 206 | { "HVC-TBROM", STD_TXROM }, |
| r8290 | r8291 | |
| 379 | 376 | // |
| 380 | 377 | { "TAITO-TC0190FMC", TAITO_TC0190FMC }, |
| 381 | 378 | { "TAITO-TC0190FMC+PAL16R4", TAITO_TC0190FMCP }, |
| 382 | | { "TAITO-X1-005", TAITO_X1_005 }, |
| 379 | { "TAITO-X1-005", TAITO_X1_005 }, // two variants exist, depending on pin17 & pin31 connections |
| 383 | 380 | { "TAITO-X1-017", TAITO_X1_017 }, |
| 384 | | /* FIXME: Made up boards the different mirroring handling */ |
| 385 | | { "TAITO-X1-005-A", TAITO_X1_005_A }, |
| 386 | 381 | // |
| 387 | 382 | { "AGCI-50282", AGCI_50282 }, |
| 388 | 383 | { "AVE-NINA-01", AVE_NINA01 }, |
| r8290 | r8291 | |
| 3093 | 3088 | |
| 3094 | 3089 | /************************************************************* |
| 3095 | 3090 | |
| 3091 | Konami VRC-2 |
| 3092 | |
| 3093 | In MESS: Supported. |
| 3094 | |
| 3095 | *************************************************************/ |
| 3096 | |
| 3097 | static WRITE8_HANDLER( konami_vrc2_w ) |
| 3098 | { |
| 3099 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 3100 | UINT8 bank, shift; |
| 3101 | UINT32 shifted_offs = (offset & 0x7000) |
| 3102 | | ((offset << (9 - state->vrc_ls_prg_a)) & 0x200) |
| 3103 | | ((offset << (8 - state->vrc_ls_prg_b)) & 0x100); |
| 3104 | LOG_MMC(("konami_vrc2_w, offset: %04x, data: %02x\n", offset, data)); |
| 3105 | |
| 3106 | if (offset < 0x1000) |
| 3107 | prg8_89(space->machine, data); |
| 3108 | else if (offset < 0x2000) |
| 3109 | { |
| 3110 | switch (data & 0x03) |
| 3111 | { |
| 3112 | case 0x00: set_nt_mirroring(space->machine, PPU_MIRROR_VERT); break; |
| 3113 | case 0x01: set_nt_mirroring(space->machine, PPU_MIRROR_HORZ); break; |
| 3114 | case 0x02: set_nt_mirroring(space->machine, PPU_MIRROR_LOW); break; |
| 3115 | case 0x03: set_nt_mirroring(space->machine, PPU_MIRROR_HIGH); break; |
| 3116 | } |
| 3117 | } |
| 3118 | else if (offset < 0x3000) |
| 3119 | prg8_ab(space->machine, data); |
| 3120 | else if (offset < 0x7000) |
| 3121 | { |
| 3122 | shift = BIT(shifted_offs, 8) * 4; |
| 3123 | bank = ((shifted_offs & 0x7000) - 0x3000) / 0x0800 + BIT(shifted_offs, 9); |
| 3124 | state->mmc_vrom_bank[bank] = (state->mmc_vrom_bank[bank] & (0xf0 >> shift)) |
| 3125 | | ((data >> state->vrc_ls_chr) << shift); |
| 3126 | chr1_x(space->machine, bank, state->mmc_vrom_bank[bank], CHRROM); |
| 3127 | } |
| 3128 | else |
| 3129 | logerror("konami_vrc2_w uncaught write, addr: %04x value: %02x\n", offset + 0x8000, data); |
| 3130 | } |
| 3131 | |
| 3132 | /************************************************************* |
| 3133 | |
| 3096 | 3134 | Konami VRC3 |
| 3097 | 3135 | |
| 3098 | 3136 | Games: Salamander |
| r8290 | r8291 | |
| 3138 | 3176 | |
| 3139 | 3177 | /************************************************************* |
| 3140 | 3178 | |
| 3179 | Konami VRC-4 |
| 3180 | |
| 3181 | In MESS: Supported |
| 3182 | |
| 3183 | *************************************************************/ |
| 3184 | |
| 3185 | #if 0 |
| 3186 | static void vrc4_set_prg( running_machine *machine ) |
| 3187 | { |
| 3188 | nes_state *state = (nes_state *)machine->driver_data; |
| 3189 | if (state->mmc_cmd1 & 0x02) |
| 3190 | { |
| 3191 | prg8_89(machine, 0xfe); |
| 3192 | prg8_cd(machine, state->mmc_prg_bank[0]); |
| 3193 | } |
| 3194 | else |
| 3195 | { |
| 3196 | prg8_89(machine, state->mmc_prg_bank[0]); |
| 3197 | prg8_cd(machine, 0xfe); |
| 3198 | } |
| 3199 | } |
| 3200 | |
| 3201 | static void konami_irq( running_device *device, int scanline, int vblank, int blanked ) |
| 3202 | { |
| 3203 | nes_state *state = (nes_state *)device->machine->driver_data; |
| 3204 | /* Increment & check the IRQ scanline counter */ |
| 3205 | if (state->IRQ_enable && (++state->IRQ_count == 0x100)) |
| 3206 | { |
| 3207 | state->IRQ_count = state->IRQ_count_latch; |
| 3208 | state->IRQ_enable = state->IRQ_enable_latch; |
| 3209 | cpu_set_input_line(state->maincpu, M6502_IRQ_LINE, HOLD_LINE); |
| 3210 | } |
| 3211 | } |
| 3212 | #endif |
| 3213 | |
| 3214 | static WRITE8_HANDLER( konami_vrc4_w ) |
| 3215 | { |
| 3216 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 3217 | UINT8 bank, shift; |
| 3218 | UINT32 shifted_offs = (offset & 0x7000) |
| 3219 | | ((offset << (9 - state->vrc_ls_prg_a)) & 0x200) |
| 3220 | | ((offset << (8 - state->vrc_ls_prg_b)) & 0x100); |
| 3221 | LOG_MMC(("konami_vrc4_w, offset: %04x, data: %02x\n", offset, data)); |
| 3222 | |
| 3223 | if (offset < 0x1000) |
| 3224 | { |
| 3225 | state->mmc_prg_bank[0] = data; |
| 3226 | vrc4_set_prg(space->machine); |
| 3227 | } |
| 3228 | else if (offset >= 0x2000 && offset < 0x3000) |
| 3229 | prg8_cd(space->machine, data); |
| 3230 | else |
| 3231 | { |
| 3232 | switch (shifted_offs & 0x7300) |
| 3233 | { |
| 3234 | case 0x1000: |
| 3235 | case 0x1100: |
| 3236 | switch (data & 0x03) |
| 3237 | { |
| 3238 | case 0x00: set_nt_mirroring(space->machine, PPU_MIRROR_VERT); break; |
| 3239 | case 0x01: set_nt_mirroring(space->machine, PPU_MIRROR_HORZ); break; |
| 3240 | case 0x02: set_nt_mirroring(space->machine, PPU_MIRROR_LOW); break; |
| 3241 | case 0x03: set_nt_mirroring(space->machine, PPU_MIRROR_HIGH); break; |
| 3242 | } |
| 3243 | break; |
| 3244 | case 0x1200: |
| 3245 | case 0x1300: |
| 3246 | state->mmc_cmd1 = data & 0x02; |
| 3247 | vrc4_set_prg(space->machine); |
| 3248 | break; |
| 3249 | case 0x3000: |
| 3250 | case 0x3100: |
| 3251 | case 0x3200: |
| 3252 | case 0x3300: |
| 3253 | case 0x4000: |
| 3254 | case 0x4100: |
| 3255 | case 0x4200: |
| 3256 | case 0x4300: |
| 3257 | case 0x5000: |
| 3258 | case 0x5100: |
| 3259 | case 0x5200: |
| 3260 | case 0x5300: |
| 3261 | case 0x6000: |
| 3262 | case 0x6100: |
| 3263 | case 0x6200: |
| 3264 | case 0x6300: |
| 3265 | shift = BIT(shifted_offs, 8) * 4; |
| 3266 | bank = ((shifted_offs & 0x7000) - 0x3000) / 0x0800 + BIT(shifted_offs, 9); |
| 3267 | state->mmc_vrom_bank[bank] = (state->mmc_vrom_bank[bank] & (0xf0 >> shift)) | (data << shift); |
| 3268 | chr1_x(space->machine, bank, state->mmc_vrom_bank[bank], CHRROM); |
| 3269 | break; |
| 3270 | case 0x7000: |
| 3271 | state->IRQ_count_latch = (state->IRQ_count_latch & 0xf0) | (data & 0x0f); |
| 3272 | break; |
| 3273 | case 0x7100: |
| 3274 | state->IRQ_count_latch = (state->IRQ_count_latch & 0x0f) | ((data & 0x0f) << 4); |
| 3275 | break; |
| 3276 | case 0x7200: |
| 3277 | state->IRQ_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 3278 | state->IRQ_enable = data & 0x02; |
| 3279 | state->IRQ_enable_latch = data & 0x01; |
| 3280 | if (data & 0x02) |
| 3281 | state->IRQ_count = state->IRQ_count_latch; |
| 3282 | break; |
| 3283 | case 0x7300: |
| 3284 | state->IRQ_enable = state->IRQ_enable_latch; |
| 3285 | break; |
| 3286 | default: |
| 3287 | logerror("konami_vrc4_w uncaught write, addr: %04x value: %02x\n", shifted_offs + 0x8000, data); |
| 3288 | break; |
| 3289 | } |
| 3290 | } |
| 3291 | } |
| 3292 | |
| 3293 | /************************************************************* |
| 3294 | |
| 3295 | Konami VRC-6 |
| 3296 | |
| 3297 | In MESS: Supported. It also uses konami_irq. |
| 3298 | |
| 3299 | *************************************************************/ |
| 3300 | |
| 3301 | static WRITE8_HANDLER( konami_vrc6_w ) |
| 3302 | { |
| 3303 | nes_state *state = (nes_state *)space->machine->driver_data; |
| 3304 | UINT8 bank; |
| 3305 | UINT32 shifted_offs = (offset & 0x7000) |
| 3306 | | ((offset << (9 - state->vrc_ls_prg_a)) & 0x200) |
| 3307 | | ((offset << (8 - state->vrc_ls_prg_b)) & 0x100); |
| 3308 | LOG_MMC(("konami_vrc6_w, offset: %04x, data: %02x\n", offset, data)); |
| 3309 | |
| 3310 | if (offset < 0x1000) |
| 3311 | prg16_89ab(space->machine, data); |
| 3312 | else if (offset >= 0x4000 && offset < 0x5000) |
| 3313 | prg8_cd(space->machine, data); |
| 3314 | else |
| 3315 | { |
| 3316 | switch (shifted_offs & 0x7300) |
| 3317 | { |
| 3318 | case 0x1000: |
| 3319 | case 0x1100: |
| 3320 | case 0x1200: |
| 3321 | case 0x2000: |
| 3322 | case 0x2100: |
| 3323 | case 0x2200: |
| 3324 | case 0x3000: |
| 3325 | case 0x3100: |
| 3326 | case 0x3200: |
| 3327 | LOG_MMC(("Konami VRC-6 Sound write, offset: %04x, data: %02x\n", shifted_offs & 0x7300, data)); |
| 3328 | break; |
| 3329 | case 0x3300: |
| 3330 | switch (data & 0x0c) |
| 3331 | { |
| 3332 | case 0x00: set_nt_mirroring(space->machine, PPU_MIRROR_VERT); break; |
| 3333 | case 0x04: set_nt_mirroring(space->machine, PPU_MIRROR_HORZ); break; |
| 3334 | case 0x08: set_nt_mirroring(space->machine, PPU_MIRROR_LOW); break; |
| 3335 | case 0x0c: set_nt_mirroring(space->machine, PPU_MIRROR_HIGH); break; |
| 3336 | } |
| 3337 | break; |
| 3338 | case 0x5000: |
| 3339 | case 0x5100: |
| 3340 | case 0x5200: |
| 3341 | case 0x5300: |
| 3342 | case 0x6000: |
| 3343 | case 0x6100: |
| 3344 | case 0x6200: |
| 3345 | case 0x6300: |
| 3346 | bank = ((shifted_offs & 0x7000) - 0x5000) / 0x0400 + ((shifted_offs & 0x0300) >> 8); |
| 3347 | chr1_x(space->machine, bank, data, CHRROM); |
| 3348 | break; |
| 3349 | case 0x7000: |
| 3350 | state->IRQ_count_latch = data; |
| 3351 | break; |
| 3352 | case 0x7100: |
| 3353 | state->IRQ_mode = data & 0x04; // currently not implemented: 0 = prescaler mode / 1 = CPU mode |
| 3354 | state->IRQ_enable = data & 0x02; |
| 3355 | state->IRQ_enable_latch = data & 0x01; |
| 3356 | if (data & 0x02) |
| 3357 | state->IRQ_count = state->IRQ_count_latch; |
| 3358 | break; |
| 3359 | case 0x7200: |
| 3360 | state->IRQ_enable = state->IRQ_enable_latch; |
| 3361 | break; |
| 3362 | default: |
| 3363 | logerror("konami_vrc6_w uncaught write, addr: %04x value: %02x\n", shifted_offs + 0x8000, data); |
| 3364 | break; |
| 3365 | } |
| 3366 | } |
| 3367 | } |
| 3368 | |
| 3369 | /************************************************************* |
| 3370 | |
| 3141 | 3371 | Konami VRC7 |
| 3142 | 3372 | |
| 3143 | 3373 | Games: Lagrange Point, Tiny Toon Adventures 2 |
| r8290 | r8291 | |
| 3222 | 3452 | } |
| 3223 | 3453 | |
| 3224 | 3454 | #endif |
| 3455 | |
| 3225 | 3456 | /************************************************************* |
| 3226 | 3457 | |
| 3227 | 3458 | Namcot-163 board emulation |
| r8290 | r8291 | |
| 10024 | 10255 | { STD_GXROM, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(gxrom_w), NULL, NULL, NULL }, |
| 10025 | 10256 | { STD_MXROM, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(gxrom_w), NULL, NULL, NULL }, |
| 10026 | 10257 | { STD_NXROM, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(ntbrom_w), NULL, NULL, NULL }, |
| 10258 | { SUNSOFT_DCS, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(ntbrom_w), NULL, NULL, NULL }, |
| 10027 | 10259 | { STD_JXROM, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(jxrom_w), NULL, NULL, jxrom_irq }, |
| 10028 | 10260 | { STD_SXROM, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(sxrom_w), NULL, NULL, NULL }, |
| 10029 | 10261 | { STD_SXROM_A, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(sxrom_a_w), NULL, NULL, NULL }, |
| r8290 | r8291 | |
| 10067 | 10299 | { JALECO_JF17, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(jf17_w), NULL, NULL, NULL }, |
| 10068 | 10300 | { JALECO_JF19, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(jf19_w), NULL, NULL, NULL }, |
| 10069 | 10301 | { KONAMI_VRC1, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(konami_vrc1_w), NULL, NULL, NULL }, |
| 10302 | { KONAMI_VRC2, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(konami_vrc2_w), NULL, NULL, NULL }, |
| 10070 | 10303 | { KONAMI_VRC3, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(konami_vrc3_w), NULL, NULL, konami_irq }, |
| 10304 | { KONAMI_VRC4, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(konami_vrc4_w), NULL, NULL, konami_irq }, |
| 10305 | { KONAMI_VRC6, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(konami_vrc6_w), NULL, NULL, konami_irq }, |
| 10071 | 10306 | { KONAMI_VRC7, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(konami_vrc7_w), NULL, NULL, konami_irq }, |
| 10072 | 10307 | { NAMCOT_163, {namcot163_l_w, namcot163_l_r}, NES_NOACCESS, NES_WRITEONLY(namcot163_w), NULL, NULL, namcot163_irq }, |
| 10073 | 10308 | { SUNSOFT_1, NES_NOACCESS, NES_WRITEONLY(sunsoft1_m_w), NES_NOACCESS, NULL, NULL, NULL }, |
| r8290 | r8291 | |
| 10212 | 10447 | { BMC_GOLDENCARD_6IN1, NES_WRITEONLY(bmc_gc6in1_l_w), NES_NOACCESS, NES_WRITEONLY(bmc_gc6in1_w), NULL, NULL, mmc3_irq }, |
| 10213 | 10448 | { UNSUPPORTED_BOARD, NES_NOACCESS, NES_NOACCESS, NES_NOACCESS, NULL, NULL, NULL }, |
| 10214 | 10449 | // |
| 10215 | | // { KONAMI_VRC2, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(konami_vrc2a_w), NULL, NULL, NULL }, |
| 10216 | | // { KONAMI_VRC4, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(konami_vrc4a_w), NULL, NULL, konami_irq }, |
| 10217 | | // { KONAMI_VRC6, NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(konami_vrc6a_w), NULL, NULL, konami_irq }, |
| 10218 | 10450 | // { BTL_SMB2B, NES_WRITEONLY(mapper50_l_w), NES_NOACCESS, NES_NOACCESS, NULL, NULL, mapper50_irq }, |
| 10219 | 10451 | }; |
| 10220 | 10452 | |
| r8290 | r8291 | |
| 10258 | 10490 | const nes_pcb *pcb = nes_pcb_lookup(feature); |
| 10259 | 10491 | |
| 10260 | 10492 | if (pcb == NULL) |
| 10261 | | fatalerror("Unimplemented PCB\n"); |
| 10493 | fatalerror("Unimplemented PCB type %s\n", feature); |
| 10262 | 10494 | |
| 10263 | 10495 | return pcb->pcb_id; |
| 10264 | 10496 | } |
| 10265 | 10497 | |
| 10266 | | void nes_pcb_setup( running_machine *machine, int ID ) |
| 10267 | | { |
| 10268 | | nes_state *state = (nes_state *)machine->driver_data; |
| 10269 | | |
| 10270 | | if (ID == STD_TVROM || ID == STD_DRROM || ID == IREM_LROG017) |
| 10271 | | state->four_screen_vram = 1; |
| 10272 | | } |
| 10273 | | |
| 10274 | 10498 | void pcb_handlers_setup( running_machine *machine ) |
| 10275 | 10499 | { |
| 10276 | 10500 | nes_state *state = (nes_state *)machine->driver_data; |
src/mess/machine/nes.c
| r8290 | r8291 | |
| 554 | 554 | { |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | struct nes_cart_lines |
| 558 | { |
| 559 | const char *tag; |
| 560 | int line; |
| 561 | }; |
| 557 | 562 | |
| 563 | static const struct nes_cart_lines nes_cart_lines_table[] = |
| 564 | { |
| 565 | { "PRG A0", 0 }, |
| 566 | { "PRG A1", 1 }, |
| 567 | { "PRG A2", 2 }, |
| 568 | { "PRG A3", 3 }, |
| 569 | { "PRG A4", 4 }, |
| 570 | { "PRG A5", 5 }, |
| 571 | { "PRG A6", 6 }, |
| 572 | { "PRG A7", 7 }, |
| 573 | { "CHR A10", 10 }, |
| 574 | { "CHR A11", 11 }, |
| 575 | { "CHR A12", 12 }, |
| 576 | { "CHR A13", 13 }, |
| 577 | { "CHR A14", 14 }, |
| 578 | { "CHR A15", 15 }, |
| 579 | { "CHR A16", 16 }, |
| 580 | { "CHR A17", 17 }, |
| 581 | { "NC", 128 }, |
| 582 | { 0 } |
| 583 | }; |
| 584 | |
| 585 | static int nes_cart_get_line( const char *feature ) |
| 586 | { |
| 587 | const struct nes_cart_lines *nes_line = &nes_cart_lines_table[0]; |
| 588 | |
| 589 | while (nes_line->tag) |
| 590 | { |
| 591 | if (strcmp(nes_line->tag, feature) == 0) |
| 592 | break; |
| 593 | |
| 594 | nes_line++; |
| 595 | } |
| 596 | |
| 597 | return nes_line->line; |
| 598 | } |
| 599 | |
| 558 | 600 | DEVICE_IMAGE_LOAD( nes_cart ) |
| 559 | 601 | { |
| 560 | 602 | nes_state *state = (nes_state *)image->machine->driver_data; |
| r8290 | r8291 | |
| 1097 | 1139 | state->format = 3; |
| 1098 | 1140 | state->mapper = 0; // this allows us to set up memory handlers without duplicating code (for the moment) |
| 1099 | 1141 | state->pcb_id = nes_get_pcb_id(image->machine, image_get_feature(image, "pcb")); |
| 1100 | | |
| 1101 | | // setup NMT etc. |
| 1102 | | nes_pcb_setup(image->machine, state->pcb_id); |
| 1103 | 1142 | |
| 1143 | if (state->pcb_id == UNSUPPORTED_BOARD) |
| 1144 | printf("This board (%s) is currently not supported by MESS\n", image_get_feature(image, "pcb")); |
| 1145 | |
| 1146 | if (state->pcb_id == STD_TVROM || state->pcb_id == STD_DRROM || state->pcb_id == IREM_LROG017) |
| 1147 | state->four_screen_vram = 1; |
| 1148 | |
| 1104 | 1149 | state->battery = (image_get_software_region(image, "bwram") != NULL) ? 1 : 0; |
| 1105 | 1150 | state->battery_size = image_get_software_region_length(image, "bwram"); |
| 1106 | 1151 | |
| r8290 | r8291 | |
| 1109 | 1154 | if (state->prg_ram) |
| 1110 | 1155 | state->wram = auto_alloc_array(image->machine, UINT8, state->wram_size); |
| 1111 | 1156 | |
| 1112 | | state->ce_mask = 0; |
| 1113 | | state->ce_state = 0; |
| 1114 | | |
| 1115 | 1157 | /* Check for mirroring */ |
| 1116 | | // FIXME: this is hacky. it would be better to include these in some feature attribute |
| 1117 | 1158 | if (image_get_feature(image, "mirroring") != NULL) |
| 1118 | 1159 | { |
| 1119 | 1160 | const char *mirroring = image_get_feature(image, "mirroring"); |
| r8290 | r8291 | |
| 1122 | 1163 | if (strcmp(mirroring, "vertical") == 0) |
| 1123 | 1164 | state->hard_mirroring = 1; |
| 1124 | 1165 | } |
| 1125 | | /* Check for pins */ |
| 1126 | | // FIXME: this is hacky. it would be better to include these in some feature attribute |
| 1127 | | if (image_get_software_region(image, "pin26") != NULL) |
| 1166 | |
| 1167 | state->chr_open_bus = 0; |
| 1168 | state->ce_mask = 0; |
| 1169 | state->ce_state = 0; |
| 1170 | state->vrc_ls_prg_a = 0; |
| 1171 | state->vrc_ls_prg_b = 0; |
| 1172 | state->vrc_ls_chr = 0; |
| 1173 | |
| 1174 | /* Check for pins in specific boards which require them */ |
| 1175 | if (state->pcb_id == STD_CNROM) |
| 1128 | 1176 | { |
| 1129 | | state->ce_mask |= 0x01; |
| 1130 | | state->ce_state |= (image_get_software_region_length(image, "pin26") == 2) ? 0 : 0x01; |
| 1177 | if (image_get_feature(image, "chr-pin26") != NULL) |
| 1178 | { |
| 1179 | state->ce_mask |= 0x01; |
| 1180 | state->ce_state |= !strcmp(image_get_feature(image, "chr-pin26"), "CE") ? 0x01 : 0; |
| 1181 | } |
| 1182 | if (image_get_feature(image, "chr-pin27") != NULL) |
| 1183 | { |
| 1184 | state->ce_mask |= 0x02; |
| 1185 | state->ce_state |= !strcmp(image_get_feature(image, "chr-pin27"), "CE") ? 0x02 : 0; |
| 1186 | } |
| 1131 | 1187 | } |
| 1132 | | if (image_get_software_region(image, "pin27") != NULL) |
| 1188 | |
| 1189 | if (state->pcb_id == TAITO_X1_005) |
| 1133 | 1190 | { |
| 1134 | | state->ce_mask |= 0x02; |
| 1135 | | state->ce_state |= (image_get_software_region_length(image, "pin27") == 2) ? 0 : 0x02; |
| 1191 | if (!strcmp(image_get_feature(image, "x1-pin17"), "CIRAM A10") && !strcmp(image_get_feature(image, "x1-pin31"), "NC")) |
| 1192 | state->pcb_id = TAITO_X1_005_A; |
| 1136 | 1193 | } |
| 1137 | | state->chr_open_bus = 0; |
| 1138 | 1194 | |
| 1195 | if (state->pcb_id == KONAMI_VRC2) |
| 1196 | { |
| 1197 | state->vrc_ls_prg_a = nes_cart_get_line(image_get_feature(image, "vrc2-pin3")); |
| 1198 | state->vrc_ls_prg_b = nes_cart_get_line(image_get_feature(image, "vrc2-pin3")); |
| 1199 | state->vrc_ls_chr = (nes_cart_get_line(image_get_feature(image, "vrc2-pin21")) != 10) ? 1 : 0; |
| 1200 | printf("VRC-2, pin3: A%d, pin4: A%d, pin21: %s\n", state->vrc_ls_prg_a, state->vrc_ls_prg_b, state->vrc_ls_chr ? "NC" : "A10"); |
| 1201 | } |
| 1202 | |
| 1203 | if (state->pcb_id == KONAMI_VRC4) |
| 1204 | { |
| 1205 | state->vrc_ls_prg_a = nes_cart_get_line(image_get_feature(image, "vrc4-pin3")); |
| 1206 | state->vrc_ls_prg_b = nes_cart_get_line(image_get_feature(image, "vrc4-pin4")); |
| 1207 | printf("VRC-4, pin3: A%d, pin4: A%d\n", state->vrc_ls_prg_a, state->vrc_ls_prg_b); |
| 1208 | } |
| 1209 | |
| 1210 | if (state->pcb_id == KONAMI_VRC6) |
| 1211 | { |
| 1212 | state->vrc_ls_prg_a = nes_cart_get_line(image_get_feature(image, "vrc6-pin9")); |
| 1213 | state->vrc_ls_prg_b = nes_cart_get_line(image_get_feature(image, "vrc6-pin10")); |
| 1214 | printf("VRC-6, pin9: A%d, pin10: A%d\n", state->vrc_ls_prg_a, state->vrc_ls_prg_b); |
| 1215 | } |
| 1216 | |
| 1217 | /* Check for other misc board variants */ |
| 1218 | if (state->pcb_id == STD_SXROM || state->pcb_id == STD_SOROM) |
| 1219 | { |
| 1220 | if (!strcmp(image_get_feature(image, "mmc1_type"), "MMC1A")) // in MMC1-A PRG RAM is always enabled |
| 1221 | state->pcb_id = STD_SXROM_A; |
| 1222 | } |
| 1223 | |
| 1224 | if (state->pcb_id == STD_NXROM || state->pcb_id == SUNSOFT_DCS) |
| 1225 | { |
| 1226 | if (image_get_software_region(image, "minicart") != NULL) // check for dual minicart |
| 1227 | { |
| 1228 | state->pcb_id = SUNSOFT_DCS; |
| 1229 | // we shall load somewhere the minicart, but we still do not support this |
| 1230 | } |
| 1231 | } |
| 1232 | |
| 1233 | |
| 1139 | 1234 | #if 1 |
| 1140 | 1235 | printf("PCB Feature: %s\n", image_get_feature(image, "pcb")); |
| 1141 | 1236 | printf("PRG chunks: %d\n", state->prg_chunks); |