Previous 15994 Revisions Next

r8306 Thursday 24th June, 2010 at 19:25:55 UTC by Fabio Priuli
[NES] progresses:
- added some missing boards and fixed various details of the boards emulation
- fixed a silly regression in MMC1 code introduced back in rev. 5945: games like Zombie Hunter,
Pirates! and Wrath of the Black Manta are working again)
- added proper handling of MMC1 consecutive writes (code by Mariusz Wojcieszek): games like
Snow Bros and AD&D Hillsfar are working for the first time ever!
[src/mess/includes]nes.h
[src/mess/machine]nes.c nes_ines.c nes_mmc.h nes_pcb.c nes_unif.c

src/mess/includes/nes.h
r8305r8306
117117   UINT8      *vram;
118118   UINT8      *wram;
119119   UINT8      *ciram; //PPU nametable RAM - external to PPU!
120   UINT8      *battery_ram;
121   UINT8      *mapper_ram;
120122   // Variables which can change
121123   UINT8      mid_ram_enable;
122124
123   /* SRAM-related (we have two elements due to the init order, but it would be better to verify they both are still needed) */
124   UINT8      *battery_ram;
125125
126126   /***** Mapper-related variables *****/
127127
r8305r8306
156156
157157   // misc mapper related variables which should be merged with the above one, where possible
158158   UINT8 MMC1_regs[4];
159   int mmc1_reg_write_enable;
159160   UINT8 MMC2_regs[4];   // these replace bank0/bank0_hi/bank1/bank1_hi
160161
161162   UINT8 mmc3_alt_irq;
r8305r8306
188189   UINT8 map217_reg[4];
189190   UINT8 map249_reg;
190191   UINT8 map14_reg[2];
191   UINT8 mapper121_reg[3];
192   UINT8 mapper121_reg[8];
192193   UINT8 mapper187_reg[4];
193194   UINT8 map208_reg[5];
194195   UINT8 bmc_64in1nr_reg[4];
r8305r8306
216217   UINT32 battery_size;
217218   UINT8 prg_ram;         // if there is PRG RAM with no backup
218219   UINT32 wram_size;
220   UINT32 mapper_ram_size;
219221
220222   int format;   // 1 = iNES, 2 = UNIF
221223
src/mess/machine/nes_pcb.c
r8305r8306
2222   { "HVC-NROM-256",     STD_NROM },
2323   { "HVC-RROM",         STD_NROM },
2424   { "HVC-RROM-128",     STD_NROM },
25   { "HVC-RTROM",        STD_NROM },
2526   { "HVC-SROM",         STD_NROM },
2627   { "HVC-STROM",        STD_NROM },
2728   { "NES-HROM",         STD_NROM },
r8305r8306
3940   { "BANDAI-NROM-256",  STD_NROM },
4041   { "KONAMI-NROM-128",  STD_NROM },
4142   { "SETA-NROM-128",    STD_NROM },
43   { "SUNSOFT-NROM-128", STD_NROM },
4244   { "SUNSOFT-NROM-256", STD_NROM },
4345   { "TAITO-NROM-128",   STD_NROM },
4446   { "TAITO-NROM-256",   STD_NROM },
4547   { "NAMCOT-3301",      STD_NROM },
4648   { "NAMCOT-3302",      STD_NROM },
4749   { "NAMCOT-3303",      STD_NROM },
50   { "NAMCOT-3304",      STD_NROM },
4851   { "NAMCOT-3305",      STD_NROM },
4952   { "NAMCOT-3311",      STD_NROM },
53   { "NAMCOT-3312",      STD_NROM },
5054   { "NAMCOT-3411",      STD_NROM },
5155   { "JALECO-JF-01",     STD_NROM },
5256   { "JALECO-JF-02",     STD_NROM },
5357   { "JALECO-JF-03",     STD_NROM },
5458   { "JALECO-JF-04",     STD_NROM },
5559   { "TENGEN-800003",    STD_NROM },
60   { "SACHEN-NROM",      STD_NROM },
5661   /* Nintendo Family BASIC pcb (NROM + 2K or 4K WRAM) */
5762   { "HVC-FAMILYBASIC",  HVC_FAMBASIC },
5863   /* Game Genie */
r8305r8306
6065//
6166   /* Nintendo UNROM/UOROM */
6267   { "HVC-UNROM",        STD_UXROM },
68   { "HVC-UNEPROM",      STD_UXROM },
6369   { "HVC-UOROM",        STD_UXROM },
6470   { "NES-UNROM",        STD_UXROM },
71   { "NES-UNEPROM",      STD_UXROM },
6572   { "NES-UOROM",        STD_UXROM },
6673   { "HVC-UNROM+74HC08", UXROM_CC },
6774   /* UxROM boards by other manufacturer */
r8305r8306
7178   { "JALECO-JF-15",     STD_UXROM },
7279   { "JALECO-JF-18",     STD_UXROM },
7380   { "JALECO-JF-39",     STD_UXROM },
74   { "UNL-UXROM",        STD_UXROM }, // e.g. mapper 2 mod (see Korean Igo)
7581//
7682   /* Nintendo CNROM */
7783   { "HVC-CNROM",        STD_CNROM },
r8305r8306
7985   /* CxROM boards by other manufacturer */
8086   { "BANDAI-CNROM",     STD_CNROM },
8187   { "KONAMI-CNROM",     STD_CNROM },
88   { "NAMCOT-CNROM+WRAM", STD_CNROM },
8289   { "TAITO-CNROM",      STD_CNROM },
8390   { "AVE-74*161",       STD_CNROM },
91   { "NTDEC-N715061",    STD_CNROM },
8492   { "NTDEC-N715062",    STD_CNROM },
8593   { "SACHEN-CNROM",     STD_CNROM },
8694   /* Bandai Aerobics Studio (CNROM boards + special audio chip) */
r8305r8306
165173   { "HVC-SGROM",        STD_SXROM },
166174   { "HVC-SH1ROM",       STD_SXROM },
167175   { "HVC-SHROM",        STD_SXROM },
176   { "HVC-SIROM",        STD_SXROM },
168177   { "HVC-SJROM",        STD_SXROM },
169178   { "HVC-SKROM",        STD_SXROM },
179   { "HVC-SKEPROM",      STD_SXROM },
170180   { "HVC-SL1ROM",       STD_SXROM },
171181   { "HVC-SL2ROM",       STD_SXROM },
172182   { "HVC-SL3ROM",       STD_SXROM },
173183   { "HVC-SLROM",        STD_SXROM },
174184   { "HVC-SLRROM",       STD_SXROM },
185   { "HVC-SMROM",        STD_SXROM },
175186   { "HVC-SNROM",        STD_SXROM },
176187   { "HVC-SUROM",        STD_SXROM },
177188   { "HVC-SXROM",        STD_SXROM },
r8305r8306
185196   { "NES-SGROM",        STD_SXROM },
186197   { "NES-SH1ROM",       STD_SXROM },
187198   { "NES-SHROM",        STD_SXROM },
199   { "NES-SIROM",        STD_SXROM },
188200   { "NES-SJROM",        STD_SXROM },
189201   { "NES-SKROM",        STD_SXROM },
202   { "NES-SKEPROM",      STD_SXROM },
190203   { "NES-SL1ROM",       STD_SXROM },
191204   { "NES-SL2ROM",       STD_SXROM },
192205   { "NES-SL3ROM",       STD_SXROM },
193206   { "NES-SLROM",        STD_SXROM },
194207   { "NES-SLRROM",       STD_SXROM },
208   { "NES-SMROM",        STD_SXROM },
195209   { "NES-SNROM",        STD_SXROM },
196210   { "NES-SUROM",        STD_SXROM },
197211   { "NES-SXROM",        STD_SXROM },
r8305r8306
303317   /* Discrete board IC_74x161x138 */
304318   { "BIT-CORP-74*161/138", DIS_74X161X138 },
305319//
306   { "BANDAI-LZ93D50+24C01", BANDAI_LZ93 },
307   { "BANDAI-LZ93D50+24C02", BANDAI_LZ93 },
320   { "BANDAI-LZ93D50",   BANDAI_LZ93 },
321   { "BANDAI-LZ93D50+24C01", BANDAI_LZ93EX },
322   { "BANDAI-LZ93D50+24C02", BANDAI_LZ93EX },
308323   { "BANDAI-FCG-1",     BANDAI_FCG },
309324   { "BANDAI-FCG-2",     BANDAI_FCG },
310325   { "BANDAI-JUMP2",     BANDAI_JUMP2 },   
r8305r8306
316331   { "IREM-G101",        IREM_G101 },
317332   { "IREM-74*161/161/21/138", IREM_LROG017 },
318333   { "IREM-H-3001",      IREM_H3001 },
334   { "IREM-H3001",       IREM_H3001 },
319335   { "IREM-HOLYDIVER",   IREM_HOLYDIV },
320336   { "IREM-TAM-S1",      IREM_TAM_S1 },
321337//
r8305r8306
357373   { "UNL-VRC7",         KONAMI_VRC7 },
358374//
359375   { "NAMCOT-163",       NAMCOT_163 },
376   { "NAMCOT-175",       NAMCOT_163 },
377   { "NAMCOT-340",       NAMCOT_163 },
360378   { "NAMCOT-3425",      NAMCOT_3425 },
361379   { "NAMCOT-3433",      NAMCOT_34X3 },
362380   { "NAMCOT-3443",      NAMCOT_34X3 },
r8305r8306
369387   //
370388   { "TAITO-TC0190FMC",  TAITO_TC0190FMC },
371389   { "TAITO-TC0190FMC+PAL16R4", TAITO_TC0190FMCP },
390   { "TAITO-TC0350FMR",  TAITO_TC0190FMC },
372391   { "TAITO-X1-005",     TAITO_X1_005 },   // two variants exist, depending on pin17 & pin31 connections
373392   { "TAITO-X1-017",     TAITO_X1_017 },
374393//
r8305r8306
378397   { "AVE-NINA-03",      AVE_NINA06 },
379398   { "AVE-NINA-06",      AVE_NINA06 },
380399   { "AVE-MB-91",        AVE_NINA06 },
400   { "TXC-74*138/175",   AVE_NINA06 },
381401   { "UNL-SA-016-1M",    AVE_NINA06 },
382402   { "CAMERICA-ALGN",    CAMERICA_BF9093 },
383403   { "CAMERICA-BF9093",  CAMERICA_BF9093 },
r8305r8306
432452   { "WAIXING-SH2",      UNSUPPORTED_BOARD },
433453//
434454   { "TXC-TW",           TXC_TW },
455   { "TXC-STRIKEWOLF",   TXC_STRIKEWOLF },
435456   { "TXC-MXMDHTWO",     TXC_MXMDHTWO },
436457   { "UNL-22211",        TXC_22211A },
437458   /* FIXME: Made up boards the different mirroring handling */
r8305r8306
481502   { "UNL-A9746",        UNSUPPORTED_BOARD },// mapper 219
482503   { "UNL-603-5052",     UNSUPPORTED_BOARD },// mapper 238?
483504   { "UNL-SHJY3",        UNSUPPORTED_BOARD },// mapper 253
505   { "UNL-RACERMATE",    UNL_RACERMATE },// mapper 168
484506   { "UNL-N625092",      UNL_N625092 },
485507   { "BMC-N625092",      UNL_N625092 },
486508   { "UNL-SC-127",       UNL_SC127 },
487509   { "UNL-SMB2J",        UNL_SMB2J },
510   { "BTL-SMB2C",        UNL_SMB2J },
488511   { "UNL-MK2",          UNL_MK2 },
489512   { "UNL-XZY",          UNL_XZY },
490513   { "UNL-KOF96",        UNL_KOF96 },
r8305r8306
551574   { "BMC-411120-C",        UNSUPPORTED_BOARD },
552575   { "BMC-830118C",         UNSUPPORTED_BOARD },
553576   { "BMC-12-IN-1",         UNSUPPORTED_BOARD },
577   { "BMC-NTD-03",          UNSUPPORTED_BOARD },
554578   { "BMC-8157",            UNSUPPORTED_BOARD /*BMC_8157*/ },
555579   { "BMC-BS-5",            UNSUPPORTED_BOARD /*BENSHENG_BS5*/ },
556580   { "BMC-FK23C",           UNSUPPORTED_BOARD /*BMC_FK23C*/ },
557581   { "BMC-FK23CA",          UNSUPPORTED_BOARD /*BMC_FK23C*/ },   // diff reg init
558582   { "BMC-GHOSTBUSTERS63IN1", UNSUPPORTED_BOARD /*BMC_G63IN1*/ },
559   { "BMC-SUPERVISION16IN1",  UNSUPPORTED_BOARD },   // mapper 53
560   { "BMC-RESETBASED-4IN1",   UNSUPPORTED_BOARD },// mapper 60 with 64k prg and 32k chr
583   { "BMC-SUPERVISION16IN1", UNSUPPORTED_BOARD },   // mapper 53
584   { "BMC-RESETBASED-4IN1", UNSUPPORTED_BOARD },// mapper 60 with 64k prg and 32k chr
561585   { "BMC-VT5201",          UNSUPPORTED_BOARD },// mapper 60 otherwise
562   { "BMC-42IN1RESETSWITCH", UNSUPPORTED_BOARD },   // mapper 60?
586   { "BMC-42IN1RESETSWITCH", UNSUPPORTED_BOARD },   // mapper 60?
563587   { "BMC-D1038",           UNSUPPORTED_BOARD }, // mapper 60?
564588   { "BMC-SUPER22GAMES",    UNSUPPORTED_BOARD },// mapper 233
565   { "BMC-GOLDENGAME-150IN1",      UNSUPPORTED_BOARD },// mapper 235 with 2M PRG
566   { "BMC-GOLDENGAME-260IN1",      UNSUPPORTED_BOARD },// mapper 235 with 4M PRG
589   { "BMC-GOLDENGAME-150IN1", UNSUPPORTED_BOARD },// mapper 235 with 2M PRG
590   { "BMC-GOLDENGAME-260IN1", UNSUPPORTED_BOARD },// mapper 235 with 4M PRG
567591   { "BMC-70IN1",           UNSUPPORTED_BOARD },   // mapper 236?
568592   { "BMC-70IN1B",          UNSUPPORTED_BOARD },   // mapper 236?
569593   { "BMC-SUPERHIK-KOF",    UNSUPPORTED_BOARD },// mapper 251
570   { "BMC-POWERJOY",    UNSUPPORTED_BOARD },// mapper 126
594   { "BMC-POWERJOY",        UNSUPPORTED_BOARD },// mapper 126
571595// are there dumps of games with these boards?
572596   { "WAIXING-I",        UNSUPPORTED_BOARD }, // [supported by NEStopia - we need more info]
573597   { "WAIXING-J",        UNSUPPORTED_BOARD }, // [supported by NEStopia - we need more info]
r8305r8306
579603   { "UNL-C-N22M",       UNSUPPORTED_BOARD }, //  [mentioned in FCEUMM source - we need more info]
580604   { "UNL-KS7017",       UNSUPPORTED_BOARD }, //  [mentioned in FCEUMM source - we need more info]
581605   { "UNL-PEC-586",      UNSUPPORTED_BOARD }, //  [mentioned in FCEUMM source - we need more info]
582   { "UNL-SA-009",       UNSUPPORTED_BOARD }  //  [mentioned in FCEUMM source - we need more info]
606   { "UNL-SA-009",       UNSUPPORTED_BOARD }, //  [mentioned in FCEUMM source - we need more info]
607//
608   { "UNKNOWN",          UNSUPPORTED_BOARD }  //  a few pirate dumps uses the wrong mapper...
583609};
584610
585611const nes_pcb *nes_pcb_lookup( const char *board )
r8305r8306
817843 
818844 *************************************************************/
819845
846static TIMER_CALLBACK( mmc1_resync_callback )
847{
848   nes_state *state = (nes_state *)machine->driver_data;
849   state->mmc1_reg_write_enable = 1;
850}
851
852
820853static void mmc1_set_wram( const address_space *space, int board )
821854{
822855   running_machine *machine = space->machine;
r8305r8306
868901    However, quoting Disch's docs: When in 4k CHR mode, 0x10 in both $A000 and $C000 *must* be
869902    set to the same value, or else pages will constantly be swapped as graphics render!
870903    Hence, we use only mmc_reg[1]&0x10 for prg_offset */
871   
904
872905   switch (prg_mode)
873906   {
874907      case 0x00:
875908      case 0x04:
876         prg32(machine, prg_offset + state->mmc_reg[3]);
909//         printf("PRG 32 bank %d \n", (prg_offset + state->mmc_reg[3]) >> 1);
910         prg32(machine, (prg_offset + state->mmc_reg[3]) >> 1);
877911         break;
878912      case 0x08:
913//         printf("PRG 16 bank %d (high) \n", prg_offset + state->mmc_reg[3]);
879914         prg16_89ab(machine, prg_offset + 0);
880915         prg16_cdef(machine, prg_offset + state->mmc_reg[3]);
881916         break;
882917      case 0x0c:
918//         printf("PRG 16 bank %d (low) \n", prg_offset + state->mmc_reg[3]);
883919         prg16_89ab(machine, prg_offset + state->mmc_reg[3]);
884920         prg16_cdef(machine, prg_offset + 0x0f);
885921         break;
r8305r8306
895931static void mmc1_set_chr( running_machine *machine )
896932{
897933   nes_state *state = (nes_state *)machine->driver_data;
898   UINT8 chr_mode = state->mmc_reg[0] & 0x10;
934   UINT8 chr_mode = BIT(state->mmc_reg[0], 4);
899935   
900936   if (chr_mode)
901937   {
r8305r8306
915951   
916952   /* here we would need to add an if(cpu_cycles_passed>1) test, and
917953    if requirement is not met simply return without writing anything.
918    AD&D Hillsfar and Bill & Ted rely on this behavior!! */
954    Some games (AD&D Hillsfar, Bill & Ted Excellent Adventure, Cosmic
955    Wars, Rocket Ranger, Sesame Street 123 and Snow Brothers) rely on
956    this behavior!! */
957   if (state->mmc1_reg_write_enable == 0)
958   {
959      return;
960   }
961   else
962   {
963      state->mmc1_reg_write_enable = 0;
964      timer_call_after_resynch(space->machine, NULL, 0, mmc1_resync_callback);
965   }
966
919967   if (data & 0x80)
920968   {
921969      state->mmc_count = 0;
r8305r8306
10901138   nes_state *state = (nes_state *)machine->driver_data;
10911139
10921140   if (BIT(state->mmc_latch2, 7))
1093         memory_install_readwrite_bank(space, 0x6000, 0x7fff, 0, 0, "bank5");
1141      memory_install_readwrite_bank(space, 0x6000, 0x7fff, 0, 0, "bank5");
10941142   else
10951143   {
10961144      memory_unmap_readwrite(space, 0x6000, 0x7fff, 0, 0);
10971145      return;
10981146   }
10991147
1100   if (BIT(state->mmc_latch2, 6))
1148   if (!BIT(state->mmc_latch2, 6))
11011149      memory_install_write_bank(space, 0x6000, 0x7fff, 0, 0, "bank5");
11021150   else
11031151   {
11041152      memory_unmap_write(space, 0x6000, 0x7fff, 0, 0);
11051153      return;
11061154   }
1107   
1108   wram_bank(machine, 0, state->battery_size ? NES_BATTERY : NES_WRAM);
11091155}
11101156
11111157static void mmc3_set_prg( running_machine *machine, int prg_base, int prg_mask )
r8305r8306
11471193      else
11481194         state->IRQ_count--;
11491195     
1150      if (state->IRQ_enable && !blanked && (state->IRQ_count == 0) && (priorCount || state->IRQ_clear || !state->mmc3_alt_irq))
1196      if (state->IRQ_enable && !blanked && (state->IRQ_count == 0) && (priorCount || state->IRQ_clear /*|| !state->mmc3_alt_irq*/)) // according to blargg the latter should be present as well, but it breaks Rampart and Joe & Mac US: they probably use the alt irq!
11511197      {
11521198         LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline,
11531199                video_screen_get_vpos(device->machine->primary_screen), video_screen_get_hpos(device->machine->primary_screen)));
r8305r8306
12441290   if (offset < 0x1000)
12451291      return;   
12461292
1247   offset &= 0x3ff;
12481293   // banks can be written only if both read & write is enabled!
12491294   write_hi = ((state->mmc6_reg & 0xc0) == 0xc0);
1250   write_lo = ((state->mmc6_reg & 0x60) == 0x60);
1295   write_lo = ((state->mmc6_reg & 0x30) == 0x30);
12511296
12521297   if (BIT(offset, 9) && write_hi)   // access to upper 1k
1253      state->battery_ram[offset] = data;
1298      state->mapper_ram[offset & (state->mapper_ram_size - 1)] = data;
12541299   
12551300   if (!BIT(offset, 9) && write_lo)   // access to lower 1k
1256      state->battery_ram[offset] = data;
1301      state->mapper_ram[offset & (state->mapper_ram_size - 1)] = data;
12571302}
12581303
12591304static READ8_HANDLER( hkrom_m_r )
r8305r8306
12661311
12671312   if (!(state->mmc6_reg & 0xa0))
12681313      return 0xff;   // here it should be open bus
1269   
1270   offset &= 0x3ff;
12711314
12721315   if (BIT(offset, 9) && BIT(state->mmc6_reg, 7))   // access to upper 1k when upper read is enabled
1273      return state->battery_ram[offset];
1316      return state->mapper_ram[offset & (state->mapper_ram_size - 1)];
12741317
12751318   if (!BIT(offset, 9) && BIT(state->mmc6_reg, 5))   // access to lower 1k when lower read is enabled
1276      return state->battery_ram[offset];
1319      return state->mapper_ram[offset & (state->mapper_ram_size - 1)];
12771320
12781321   // If only one bank is enabled for reading, the other reads back as zero
12791322   return 0x00;
r8305r8306
14841527{
14851528   nes_state *state = (nes_state *)space->machine->driver_data;
14861529   UINT8 map37_helper;
1487   LOG_MMC(("mapper37_m_w, offset: %04x, data: %02x\n", offset, data));
1530   LOG_MMC(("zz_m_w, offset: %04x, data: %02x\n", offset, data));
14881531   
1489   map37_helper = (data & 0x06) >> 1;
1532   map37_helper = data & 0x07;
14901533   
1491   state->mmc_prg_base = map37_helper << 3;
1492   state->mmc_prg_mask = (map37_helper == 2) ? 0x0f : 0x07;
1493   state->mmc_chr_base = map37_helper << 6;
1534   state->mmc_prg_base = (BIT(map37_helper, 2) << 4) | (((map37_helper & 0x03) == 0x03) ? 0x08 : 0);
1535   state->mmc_prg_mask = (map37_helper << 1) | 0x07;
1536   state->mmc_chr_base = BIT(map37_helper, 2) << 7;
14941537   state->mmc_chr_mask = 0x7f;
14951538   mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
14961539   mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
r8305r8306
15101553   nes_state *state = (nes_state *)space->machine->driver_data;
15111554   LOG_MMC(("qj_m_w, offset: %04x, data: %02x\n", offset, data));
15121555   
1513   state->mmc_prg_base = (data & 0x01) << 4;
1556   state->mmc_prg_base = BIT(data, 0) << 4;
15141557   state->mmc_prg_mask = 0x0f;
1515   state->mmc_chr_base = (data & 0x01) << 7;
1558   state->mmc_chr_base = BIT(data, 0) << 7;
15161559   state->mmc_chr_mask = 0x7f;
15171560   mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
15181561   mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
r8305r8306
23232366{
23242367   nes_state *state = (nes_state *)space->machine->driver_data;
23252368   LOG_MMC(("dxrom_w, offset: %04x, data: %02x\n", offset, data));
2326   
2327   if (offset >= 0x2000)
2369
2370    if (offset >= 0x2000)
23282371      return;
2329   
2372
23302373   switch (offset & 1)
23312374   {
23322375      case 1:
r8305r8306
23482391   }
23492392}
23502393
2394
23512395/*************************************************************
23522396 
23532397 Namcot 3453 board emulation
r8305r8306
23552399 These are the same as Namcot 34x3, but with additional mirroring
23562400 control
23572401 
2358 iNES: mappers 154
2402 iNES: mapper 154
23592403 
23602404 *************************************************************/
23612405
r8305r8306
23762420 
23772421 These are similar Namcot 34x3, but different bankswitch capabilities
23782422 
2379 iNES: mappers 76
2423 iNES: mapper 76
23802424 
23812425 *************************************************************/
23822426
r8305r8306
26122656   LOG_MMC(("lz93d50_m_w, offset: %04x, data: %02x\n", offset, data));
26132657
26142658   if (!state->battery && !state->wram)
2615      lz93d50_w(space, offset, data);
2659      lz93d50_w(space, offset & 0x0f, data);
26162660   else if (state->battery)
26172661      state->battery_ram[offset] = data;
26182662   else
r8305r8306
26282672   for (i = 0; i < 8; i++)
26292673      mmc_helper |= ((state->mmc_reg[i] & 0x01) << 4);
26302674   
2631   state->mmc_latch1 = mmc_helper | (state->mmc_latch1 & 0x0f);
2632   
2633   prg16_89ab(machine, state->mmc_latch1);
2675   prg16_89ab(machine, mmc_helper | state->mmc_latch1);
26342676   prg16_cdef(machine, mmc_helper | 0x0f);
26352677}
26362678
26372679static WRITE8_HANDLER( fjump2_w )
26382680{
26392681   nes_state *state = (nes_state *)space->machine->driver_data;
2640
26412682   LOG_MMC(("fjump2_w, offset: %04x, data: %02x\n", offset, data));
26422683   
26432684   switch (offset & 0x000f)
r8305r8306
26482689         fjump2_set_prg(space->machine);
26492690         break;
26502691      case 8:
2651         state->mmc_latch1 = (data & 0x0f) | (state->mmc_latch1 & 0x10);
2652         prg16_89ab(space->machine, state->mmc_latch1);
2692         state->mmc_latch1 = (data & 0x0f);
2693         fjump2_set_prg(space->machine);
26532694         break;
26542695      default:
26552696         lz93d50_m_w(space, offset & 0x0f, data);
r8305r8306
26942735
26952736   state->mmc_latch1 = data;
26962737   mmc_helper = (state->mmc_latch1 & 0x03) | (data & 0x04);
2697   chr4_0(space->machine, mmc_helper, state->mmc_chr_source);
2698   chr4_4(space->machine, 0x03 | (data & 0x04), state->mmc_chr_source);
2738   chr4_0(space->machine, mmc_helper, CHRRAM);
2739   chr4_4(space->machine, 0x03 | (data & 0x04), CHRRAM);
26992740}
27002741
27012742/*************************************************************
r8305r8306
31093150   if (BIT(data, 6))
31103151      chr8(space->machine, data & 0x0f, CHRROM);
31113152   if (BIT(data, 5) && !BIT(data,4))
3112      LOG_MMC(("Jaleco JF-17 sound write, data: %02x\n", data & 0x1f));
3153      LOG_MMC(("Jaleco JF-19 sound write, data: %02x\n", data & 0x1f));
31133154}
31143155
31153156/*************************************************************
r8305r8306
31693210static WRITE8_HANDLER( konami_vrc2_w )
31703211{
31713212   nes_state *state = (nes_state *)space->machine->driver_data;
3172   UINT8 bank, shift;
3213   UINT8 bank, shift, mask;
31733214   UINT32 shifted_offs = (offset & 0x7000)
31743215                  | ((offset << (9 - state->vrc_ls_prg_a)) & 0x200)
31753216                  | ((offset << (8 - state->vrc_ls_prg_b)) & 0x100);
r8305r8306
31913232      prg8_ab(space->machine, data);
31923233   else if (offset < 0x7000)
31933234   {
3235      bank = ((shifted_offs & 0x7000) - 0x3000) / 0x0800 + BIT(shifted_offs, 9);
31943236      shift = BIT(shifted_offs, 8) * 4;
3195      bank = ((shifted_offs & 0x7000) - 0x3000) / 0x0800 + BIT(shifted_offs, 9);
3196      state->mmc_vrom_bank[bank] = (state->mmc_vrom_bank[bank] & (0xf0 >> shift))
3197                           | ((data >> state->vrc_ls_chr) << shift);
3237      mask = (0xf0 >> shift);
3238      state->mmc_vrom_bank[bank] = (state->mmc_vrom_bank[bank] & mask)
3239                           | (((data >> state->vrc_ls_chr) & 0x0f) << shift);
31983240      chr1_x(space->machine, bank, state->mmc_vrom_bank[bank], CHRROM);
31993241   }
32003242   else
r8305r8306
32863328static WRITE8_HANDLER( konami_vrc4_w )
32873329{
32883330   nes_state *state = (nes_state *)space->machine->driver_data;
3289   UINT8 bank, shift;
3331   UINT8 bank, shift, mask;
32903332   UINT32 shifted_offs = (offset & 0x7000)
32913333                  | ((offset << (9 - state->vrc_ls_prg_a)) & 0x200)
32923334                  | ((offset << (8 - state->vrc_ls_prg_b)) & 0x100);
r8305r8306
32983340      vrc4_set_prg(space->machine);
32993341   }
33003342   else if (offset >= 0x2000 && offset < 0x3000)
3301      prg8_cd(space->machine, data);
3343      prg8_ab(space->machine, data);
33023344   else
33033345   {
33043346      switch (shifted_offs & 0x7300)
r8305r8306
33063348         case 0x1000:
33073349         case 0x1100:
33083350            switch (data & 0x03)
3309         {
3351            {
33103352            case 0x00: set_nt_mirroring(space->machine, PPU_MIRROR_VERT); break;
33113353            case 0x01: set_nt_mirroring(space->machine, PPU_MIRROR_HORZ); break;
33123354            case 0x02: set_nt_mirroring(space->machine, PPU_MIRROR_LOW); break;
33133355            case 0x03: set_nt_mirroring(space->machine, PPU_MIRROR_HIGH); break;
3314         }
3356            }
33153357            break;
33163358         case 0x1200:
33173359         case 0x1300:
r8305r8306
33343376         case 0x6100:
33353377         case 0x6200:
33363378         case 0x6300:
3379            bank = ((shifted_offs & 0x7000) - 0x3000) / 0x0800 + BIT(shifted_offs, 9);
33373380            shift = BIT(shifted_offs, 8) * 4;
3338            bank = ((shifted_offs & 0x7000) - 0x3000) / 0x0800 + BIT(shifted_offs, 9);
3339            state->mmc_vrom_bank[bank] = (state->mmc_vrom_bank[bank] & (0xf0 >> shift)) | (data << shift);
3381            mask = (0xf0 >> shift);
3382            state->mmc_vrom_bank[bank] = (state->mmc_vrom_bank[bank] & mask) | ((data & 0x0f) << shift);
33403383            chr1_x(space->machine, bank, state->mmc_vrom_bank[bank], CHRROM);
33413384            break;
33423385         case 0x7000:
r8305r8306
33663409 
33673410 Konami VRC-6
33683411 
3369 In MESS: Supported. It also uses konami_irq.
3412 In MESS: Supported. It also uses konami_irq (there are IRQ
3413 issues though: see Akumajou Densetsu intro).
33703414 
33713415 *************************************************************/
33723416
r8305r8306
36443688 
36453689 Sunsoft-1 board emulation
36463690 
3647 iNES: mapper 184
3691 iNES: mapper 184 (Fantasy Zone uses this board with no
3692 CHRROM, and the register switches PRG banks)
36483693 
36493694 *************************************************************/
36503695
36513696static WRITE8_HANDLER( sunsoft1_m_w )
36523697{
3698   nes_state *state = (nes_state *)space->machine->driver_data;
36533699   LOG_MMC(("sunsoft1_m_w, offset: %04x, data: %02x\n", offset, data));
36543700   
3655   chr4_0(space->machine, data & 0x0f, CHRROM);
3656   chr4_4(space->machine, data >> 4, CHRROM);
3701   if (state->chr_chunks)
3702   {
3703      chr4_0(space->machine, data & 0x0f, CHRROM);
3704      chr4_4(space->machine, data >> 4, CHRROM);
3705   }
3706   else
3707      prg16_89ab(space->machine, data & 0x0f);
36573708}
36583709
36593710/*************************************************************
r8305r8306
36713722{
36723723   nes_state *state = (nes_state *)space->machine->driver_data;
36733724   UINT8 sunsoft_helper = (data & 0x07) | ((data & 0x80) ? 0x08 : 0x00);
3674   LOG_MMC(("mapper93_w, offset: %04x, data: %02x\n", offset, data));
3725   LOG_MMC(("sunsoft2_w, offset: %04x, data: %02x\n", offset, data));
36753726
36763727   if (!state->hard_mirroring)   // there are two 'variants' depending on hardwired or mapper ctrl mirroring
36773728      set_nt_mirroring(space->machine, BIT(data, 3) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW);
3729   if (state->chr_chunks)
3730      chr8(space->machine, sunsoft_helper, CHRROM);
3731
36783732   prg16_89ab(space->machine, data >> 4);
3679   chr8(space->machine, sunsoft_helper, CHRROM);
36803733}
36813734
36823735/*************************************************************
r8305r8306
38643917
38653918static WRITE8_HANDLER( x1005_m_w )
38663919{
3920   nes_state *state = (nes_state *)space->machine->driver_data;
38673921   LOG_MMC(("x1005_m_w, offset: %04x, data: %02x\n", offset, data));
38683922   
38693923   switch (offset)
r8305r8306
38903944      case 0x1ef7:
38913945         set_nt_mirroring(space->machine, BIT(data, 0) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ);
38923946         break;
3947      case 0x1ef8:
3948      case 0x1ef9:
3949         state->mmc_latch1 = data;
3950         break;
38933951      case 0x1efa:
38943952      case 0x1efb:
38953953         prg8_89(space->machine, data);
r8305r8306
39063964         logerror("mapper80_m_w uncaught addr: %04x, value: %02x\n", offset + 0x6000, data);
39073965         break;
39083966   }
3967
3968   if (offset >= 0x1f00 && state->mapper_ram != NULL && state->mmc_latch1 == 0xa3)
3969      state->mapper_ram[offset & (state->mapper_ram_size - 1)] = data;
39093970}
39103971
3972static READ8_HANDLER( x1005_m_r )
3973{
3974   nes_state *state = (nes_state *)space->machine->driver_data;
3975   LOG_MMC(("x1005a_m_r, offset: %04x\n", offset));
3976
3977   if (offset >= 0x1f00 && state->mapper_ram != NULL && state->mmc_latch1 == 0xa3)
3978      return state->mapper_ram[offset & (state->mapper_ram_size - 1)];
3979
3980   return 0xff;
3981}
3982
39113983static WRITE8_HANDLER( x1005a_m_w )
39123984{
39133985   LOG_MMC(("x1005a_m_w, offset: %04x, data: %02x\n", offset, data));
39143986   
3987   // similar to x1005_m_w but mirroring is handled differently
3988   if (offset == 0x1ef6 || offset == 0x1ef7)
3989      return;
3990
39153991   switch (offset)
39163992   {
39173993      case 0x1ef0:
39183994         set_nt_page(space->machine, 0, CIRAM, (data & 0x80) ? 1 : 0, 1);
39193995         set_nt_page(space->machine, 1, CIRAM, (data & 0x80) ? 1 : 0, 1);
3920         chr2_0(space->machine, (data & 0x7f) >> 1, CHRROM);
39213996         break;
39223997      case 0x1ef1:
39233998         set_nt_page(space->machine, 2, CIRAM, (data & 0x80) ? 1 : 0, 1);
39243999         set_nt_page(space->machine, 3, CIRAM, (data & 0x80) ? 1 : 0, 1);
3925         chr2_2(space->machine, (data & 0x7f) >> 1, CHRROM);
39264000         break;
3927      case 0x1ef2:
3928         chr1_4(space->machine, data, CHRROM);
3929         break;
3930      case 0x1ef3:
3931         chr1_5(space->machine, data, CHRROM);
3932         break;
3933      case 0x1ef4:
3934         chr1_6(space->machine, data, CHRROM);
3935         break;
3936      case 0x1ef5:
3937         chr1_7(space->machine, data, CHRROM);
3938         break;
3939      case 0x1efa:
3940      case 0x1efb:
3941         prg8_89(space->machine, data);
3942         break;
3943      case 0x1efc:
3944      case 0x1efd:
3945         prg8_ab(space->machine, data);
3946         break;
3947      case 0x1efe:
3948      case 0x1eff:
3949         prg8_cd(space->machine, data);
3950         break;
3951      default:
3952         logerror("x1005a_m_w uncaught write, addr: %04x, value: %02x\n", offset + 0x6000, data);
3953         break;
39544001   }
4002
4003   x1005_m_w(space, offset, data);
39554004}
39564005
39574006/*************************************************************
r8305r8306
40154064         state->mmc_latch1 = ((data & 0x02) << 1);
40164065         x1017_set_chr(space->machine);
40174066         break;
4067      case 0x1ef7:
4068      case 0x1ef8:
4069      case 0x1ef9:
4070         state->mmc_reg[(offset & 0x0f) - 7] = data;
4071         break;
40184072      case 0x1efa:
40194073         prg8_89(space->machine, data >> 2);
40204074         break;
r8305r8306
40304084   }
40314085}
40324086
4087static READ8_HANDLER( x1017_m_r )
4088{
4089   nes_state *state = (nes_state *)space->machine->driver_data;
4090   LOG_MMC(("x1017_m_r, offset: %04x\n", offset));
4091
4092   // 2+2+1 KB of Internal RAM can be independently enabled/disabled!
4093   if (offset < 0x0800 && state->mapper_ram != NULL && state->mmc_reg[0] == 0xca)
4094      return state->mapper_ram[offset & (state->mapper_ram_size - 1)];
4095   if (offset < 0x1000 && state->mapper_ram != NULL && state->mmc_reg[1] == 0x69)
4096      return state->mapper_ram[offset & (state->mapper_ram_size - 1)];
4097   if (offset < 0x1800 && state->mapper_ram != NULL && state->mmc_reg[2] == 0x84)
4098      return state->mapper_ram[offset & (state->mapper_ram_size - 1)];
4099   
4100   return 0xff;
4101}
4102
40334103/*************************************************************
40344104 
40354105      MISC UNLICENSED BOARDS
r8305r8306
40484118{
40494119   LOG_MMC(("agci_50282_w, offset: %04x, data: %02x\n", offset, data));
40504120   
4121   offset += 0x8000;
40514122   data |= (memory_read_byte(space, offset) & 1);
40524123   
40534124   chr8(space->machine, data >> 4, CHRROM);
r8305r8306
41094180
41104181static WRITE8_HANDLER( ae_act52_w )
41114182{
4112   nes_state *state = (nes_state *)space->machine->driver_data;
4113   int pbank, pchip, cbank;
4183   int pbank, cbank;
41144184   UINT8 pmode;
4115   LOG_MMC(("mapper228_w, offset: %04x, data: %02x\n", offset, data));
4185   LOG_MMC(("ae_act52_w, offset: %04x, data: %02x\n", offset, data));
41164186   
4117   set_nt_mirroring(space->machine, (offset & 0x2000) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
4187   set_nt_mirroring(space->machine, BIT(offset, 13) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
41184188   
41194189   cbank = (data & 0x03) | ((offset & 0x0f) << 2);
41204190   chr8(space->machine, cbank, CHRROM);
41214191   
4122   pbank = (offset & 0x7c0) >> 6;
4123   pchip = (offset & 0x1800) >> 11;
41244192   pmode = offset & 0x20;
4125
4126   if (!state->crc_hack)
4127      pbank += (0x10 * pchip);
4128   else   // FIXME: iNES loading for this mapper should be fixed as well to have the last bank at the correct offset)
4129   {
4130      switch (pchip)
4131      {
4132      case 0: break;         // we are already at the correct bank
4133      case 1: pbank += 0x10; break;   // chip 1 starts at block 16
4134      case 2: break;         // chip 2 was an empty socket
4135      case 3: pbank += 0x20; break;   // chip 3 starts at block 32
4136      }
4137   }
4138   
4193   pbank = (offset & 0x1fc0) >> 6;
41394194   if (pmode)
41404195   {
41414196      prg16_89ab(space->machine, pbank);
r8305r8306
42314286      }
42324287   }
42334288   else
4234      state->wram[offset] = data;
4289      state->battery_ram[offset] = data;
42354290}
42364291
42374292/*************************************************************
r8305r8306
43094364
43104365static WRITE8_HANDLER( bf9093_w )
43114366{
4367   nes_state *state = (nes_state *)space->machine->driver_data;
43124368   LOG_MMC(("bf9093_w, offset: %04x, data: %02x\n", offset, data));
43134369   
43144370   switch (offset & 0x7000)
43154371   {
43164372      case 0x0000:
43174373      case 0x1000:
4374         if (!state->hard_mirroring)
4375            set_nt_mirroring(space->machine, BIT(data, 4) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW);
43184376         break;
43194377      case 0x4000:
43204378      case 0x5000:
r8305r8306
43254383   }
43264384}
43274385
4328static WRITE8_HANDLER( bf9097_w )
4329{
4330   LOG_MMC(("bf9097_w, offset: %04x, data: %02x\n", offset, data));
4331   
4332   switch (offset & 0x7000)
4333   {
4334      case 0x0000:
4335      case 0x1000:
4336         set_nt_mirroring(space->machine, BIT(data, 4) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW);
4337         break;
4338      case 0x4000:
4339      case 0x5000:
4340      case 0x6000:
4341      case 0x7000:
4342         prg16_89ab(space->machine, data);
4343         break;
4344   }
4345}
4346
43474386/*************************************************************
43484387 
43494388 Camerica BF9096 & ALGQV11 Boards
r8305r8306
44344473   nes_state *state = (nes_state *)space->machine->driver_data;
44354474   LOG_MMC(("cony_l_w, offset: %04x, data: %02x\n", offset, data));
44364475
4437   state->mapper83_low_reg[offset & 0x03] = data;
4476   if (offset >= 0x1000 && offset < 0x1103) // from 0x5100-0x51ff
4477      state->mapper83_low_reg[offset & 0x03] = data;
44384478}
44394479
44404480static READ8_HANDLER( cony_l_r )
44414481{
44424482   nes_state *state = (nes_state *)space->machine->driver_data;
44434483   LOG_MMC(("cony_l_r, offset: %04x\n", offset));
4444   return state->mapper83_low_reg[offset & 0x03];
4484
4485   if (offset == 0x0f00)   // 0x5000
4486   {
4487      // read dipswitch bit! - currently unimplemented
4488   }
4489   if (offset >= 0x1000 && offset < 0x1103) // from 0x5100-0x51ff
4490      return state->mapper83_low_reg[offset & 0x03];
4491   else
4492      return 0x00;
44454493}
44464494
44474495static void cony_set_prg( running_machine *machine )
r8305r8306
44544502static void cony_set_chr( running_machine *machine )
44554503{
44564504   nes_state *state = (nes_state *)machine->driver_data;
4457   chr1_0(machine, state->mapper83_reg[0] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4458   chr1_1(machine, state->mapper83_reg[1] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4459   chr1_2(machine, state->mapper83_reg[2] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4460   chr1_3(machine, state->mapper83_reg[3] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4461   chr1_4(machine, state->mapper83_reg[4] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4462   chr1_5(machine, state->mapper83_reg[5] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4463   chr1_6(machine, state->mapper83_reg[6] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4464   chr1_7(machine, state->mapper83_reg[7] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4505   // FIXME: here we emulate at least 3 different boards!!!
4506   // one board switches 1k VROM banks only
4507   // one writes to 0x8000 and then switches 2k VROM banks only
4508   // one writes to 0x831n (n=2,3,4,5) and then switches 2k VROM banks only
4509   // we should split them and possibly document the proper behavior of each variant
4510   if (state->mmc_latch1 && !state->mmc_latch2)
4511   {
4512      chr2_0(machine, state->mapper83_reg[0], CHRROM);
4513      chr2_2(machine, state->mapper83_reg[1], CHRROM);
4514      chr2_4(machine, state->mapper83_reg[6], CHRROM);
4515      chr2_6(machine, state->mapper83_reg[7], CHRROM);
4516   }
4517   else
4518   {
4519      chr1_0(machine, state->mapper83_reg[0] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4520      chr1_1(machine, state->mapper83_reg[1] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4521      chr1_2(machine, state->mapper83_reg[2] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4522      chr1_3(machine, state->mapper83_reg[3] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4523      chr1_4(machine, state->mapper83_reg[4] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4524      chr1_5(machine, state->mapper83_reg[5] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4525      chr1_6(machine, state->mapper83_reg[6] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4526      chr1_7(machine, state->mapper83_reg[7] | ((state->mapper83_reg[8] & 0x30) << 4), CHRROM);
4527   }
44654528}
44664529
44674530static WRITE8_HANDLER( cony_w )
r8305r8306
44724535   switch (offset)
44734536   {
44744537      case 0x0000:
4538         state->mmc_latch1 = 1;
44754539      case 0x3000:
44764540      case 0x30ff:
44774541      case 0x31ff:
r8305r8306
44804544         cony_set_chr(space->machine);
44814545         break;
44824546      case 0x0100:
4547         state->mmc_reg[0] = data & 0x80;
44834548         switch (data & 0x03)
44844549         {
44854550         case 0:
r8305r8306
45004565         state->IRQ_count = (state->IRQ_count & 0xff00) | data;
45014566         break;
45024567      case 0x0201:
4503         state->IRQ_enable = 1;
4568         state->IRQ_enable = state->mmc_reg[0];
45044569         state->IRQ_count = (data << 8) | (state->IRQ_count & 0xff);
45054570         break;
45064571      case 0x0300:
r8305r8306
45124577      case 0x0302:
45134578         prg8_cd(space->machine, data);
45144579         break;
4515      case 0x0310:
4516      case 0x0311:
45174580      case 0x0312:
45184581      case 0x0313:
45194582      case 0x0314:
45204583      case 0x0315:
4584         state->mmc_latch2 = 1;
4585      case 0x0310:
4586      case 0x0311:
45214587      case 0x0316:
45224588      case 0x0317:
45234589         state->mapper83_reg[offset - 0x0310] = data;
r8305r8306
49204986 
49214987 iNES: mapper 121
49224988 
4923 In MESS: Supported.
4924 
4989 In MESS: Only preliminarly supported (Panda Prince works,
4990 other games require handling properly the protection).
4991 
49254992 *************************************************************/
49264993
49274994static WRITE8_HANDLER( kay_pp_l_w )
r8305r8306
49345001   {
49355002      switch (data & 0x03)
49365003      {
4937         case 0x00:
49385004         case 0x03:
49395005            state->mapper121_reg[2] = 0x00;
49405006            break;
5007         case 0x00:
49415008         case 0x01:
49425009            state->mapper121_reg[2] = 0x83;
49435010            break;
r8305r8306
49605027      return 0;
49615028}
49625029
5030static void kay_pp_update_regs( running_machine *machine, UINT8 data )
5031{
5032   nes_state *state = (nes_state *)machine->driver_data;
5033
5034   switch (data & 0x3f)
5035   {
5036      case 0x20:
5037      case 0x29:
5038      case 0x2b:
5039      case 0x3f:
5040//         printf("reg (%x) %x \n", data, state->mapper121_reg[3]);
5041         state->mapper121_reg[1] = state->mapper121_reg[3];
5042         break;
5043      case 0x2c:
5044//         printf("reg (%x) %x \n", data, state->mapper121_reg[3]);
5045         state->mapper121_reg[1] = state->mapper121_reg[3];
5046         break;
5047         
5048      case 0x28:
5049//         printf("reg (%x) %x \n", data, state->mapper121_reg[3]);
5050         state->mapper121_reg[0] = state->mapper121_reg[3];
5051         break;
5052         
5053      case 0x2a:
5054//         printf("reg (%x) %x \n", data, state->mapper121_reg[3]);
5055         state->mapper121_reg[4] = state->mapper121_reg[3];
5056         break;
5057         
5058      case 0x2f:
5059         break;
5060
5061      default:
5062         state->mapper121_reg[0] = 0x0;
5063         state->mapper121_reg[1] = 0x0;
5064         state->mapper121_reg[4] = 0x0;
5065         break;
5066   }
5067}
5068
49635069static void kay_pp_set_prg( running_machine *machine, int prg_base, int prg_mask )
49645070{
49655071   nes_state *state = (nes_state *)machine->driver_data;
49665072   UINT8 prg_flip = (state->mmc_latch1 & 0x40) ? 2 : 0;
4967   UINT8 new_bank2, new_bank3;
5073   UINT8 new_bank1, new_bank2, new_bank3;
49685074   
49695075   new_bank2 = state->mapper121_reg[0] ? state->mapper121_reg[0] : state->mmc_prg_bank[2 ^ prg_flip];
49705076   new_bank3 = state->mapper121_reg[1] ? state->mapper121_reg[1] : state->mmc_prg_bank[3];
5077   new_bank1 = state->mapper121_reg[4] ? state->mapper121_reg[4] : state->mmc_prg_bank[1];
49715078   
49725079   prg8_89(machine, prg_base | (state->mmc_prg_bank[0 ^ prg_flip] & prg_mask));
4973   prg8_ab(machine, prg_base | (state->mmc_prg_bank[1] & prg_mask));
5080   prg8_ab(machine, prg_base | (new_bank1 & prg_mask));
49745081   prg8_cd(machine, prg_base | (new_bank2 & prg_mask));
49755082   prg8_ef(machine, prg_base | (new_bank3 & prg_mask));
49765083}
r8305r8306
49835090   
49845091   if ((offset < 0x2000) && (offset & 0x03) == 0x03)
49855092   {
4986      switch (data)
4987      {
4988         case 0x20:
4989            state->mapper121_reg[1] = 0x13;
4990            break;
4991         case 0x26:
4992            state->mapper121_reg[1] = 0x08;
4993            break;
4994         case 0x28:
4995            state->mapper121_reg[0] = 0x0c;
4996            break;
4997         case 0x29:
4998            state->mapper121_reg[1] = 0x1b;
4999            break;
5000         case 0xab:
5001            state->mapper121_reg[1] = 0x07;
5002            break;
5003         case 0xec:
5004         case 0xef:
5005            state->mapper121_reg[1] = 0x0d;
5006            break;
5007         case 0xff:
5008            state->mapper121_reg[1] = 0x09;
5009            break;
5010         default:
5011            state->mapper121_reg[0] = 0x0;
5012            state->mapper121_reg[1] = 0x0;
5013            break;
5014      }
5093      kay_pp_update_regs(space->machine, data);
5094      kay_pp_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
50155095   }
50165096   else
50175097   {
r8305r8306
50315111            break;
50325112           
50335113         case 0x0001:
5114            state->mapper121_reg[3] = (BIT(data, 0) << 5) | (BIT(data, 1) << 4) | (BIT(data, 2) << 3)
5115                              | (BIT(data, 3) << 2) | (BIT(data, 4) << 1) | BIT(data, 5);
50345116            cmd = state->mmc_latch1 & 0x07;
50355117            switch (cmd)
5036         {
5118            {
50375119            case 0: case 1:
50385120            case 2: case 3: case 4: case 5:
50395121               state->mmc_vrom_bank[cmd] = data;
r8305r8306
50445126               state->mmc_prg_bank[cmd - 6] = data;
50455127               kay_pp_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
50465128               break;
5047         }
5129            }
50485130            break;
50495131           
50505132         default:
r8305r8306
50525134            break;
50535135      }
50545136   }
5055   kay_pp_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
50565137}
50575138
5139
50585140/*************************************************************
50595141 
50605142 Bootleg Board by Kasing
r8305r8306
68166898
68176899/*************************************************************
68186900 
6901 Bootleg Board 'Strike Wolf' by TXC
6902 
6903 Games: Strike Wolf (also Policeman?? according to Nestopia)
6904
6905 iNES: mapper 36
6906 
6907 Known Boards: Bootleg Board by TXC
6908 
6909 In MESS: Supported.
6910 
6911 *************************************************************/
6912
6913static WRITE8_HANDLER( txc_strikewolf_w )
6914{
6915   LOG_MMC(("txc_strikewolf_w, offset: %04x, data: %02x\n", offset, data));
6916   
6917   if ((offset >= 0x400) && (offset < 0x7fff))
6918   {
6919      prg32(space->machine, data >> 4);
6920      chr8(space->machine, data & 0x0f, CHRROM);
6921   }
6922}
6923
6924/*************************************************************
6925 
68196926 Bootleg Board MXMDHTWO by TXC
68206927
68216928 Games: Commandos, Journey to the West, Ma Bu Mi Zhen &
r8305r8306
85708677
85718678/*************************************************************
85728679 
8573 Bootleg Board
8680 BTL-SMB2B
8681 
8682 Games: Super Mario Bros. 2 Pirate (Jpn version of SMB2)
8683 
8684 This was marked as Alt. Levels. is it true?
8685 
8686 iNES: mapper 50
85748687
8575 Games: Super Fighter III
8688 In MESS: Supported.
85768689 
8690 *************************************************************/
8691
8692static void smb2jb_irq( running_device *device, int scanline, int vblank, int blanked )
8693{
8694   nes_state *state = (nes_state *)device->machine->driver_data;
8695   if (state->IRQ_enable)
8696   {
8697      if (state->IRQ_count < 0x1000)
8698      {
8699         if ((0x1000 - state->IRQ_count) <= 114)
8700            cpu_set_input_line(state->maincpu, M6502_IRQ_LINE, HOLD_LINE);
8701         else
8702            state->IRQ_count += 114;
8703      }
8704      else
8705         state->IRQ_count += 114;
8706     
8707      state->IRQ_count &= 0xffff;   // according to docs is 16bit counter -> it wraps only after 0xffff
8708   }
8709}
8710
8711static WRITE8_HANDLER( smb2jb_l_w )
8712{
8713   nes_state *state = (nes_state *)space->machine->driver_data;
8714   UINT8 prg;
8715   LOG_MMC(("smb2jb_l_w, offset: %04x, data: %02x\n", offset, data));
8716   offset += 0x100;
8717   
8718   switch (offset & 0x160)
8719   {
8720      case 0x020:
8721         prg = (data & 0x08) | ((data & 0x06) >> 1) | ((data & 0x01) << 2);
8722         prg8_cd(space->machine, prg);
8723         break;
8724      case 0x120:
8725         state->IRQ_enable = data & 0x01;
8726         break;
8727   }
8728}
8729
8730/* This goes to 0x4020-0x403f */
8731WRITE8_HANDLER( smb2jb_extra_w )
8732{
8733   UINT8 prg;
8734   LOG_MMC(("smb2jb_extra_w, offset: %04x, data: %02x\n", offset, data));
8735   
8736   prg = (data & 0x08) | ((data & 0x06) >> 1) | ((data & 0x01) << 2);
8737   prg8_cd(space->machine, prg);
8738}
8739
8740/*************************************************************
8741 
8742 Bootleg Board for Super Fighter III
8743 
85778744 MMC3 clone
85788745 
85798746 In MESS: Supported.
r8305r8306
86638830
86648831/*************************************************************
86658832 
8833 Board UNL-RACERMATE
8834 
8835 In MESS: *VERY* preliminary support. Also, it seems that this
8836 board saves to battery the CHRRAM!!!
8837 
8838 *************************************************************/
8839
8840static void racmate_update_banks( running_machine *machine )
8841{
8842   nes_state *state = (nes_state *)machine->driver_data;
8843   chr4_4(machine, state->mmc_latch1 & 0x0f, state->mmc_chr_source);
8844   prg16_89ab(machine, state->mmc_latch1 >> 1);
8845}
8846
8847static WRITE8_HANDLER( unl_racmate_w )
8848{
8849   nes_state *state = (nes_state *)space->machine->driver_data;
8850   LOG_MMC(("unl_racmate_w offset: %04x, data: %02x\n", offset, data));
8851
8852   if (offset == 0x3000)
8853   {
8854      state->mmc_latch1 = data;
8855      racmate_update_banks(space->machine);
8856   }
8857}
8858
8859/*************************************************************
8860 
86668861        BOOTLEG CART VERSIONS OF FDS GAMES
86678862 
86688863 *************************************************************/
r8305r8306
93479542
93489543static WRITE8_HANDLER( bmc_gkb_w )
93499544{
9545   nes_state *state = (nes_state *)space->machine->driver_data;
93509546   UINT8 bank = (offset & 0x40) ? 0 : 1;
93519547   LOG_MMC(("bmc_gkb_w, offset: %04x, data: %02x\n", offset, data));
93529548   
93539549   prg16_89ab(space->machine, offset & ~bank);
93549550   prg16_cdef(space->machine, offset | bank);
9355   chr8(space->machine, offset >> 3, CHRROM);
9551   chr8(space->machine, offset >> 3, state->mmc_chr_source);
93569552   set_nt_mirroring(space->machine, BIT(data, 7) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
93579553}
93589554
r8305r8306
990010096   
990110097   /* This bit is the "register lock". Once register are locked, writes go to WRAM
990210098    and there is no way to unlock them (except by resetting the machine) */
9903   if (state->mapper45_reg[3] & 0x40)
10099   if ((state->mapper45_reg[3] & 0x40) && state->wram != NULL)
990410100      state->wram[offset] = data;
990510101   else
990610102   {
r8305r8306
991410110         
991510111         state->mmc_prg_base = state->mapper45_reg[1];
991610112         state->mmc_prg_mask = 0x3f ^ (state->mapper45_reg[3] & 0x3f);
9917         state->mmc_chr_base = ((state->mapper45_reg[2] & 0xf0) << 4) + state->mapper45_reg[0];
9918         state->mmc_chr_mask = 0xff >> (~state->mapper45_reg[2] & 0x0f);
10113         state->mmc_chr_base = ((state->mapper45_reg[2] & 0xf0) << 4) | state->mapper45_reg[0];
10114         if (BIT(state->mapper45_reg[2], 3))
10115            state->mmc_chr_mask = (1 << ((state->mapper45_reg[2] & 7) + 1)) - 1;
10116         else if (state->mapper45_reg[2])
10117            state->mmc_chr_mask = 0;
10118         else
10119            state->mmc_chr_mask = 0xff;   // i.e. we use the vrom_bank with no masking
10120         
991910121         mmc3_set_prg(space->machine, state->mmc_prg_base, state->mmc_prg_mask);
992010122         mmc3_set_chr(space->machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
992110123      }
r8305r8306
1030010502#define NES_WRITEONLY(a) \
1030110503{a, NULL}
1030210504
10505#if 0
10506static WRITE8_HANDLER( dummy_w )
10507{
10508}
10509
10510static READ8_HANDLER( dummy_r )
10511{
10512   return 0x00;
10513}
10514#endif
10515
1030310516// further review needed for: TXROM, PXROM, FXROM, Bandai LZ93D50, Irem G-101, Konami VRC3
1030410517// all multicart pcb, many unl/btl pcbs
1030510518static const nes_pcb_intf nes_intf_list[] =
r8305r8306
1032610539   { STD_SXROM_A,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(sxrom_w),               NULL, NULL, NULL },
1032710540   { STD_SOROM_A,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(sxrom_w),               NULL, NULL, NULL },
1032810541   { STD_TXROM,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(txrom_w),               NULL, NULL, mmc3_irq },
10329   { STD_HKROM,            NES_NOACCESS, {hkrom_m_w, hkrom_m_r}, NES_WRITEONLY(hkrom_w),     NULL, NULL, mmc3_irq },
10542   { STD_TVROM,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(txrom_w),               NULL, NULL, mmc3_irq },
10543   { STD_TKROM,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(txrom_w),               NULL, NULL, mmc3_irq },
10544   { STD_HKROM,            NES_NOACCESS, {hkrom_m_w, hkrom_m_r}, NES_WRITEONLY(hkrom_w),               NULL, NULL, mmc3_irq },
1033010545   { STD_TQROM,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(tqrom_w),               NULL, NULL, mmc3_irq },
1033110546   { STD_TXSROM,           NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(txsrom_w),              NULL, NULL, mmc3_irq },
1033210547   { STD_DXROM,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(dxrom_w),               NULL, NULL, NULL },
r8305r8306
1034510560   { DIS_74X161X161X32,    NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(dis_74x161x161x32_w),   NULL, NULL, NULL },
1034610561   { DIS_74X161X138,       NES_NOACCESS, NES_WRITEONLY(dis_74x161x138_m_w), NES_NOACCESS,    NULL, NULL, NULL },
1034710562   { BANDAI_LZ93,          NES_NOACCESS, NES_WRITEONLY(lz93d50_m_w), NES_WRITEONLY(lz93d50_w), NULL, NULL, bandai_lz_irq },
10563   { BANDAI_LZ93EX,        NES_NOACCESS, NES_WRITEONLY(lz93d50_m_w), NES_WRITEONLY(lz93d50_w), NULL, NULL, bandai_lz_irq },
1034810564   { BANDAI_FCG,           NES_NOACCESS, NES_WRITEONLY(lz93d50_m_w), NES_WRITEONLY(lz93d50_w), NULL, NULL, bandai_lz_irq },
1034910565   { BANDAI_DATACH,        NES_NOACCESS, NES_WRITEONLY(lz93d50_m_w), NES_WRITEONLY(lz93d50_w), NULL, NULL, bandai_lz_irq },
1035010566   { BANDAI_JUMP2,         NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(fjump2_w),              NULL, NULL, bandai_lz_irq },
1035110567   { BANDAI_KARAOKE,       NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bandai_ks_w),           NULL, NULL, NULL },
10352   { BANDAI_OEKAKIDS,      NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bandai_ok_w),            NULL, NULL, NULL },
10568   { BANDAI_OEKAKIDS,      NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bandai_ok_w),           NULL, NULL, NULL },
1035310569   { IREM_G101,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(g101_w),                NULL, NULL, NULL },
1035410570   { IREM_LROG017,         NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(lrog017_w),             NULL, NULL, NULL },
1035510571   { IREM_H3001,           NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(h3001_w),               NULL, NULL, h3001_irq },
r8305r8306
1037310589   { SUNSOFT_3,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(sunsoft3_w),            NULL, NULL, sunsoft3_irq },
1037410590   { TAITO_TC0190FMC,      NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(tc0190fmc_w),           NULL, NULL, NULL },
1037510591   { TAITO_TC0190FMCP,     NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(tc0190fmc_p16_w),       NULL, NULL, mmc3_irq },
10376   { TAITO_X1_005,         NES_NOACCESS, NES_WRITEONLY(x1005_m_w), NES_NOACCESS,             NULL, NULL, NULL },
10377   { TAITO_X1_005_A,       NES_NOACCESS, NES_WRITEONLY(x1005a_m_w), NES_NOACCESS,            NULL, NULL, NULL },
10378   { TAITO_X1_017,         NES_NOACCESS, NES_WRITEONLY(x1017_m_w), NES_NOACCESS,             NULL, NULL, NULL },
10592   { TAITO_X1_005,         NES_NOACCESS, {x1005_m_w, x1005_m_r}, NES_NOACCESS,               NULL, NULL, NULL },
10593   { TAITO_X1_005_A,       NES_NOACCESS, {x1005a_m_w, x1005_m_r}, NES_NOACCESS,              NULL, NULL, NULL },
10594   { TAITO_X1_017,         NES_NOACCESS, {x1017_m_w, x1017_m_r}, NES_NOACCESS,               NULL, NULL, NULL },
1037910595   //
1038010596   { AGCI_50282,           NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(agci_50282_w),          NULL, NULL, NULL },
1038110597   { ACTENT_ACT52,         NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(ae_act52_w),            NULL, NULL, NULL },
r8305r8306
1038610602   { CNE_SHLZ,             NES_WRITEONLY(cne_shlz_l_w), NES_NOACCESS, NES_NOACCESS,          NULL, NULL, NULL },
1038710603   { CALTRON_6IN1,         NES_NOACCESS, NES_WRITEONLY(caltron6in1_m_w), NES_WRITEONLY(caltron6in1_w),      NULL, NULL, NULL },
1038810604   { CAMERICA_BF9093,      NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bf9093_w),              NULL, NULL, NULL },
10389   { CAMERICA_BF9097,      NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bf9097_w),              NULL, NULL, NULL },
10605   { CAMERICA_BF9097,      NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bf9093_w),              NULL, NULL, NULL },
1039010606   { CAMERICA_BF9096,      NES_NOACCESS, NES_WRITEONLY(bf9096_w), NES_WRITEONLY(bf9096_w),   NULL, NULL, NULL },
1039110607   { CAMERICA_GOLDENFIVE,  NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(golden5_w),             NULL, NULL, NULL },
10392   { CONY_BOARD,           {cony_l_w, cony_l_r}, NES_NOACCESS, NES_WRITEONLY(cony_w),        NULL, NULL, NULL },
10608   { CONY_BOARD,           {cony_l_w, cony_l_r}, NES_NOACCESS, NES_WRITEONLY(cony_w),        NULL, NULL, sunsoft3_irq },
1039310609   { DREAMTECH_BOARD,      NES_WRITEONLY(dreamtech_l_w), NES_NOACCESS, NES_NOACCESS,         NULL, NULL, NULL },
1039410610   { FUTUREMEDIA_BOARD,    NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(futuremedia_w),         NULL, NULL, futuremedia_irq },
1039510611   { GOUDER_37017,         {gouder_sf4_l_w, gouder_sf4_l_r}, NES_NOACCESS, NES_WRITEONLY(gouder_sf4_w), NULL, NULL, mmc3_irq },
r8305r8306
1043510651   { TXC_22211B,           {txc_22211_l_w, txc_22211_l_r}, NES_NOACCESS, NES_WRITEONLY(txc_22211b_w), NULL, NULL, NULL },
1043610652   { TXC_22211C,           {txc_22211_l_w, txc_22211c_l_r}, NES_NOACCESS, NES_WRITEONLY(txc_22211_w), NULL, NULL, NULL },
1043710653   { TXC_TW,               NES_WRITEONLY(txc_tw_l_w), NES_WRITEONLY(txc_tw_m_w), NES_WRITEONLY(txc_tw_w), NULL, NULL, mmc3_irq },
10654   { TXC_STRIKEWOLF,       NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(txc_strikewolf_w),      NULL, NULL, NULL },
1043810655   { TXC_MXMDHTWO,         NES_READONLY(txc_mxmdhtwo_l_r), NES_NOACCESS, NES_WRITEONLY(txc_mxmdhtwo_w), NULL, NULL, NULL },
1043910656   { WAIXING_TYPE_A,       NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(waixing_a_w),           NULL, NULL, mmc3_irq },
1044010657   { WAIXING_TYPE_B,       NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(waixing_b_w),           NULL, NULL, mmc3_irq },
r8305r8306
1046310680   { UNL_SMB2J,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(smb2j_w),               NULL, NULL, NULL },
1046410681   { UNL_SUPERFIGHTER3,    NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(unl_sf3_w),             NULL, NULL, mmc3_irq },
1046510682   { UNL_XZY,              NES_WRITEONLY(unl_xzy_l_w), NES_NOACCESS, NES_NOACCESS,           NULL, NULL, NULL },
10683   { UNL_RACERMATE,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(unl_racmate_w),         NULL, NULL, NULL },
1046610684   //
1046710685   { BTL_AISENSHINICOL,    NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(btl_mariobaby_w),       NULL, NULL, NULL },
1046810686   { BTL_DRAGONNINJA,      NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(btl_dn_w),              NULL, NULL, btl_dn_irq },
1046910687   { BTL_MARIOBABY,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(btl_mariobaby_w),       NULL, NULL, NULL },
1047010688   { BTL_SMB2A,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(btl_smb2a_w),           NULL, NULL, btl_smb2a_irq },
10689   { BTL_SMB2B,            NES_WRITEONLY(smb2jb_l_w), NES_NOACCESS, NES_NOACCESS,            NULL, NULL, smb2jb_irq },
1047110690   { BTL_SMB3,             NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(btl_smb3_w),            NULL, NULL, btl_smb3_irq },
1047210691   { BTL_SUPERBROS11,      NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(btl_smb11_w),           NULL, NULL, mmc3_irq },
1047310692   //
r8305r8306
1050910728   { BMC_GOLDENCARD_6IN1,  NES_WRITEONLY(bmc_gc6in1_l_w), NES_NOACCESS, NES_WRITEONLY(bmc_gc6in1_w), NULL, NULL, mmc3_irq },
1051010729   { UNSUPPORTED_BOARD,    NES_NOACCESS, NES_NOACCESS, NES_NOACCESS,                         NULL, NULL, NULL },
1051110730   //
10512   //   { BTL_SMB2B,            NES_WRITEONLY(mapper50_l_w), NES_NOACCESS, NES_NOACCESS,          NULL, NULL, mapper50_irq },
1051310731};
1051410732
1051510733
r8305r8306
1057110789      state->mmc_write_mid = intf->mmc_m.write;
1057210790      state->mmc_write = intf->mmc_h.write;
1057310791      state->mmc_read_low = intf->mmc_l.read;
10574      state->mmc_read_mid = NULL;   // in progress
10575      state->mmc_read = NULL;   // in progress
10792      state->mmc_read_mid = intf->mmc_m.read;   // in progress
10793      state->mmc_read = intf->mmc_h.read;   // in progress
1057610794      ppu_latch = intf->mmc_ppu_latch;
1057710795   }
1057810796   else
src/mess/machine/nes.c
r8305r8306
163163         break;
164164   }
165165
166   // install additional handlers
167   if (state->pcb_id == BTL_SMB2B)
168   {
169      memory_install_write8_handler(space, 0x4020, 0x403f, 0, 0, smb2jb_extra_w);
170      memory_install_write8_handler(space, 0x40a0, 0x40bf, 0, 0, smb2jb_extra_w);
171   }
166172}
167173
168174// to be probably removed (it does nothing since a long time)
r8305r8306
286292   nes_state *state = (nes_state *)machine->driver_data;
287293
288294   /* Write out the battery file if necessary */
295   // FIXME: are there cases with both internal mapper RAM and external RAM (both battery backed)?
289296   if (state->battery)
290297      image_battery_save(state->cart, state->battery_ram, state->battery_size);
298   if (state->mapper_ram_size)
299      image_battery_save(state->cart, state->mapper_ram, state->mapper_ram_size);
291300}
292301
293302
r8305r8306
585594   { "CHR A15",  15 },
586595   { "CHR A16",  16 },
587596   { "CHR A17",  17 },
588   { "NC",      128 },
597   { "NC",      127 },
589598   { 0 }
590599};
591600
592601static int nes_cart_get_line( const char *feature )
593602{
594603   const struct nes_cart_lines *nes_line = &nes_cart_lines_table[0];
595   
604
605   if (feature == NULL)
606      return 128;
607
596608   while (nes_line->tag)
597609   {
598610      if (strcmp(nes_line->tag, feature) == 0)
r8305r8306
607619DEVICE_IMAGE_LOAD( nes_cart )
608620{
609621   nes_state *state = (nes_state *)image->machine->driver_data;
622   state->pcb_id = NO_BOARD;   // initialization
610623
611624   if (image_software_entry(image) == NULL)
612625   {
r8305r8306
688701         }
689702
690703         state->hard_mirroring = (local_options & 0x01) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ;
691//         printf("%d\n", state->hard_mirroring);
692704         state->battery = local_options & 0x02;
693705         state->trainer = local_options & 0x04;
694706         state->four_screen_vram = local_options & 0x08;
r8305r8306
800812         }
801813#endif
802814
803         logerror("CHR chunks: %02x, size: %06x\n", state->chr_chunks, 0x4000 * state->chr_chunks);
815         logerror("CHR chunks: %02x, size: %06x\n", state->chr_chunks, 0x2000 * state->chr_chunks);
804816         logerror("**\n");
805         // printf("CHR chunks: %02x, size: %06x\n", state->chr_chunks, 0x4000 * state->chr_chunks);
817         // printf("CHR chunks: %02x, size: %06x\n", state->chr_chunks, 0x2000 * state->chr_chunks);
806818         // printf("**\n");
807819      }
808820      else if ((magic[0] == 'U') && (magic[1] == 'N') && (magic[2] == 'I') && (magic[3] == 'F')) /* If header starts with 'UNIF' it is UNIF */
r8305r8306
11091121      UINT32 prg_size = image_get_software_region_length(image, "prg");
11101122      UINT32 chr_size = image_get_software_region_length(image, "chr");
11111123      UINT32 vram_size = image_get_software_region_length(image, "vram");
1112
1124      vram_size += image_get_software_region_length(image, "vram2");
1125     
11131126      /* Free the regions that were allocated by the ROM loader */
11141127      memory_region_free(image->machine, "maincpu");
11151128      memory_region_free(image->machine, "gfx1");
r8305r8306
11471160      state->mapper = 0;      // this allows us to set up memory handlers without duplicating code (for the moment)
11481161      state->pcb_id = nes_get_pcb_id(image->machine, image_get_feature(image, "pcb"));
11491162
1150      if (state->pcb_id == UNSUPPORTED_BOARD)
1151         printf("This board (%s) is currently not supported by MESS\n", image_get_feature(image, "pcb"));
1152
11531163      if (state->pcb_id == STD_TVROM || state->pcb_id == STD_DRROM || state->pcb_id == IREM_LROG017)
11541164         state->four_screen_vram = 1;
1165      else
1166         state->four_screen_vram = 0;
11551167
11561168      state->battery = (image_get_software_region(image, "bwram") != NULL) ? 1 : 0;
11571169      state->battery_size = image_get_software_region_length(image, "bwram");
11581170
1171      if (state->pcb_id == BANDAI_LZ93EX)
1172      {
1173         // allocate the 24C01 or 24C02 EEPROM
1174         state->battery = 1;
1175         state->battery_size += 0x2000;
1176      }
1177
1178      if (state->pcb_id == BANDAI_DATACH)
1179      {
1180         // allocate the 24C01 and 24C02 EEPROM
1181         state->battery = 1;
1182         state->battery_size += 0x4000;
1183      }
1184     
11591185      state->prg_ram = (image_get_software_region(image, "wram") != NULL) ? 1 : 0;
11601186      state->wram_size = image_get_software_region_length(image, "wram");
1187      state->mapper_ram_size = image_get_software_region_length(image, "mapper_ram");
11611188      if (state->prg_ram)
11621189         state->wram = auto_alloc_array(image->machine, UINT8, state->wram_size);
1190      if (state->mapper_ram_size)
1191         state->mapper_ram = auto_alloc_array(image->machine, UINT8, state->mapper_ram_size);
11631192
11641193      /* Check for mirroring */
11651194      if (image_get_feature(image, "mirroring") != NULL)
r8305r8306
11971226         }
11981227      }
11991228
1200      if (state->pcb_id == TAITO_X1_005)
1229      if (state->pcb_id == TAITO_X1_005 && image_get_feature(image, "x1-pin17") != NULL && image_get_feature(image, "x1-pin31") != NULL)
12011230      {
12021231         if (!strcmp(image_get_feature(image, "x1-pin17"), "CIRAM A10") && !strcmp(image_get_feature(image, "x1-pin31"), "NC"))
12031232            state->pcb_id = TAITO_X1_005_A;
r8305r8306
12061235      if (state->pcb_id == KONAMI_VRC2)
12071236      {
12081237         state->vrc_ls_prg_a = nes_cart_get_line(image_get_feature(image, "vrc2-pin3"));
1209         state->vrc_ls_prg_b = nes_cart_get_line(image_get_feature(image, "vrc2-pin3"));
1238         state->vrc_ls_prg_b = nes_cart_get_line(image_get_feature(image, "vrc2-pin4"));
12101239         state->vrc_ls_chr = (nes_cart_get_line(image_get_feature(image, "vrc2-pin21")) != 10) ? 1 : 0;
1211         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");
1240//         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");
12121241      }
12131242
12141243      if (state->pcb_id == KONAMI_VRC4)
12151244      {
12161245         state->vrc_ls_prg_a = nes_cart_get_line(image_get_feature(image, "vrc4-pin3"));
12171246         state->vrc_ls_prg_b = nes_cart_get_line(image_get_feature(image, "vrc4-pin4"));
1218         printf("VRC-4, pin3: A%d, pin4: A%d\n", state->vrc_ls_prg_a, state->vrc_ls_prg_b);
1247//         printf("VRC-4, pin3: A%d, pin4: A%d\n", state->vrc_ls_prg_a, state->vrc_ls_prg_b);
12191248      }
12201249     
12211250      if (state->pcb_id == KONAMI_VRC6)
12221251      {
12231252         state->vrc_ls_prg_a = nes_cart_get_line(image_get_feature(image, "vrc6-pin9"));
12241253         state->vrc_ls_prg_b = nes_cart_get_line(image_get_feature(image, "vrc6-pin10"));
1225         printf("VRC-6, pin9: A%d, pin10: A%d\n", state->vrc_ls_prg_a, state->vrc_ls_prg_b);
1254//         printf("VRC-6, pin9: A%d, pin10: A%d\n", state->vrc_ls_prg_a, state->vrc_ls_prg_b);
12261255      }
12271256
12281257      /* Check for other misc board variants */
1229      if (state->pcb_id == STD_SOROM && !strcmp(image_get_feature(image, "mmc1_type"), "MMC1A"))
1230         state->pcb_id = STD_SOROM_A;   // in MMC1-A PRG RAM is always enabled
1258      if (state->pcb_id == STD_SOROM)
1259      {
1260         if (image_get_feature(image, "mmc1_type") != NULL && !strcmp(image_get_feature(image, "mmc1_type"), "MMC1A"))
1261            state->pcb_id = STD_SOROM_A;   // in MMC1-A PRG RAM is always enabled
1262      }
12311263     
1232      if (state->pcb_id == STD_SXROM && !strcmp(image_get_feature(image, "mmc1_type"), "MMC1A"))
1233         state->pcb_id = STD_SXROM_A;   // in MMC1-A PRG RAM is always enabled
1264      if (state->pcb_id == STD_SXROM)
1265      {
1266         if (image_get_feature(image, "mmc1_type") != NULL && !strcmp(image_get_feature(image, "mmc1_type"), "MMC1A"))
1267            state->pcb_id = STD_SXROM_A;   // in MMC1-A PRG RAM is always enabled
1268      }
12341269     
12351270      if (state->pcb_id == STD_NXROM || state->pcb_id == SUNSOFT_DCS)
12361271      {
r8305r8306
12411276         }
12421277      }
12431278     
1244#if 1
1279#if 0
1280      if (state->pcb_id == UNSUPPORTED_BOARD)
1281         printf("This board (%s) is currently not supported by MESS\n", image_get_feature(image, "pcb"));
12451282      printf("PCB Feature: %s\n", image_get_feature(image, "pcb"));
12461283      printf("PRG chunks: %d\n", state->prg_chunks);
12471284      printf("CHR chunks: %d\n", state->chr_chunks);
r8305r8306
12491286      printf("NVWRAM: Present %s, size: %d\n", state->battery ? "Yes" : "No", state->battery_size);
12501287      printf("WRAM:   Present %s, size: %d\n", state->prg_ram ? "Yes" : "No", state->wram_size);
12511288#endif
1252      // FIXME: we need to handle the remaining variables. on the short term, we might
1253      // create a table for the various mappers (based on the 'feature' value in xml),
1254      // but on the long term we need to rework the whole emulation to first use the
1255      // xml list and have mappers and unif boards to fall back to particular 'feature'
1256      // values!
1257
1258      //state->crc_hack = ;
1259      //state->hard_mirroring = ;
1260      //state->trainer = ;
1261      //state->four_screen_vram = ;
12621289   }
12631290
1264   /* Attempt to load a battery file for this ROM. If successful, we */
1265   /* must wait until later to move it to the system memory. */
1266   if (state->battery)
1291   // Attempt to load a battery file for this ROM
1292   // A few boards have internal RAM with a battery (MMC6, Taito X1-005 & X1-017, etc.)
1293   if (state->battery || state->mapper_ram_size)
12671294   {
1268      state->battery_ram = auto_alloc_array(image->machine, UINT8, state->battery_size);
1269      image_battery_load(image, state->battery_ram, state->battery_size, 0x00);
1295      UINT8 *temp_nvram = auto_alloc_array(image->machine, UINT8, state->battery_size + state->mapper_ram_size);
1296      image_battery_load(image, temp_nvram, state->battery_size + state->mapper_ram_size, 0x00);
1297      if (state->battery)
1298      {
1299         state->battery_ram = auto_alloc_array(image->machine, UINT8, state->battery_size);
1300         memcpy(state->battery_ram, temp_nvram, state->battery_size);
1301      }
1302      if (state->mapper_ram_size)
1303         memcpy(state->mapper_ram, temp_nvram + state->battery_size, state->mapper_ram_size);
1304     
1305      auto_free(image->machine, temp_nvram);
12701306   }
12711307
12721308   return INIT_PASS;
src/mess/machine/nes_unif.c
r8305r8306
139139   { "BMC-70IN1",                  0,    0, CHRRAM_0,  NT_X,  UNSUPPORTED_BOARD},   // mapper 236?
140140   { "BMC-70IN1B",                 0,    0, CHRRAM_0,  NT_X,  UNSUPPORTED_BOARD},   // mapper 236?
141141   { "BMC-SUPERVISION16IN1",       0,    0, CHRRAM_0,  NT_X,  UNSUPPORTED_BOARD},   // mapper 53
142   { "BMC-NTD-03",                 0,    0, CHRRAM_0,  NT_X,  UNSUPPORTED_BOARD}
142143};
143144
144145const unif *nes_unif_lookup( const char *board )
r8305r8306
202203         state->mmc_count = 0;
203204         state->mmc_reg[0] = 0x0f;
204205         state->mmc_reg[1] = state->mmc_reg[2] = state->mmc_reg[3] = 0;
206         state->mmc1_reg_write_enable = 1;
205207         set_nt_mirroring(machine, PPU_MIRROR_HORZ);
206208         state->mmc_chr_source = state->chr_chunks ? CHRROM : CHRRAM;
207209         mmc1_set_chr(machine);
r8305r8306
226228         break;
227229      case STD_TXROM:   // mapper 4
228230      case STD_TVROM:
231      case STD_TKROM:
229232      case REXSOFT_DBZ5:   // mapper 12
230233      case WAIXING_TYPE_A:   // mapper 74
231234      case STD_TXSROM:   // mapper 118
r8305r8306
256259         mmc3_set_chr(machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
257260         break;
258261      case STD_HKROM:   // MMC6 (basically the same as TxROM, but alt IRQ behaviour)
259         state->mmc3_alt_irq = 1;
262         state->mmc3_alt_irq = 0;
263         state->mmc6_reg = 0xf0;
260264         state->mmc_prg_bank[0] = state->mmc_prg_bank[2] = 0xfe;   // prg_bank[2] & prg_bank[3] remain always the same in most MMC3 variants
261265         state->mmc_prg_bank[1] = state->mmc_prg_bank[3] = 0xff;   // but some pirate clone mappers change them after writing certain registers
262266         state->mmc_latch1 = 0;
263         state->mmc_latch2 = 0x80;
267         state->mmc_latch2 = 0;
264268         state->mmc_prg_base = state->mmc_chr_base = 0;
265269         state->mmc_prg_mask = state->mmc_chr_mask = 0xff;   // these could be init'ed as xxx_chunks-1 and they would work the same
266270         state->mmc_chr_source = state->chr_chunks ? CHRROM : CHRRAM;
r8305r8306
327331            set_nt_page(machine, 2, CART_NTRAM, 2, 1);
328332            set_nt_page(machine, 3, CART_NTRAM, 3, 1);
329333         }
330         prg8_89(machine, 0xc);
331         prg8_ab(machine, 0xd);
332         prg8_cd(machine, 0xe);
333         prg8_ef(machine, 0xf);
334         break;
335334      case NAMCOT_3453:   // mapper 154
336335         prg16_89ab(machine, state->prg_chunks - 2);
337336         prg16_cdef(machine, state->prg_chunks - 1);
r8305r8306
369368            chr8(machine, 0, CHRROM);
370369         break;
371370      case BANDAI_LZ93:   // mapper 16, 157
371      case BANDAI_LZ93EX:   // same + EEPROM
372372      case BANDAI_DATACH:
373373         state->mmc_latch1 = 0;
374374         prg16_89ab(machine, 0);
r8305r8306
382382         prg16_89ab(machine, 0);
383383         prg16_cdef(machine, state->prg_chunks - 1);
384384         state->mmc_chr_source = state->chr_chunks ? CHRROM : CHRRAM;
385         state->mmc_latch1 = 0;
386385         fjump2_set_prg(machine);
387386         break;
388387      case BANDAI_FCG:
r8305r8306
390389         prg16_89ab(machine, 0);
391390         prg16_cdef(machine, state->prg_chunks - 1);
392391         state->mmc_chr_source = state->chr_chunks ? CHRROM : CHRRAM;
393         state->mmc_latch1 = 0;
394392         break;
395393      case BANDAI_OEKAKIDS:   // mapper 96
396394         prg32(machine, 0);
r8305r8306
431429         break;
432430      case JALECO_JF11:   // mapper 140
433431      case JALECO_JF13:   // mapper 86
434      case JALECO_JF16:   // mapper 78
435      case JALECO_JF17:   // mapper 72
436432      case JALECO_JF19:   // mapper 92
437433         prg32(machine, 0);
438434         break;
435      case JALECO_JF16:   // mapper 78
436      case JALECO_JF17:   // mapper 72
437         prg16_89ab(machine, 0);
438         prg16_cdef(machine, state->prg_chunks - 1);
439         break;
439440      case KONAMI_VRC1:   // mapper 75
440441      case KONAMI_VRC2:
441442      case KONAMI_VRC3:   // mapper 73
r8305r8306
460461         set_nt_mirroring(machine, PPU_MIRROR_VERT);
461462         break;
462463      case SUNSOFT_1:   // mapper 184
463         prg32(machine, 0);
464         break;
465464      case SUNSOFT_2:   // mapper 89 & 93
466465         prg16_89ab(machine, 0);
467466         prg16_cdef(machine, state->prg_chunks - 1);
r8305r8306
509508         prg32(machine, 0xff);
510509         break;
511510
511// mapper 36
512      case TXC_STRIKEWOLF:
513         break;
512514// mapper 40
513515      case BTL_SMB2A:
514516         prg8_67(machine, 0xfe);
r8305r8306
558560         state->mmc_latch2 = 0x80;
559561         state->mmc_chr_source = state->chr_chunks ? CHRROM : CHRRAM;
560562         state->mapper45_reg[0] = state->mapper45_reg[1] = state->mapper45_reg[2] = state->mapper45_reg[3] = 0;
561         state->mmc_prg_base = 0x30;
563         state->mmc_prg_base = 0;
562564         state->mmc_prg_mask = 0x3f;
563565         state->mmc_chr_base = 0;
564         state->mmc_chr_mask = 0x7f;
566         state->mmc_chr_mask = 0xff;
565567         mmc3_set_prg(machine, state->mmc_prg_base, state->mmc_prg_mask);
566568         mmc3_set_chr(machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
567         //         memory_set_bankptr(machine, "bank5", state->wram);
568569         break;
569570// mapper 46
570571      case RUMBLESTATION_BOARD:
r8305r8306
613614         break;
614615// mapper 58
615616      case BMC_GKB:
617         state->mmc_chr_source = state->chr_chunks ? CHRROM : CHRRAM;
616618         prg32(machine, 0);
617         chr8(machine, 0, CHRROM);
619         chr8(machine, 0, state->mmc_chr_source);
618620         break;
619621// mapper 61
620622      case RCM_TETRISFAMILY:
r8305r8306
633635         prg16_cdef(machine, state->prg_chunks - 1);
634636         break;
635637// mapper 71
636      case CAMERICA_BF9093:
637638      case CAMERICA_BF9097:
638639         set_nt_mirroring(machine, PPU_MIRROR_HORZ);
639         prg16_89ab(machine, 0);
640         prg16_cdef(machine, state->prg_chunks - 1);
640      case CAMERICA_BF9093:
641         prg32(machine, 0xff);
641642         break;
642643
643644// mapper 79 (& 146)
r8305r8306
649650
650651// mapper 83
651652      case CONY_BOARD:
653         state->mmc_chr_source = state->chr_chunks ? CHRROM : CHRRAM;
652654         state->mapper83_reg[9] = 0x0f;
653655         prg8_cd(machine, 0x1e);
654656         prg8_ef(machine, 0x1f);
r8305r8306
726728         break;
727729// mapper 121
728730      case KAY_PANDAPRINCE:
731#if 0
729732         state->mmc_prg_bank[0] = state->mmc_prg_bank[2] = 0xfe;
730733         state->mmc_prg_bank[1] = state->mmc_prg_bank[3] = 0xff;
731734         state->mapper121_reg[0] = state->mapper121_reg[1] = state->mapper121_reg[2] = 0;
735         state->mapper121_reg[3] = 0;
736         state->mapper121_reg[4] = state->mapper121_reg[5] = state->mapper121_reg[6] = 0;
732737         state->mmc_latch1 = 0;
733738         state->mmc_latch2 = 0x80;
734739         state->mmc_prg_base = state->mmc_chr_base = 0;
735740         state->mmc_prg_mask = state->mmc_chr_mask = 0xff;
736741         state->mmc_chr_source = state->chr_chunks ? CHRROM : CHRRAM;
742         kay_pp_update_reg(machine);
743         kay_pp_set_prg(machine, state->mmc_prg_base, state->mmc_prg_mask);
744         kay_pp_set_chr(machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
745#endif
746         state->mmc_prg_bank[0] = state->mmc_prg_bank[2] = 0xfe;
747         state->mmc_prg_bank[1] = state->mmc_prg_bank[3] = 0xff;
748         state->mapper121_reg[0] = state->mapper121_reg[1] = state->mapper121_reg[2] = 0;
749         state->mmc_latch1 = 0;
750         state->mmc_latch2 = 0x80;
751         state->mmc_prg_base = state->mmc_chr_base = 0;
752         state->mmc_prg_mask = state->mmc_chr_mask = 0xff;
753         state->mmc_chr_source = state->chr_chunks ? CHRROM : CHRRAM;
737754         mmc3_set_prg(machine, state->mmc_prg_base, state->mmc_prg_mask);
738755         mmc3_set_chr(machine, state->mmc_chr_source, state->mmc_chr_base, state->mmc_chr_mask);
739756         break;
r8305r8306
12281245         prg16_89ab(machine, 0);
12291246         prg16_cdef(machine, state->prg_chunks - 1);
12301247         break;
1231
1248      case UNL_RACERMATE:
1249         state->mmc_chr_source = state->chr_chunks ? CHRROM : CHRRAM;
1250         chr4_0(machine, 0, state->mmc_chr_source);
1251         chr4_4(machine, 0, state->mmc_chr_source);
1252         prg16_89ab(machine, 0);
1253         prg16_cdef(machine, state->prg_chunks - 1);
1254         break;
1255         
12321256      case UNSUPPORTED_BOARD:
12331257      default:
12341258         /* Mapper not supported */
src/mess/machine/nes_mmc.h
r8305r8306
99   STD_DXROM, STD_EXROM, STD_FXROM, STD_GXROM,
1010   STD_HKROM, STD_JXROM, STD_MXROM, STD_NXROM,
1111   STD_PXROM, STD_SXROM, STD_TXROM, STD_TXSROM,
12   STD_TQROM, STD_TVROM, STD_UN1ROM, STD_UXROM,
12   STD_TKROM, STD_TQROM, STD_TVROM,
13   STD_UN1ROM, STD_UXROM,
1314   HVC_FAMBASIC, NES_QJ, PAL_ZZ, UXROM_CC,
1415   STD_DRROM, STD_SXROM_A, STD_SOROM, STD_SOROM_A,
1516   /* Discrete components boards (by various manufacturer) */
r8305r8306
2425   /* Bandai */
2526   BANDAI_JUMP2, BANDAI_PT554,
2627   BANDAI_DATACH, BANDAI_KARAOKE, BANDAI_OEKAKIDS,
27   BANDAI_FCG, BANDAI_LZ93,
28   BANDAI_FCG, BANDAI_LZ93, BANDAI_LZ93EX,
2829   /* Caltron */
2930   CALTRON_6IN1,
3031   /* Camerica */
r8305r8306
6465   TENGEN_800008, TENGEN_800032, TENGEN_800037,
6566   /* TXC */
6667   TXC_22211A, TXC_22211B, TXC_22211C,
67   TXC_MXMDHTWO, TXC_TW,
68   TXC_MXMDHTWO, TXC_TW, TXC_STRIKEWOLF,
6869   /* Multigame Carts */
6970   BMC_64IN1NR, BMC_190IN1, BMC_A65AS, BMC_GS2004, BMC_GS2013,
7071   BMC_HIK8IN1, BMC_NOVELDIAMOND, BMC_S24IN1SC03, BMC_T262,
r8305r8306
7879   UNL_8237, UNL_CC21, UNL_AX5705, UNL_KOF97,
7980   UNL_N625092, UNL_SC127, UNL_SMB2J, UNL_T230,
8081   UNL_UXROM, UNL_MK2, UNL_XZY, UNL_KOF96,
81   UNL_SUPERFIGHTER3,
82   UNL_SUPERFIGHTER3, UNL_RACERMATE,
8283   /* Bootleg boards */
8384   BTL_SMB2A, BTL_MARIOBABY, BTL_AISENSHINICOL,
8485   BTL_SMB2B, BTL_SMB3, BTL_SUPERBROS11, BTL_DRAGONNINJA,
r8305r8306
9293   WAIXING_SGZLZ, WAIXING_SGZ, WAIXING_ZS, WAIXING_SECURITY,
9394   WAIXING_DQ8, WAIXING_FFV, WAIXING_PS2, SUPERGAME_LIONKING, SUPERGAME_BOOGERMAN,
9495   KAY_PANDAPRINCE, HOSENKAN_BOARD, NITRA_TDA, GOUDER_37017,
95   /* Unsupported (for place-holder boards, with no working emulation) */
96   UNSUPPORTED_BOARD
96   /* Unsupported (for place-holder boards, with no working emulation) & no-board (at init) */
97   UNSUPPORTED_BOARD, NO_BOARD
9798};
9899
99100//extern int MMC1_extended; /* 0 = normal MMC1 cart, 1 = 512k MMC1, 2 = 1024k MMC1 */
r8305r8306
118119READ8_HANDLER( nes_fds_r );
119120WRITE8_HANDLER( nes_fds_w );
120121WRITE8_HANDLER( nes_mapper50_add_w );
122WRITE8_HANDLER( smb2jb_extra_w );
121123
122124//TEMPORARY PPU STUFF
123125
src/mess/machine/nes_ines.c
r8305r8306
6969   {
7070   case 0x00:
7171   case 0x04:
72      prg32(machine, prg_offset + state->MMC1_regs[3]);
72      prg32(machine, (prg_offset + state->MMC1_regs[3]) >> 1);
7373      break;
7474   case 0x08:
7575      prg16_89ab(machine, prg_offset + 0);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team