Previous 15994 Revisions Next

r8379 Saturday 3rd July, 2010 at 01:52:05 UTC by Fabio Priuli
[NES] some new boards emulated (to various degree of completeness) and some improvements to already supported board
[src/mess/machine]nes_ines.c nes_mmc.h nes_pcb.c nes_unif.c

src/mess/machine/nes_pcb.c
r8378r8379
414414   { "NTDEC-193",        NTDEC_FIGHTINGHERO },
415415   { "UNL-TEK90",        UNSUPPORTED_BOARD },   // related to JY Company? (i.e. mappers 90, 209, 211?)
416416   { "UNL-SA-002",       SACHEN_TCU02 },
417   { "UNL-SA-009",       SACHEN_SA009 },
417418   { "UNL-SA-0036",      SACHEN_SA0036 },
418419   { "UNL-SA-0037",      SACHEN_SA0037 },
419420   { "UNL-SA-72007",     SACHEN_SA72007 },
r8378r8379
465466   { "UNL-SL1632",       REXSOFT_SL1632 },
466467   { "SUBOR-BOARD-0",    SUBOR_TYPE0 },
467468   { "SUBOR-BOARD-1",    SUBOR_TYPE1 },
468   { "SOMERITEAM-SL-12", UNSUPPORTED_BOARD }, // mapper 116
469   { "SOMERITEAM-SL-12", SOMERI_SL12 }, // mapper 116
469470   { "UNL-CONY",         CONY_BOARD },
470471   { "UNL-GOUDER",       GOUDER_37017 },
471472   { "UNL-NITRA",        NITRA_TDA },
r8378r8379
479480   { "HES-6IN1",         HES6IN1_BOARD },
480481   { "SUPERGAME-BOOGERMAN", SUPERGAME_BOOGERMAN },
481482   { "FUTUREMEDIA",      FUTUREMEDIA_BOARD },
483   { "FUKUTAKE",         FUKUTAKE_BOARD },
482484   { "MAGICSERIES",      MAGICSERIES_MD },
483485   { "KASING",           KASING_BOARD },
484486   { "HENGGEDIANZI",     HENGEDIANZI_BOARD },
r8378r8379
492494   { "RCM-TETRISFAMILY", RCM_TETRISFAMILY },
493495   { "UNL-NINJARYU",     UNSUPPORTED_BOARD },// mapper 111
494496   { "UNL-NANJING",      NANJING_BOARD },// mapper 163
495   { "FUKUTAKE",         UNSUPPORTED_BOARD },   // mapper 186
496497   { "WHIRLWIND-2706",   WHIRLWIND_2706 },
497   { "UNL-H2288",        UNSUPPORTED_BOARD },   // mapper 123
498   { "UNL-H2288",        UNL_H2288 },
498499   { "UNL-DANCE",        UNSUPPORTED_BOARD },
499500   { "UNL-EDU2000",      UNL_EDU2K },
500501   { "UNL-SHERO",        UNSUPPORTED_BOARD /*SACHEN_SHERO*/ },
r8378r8379
594595   { "BMC-70IN1",           UNSUPPORTED_BOARD },   // mapper 236?
595596   { "BMC-70IN1B",          UNSUPPORTED_BOARD },   // mapper 236?
596597   { "BMC-SUPERHIK-KOF",    UNSUPPORTED_BOARD },// mapper 251
597   { "BMC-POWERJOY",        UNSUPPORTED_BOARD },// mapper 126
598   { "BMC-POWERJOY",        BMC_PJOY84 },
598599// are there dumps of games with these boards?
599   { "WAIXING-I",        UNSUPPORTED_BOARD }, // [supported by NEStopia - we need more info]
600   { "WAIXING-J",        UNSUPPORTED_BOARD }, // [supported by NEStopia - we need more info]
601600   { "BMC-13IN1JY110",   UNSUPPORTED_BOARD }, //  [mentioned in FCEUMM source - we need more info]
602601   { "BMC-GK-192",       UNSUPPORTED_BOARD }, //  [mentioned in FCEUMM source - we need more info]
603602   { "KONAMI-QTAI",      UNSUPPORTED_BOARD }, //  [mentioned in FCEUMM source - we need more info]
604   { "UNL-8157",         UNSUPPORTED_BOARD }, //  [mentioned in FCEUMM source - we need more info]
605603   { "UNL-3D-BLOCK",     UNSUPPORTED_BOARD }, //  [mentioned in FCEUMM source - we need more info]
606604   { "UNL-C-N22M",       UNSUPPORTED_BOARD }, //  [mentioned in FCEUMM source - we need more info]
607605   { "UNL-PEC-586",      UNSUPPORTED_BOARD }, //  [mentioned in FCEUMM source - we need more info]
608   { "UNL-SA-009",       UNSUPPORTED_BOARD }, //  [mentioned in FCEUMM source - we need more info]
609606//
610607   { "UNKNOWN",          UNKNOWN_BOARD }  //  a few pirate dumps uses the wrong mapper...
611608};
r8378r8379
49304927}
49314928
49324929/*************************************************************
4930 
4931 Bootleg Board by Fukutake
4932 
4933 Games: Study Box
4934 
4935 iNES: mapper 186
4936 
4937 In MESS: Unsupported.
4938 
4939 
4940 *************************************************************/
49334941
4942static WRITE8_HANDLER( fukutake_l_w )
4943{
4944   nes_state *state = (nes_state *)space->machine->driver_data;
4945   LOG_MMC(("fukutake_l_w offset: %04x, data: %02x\n", offset, data));
4946   offset += 0x100;
4947   
4948   if (offset >= 0x200 && offset < 0x400)
4949   {
4950      if (offset & 1)
4951         prg16_89ab(space->machine, data);
4952      else
4953         wram_bank(space->machine, data >> 6, NES_WRAM);         
4954   }
4955   else if (offset >= 0x400 && offset < 0xf00)
4956      state->mapper_ram[offset - 0x400] = data;
4957}
4958
4959static READ8_HANDLER( fukutake_l_r )
4960{
4961   nes_state *state = (nes_state *)space->machine->driver_data;
4962   LOG_MMC(("fukutake_l_r offset: %04x\n", offset));
4963   offset += 0x100;
4964   
4965   if (offset >= 0x200 && offset < 0x400)
4966   {
4967      if (offset == 0x200 || offset == 0x201 || offset == 0x203)
4968         return 0x00;
4969      else if (offset == 0x202)
4970         return 0x40;
4971      else
4972         return 0xff;
4973   }
4974   else if (offset >= 0x400 && offset < 0xf00)
4975      return state->mapper_ram[offset - 0x400];
4976
4977   return 0;
4978}
4979
4980/*************************************************************
4981
49344982 Bootleg Board by Future Media
49354983
49364984 Games: Crayon Shin-chan (C), San Guo Zhi 4 - Chi Bi Feng Yun
r8378r8379
53685416   }
53695417}
53705418
5371static WRITE8_HANDLER( ks7032_l_w )
5372{
5373   nes_state *state = (nes_state *)space->machine->driver_data;
5374   LOG_MMC(("ks7032_l_w, offset: %04x, data: %02x\n", offset, data));
5375
5376   chr8(space->machine, data, state->mmc_chr_source);
5377}
5378
53795419static WRITE8_HANDLER( ks7032_w )
53805420{
53815421   nes_state *state = (nes_state *)space->machine->driver_data;
r8378r8379
55355575
55365576 Bootleg Board by Kay (for Panda Prince)
55375577
5538 Games: The Panda Prince
5578 Games: The Panda Prince, Sonic 3d Blast 6, SFZ2 '97, YuYu '97
5579 (and its title hack MK6), UMK3, Super Lion King 2
55395580
5540 MMC3 clone
5581 MMC3 clone. This is basically KOF96 board + protection
55415582
55425583 iNES: mapper 121
55435584
5544 In MESS: Only preliminarly supported (Panda Prince works,
5545 other games require handling properly the protection).
5585 In MESS: Most game works, with some graphical issues.
55465586
55475587 *************************************************************/
55485588
r8378r8379
55525592   LOG_MMC(("kay_pp_l_w, offset: %04x, data: %02x\n", offset, data));
55535593   offset += 0x100;
55545594
5555   if (!(offset < 0x1000))
5595   if (offset >= 0x1000)
55565596   {
55575597      switch (data & 0x03)
55585598      {
5559         case 0x03:
5560            state->mapper121_reg[2] = 0x00;
5561            break;
55625599         case 0x00:
55635600         case 0x01:
5564            state->mapper121_reg[2] = 0x83;
5601            state->mmc_reg[0] = 0x83;
55655602            break;
55665603         case 0x02:
5567            state->mapper121_reg[2] = 0x42;
5604            state->mmc_reg[0] = 0x42;
55685605            break;
5606         case 0x03:
5607            state->mmc_reg[0] = 0x00;
5608            break;
55695609      }
55705610   }
55715611}
r8378r8379
55765616   LOG_MMC(("kay_pp_l_r, offset: %04x\n", offset));
55775617   offset += 0x100;
55785618
5579   if (!(offset < 0x1000))
5580      return state->mapper121_reg[2];
5619   if (offset >= 0x1000)
5620      return state->mmc_reg[0];
55815621   else
5582      return 0;
5622      return 0xff;
55835623}
55845624
5585static void kay_pp_update_regs( running_machine *machine, UINT8 data )
5625static void kay_pp_update_regs( running_machine *machine )
55865626{
55875627   nes_state *state = (nes_state *)machine->driver_data;
5588
5589   switch (data & 0x3f)
5628   
5629   switch (state->mmc_reg[5] & 0x3f)
55905630   {
55915631      case 0x20:
55925632      case 0x29:
55935633      case 0x2b:
55945634      case 0x3f:
5595//          printf("reg (%x) %x \n", data, state->mapper121_reg[3]);
5596         state->mapper121_reg[1] = state->mapper121_reg[3];
5635         state->mmc_reg[7] = 1;
5636         state->mmc_reg[1] = state->mmc_reg[6];
55975637         break;
5638      case 0x26:
5639         state->mmc_reg[7] = 0;
5640         state->mmc_reg[1] = state->mmc_reg[6];
5641         break;
55985642      case 0x2c:
5599//          printf("reg (%x) %x \n", data, state->mapper121_reg[3]);
5600         state->mapper121_reg[1] = state->mapper121_reg[3];
5643         state->mmc_reg[7] = 1;
5644         if (state->mmc_reg[6])
5645            state->mmc_reg[1] = state->mmc_reg[6];
56015646         break;
5602
5647         
56035648      case 0x28:
5604//          printf("reg (%x) %x \n", data, state->mapper121_reg[3]);
5605         state->mapper121_reg[0] = state->mapper121_reg[3];
5649         state->mmc_reg[7] = 0;
5650         state->mmc_reg[2] = state->mmc_reg[6];
56065651         break;
5607
5652         
56085653      case 0x2a:
5609//          printf("reg (%x) %x \n", data, state->mapper121_reg[3]);
5610         state->mapper121_reg[4] = state->mapper121_reg[3];
5654         state->mmc_reg[7] = 0;
5655         state->mmc_reg[3] = state->mmc_reg[6];
56115656         break;
5612
5657         
56135658      case 0x2f:
56145659         break;
5615
5660         
56165661      default:
5617         state->mapper121_reg[0] = 0x0;
5618         state->mapper121_reg[1] = 0x0;
5619         state->mapper121_reg[4] = 0x0;
5662         state->mmc_reg[5] = 0;
56205663         break;
56215664   }
56225665}
56235666
5624static void kay_pp_set_prg( running_machine *machine, int prg_base, int prg_mask )
5667static void kay_pp_prg_cb( running_machine *machine, int start, int bank )
56255668{
56265669   nes_state *state = (nes_state *)machine->driver_data;
5627   UINT8 prg_flip = (state->mmc_latch1 & 0x40) ? 2 : 0;
5628   UINT8 new_bank1, new_bank2, new_bank3;
5670   
5671   if (state->mmc_reg[5] & 0x3f)
5672   {
5673      prg8_x(machine, start, bank & 0x3f);
5674      prg8_ef(machine, state->mmc_reg[1]);
5675      prg8_cd(machine, state->mmc_reg[2]);
5676      prg8_ab(machine, state->mmc_reg[3]);
5677   }
5678   else
5679      prg8_x(machine, start, bank & 0x3f);
5680}
56295681
5630   new_bank2 = state->mapper121_reg[0] ? state->mapper121_reg[0] : state->mmc_prg_bank[2 ^ prg_flip];
5631   new_bank3 = state->mapper121_reg[1] ? state->mapper121_reg[1] : state->mmc_prg_bank[3];
5632   new_bank1 = state->mapper121_reg[4] ? state->mapper121_reg[4] : state->mmc_prg_bank[1];
5633
5634   prg8_89(machine, prg_base | (state->mmc_prg_bank[0 ^ prg_flip] & prg_mask));
5635   prg8_ab(machine, prg_base | (new_bank1 & prg_mask));
5636   prg8_cd(machine, prg_base | (new_bank2 & prg_mask));
5637   prg8_ef(machine, prg_base | (new_bank3 & prg_mask));
5682static void kay_pp_chr_cb( running_machine *machine, int start, int bank, int source )
5683{
5684   nes_state *state = (nes_state *)machine->driver_data;
5685   UINT8 chr_page = (state->mmc_latch1 & 0x80) >> 5;
5686   
5687   if ((start & 0x04) == chr_page)
5688      bank |= 0x100;
5689   
5690   chr1_x(machine, start, bank, source);
56385691}
56395692
56405693static WRITE8_HANDLER( kay_pp_w )
56415694{
56425695   nes_state *state = (nes_state *)space->machine->driver_data;
5643   UINT8 MMC3_helper, cmd;
56445696   LOG_MMC(("kay_pp_w, offset: %04x, data: %02x\n", offset, data));
5645
5646   if ((offset < 0x2000) && (offset & 0x03) == 0x03)
5697   
5698   switch (offset & 0x6003)
56475699   {
5648      kay_pp_update_regs(space->machine, data);
5649      kay_pp_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
5650   }
5651   else
5652   {
5653      switch (offset & 0x6001)
5654      {
5655         case 0x0000:
5656            MMC3_helper = state->mmc_latch1 ^ data;
5657            state->mmc_latch1 = data;
5700      case 0x0000:
5701         txrom_w(space, offset, data);
5702         mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
5703         break;
5704         
5705      case 0x0001:
5706         state->mmc_reg[6] = (BIT(data, 0) << 5) | (BIT(data, 1) << 4) | (BIT(data, 2) << 3)
5707                        | (BIT(data, 3) << 2) | (BIT(data, 4) << 1) | BIT(data, 5);
5708         if (!state->mmc_reg[7])
5709            kay_pp_update_regs(space->machine);
5710         txrom_w(space, offset, data);
5711         mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
5712         break;
5713         
5714      case 0x0003:
5715         state->mmc_reg[5] = data;
5716         kay_pp_update_regs(space->machine);
5717         txrom_w(space, 0x0000, data);
5718         mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
5719         break;
56585720
5659            /* Has PRG Mode changed? */
5660            if (MMC3_helper & 0x40)
5661               kay_pp_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
5662
5663            /* Has CHR Mode changed? */
5664            if (MMC3_helper & 0x80)
5665               mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
5666            break;
5667
5668         case 0x0001:
5669            state->mapper121_reg[3] = (BIT(data, 0) << 5) | (BIT(data, 1) << 4) | (BIT(data, 2) << 3)
5670                              | (BIT(data, 3) << 2) | (BIT(data, 4) << 1) | BIT(data, 5);
5671            cmd = state->mmc_latch1 & 0x07;
5672            switch (cmd)
5673            {
5674            case 0: case 1:
5675            case 2: case 3: case 4: case 5:
5676               state->mmc_vrom_bank[cmd] = data;
5677               mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
5678               break;
5679            case 6:
5680            case 7:
5681               state->mmc_prg_bank[cmd - 6] = data;
5682               kay_pp_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
5683               break;
5684            }
5685            break;
5686
5687         default:
5688            txrom_w(space, offset, data);
5689            break;
5690      }
5721      default:
5722         txrom_w(space, offset, data);
5723         break;
56915724   }
56925725}
56935726
5694
56955727/*************************************************************
56965728
56975729 Bootleg Board by Kasing
r8378r8379
66266658
66276659
66286660/*************************************************************
6661 
6662 Sachen SA009 bootleg boards
6663 
6664 Games: Pipe 5
6665 
6666 iNES: mapper 160
6667 
6668 In MESS: Supported.
6669 
6670 *************************************************************/
66296671
6672static WRITE8_HANDLER( sa009_l_w )
6673{
6674   nes_state *state = (nes_state *)space->machine->driver_data;
6675   LOG_MMC(("sa009_l_w, offset: %04x, data: %02x\n", offset, data));
6676   
6677   chr8(space->machine, data, state->mmc_chr_source);
6678}
6679
6680/*************************************************************
6681
66306682 Sachen SA0036 bootleg boards
66316683
66326684 Games: Taiwan Mahjong 16
r8378r8379
70937145         case 0x2000:
70947146            state->map114_reg_enabled = 1;
70957147            data = (data & 0xc0) | conv_table[data & 0x07];
7096            txrom_w(space, 0x8000, data);
7148            txrom_w(space, 0x0000, data);
70977149            break;
70987150         case 0x4000:
70997151            if (state->map114_reg_enabled && (state->map114_reg & 0x80) == 0)
71007152            {
71017153               state->map114_reg_enabled = 0;
7102               txrom_w(space, 0x8001, data);
7154               txrom_w(space, 0x0001, data);
71037155            }
71047156            break;
71057157      }
r8378r8379
71097161      switch (offset & 0x03)
71107162      {
71117163         case 0x02:
7112            txrom_w(space, 0xe000, data);
7164            txrom_w(space, 0x6000, data);
71137165            break;
71147166         case 0x03:
7115            txrom_w(space, 0xe001, data);
7116            txrom_w(space, 0xc000, data);
7117            txrom_w(space, 0xc001, data);
7167            txrom_w(space, 0x6001, data);
7168            txrom_w(space, 0x4000, data);
7169            txrom_w(space, 0x4001, data);
71187170            break;
71197171      }
71207172   }
r8378r8379
83738425      case 0x3000:
83748426         state->unl_8237_reg[2] = 1;
83758427         data = (data & 0xc0) | conv_table[data & 0x07];
8376         txrom_w(space, 0x8000, data);
8428         txrom_w(space, 0x0000, data);
83778429         break;
83788430
83798431      case 0x4000:
r8378r8379
83818433         if (state->unl_8237_reg[2])
83828434         {
83838435            state->unl_8237_reg[2] = 0;
8384            txrom_w(space, 0x8001, data);
8436            txrom_w(space, 0x0001, data);
83858437         }
83868438         break;
83878439
r8378r8379
85438595         case 0x2001:
85448596            data = unl_kof97_unscramble(data);
85458597            txrom_w(space, offset, data);
8546            break;
8598            break;         
85478599      }
85488600   }
85498601}
r8378r8379
87918843   {
87928844      case 0x0000:
87938845         switch (offset & 0x03)
8794      {
8846         {
87958847         case 0x00: chr2_0(space->machine, data, CHRROM); break;
87968848         case 0x01: chr2_2(space->machine, data, CHRROM); break;
87978849         case 0x02: chr2_4(space->machine, data, CHRROM); break;
87988850         case 0x03: chr2_6(space->machine, data, CHRROM); break;
8799      }
8851         }
88008852         break;
88018853      case 0x1000:
88028854         switch (offset & 0x03)
8803      {
8855         {
88048856         case 0x00: prg8_89(space->machine, data); break;
88058857         case 0x01: prg8_ab(space->machine, data); break;
88068858         case 0x02: state->IRQ_enable = 0; state->IRQ_count = 0; break;
88078859         case 0x03: state->IRQ_enable = 1; state->IRQ_count = 7; break;
8808      }
8860         }
88098861         break;
88108862      default:
88118863         logerror("mk2_m_w uncaught addr: %04x value: %02x\n", offset + 0x6000, data);
r8378r8379
1098211034      switch (offset & 0x6001)
1098311035      {
1098411036         case 0x0000:
10985            txrom_w(space, 0xc000, data);
11037            txrom_w(space, 0x4000, data);
1098611038            break;
1098711039
1098811040         case 0x0001:
r8378r8379
1126411316
1126511317/*************************************************************
1126611318 
11319 UNL-H2288
11320 
11321 *************************************************************/
11322
11323static void h2288_prg_cb( running_machine *machine, int start, int bank )
11324{
11325   nes_state *state = (nes_state *)machine->driver_data;
11326   
11327   if (!(state->mmc_reg[0] & 0x40))
11328      prg8_x(machine, start, bank);
11329}
11330
11331static WRITE8_HANDLER( h2288_l_w )
11332{
11333   nes_state *state = (nes_state *)space->machine->driver_data;
11334   LOG_MMC(("h2288_l_w offset: %04x, data: %02x\n", offset, data));
11335   offset += 0x100;
11336   
11337   if (offset >= 0x1800)
11338   {
11339      state->mmc_reg[offset & 1] = data;
11340      if (state->mmc_reg[0] & 0x40)
11341      {
11342         UINT8 helper1 = (state->mmc_reg[0] & 0x05) | ((state->mmc_reg[0] >> 2) & 0x0a);
11343         UINT8 helper2 = BIT(state->mmc_reg[0], 1);
11344         prg16_89ab(space->machine, helper1 & ~helper2);
11345         prg16_cdef(space->machine, helper1 |  helper2);
11346      }
11347      else
11348         mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
11349   }
11350}
11351
11352static READ8_HANDLER( h2288_l_r )
11353{
11354   LOG_MMC(("h2288_l_r offset: %04x\n", offset));
11355   offset += 0x100;
11356   
11357   if (offset >= 0x1000)
11358   {
11359      int helper = offset >> 8;
11360      if (offset & 1)
11361         return helper | 0x01;
11362      else
11363         return helper ^ 0x01;
11364   }
11365
11366   return 0;
11367}
11368
11369static WRITE8_HANDLER( h2288_w )
11370{
11371   static const UINT8 conv_table[8] = {0, 3, 1, 5, 6, 7, 2, 4};
11372   LOG_MMC(("h2288_w, offset: %04x, data: %02x\n", offset, data));
11373   
11374   switch (offset & 0x6001)
11375   {
11376      case 0x0000:
11377         txrom_w(space, 0x0000, (data & 0xc0) | conv_table[data & 0x07]);
11378         break;
11379         
11380      default:
11381         txrom_w(space, offset, data);
11382         break;
11383   }
11384}
11385
11386/*************************************************************
11387 
1126711388 UNL-SHJY3
1126811389 
1126911390 *************************************************************/
r8378r8379
1136711488
1136811489/*************************************************************
1136911490 
11491 UNL-603-5052
11492 
11493 MMC3 + protection access in 0x4020 - 0x7fff
11494 
11495 in MESS: Partial support
11496
11497 *************************************************************/
11498
11499WRITE8_HANDLER( unl_6035052_extra_w )
11500{
11501   nes_state *state = (nes_state *)space->machine->driver_data;
11502   LOG_MMC(("unl_6035052_extra_w, offset: %04x, data: %02x\n", offset, data));
11503   state->mmc_latch1 = data & 0x03;
11504   if (state->mmc_latch1 == 1)
11505      state->mmc_latch1 = 2;
11506}
11507
11508READ8_HANDLER( unl_6035052_extra_r )
11509{
11510   nes_state *state = (nes_state *)space->machine->driver_data;
11511   LOG_MMC(("unl_6035052_extra_r, offset: %04x\n", offset));   
11512   return state->mmc_latch1;
11513}
11514
11515
11516/*************************************************************
11517 
11518 BMC-POWERJOY
11519 
11520 *************************************************************/
11521
11522static void pjoy84_prg_cb( running_machine *machine, int start, int bank )
11523{
11524   nes_state *state = (nes_state *)machine->driver_data;
11525   UINT8 flip = (state->mmc_latch1 & 0x40) ? 2 : 0;
11526   
11527   if (!(state->mmc_reg[3] & 0x03))
11528      prg8_x(machine, start, bank);
11529   else if (start == flip)
11530   {
11531      if ((state->mmc_reg[3] & 0x03) == 0x03)
11532         prg32(machine, bank >> 2);
11533      else
11534      {
11535         prg16_89ab(machine, bank >> 1);
11536         prg16_cdef(machine, bank >> 1);
11537      }
11538   }
11539}
11540
11541static void pjoy84_chr_cb( running_machine *machine, int start, int bank, int source )
11542{
11543   nes_state *state = (nes_state *)machine->driver_data;
11544
11545   if (!(state->mmc_reg[3] & 0x10))
11546      chr1_x(machine, start, bank, source);
11547}
11548
11549INLINE void pjoy84_set_base_mask( running_machine *machine )
11550{
11551   nes_state *state = (nes_state *)machine->driver_data;
11552
11553   state->mmc_prg_base = ((state->mmc_reg[0] & (0x06 | BIT(state->mmc_reg[0], 6))) << 4) |
11554                  (BIT(state->mmc_reg[0], 4) << 7);
11555
11556   state->mmc_chr_base = ((~state->mmc_reg[0] << 0) & 0x080 & state->mmc_reg[2]) |
11557                  ((state->mmc_reg[0] << 4) & 0x080 & state->mmc_reg[0]) |
11558                  ((state->mmc_reg[0] << 3) & 0x100) |
11559                  ((state->mmc_reg[0] << 5) & 0x200);
11560   
11561   state->mmc_prg_mask = BIT(state->mmc_reg[0], 6) ? 0x0f : 0x1f;
11562   state->mmc_chr_mask = BIT(state->mmc_reg[0], 7) ? 0x7f : 0xff;
11563}
11564
11565static WRITE8_HANDLER( pjoy84_m_w )
11566{
11567   nes_state *state = (nes_state *)space->machine->driver_data;
11568   LOG_MMC(("pjoy84_m_w offset: %04x, data: %02x\n", offset, data));
11569
11570   switch (offset & 0x03)
11571   {
11572      case 0x00:
11573      case 0x03:
11574         if (state->mmc_reg[3] & 0x80)
11575            return;   // else we act as if offset & 3 = 1,2
11576      case 0x01:
11577      case 0x02:
11578         state->mmc_reg[offset & 0x03] = data;
11579         pjoy84_set_base_mask(space->machine);
11580         if (state->mmc_reg[3] & 0x10)
11581            chr8(space->machine, (state->mmc_chr_base >> 3) | (state->mmc_reg[2] & 0x0f), state->mmc_chr_source);
11582         else
11583            mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
11584         mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
11585         break;
11586   }
11587}
11588
11589/*************************************************************
11590 
11591 SOMERI TEAM
11592 
11593 iNES: mapper 116
11594 
11595 Emulation note about regs in MESS: currently,
11596 - state->mmc_cmd1 represent the board mode
11597 - state->mmc_reg[n] for n=0,1,2,3 represent the MMC1 regs
11598 - state->mmc_prg_bank[n] for n=0,...,3 represent the MMC3 PRG banks
11599 - state->mmc_vrom_bank[n] for n=0,...,5 represent the MMC3 CHR banks
11600 - state->mmc_prg_bank[n] for n=4,5 represent the VRC2 PRG banks
11601 - state->mmc_vrom_bank[n] for n=6,...,13 represent the VRC2 CHR banks
11602 
11603 In MESS: Preliminary support
11604 
11605 *************************************************************/
11606
11607// MMC1 Mode emulation
11608static void someri_mmc1_set_prg( running_machine *machine )
11609{
11610   nes_state *state = (nes_state *)machine->driver_data;
11611   UINT8 prg_mode = state->mmc_reg[0] & 0x0c;
11612   UINT8 prg_offset = state->mmc_reg[1] & 0x10;
11613
11614   switch (prg_mode)
11615   {
11616      case 0x00:
11617      case 0x04:
11618         prg32(machine, (prg_offset + state->mmc_reg[3]) >> 1);
11619         break;
11620      case 0x08:
11621         prg16_89ab(machine, prg_offset + 0);
11622         prg16_cdef(machine, prg_offset + state->mmc_reg[3]);
11623         break;
11624      case 0x0c:
11625         prg16_89ab(machine, prg_offset + state->mmc_reg[3]);
11626         prg16_cdef(machine, prg_offset + 0x0f);
11627         break;
11628   }
11629}
11630
11631static void someri_mmc1_set_chr( running_machine *machine )
11632{
11633   nes_state *state = (nes_state *)machine->driver_data;
11634   UINT8 chr_mode = BIT(state->mmc_reg[0], 4);
11635   
11636   if (chr_mode)
11637   {
11638      chr4_0(machine, state->mmc_reg[1] & 0x1f, state->mmc_chr_source);
11639      chr4_4(machine, state->mmc_reg[2] & 0x1f, state->mmc_chr_source);
11640   }
11641   else
11642      chr8(machine, (state->mmc_reg[1] & 0x1f) >> 1, state->mmc_chr_source);
11643}
11644
11645static WRITE8_HANDLER( someri_mmc1_w )
11646{
11647   nes_state *state = (nes_state *)space->machine->driver_data;
11648   
11649   assert(state->mmc_cmd1 == 2);
11650
11651   if (data & 0x80)
11652   {
11653      state->mmc_count = 0;
11654      state->mmc_latch2 = 0;
11655     
11656      state->mmc_reg[0] |= 0x0c;
11657      someri_mmc1_set_prg(space->machine);
11658      return;
11659   }
11660   
11661   if (state->mmc_count < 5)
11662   {
11663      if (state->mmc_count == 0) state->mmc_latch2 = 0;
11664      state->mmc_latch2 >>= 1;
11665      state->mmc_latch2 |= (data & 0x01) ? 0x10 : 0x00;
11666      state->mmc_count++;
11667   }
11668   
11669   if (state->mmc_count == 5)
11670   {
11671      switch (offset & 0x6000)
11672      {
11673         case 0x0000:
11674            state->mmc_reg[0] = state->mmc_latch2;
11675            switch (state->mmc_reg[0] & 0x03)
11676            {
11677            case 0: set_nt_mirroring(space->machine, PPU_MIRROR_LOW); break;
11678            case 1: set_nt_mirroring(space->machine, PPU_MIRROR_HIGH); break;
11679            case 2: set_nt_mirroring(space->machine, PPU_MIRROR_VERT); break;
11680            case 3: set_nt_mirroring(space->machine, PPU_MIRROR_HORZ); break;
11681            }
11682            someri_mmc1_set_chr(space->machine);
11683            someri_mmc1_set_prg(space->machine);
11684            break;
11685         case 0x2000:
11686            state->mmc_reg[1] = state->mmc_latch2;
11687            someri_mmc1_set_chr(space->machine);
11688            someri_mmc1_set_prg(space->machine);
11689            break;
11690         case 0x4000:
11691            state->mmc_reg[2] = state->mmc_latch2;
11692            someri_mmc1_set_chr(space->machine);
11693            break;
11694         case 0x6000:
11695            state->mmc_reg[3] = state->mmc_latch2;
11696            someri_mmc1_set_prg(space->machine);
11697            break;
11698      }
11699     
11700      state->mmc_count = 0;
11701   }
11702}
11703
11704// MMC3 Mode emulation
11705static WRITE8_HANDLER( someri_mmc3_w )
11706{
11707   nes_state *state = (nes_state *)space->machine->driver_data;
11708   UINT8 mmc3_helper, cmd;
11709   
11710   assert(state->mmc_cmd1 == 1);
11711   switch (offset & 0x6001)
11712   {
11713      case 0x0000:
11714         mmc3_helper = state->mmc_latch1 ^ data;
11715         state->mmc_latch1 = data;
11716         
11717         if (mmc3_helper & 0x40)
11718            mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
11719         
11720         if (mmc3_helper & 0x80)
11721            mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
11722         break;
11723         
11724      case 0x0001:
11725         cmd = state->mmc_latch1 & 0x07;
11726         switch (cmd)
11727         {
11728         case 0: case 1:
11729         case 2: case 3: case 4: case 5:
11730            state->mmc_vrom_bank[cmd] = data;
11731            mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
11732            break;
11733         case 6:
11734         case 7:
11735            state->mmc_prg_bank[cmd - 6] = data;
11736            mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
11737            break;
11738         }
11739         break;
11740         
11741      case 0x2000:
11742         set_nt_mirroring(space->machine, BIT(data, 0) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
11743         break;
11744      case 0x2001: break;
11745      case 0x4000: state->IRQ_count_latch = data; break;
11746      case 0x4001: state->IRQ_count = 0; break;
11747      case 0x6000: state->IRQ_enable = 0; break;
11748      case 0x6001: state->IRQ_enable = 1; break;
11749   }
11750}
11751
11752// VRC2 Mode emulation
11753static WRITE8_HANDLER( someri_vrc2_w )
11754{
11755   nes_state *state = (nes_state *)space->machine->driver_data;
11756   UINT8 bank, shift;
11757   
11758   assert(state->mmc_cmd1 == 0);
11759
11760   if (offset < 0x1000)
11761   {
11762      state->mmc_prg_bank[4] = data;
11763      prg8_89(space->machine, state->mmc_prg_bank[4]);
11764   }
11765   else if (offset < 0x2000)
11766   {
11767      switch (data & 0x03)
11768      {
11769         case 0x00: set_nt_mirroring(space->machine, PPU_MIRROR_VERT); break;
11770         case 0x01: set_nt_mirroring(space->machine, PPU_MIRROR_HORZ); break;
11771         case 0x02: set_nt_mirroring(space->machine, PPU_MIRROR_LOW); break;
11772         case 0x03: set_nt_mirroring(space->machine, PPU_MIRROR_HIGH); break;
11773      }
11774   }
11775   else if (offset < 0x3000)
11776   {
11777      state->mmc_prg_bank[5] = data;
11778      prg8_ab(space->machine, state->mmc_prg_bank[5]);
11779   }
11780   else if (offset < 0x7000)
11781   {
11782      bank = ((offset & 0x7000) - 0x3000) / 0x0800 + BIT(offset, 1);
11783      shift = BIT(offset, 2) * 4;
11784      data = (data & 0x0f) << shift;
11785      state->mmc_vrom_bank[6 + bank] = data | state->mmc_chr_base;
11786      chr1_x(space->machine, bank, state->mmc_vrom_bank[6 + bank], CHRROM);
11787   }
11788}
11789
11790static WRITE8_HANDLER( someri_w )
11791{
11792   nes_state *state = (nes_state *)space->machine->driver_data;
11793   LOG_MMC(("someri_w mode %d, offset: %04x, data: %02x\n", state->mmc_cmd1, offset, data));
11794
11795   switch (state->mmc_cmd1)
11796   {
11797      case 0x00: someri_vrc2_w(space, offset, data); break;
11798      case 0x01: someri_mmc3_w(space, offset, data); break;
11799      case 0x02: someri_mmc1_w(space, offset, data); break;
11800   }
11801}
11802
11803static void someri_mode_update( running_machine *machine )
11804{
11805   nes_state *state = (nes_state *)machine->driver_data;
11806   int i;
11807
11808   switch (state->mmc_cmd1)
11809   {
11810      case 0x00:
11811         prg8_89(machine, state->mmc_prg_bank[4]);
11812         prg8_ab(machine, state->mmc_prg_bank[5]);
11813         for (i = 0; i < 8; i++)
11814            chr1_x(machine, i, state->mmc_vrom_bank[6 + i], CHRROM);
11815         break;
11816      case 0x01:
11817         mmc3_set_prg(machine, state->mmc_prg_base, state->mmc_prg_mask);
11818         mmc3_set_chr(machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
11819         break;
11820      case 0x02:
11821         someri_mmc1_set_prg(machine);
11822         someri_mmc1_set_chr(machine);
11823         break;
11824   }
11825}
11826
11827static WRITE8_HANDLER( someri_l_w )
11828{
11829   nes_state *state = (nes_state *)space->machine->driver_data;
11830   LOG_MMC(("someri_l_w, offset: %04x, data: %02x\n", offset, data));
11831   offset += 0x100;
11832
11833   if (offset & 0x100)
11834   {
11835      state->mmc_cmd1 = data & 0x03;
11836      state->mmc_chr_base = ((state->mmc_cmd1 & 0x04) << 6);
11837      if (state->mmc_cmd1 != 1)
11838         state->IRQ_enable = 0;
11839      someri_mode_update(space->machine);
11840   }
11841}
11842
11843#ifdef UNUSED_FUNCTION
11844/*************************************************************
11845 
1137011846 FUJIYA Board - mapper 170 according to NEStopia
1137111847 
1137211848 Which games are supposed to use this?
1137311849 
1137411850 *************************************************************/
1137511851
11376#ifdef UNUSED_FUNCTION
1137711852static WRITE8_HANDLER( fujiya_m_w )
1137811853{
1137911854   nes_state *state = (nes_state *)space->machine->driver_data;
1138011855   LOG_MMC(("fujiya_m_w, offset: %04x, data: %02x\n", offset, data));
1138111856   offset += 0x6000;
11382
11857   
1138311858   if (offset == 0x6502 || offset == 0x7000)
1138411859      state->mmc_latch1 = (data & 0x40) << 1;
1138511860}
r8378r8379
1139711872}
1139811873#endif
1139911874
11400/*************************************************************
11401 
11402 UNL-603-5052
11403 
11404 MMC3 + protection access in 0x4020 - 0x7fff
11405 
11406 in MESS: Partial support
1140711875
11408 *************************************************************/
1140911876
11410WRITE8_HANDLER( unl_6035052_extra_w )
11411{
11412   nes_state *state = (nes_state *)space->machine->driver_data;
11413   LOG_MMC(("unl_6035052_extra_w, offset: %04x, data: %02x\n", offset, data));
11414   state->mmc_latch1 = data & 0x03;
11415   if (state->mmc_latch1 == 1)
11416      state->mmc_latch1 = 2;
11417}
1141811877
11419READ8_HANDLER( unl_6035052_extra_r )
11420{
11421   nes_state *state = (nes_state *)space->machine->driver_data;
11422   LOG_MMC(("unl_6035052_extra_r, offset: %04x\n", offset));   
11423   return state->mmc_latch1;
11424}
11425
11426
11427
1142811878typedef void (*nes_ppu_latch)(running_device *device, offs_t offset);
1142911879
1143011880struct nes_memory_accessor
r8378r8379
1158212032   { CONY_BOARD,           {cony_l_w, cony_l_r}, NES_NOACCESS, NES_WRITEONLY(cony_w),        NULL, NULL, sunsoft3_irq },
1158312033   { DREAMTECH_BOARD,      NES_WRITEONLY(dreamtech_l_w), NES_NOACCESS, NES_NOACCESS,         NULL, NULL, NULL },
1158412034   { FUTUREMEDIA_BOARD,    NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(futuremedia_w),         NULL, NULL, futuremedia_irq },
12035   { FUKUTAKE_BOARD,       {fukutake_l_w, fukutake_l_r}, NES_NOACCESS, NES_NOACCESS,         NULL, NULL, NULL },
1158512036   { GOUDER_37017,         {gouder_sf4_l_w, gouder_sf4_l_r}, NES_NOACCESS, NES_WRITEONLY(gouder_sf4_w), NULL, NULL, mmc3_irq },
1158612037   { HENGEDIANZI_BOARD,    NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(henggedianzi_w),        NULL, NULL, NULL },
1158712038   { HENGEDIANZI_XJZB,     NES_WRITEONLY(heng_xjzb_l_w), NES_NOACCESS, NES_WRITEONLY(heng_xjzb_w), NULL, NULL, NULL },
r8378r8379
1159012041   { HOSENKAN_BOARD,       NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(hosenkan_w),            NULL, NULL, mmc3_irq },
1159112042   { KAISER_KS7058,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(ks7058_w),              NULL, NULL, NULL },
1159212043   { KAISER_KS7022,        NES_NOACCESS, NES_NOACCESS, {ks7022_w, ks7022_r},                 NULL, NULL, NULL },
11593   { KAISER_KS7032,        NES_WRITEONLY(ks7032_l_w), NES_NOACCESS, NES_WRITEONLY(ks7032_w), NULL, NULL, ks7032_irq },
12044   { KAISER_KS7032,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(ks7032_w),              NULL, NULL, ks7032_irq },
1159412045   { KAISER_KS202,         NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(ks202_w),               NULL, NULL, ks7032_irq },
1159512046   { KAISER_KS7017,      NES_WRITEONLY(ks7017_l_w), NES_NOACCESS, NES_NOACCESS,            NULL, NULL, mmc_fds_irq },
1159612047   { KAY_PANDAPRINCE,      {kay_pp_l_w, kay_pp_l_r}, NES_NOACCESS, NES_WRITEONLY(kay_pp_w),  NULL, NULL, mmc3_irq },
r8378r8379
1160112052   { SACHEN_8259B,         NES_WRITEONLY(s8259_l_w), NES_WRITEONLY(s8259_m_w), NES_NOACCESS, NULL, NULL, NULL },
1160212053   { SACHEN_8259C,         NES_WRITEONLY(s8259_l_w), NES_WRITEONLY(s8259_m_w), NES_NOACCESS, NULL, NULL, NULL },
1160312054   { SACHEN_8259D,         NES_WRITEONLY(s8259_l_w), NES_WRITEONLY(s8259_m_w), NES_NOACCESS, NULL, NULL, NULL },
12055   { SACHEN_SA009,         NES_WRITEONLY(sa009_l_w), NES_NOACCESS, NES_NOACCESS,             NULL, NULL, NULL },
1160412056   { SACHEN_SA0036,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(sa0036_w),              NULL, NULL, NULL },
1160512057   { SACHEN_SA0037,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(sa0037_w),              NULL, NULL, NULL },
1160612058   { SACHEN_SA72007,       NES_WRITEONLY(sa72007_l_w), NES_NOACCESS, NES_NOACCESS,           NULL, NULL, NULL },
r8378r8379
1162112073   { REXSOFT_DBZ5,         {rex_dbz_l_w, rex_dbz_l_r}, NES_NOACCESS, NES_WRITEONLY(rex_dbz_w), NULL, NULL, mmc3_irq },
1162212074   { REXSOFT_SL1632,       NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(rex_sl1632_w),          NULL, NULL, mmc3_irq },
1162312075   { RUMBLESTATION_BOARD,  NES_NOACCESS, NES_WRITEONLY(rumblestation_m_w), NES_WRITEONLY(rumblestation_w),      NULL, NULL, NULL },
12076   { SOMERI_SL12,          NES_WRITEONLY(someri_l_w), NES_NOACCESS, NES_WRITEONLY(someri_w), NULL, NULL, mmc3_irq },
1162412077   { SUPERGAME_BOOGERMAN,  NES_WRITEONLY(sgame_boog_l_w), NES_WRITEONLY(sgame_boog_m_w), NES_WRITEONLY(sgame_boog_w), NULL, NULL, mmc3_irq },
1162512078   { SUPERGAME_LIONKING,   NES_NOACCESS, NES_WRITEONLY(sgame_lion_m_w), NES_WRITEONLY(sgame_lion_w), NULL, NULL, mmc3_irq },
1162612079   { TENGEN_800008,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(tengen_800008_w),       NULL, NULL, NULL },
r8378r8379
1166612119   { UNL_RACERMATE,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(unl_racmate_w),         NULL, NULL, NULL },
1166712120   { UNL_STUDYNGAME,       NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(sng32_w),               NULL, NULL, NULL },
1166812121   { UNL_603_5052,         {unl_6035052_extra_w, unl_6035052_extra_r}, {unl_6035052_extra_w, unl_6035052_extra_r}, NES_WRITEONLY(txrom_w), NULL, NULL, NULL },
12122   { UNL_EDU2K,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(edu2k_w),               NULL, NULL, NULL },
12123   { UNL_SHJY3,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(shjy3_w),               NULL, NULL, shjy3_irq },
12124   { UNL_H2288,            {h2288_l_w, h2288_l_r}, NES_NOACCESS, NES_WRITEONLY(h2288_w),     NULL, NULL, mmc3_irq },
1166912125   //
1167012126   { BTL_AISENSHINICOL,    NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(btl_mariobaby_w),       NULL, NULL, NULL },
1167112127   { BTL_DRAGONNINJA,      NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(btl_dn_w),              NULL, NULL, btl_dn_irq },
r8378r8379
1171912175   { BMC_810544,           NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bmc_810544_w),          NULL, NULL, NULL },
1172012176   { BMC_NTD_03,           NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bmc_ntd03_w),           NULL, NULL, NULL },
1172112177   { BMC_G63IN1,           NES_NOACCESS, NES_NOACCESS, {bmc_gb63_w, bmc_gb63_r},             NULL, NULL, NULL },
11722   { UNL_EDU2K,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(edu2k_w),               NULL, NULL, NULL },
11723   { UNL_SHJY3,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(shjy3_w),               NULL, NULL, shjy3_irq },
1172412178   { BMC_FK23C,            NES_WRITEONLY(fk23c_l_w), NES_NOACCESS, NES_WRITEONLY(fk23c_w),   NULL, NULL, mmc3_irq },
1172512179   { BMC_FK23CA,           NES_WRITEONLY(fk23c_l_w), NES_NOACCESS, NES_WRITEONLY(fk23c_w),   NULL, NULL, mmc3_irq },
12180   { BMC_PJOY84,           NES_NOACCESS, NES_WRITEONLY(pjoy84_m_w), NES_WRITEONLY(txrom_w),  NULL, NULL, mmc3_irq },
1172612181   //
1172712182   { FFE_MAPPER6,          NES_WRITEONLY(mapper6_l_w), NES_NOACCESS, NES_WRITEONLY(mapper6_w), NULL, NULL, ffe_irq },
1172812183   { FFE_MAPPER8,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(mapper8_w),             NULL, NULL, NULL },
r8378r8379
1185812313         state->mmc3_prg_cb = unl_8237_prg_cb;
1185912314         state->mmc3_chr_cb = unl_8237_chr_cb;
1186012315         break;
12316      case UNL_H2288:
12317         state->mmc3_prg_cb = h2288_prg_cb;
12318         break;
1186112319      case SUPERGAME_BOOGERMAN:
1186212320         state->mmc3_prg_cb = sgame_boog_prg_cb;
1186312321         state->mmc3_chr_cb = sgame_boog_chr_cb;
r8378r8379
1186612324         state->mmc3_prg_cb = kof96_prg_cb;
1186712325         state->mmc3_chr_cb = kof96_chr_cb;
1186812326         break;
12327      case KAY_PANDAPRINCE:
12328         state->mmc3_prg_cb = kay_pp_prg_cb;
12329         state->mmc3_chr_cb = kay_pp_chr_cb;
12330         break;
1186912331      case BMC_FK23C:
1187012332         state->mmc3_prg_cb = fk23c_prg_cb;
1187112333         state->mmc3_chr_cb = fk23c_chr_cb;
1187212334         break;
12335      case BMC_PJOY84:
12336         state->mmc3_prg_cb = pjoy84_prg_cb;
12337         state->mmc3_chr_cb = pjoy84_chr_cb;
12338         break;
1187312339   }
1187412340}
1187512341
src/mess/machine/nes_unif.c
r8378r8379
232232      case SACHEN_TCU02:   // mapper 136
233233      case SACHEN_SA72007:   // mapper 145
234234      case SACHEN_TCU01:   // mapper 147
235      case SACHEN_SA009:   // mapper 160
235236      case SACHEN_SA0037:   // mapper 148
236237      case SACHEN_SA0036:   // mapper 149
237238      case AGCI_50282:   // mapper 144
r8378r8379
353354      case WAIXING_TYPE_E:   // mapper 195
354355      case WAIXING_TYPE_H:   // mapper 245
355356      case BTL_SUPERBROS11:   // mapper 196
357      case UNL_H2288:      // mapper 123
356358      case UNL_KOF97:
357359      case UNL_603_5052:
358360      case NITRA_TDA:   // mapper 250
r8378r8379
604606         mmc3_common_initialize(machine, 0xff, 0xff, 0);
605607         break;
606608// mapper 116
607//      case SOMERITEAM_SL12:
608//          break;
609
609      case SOMERI_SL12:
610         state->mmc_prg_base = state->mmc_chr_base = 0;
611         state->mmc_prg_mask = 0xff;
612         state->mmc_chr_mask = 0xff;
613         state->mmc_cmd1 = 2; // mode
614         state->mmc_latch1 = 0;
615         state->mmc_latch2 = 0;
616         // MMC1 regs
617         state->mmc_count = 0;
618         state->mmc_reg[0] = 0x0c;
619         state->mmc_reg[1] = 0x00;
620         state->mmc_reg[2] = 0x00;
621         state->mmc_reg[3] = 0x00;
622         // MMC3 regs
623         state->mmc_prg_bank[0] = 0x3c;
624         state->mmc_prg_bank[1] = 0x3d;
625         state->mmc_prg_bank[2] = 0xfe;
626         state->mmc_prg_bank[3] = 0xff;
627         state->mmc_vrom_bank[0] = 0x00;
628         state->mmc_vrom_bank[1] = 0x01;
629         state->mmc_vrom_bank[2] = 0x04;
630         state->mmc_vrom_bank[3] = 0x05;
631         state->mmc_vrom_bank[4] = 0x06;
632         state->mmc_vrom_bank[5] = 0x07;
633         // VRC2 regs
634         state->mmc_prg_bank[4] = 0x00;
635         state->mmc_prg_bank[5] = 0x01;
636         for (i = 0; i < 8; ++i)
637            state->mmc_vrom_bank[6 + i] = i;
638         someri_mode_update(machine);
639         break;
640         
610641// mapper 120
611642      case BTL_TOBIDASE:
612643         prg32(machine, 2);
r8378r8379
614645         
615646// mapper 121
616647      case KAY_PANDAPRINCE:
617         state->mapper121_reg[0] = state->mapper121_reg[1] = state->mapper121_reg[2] = 0;
648         state->mmc_reg[5] = state->mmc_reg[6] = state->mmc_reg[7] = 0;
618649         mmc3_common_initialize(machine, 0xff, 0xff, 0);
619650         break;
651         
652// mapper 126
653      case BMC_PJOY84:
654         mmc3_common_initialize(machine, 0xff, 0xff, 0);
655         state->mmc_reg[0] = state->mmc_reg[1] = state->mmc_reg[2] = state->mmc_reg[3] = 0;
656         pjoy84_set_base_mask(machine);
657         mmc3_set_chr(machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
658         mmc3_set_prg(machine, state->mmc_prg_base, state->mmc_prg_mask);
659         break;
660
620661// mapper 132
621662      case TXC_22211A:
622663// mapper 172
r8378r8379
691732         prg32(machine, (state->prg_chunks - 1) >> 1);
692733         break;
693734
735      case FUKUTAKE_BOARD:   // mapper 186
736         prg16_89ab(machine, 0);
737         prg16_cdef(machine, 0);
738         break;
739
694740// mapper 187
695741      case UNL_KOF96:
696742         state->mapper187_reg[0] = state->mapper187_reg[1] = state->mapper187_reg[2] = state->mapper187_reg[3] = 0;
src/mess/machine/nes_mmc.h
r8378r8379
5050   /* Rex Soft */
5151   REXSOFT_SL1632, REXSOFT_DBZ5,
5252   /* Sachen */
53   SACHEN_8259A, SACHEN_8259B, SACHEN_8259C,
54   SACHEN_8259D, SACHEN_SA0036, SACHEN_SA0037,
53   SACHEN_8259A, SACHEN_8259B, SACHEN_8259C, SACHEN_8259D,
54   SACHEN_SA009, SACHEN_SA0036, SACHEN_SA0037,
5555   SACHEN_SA72007, SACHEN_SA72008, SACHEN_TCA01,
5656   SACHEN_TCU01, SACHEN_TCU02,
5757   SACHEN_74LS374, SACHEN_74LS374_A,
r8378r8379
7676   BMC_GOLDENCARD_6IN1, BMC_72IN1, BMC_SUPER_42IN1, BMC_76IN1,
7777   BMC_1200IN1, BMC_31IN1, BMC_22GAMES, BMC_20IN1, BMC_110IN1,
7878   BMC_GKA, BMC_GKB, BMC_VT5201, BMC_BENSHENG_BS5, BMC_810544,
79   BMC_NTD_03, BMC_G63IN1, BMC_FK23C, BMC_FK23CA,
79   BMC_NTD_03, BMC_G63IN1, BMC_FK23C, BMC_FK23CA, BMC_PJOY84,
8080   /* Unlicensed */
8181   UNL_8237, UNL_CC21, UNL_AX5705, UNL_KOF97,
8282   UNL_N625092, UNL_SC127, UNL_SMB2J, UNL_T230,
8383   UNL_UXROM, UNL_MK2, UNL_XZY, UNL_KOF96,
8484   UNL_SUPERFIGHTER3, UNL_RACERMATE, UNL_EDU2K,
85   UNL_SHJY3, UNL_STUDYNGAME, UNL_603_5052,
85   UNL_SHJY3, UNL_STUDYNGAME, UNL_603_5052, UNL_H2288,
8686   /* Bootleg boards */
8787   BTL_SMB2A, BTL_MARIOBABY, BTL_AISENSHINICOL, BTL_TOBIDASE,
8888   BTL_SMB2B, BTL_SMB3, BTL_SUPERBROS11, BTL_DRAGONNINJA,
8989   BTL_PIKACHUY2K,
9090   /* Misc: these are needed to convert mappers to boards, I will sort them later */
9191   OPENCORP_DAOU306, HES_BOARD, HES6IN1_BOARD, RUMBLESTATION_BOARD,
92   MAGICSERIES_MD, KASING_BOARD, FUTUREMEDIA_BOARD, SOMERITEAM_SL12,
92   MAGICSERIES_MD, KASING_BOARD, FUTUREMEDIA_BOARD, FUKUTAKE_BOARD, SOMERI_SL12,
9393   HENGEDIANZI_BOARD, HENGEDIANZI_XJZB, SUBOR_TYPE0, SUBOR_TYPE1,
9494   KAISER_KS7058, KAISER_KS7032, KAISER_KS7022, KAISER_KS7017, KAISER_KS202, CONY_BOARD,
9595   CNE_DECATHLON, CNE_FSB, CNE_SHLZ, RCM_GS2015, RCM_TETRISFAMILY,
src/mess/machine/nes_ines.c
r8378r8379
299299   { 113, HES_BOARD },
300300   { 114, SUPERGAME_LIONKING },
301301   { 115, KASING_BOARD },
302   // 116 Someri Team (AV Mei Shao Nv Zhan Shi, Chuugoku Taitei) - Unsupported
302   { 116, SOMERI_SL12 },
303303   { 117, FUTUREMEDIA_BOARD },
304304   { 118, STD_TXSROM },
305305   { 119, STD_TQROM },
306306   { 120, BTL_TOBIDASE },
307307   { 121, KAY_PANDAPRINCE },
308308   // 122 Unused
309   // 123 K H2288 (ejim2) - Unsupported
309   { 123, UNL_H2288 },
310310   // 124 Unused
311311   // 125 Unused
312   // 126 Powerjoy 84-in-1 - Unsupported
312   { 126, BMC_PJOY84 },
313313   // 127 Unused
314314   // 128 Unused
315315   // 129 Unused
r8378r8379
343343   { 157, BANDAI_DATACH },   // no Datach Reader -> we fall back to mapper 16
344344   { 158, TENGEN_800037 },
345345   { 159, BANDAI_LZ93EX },   // with 24c01
346   // 160 Unused
346   { 160, SACHEN_SA009 },
347347   // 161 Unused
348348   // 162 Unused
349349   { 163, NANJING_BOARD},
r8378r8379
369369   // 183 FDS bootleg (Shui Guan Pipe) - Unsupported
370370   { 184, SUNSOFT_1 },
371371   { 185, STD_CNROM },
372   // 186 Fukutake (Study Box) - Unsupported
372   { 186, FUKUTAKE_BOARD },
373373   { 187, UNL_KOF96 },
374374   { 188, BANDAI_KARAOKE },
375375   { 189, TXC_TW },

Previous 15994 Revisions Next


© 1998-2018 The MESS Team