Skip to content

Commit

Permalink
bus/nes: extend mapper numbers to full 12-bits, hook up .nes loader u…
Browse files Browse the repository at this point in the history
…p for some mappers > 255
  • Loading branch information
0kmg committed Jul 11, 2021
1 parent f2d74f9 commit 71e162d
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 15 deletions.
2 changes: 1 addition & 1 deletion hash/nes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66644,7 +66644,7 @@ Also notice that VRAM & WRAM are probably incorrect for some of these sets, at t
<feature name="pcb" value="UNL-KS7031" />
<feature name="mirroring" value="vertical" />
<dataarea name="prg" size="131072">
<rom name="dracula ii - noroi no fuuin (fds conversion).prg" size="131072" crc="8b7c2f62" sha1="759801bc77163613a21840591b69a336a8e0a06a" offset="00000" status="baddump" />
<rom name="ks128" size="131072" crc="8b7c2f62" sha1="759801bc77163613a21840591b69a336a8e0a06a" offset="00000" status="baddump" />
</dataarea>
<!-- 8k VRAM on cartridge -->
<dataarea name="vram" size="8192">
Expand Down
4 changes: 1 addition & 3 deletions src/devices/bus/nes/kaiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,9 +770,7 @@ void nes_ks7030_device::write_h(offs_t offset, u8 data)
of the 0x8000-0xffff region. Main bank is fixed, while
the 8K mapped at 0x6000-0x7fff varies with reg writes.
TODO: understand how SRAM is handled...
NES 2.0: mapper 302
NES 2.0: mapper 305
In MAME: Supported.
Expand Down
73 changes: 62 additions & 11 deletions src/devices/bus/nes/nes_ines.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,55 @@ static const nes_mmc mmc_list[] =
// 253 Super 8-in-1 99 King Fighter?? - Unsupported
{ 254, BTL_PIKACHUY2K },
{ 255, BMC_110IN1 },

// NES 2.0
{ 264, YOKO_BOARD },

{ 302, KAISER_KS7057 }, // Gyruss FDS conversion
{ 303, KAISER_KS7017 }, // Almana no Kiseki FDS conversion
{ 304, BTL_09034A }, // various FDS conversions
{ 305, KAISER_KS7031 }, // Dracula II FDS conversion
// { 306, KAISER_KS7016 }, // Exciting Basket FDS conversion
{ 307, KAISER_KS7037 }, // Metroid FDS conversion
// 308 Batman (Sunsoft) pirate on VRC2 clone hardware
// { 309, UNL_LH51 }, // Ai Senshi Nicol alt FDS conversion (dump available?)
// 310 variant of mapper 125?
// 311 Unused (previously assigned in error to a bad SMB2 pirate dump)
{ 312, KAISER_KS7013B }, // Highway Star FDS conversion

{ 328, UNL_RT01 }, // test cart (Russia)

{ 346, KAISER_KS7012 }, // Zanac alt FDS conversion
{ 347, KAISER_KS7030 },

// { 389, CALTRON_9IN1 },

{ 415, BTL_0353 }, // Lucky (Roger) Rabbit FDS conversion

// { 519, UNL_EH8813A }, // Dr Mario II Chinese pirate
// { 520, UNKNOWN }, TODO: this is probably 2yudb
{ 521, DREAMTECH_BOARD }, // Korean Igo
{ 522, UNL_LH10 }, // Fuuun Shaolin Kyo FDS conversion
// { 523, UNKNOWN } TODO: likely fengshnb or a clone not yet in nes.xml
// { 524, BTL_900218 } TODO: this seems to be lordkinga
// { 525, KAISER_KS7021A },
// 526 sangochu clone not yet in nes.xml?
// 527 demnswrd/fudomyod clone not yet in nes.xml
// 528, 1995 New Series Super 2-in-1 multicart not in nes.xml
// 529 Datach Dragon Ball Z bootleg?
{ 530, UNL_AX5705 }, // Super Mario Bros Pocker Mali
// 531 Used by Asder PC-95 Famicom clone built into a keyboard
// 532 Emulator only mapper for Chinese version of sangoht2?
// 533 Used by dongdng2 which is a CNROM variant with protection?
// 534 Are these all PnPs? Is one mc_101 or a clone not in nes.xml?
{ 535, UNL_LH53 }, // Nazo no Murasamejo FDS conversion
// 536 and 537 Waixing FS303, mapper 195 variants?
// { 538, BTL_60106416L } TODO: Exciting Soccer bootleg, not in nes.xml (available baddump needs banks rearranged?)
{ 539, BTL_PALTHENA }, // Hikari Shinwa (Kid Icarus) FDS conversion

// { 549, KAISER_KS7016B }, // Meikyuu Jiin Dababa alt FDS conversion

{ 554, KAISER_KS7010 }, // Akumajo Dracula FDS conversion
};

