Previous 15994 Revisions Next

r8319 Friday 25th June, 2010 at 17:01:41 UTC by Fabio Priuli
[NES] Added pcb code to emulate multicarts on D1038, VT5201 and Bensheng BS5 boards
[src/mess/includes]nes.h
[src/mess/machine]nes_mmc.h nes_pcb.c nes_unif.c

src/mess/includes/nes.h
r8318r8319
153153
154154   UINT8 mmc_latch1, mmc_latch2;
155155   UINT8 mmc_reg[16];
156   
157   UINT8 mmc_dipsetting;
156158
157159   // misc mapper related variables which should be merged with the above one, where possible
158160   UINT8 MMC1_regs[4];
src/mess/machine/nes_pcb.c
r8318r8319
576576   { "BMC-12-IN-1",         UNSUPPORTED_BOARD },
577577   { "BMC-NTD-03",          UNSUPPORTED_BOARD },
578578   { "BMC-8157",            UNSUPPORTED_BOARD /*BMC_8157*/ },
579   { "BMC-BS-5",            UNSUPPORTED_BOARD /*BENSHENG_BS5*/ },
579   { "BMC-BS-5",            BMC_BENSHENG_BS5 },
580580   { "BMC-FK23C",           UNSUPPORTED_BOARD /*BMC_FK23C*/ },
581581   { "BMC-FK23CA",          UNSUPPORTED_BOARD /*BMC_FK23C*/ },   // diff reg init
582582   { "BMC-GHOSTBUSTERS63IN1", UNSUPPORTED_BOARD /*BMC_G63IN1*/ },
583583   { "BMC-SUPERVISION16IN1", UNSUPPORTED_BOARD },   // mapper 53
584584   { "BMC-RESETBASED-4IN1", UNSUPPORTED_BOARD },// mapper 60 with 64k prg and 32k chr
585   { "BMC-VT5201",          UNSUPPORTED_BOARD },// mapper 60 otherwise
585   { "BMC-VT5201",          BMC_VT5201 },// mapper 60 otherwise
586   { "BMC-D1038",           BMC_VT5201 }, // mapper 60?
586587   { "BMC-42IN1RESETSWITCH", UNSUPPORTED_BOARD },   // mapper 60?
587   { "BMC-D1038",           UNSUPPORTED_BOARD }, // mapper 60?
588588   { "BMC-SUPER22GAMES",    UNSUPPORTED_BOARD },// mapper 233
589589   { "BMC-GOLDENGAME-150IN1", UNSUPPORTED_BOARD },// mapper 235 with 2M PRG
590590   { "BMC-GOLDENGAME-260IN1", UNSUPPORTED_BOARD },// mapper 235 with 4M PRG
r8318r8319
1062810628   }
1062910629}
1063010630
10631/*************************************************************
10632 
10633 BMC-VT5201
10634 
10635 *************************************************************/
1063110636
10637static WRITE8_HANDLER( bmc_vt5201_w )
10638{
10639   nes_state *state = (nes_state *)space->machine->driver_data;
10640   LOG_MMC(("bmc_vt5201_w, offset: %04x, data: %02x\n", offset, data));
10641   
10642   state->mmc_latch1 = BIT(offset, 8);
10643   
10644   // not sure about this mirroring bit!!
10645   // without it TN 95 in 1 has glitches in Lunar Ball; with it TN 95 in 1 has glitches in Galaxian!
10646   set_nt_mirroring(space->machine, BIT(data, 3) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
10647   if (BIT(offset, 7))
10648   {
10649      prg16_89ab(space->machine, (offset >> 4) & 0x07);
10650      prg16_cdef(space->machine, (offset >> 4) & 0x07);
10651   }
10652   else
10653      prg32(space->machine, (offset >> 5) & 0x03);
10654   chr8(space->machine, offset, CHRROM);
10655}
10656
10657static READ8_HANDLER( bmc_vt5201_r )
10658{
10659   nes_state *state = (nes_state *)space->machine->driver_data;
10660   LOG_MMC(("bmc_vt5201_r, offset: %04x\n", offset));
10661   //   state->mmc_dipsetting = input_port_read(space->machine, "CARTDIPS");
10662
10663   if (state->mmc_latch1)
10664      return state->mmc_dipsetting; // cart mode, depending on the Dip Switches (always zero atm, given we have no way to add cart-based DIPs)
10665   else
10666   {   // usual ROM access
10667      switch (offset & 0x6000)
10668      {
10669         case 0x0000:
10670            return state->rom[0x10000 + state->prg_bank[0] * 0x2000 + (offset & 0x1fff)];
10671         case 0x2000:
10672            return state->rom[0x10000 + state->prg_bank[1] * 0x2000 + (offset & 0x1fff)];
10673         case 0x4000:
10674            return state->rom[0x10000 + state->prg_bank[2] * 0x2000 + (offset & 0x1fff)];
10675         case 0x6000:
10676            return state->rom[0x10000 + state->prg_bank[3] * 0x2000 + (offset & 0x1fff)];
10677      }
10678      return 0;
10679   }
10680}
10681
10682/*************************************************************
10683 
10684 BMC-BS-5
10685 
10686 *************************************************************/
10687
10688static void bmc_bs5_update_banks( running_machine *machine )
10689{
10690   nes_state *state = (nes_state *)machine->driver_data;
10691
10692   prg8_89(machine, state->mmc_prg_bank[0]);
10693   prg8_ab(machine, state->mmc_prg_bank[1]);
10694   prg8_cd(machine, state->mmc_prg_bank[2]);
10695   prg8_ef(machine, state->mmc_prg_bank[3]);
10696   chr2_0(machine, state->mmc_vrom_bank[0], CHRROM);
10697   chr2_2(machine, state->mmc_vrom_bank[1], CHRROM);
10698   chr2_4(machine, state->mmc_vrom_bank[2], CHRROM);
10699   chr2_6(machine, state->mmc_vrom_bank[3], CHRROM);
10700}
10701
10702static WRITE8_HANDLER( bmc_bs5_w )
10703{
10704   nes_state *state = (nes_state *)space->machine->driver_data;
10705   UINT8 bs5_helper = (offset & 0xc00) >> 10;
10706   LOG_MMC(("bmc_bs5_w, offset: %04x, data: %02x\n", offset, data));
10707//   state->mmc_dipsetting = input_port_read(space->machine, "CARTDIPS");
10708   
10709   switch (offset & 0x7000)
10710   {
10711      case 0x0000:
10712         state->mmc_vrom_bank[bs5_helper] = offset & 0x1f;
10713         break;
10714      case 0x2000:
10715         if (BIT(offset, state->mmc_dipsetting + 4))   // mmc_dipsetting is always zero atm, given we have no way to add cart-based DIPs
10716            state->mmc_prg_bank[bs5_helper] = offset & 0x0f;
10717         break;
10718   }
10719   bmc_bs5_update_banks(space->machine);
10720}
10721
10722
1063210723typedef void (*nes_ppu_latch)(running_device *device, offs_t offset);
1063310724
1063410725struct nes_memory_accessor
r8318r8319
1088310974   { BMC_15IN1,            NES_NOACCESS, NES_WRITEONLY(bmc_15in1_m_w), NES_WRITEONLY(txrom_w), NULL, NULL, mmc3_irq },
1088410975   { BMC_BALLGAMES_11IN1,  NES_NOACCESS, NES_WRITEONLY(bmc_ball11_m_w), NES_WRITEONLY(bmc_ball11_w), NULL, NULL, NULL },
1088510976   { BMC_GOLDENCARD_6IN1,  NES_WRITEONLY(bmc_gc6in1_l_w), NES_NOACCESS, NES_WRITEONLY(bmc_gc6in1_w), NULL, NULL, mmc3_irq },
10977   { BMC_VT5201,           NES_NOACCESS, NES_NOACCESS, {bmc_vt5201_w, bmc_vt5201_r},         NULL, NULL, NULL },
10978   { BMC_BENSHENG_BS5,     NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bmc_bs5_w),             NULL, NULL, NULL },
1088610979   { UNSUPPORTED_BOARD,    NES_NOACCESS, NES_NOACCESS, NES_NOACCESS,                         NULL, NULL, NULL },
1088710980   //
1088810981};
src/mess/machine/nes_unif.c
r8318r8319
12651265         prg16_cdef(machine, state->prg_chunks - 1);
12661266         break;
12671267         
1268      case BMC_VT5201:
1269         prg32(machine, 0);
1270         chr8(machine, 0, CHRROM);
1271         break;
1272
1273      case BMC_BENSHENG_BS5:
1274         state->mmc_prg_bank[0] = 0xff;
1275         state->mmc_prg_bank[1] = 0xff;
1276         state->mmc_prg_bank[2] = 0xff;
1277         state->mmc_prg_bank[3] = 0xff;
1278         bmc_bs5_update_banks(machine);
1279         break;
1280         
12681281      case UNSUPPORTED_BOARD:
12691282      default:
12701283         /* Mapper not supported */
src/mess/machine/nes_mmc.h
r8318r8319
7474   BMC_36IN1, BMC_21IN1, BMC_150IN1, BMC_35IN1, BMC_64IN1,
7575   BMC_15IN1, BMC_SUPERHIK_300IN1, BMC_9999999IN1, BMC_SUPERGUN_20IN1,
7676   BMC_GOLDENCARD_6IN1, BMC_72IN1, BMC_SUPER_42IN1, BMC_76IN1,
77   BMC_1200IN1, BMC_31IN1, BMC_22GAMES, BMC_20IN1, BMC_110IN1, BMC_GKA, BMC_GKB,
77   BMC_1200IN1, BMC_31IN1, BMC_22GAMES, BMC_20IN1, BMC_110IN1,
78   BMC_GKA, BMC_GKB, BMC_VT5201, BMC_BENSHENG_BS5,
7879   /* Unlicensed */
7980   UNL_8237, UNL_CC21, UNL_AX5705, UNL_KOF97,
8081   UNL_N625092, UNL_SC127, UNL_SMB2J, UNL_T230,

Previous 15994 Revisions Next


© 1998-2018 The MESS Team