const nes_mmc *nes_mapper_lookup( int mapper )
Expand Down Expand Up @@ -340,7 +389,8 @@ void nes_cart_slot_device::call_load_ines()
uint32_t vram_size = 0, prgram_size = 0, battery_size = 0, mapper_sram_size = 0;
uint32_t prg_size, vrom_size;
uint8_t header[0x10];
uint8_t mapper, submapper = 0, local_options;
uint16_t mapper;
uint8_t submapper = 0, local_options;
bool ines20 = false, prg16k;
std::string mapinfo;
int pcb_id = 0, mapint1 = 0, mapint2 = 0, mapint3 = 0, mapint4 = 0;
Expand Down Expand Up @@ -368,7 +418,7 @@ void nes_cart_slot_device::call_load_ines()
// probably the header got corrupted: don't trust upper bits for mapper
break;

case 0x8: // it's iNES 2.0 format
case 0x8: // it's NES 2.0 format
ines20 = true;
[[fallthrough]];
case 0x0:
Expand Down Expand Up @@ -401,7 +451,7 @@ void nes_cart_slot_device::call_load_ines()
logerror("NES: No extrainfo found\n");
}

// use extended iNES2.0 info if available!
// use extended NES 2.0 info if available!
if (ines20)
{
mapper |= (header[8] & 0x0f) << 8;
Expand All @@ -419,7 +469,7 @@ void nes_cart_slot_device::call_load_ines()
if (mapper == 1 && submapper == 3)
pcb_id = STD_SXROM_A;
else if (mapper == 1 && submapper == 5)
logerror("Unimplemented iNES2.0 submapper: SEROM/SHROM/SH1ROM.\n");
logerror("Unimplemented NES 2.0 submapper: SEROM/SHROM/SH1ROM.\n");
// 002, 003, 007: UxROM, CNROM, AxROM
else if (mapper == 2 && submapper == 2)
bus_conflict = true;
Expand Down Expand Up @@ -468,7 +518,7 @@ void nes_cart_slot_device::call_load_ines()
else if (mapper == 68 && submapper == 1)
{
submapper = 0;
logerror("Unimplemented iNES2.0 submapper: SUNSOFT-DCS.\n");
logerror("Unimplemented NES 2.0 submapper: SUNSOFT-DCS.\n");
}
// iNES Mapper 071
else if (mapper == 71 && submapper == 1)
Expand All @@ -493,12 +543,12 @@ void nes_cart_slot_device::call_load_ines()
else if (mapper == 210 && submapper == 1)
{
submapper = 0;
logerror("Unimplemented iNES2.0 submapper: CAMERICA-BF9096.\n");
logerror("Unimplemented NES 2.0 submapper: CAMERICA-BF9096.\n");
}
else if (submapper)
{
submapper = 0;
logerror("Undocumented iNES2.0 submapper, please report it to the MAME boards!\n");
logerror("Undocumented NES 2.0 submapper, please report it to the MAME boards!\n");
}
}

Expand Down Expand Up @@ -851,7 +901,8 @@ void nes_cart_slot_device::call_load_ines()

const char * nes_cart_slot_device::get_default_card_ines(get_default_card_software_hook &hook, const uint8_t *ROM, uint32_t len) const
{
uint8_t mapper, submapper = 0;
uint16_t mapper;
uint8_t submapper = 0;
bool ines20 = false;
std::string mapinfo;
int pcb_id = 0, mapint1 = 0, mapint2 = 0, mapint3 = 0, mapint4 = 0;
Expand All @@ -866,7 +917,7 @@ const char * nes_cart_slot_device::get_default_card_ines(get_default_card_softwa
// probably the header got corrupted: don't trust upper bits for mapper
break;

case 0x8: // it's iNES 2.0 format
case 0x8: // it's NES 2.0 format
ines20 = true;
[[fallthrough]];
case 0x0:
Expand All @@ -886,7 +937,7 @@ const char * nes_cart_slot_device::get_default_card_ines(get_default_card_softwa
}
}

// use extended iNES2.0 info if available!
// use extended NES 2.0 info if available!
if (ines20)
{
mapper |= (ROM[8] & 0x0f) << 8;
Expand All @@ -903,7 +954,7 @@ const char * nes_cart_slot_device::get_default_card_ines(get_default_card_softwa
if (mapper == 1 && submapper == 3)
pcb_id = STD_SXROM_A;
else if (mapper == 1 && submapper == 5)
logerror("Unimplemented iNES2.0 submapper: SEROM/SHROM/SH1ROM.\n");
logerror("Unimplemented NES 2.0 submapper: SEROM/SHROM/SH1ROM.\n");
// 021, 023, 025: VRC4 / VRC2
else if (mapper == 21 || mapper == 23 || mapper == 25)
{
Expand Down

0 comments on commit 71e162d

Please sign in to comment.