mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +03:00
bus/gameboy: Added support for newer NT/Makon cartridges.
bus/gameboy: Removed the non-working "Digimon 2" cartridge device. gbcolor.xml: Corrected titles for a few Chinese games. New working software items (gbcolor.xml) ---------------------------------------- Capcom Vs. SNK: Millennium Fight 2001 (China) [Pepper9801, taizou] Digimon 02 4 (China) [taizou] Digimon 2 (China) [Robyn A1200, taizou] Digimon Pocket (China) [taizou] Harry Potter 3 (China) [taizou] Pokémon Diamond: Special Pikachu Edition [taizou] Pokémon Jade: Special Pikachu Edition [taizou] Pokémon: Mewtwo Strikes Back [taizou] Street Fighter Zero 4 (China) [taizou] Software items promoted to working (gbcolor.xml) ------------------------------------------------ Shùmǎ Bào Lóng 02 4 (China) [Vas Crabb] Shùmǎ Bào Lóng 3 Shuǐjīng Bǎn (China) [Vas Crabb]
This commit is contained in:
parent
f51c310ad3
commit
2a33336d95
310
hash/gbcolor.xml
310
hash/gbcolor.xml
@ -25842,22 +25842,6 @@ license:CC0
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="smbbhzs">
|
||||
<description>Shuma Baobei - Hai Zhi Shen (China)</description>
|
||||
<year>200?</year>
|
||||
<publisher>Li Cheng</publisher>
|
||||
<info name="serial" value="CBA087"/>
|
||||
<info name="alt_title" value="数码宝贝-海之神"/>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_licheng" />
|
||||
<dataarea name="rom" size="524288">
|
||||
<rom name="shuma baobei - hai zhi shen (unlicensed, chinese) (cba087) [raw dump].bin" size="524288" crc="c3cedaed" sha1="4e7b7b361302e5e400047c9e668f23cbc885a9e0" offset="0" />
|
||||
</dataarea>
|
||||
<dataarea name="nvram" size="32768"> <!-- Unconfirmed size -->
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="mojie3">
|
||||
<description>Mo Jie 3 - Bu Wanme De Shijie (China)</description>
|
||||
<year>200?</year>
|
||||
@ -27772,12 +27756,12 @@ license:CC0
|
||||
</software>
|
||||
|
||||
<software name="yxcs" supported="no">
|
||||
<description>Ying Xiong Chuan Shuo (China)</description>
|
||||
<description>Yīngxióng Chuánshuō (China)</description>
|
||||
<year>20??</year>
|
||||
<publisher>Waixing</publisher>
|
||||
<info name="alt_title" value="英雄传说"/>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_digimon" />
|
||||
<feature name="slot" value="rom_ntnew" /> <!-- FIXME: incorrect - what's the correct cartridge type? -->
|
||||
<dataarea name="rom" size="1048576">
|
||||
<rom name="legend of heroes (unl).bin" size="1048576" crc="0dd2b42b" sha1="b62bff46fb8d5962598445bd113370dd0717f170"/>
|
||||
</dataarea>
|
||||
@ -27914,6 +27898,219 @@ license:CC0
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- intro/title/win screens are a flickering mess on gbcolor (uses a high-colour trick), gameplay displays correctly -->
|
||||
<software name="capsnk" supported="partial">
|
||||
<description>Capcom Vs. SNK: Millennium Fight 2001 (China)</description>
|
||||
<year>200?</year>
|
||||
<publisher>Makon</publisher>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_ntnew" />
|
||||
<dataarea name="rom" size="0x100000">
|
||||
<rom name="capcom vs snk millennium fight 2001.gbc" size="0x100000" crc="97280455" sha1="cddd079eebaeeb45b22c808cfb5e369f70e7fa20" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="digimn24">
|
||||
<description>Digimon 02 4 (China)</description>
|
||||
<year>200?</year>
|
||||
<publisher>Makon</publisher>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_ntnew" />
|
||||
<dataarea name="rom" size="0x100000">
|
||||
<rom name="digimon 02 4.gbc" size="0x100000" crc="a90061e9" sha1="0c8280e5349dda05fdd27bb1eb68a1be2f3d5c04" />
|
||||
</dataarea>
|
||||
<dataarea name="nvram" size="0x8000" />
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="shumabl24" cloneof="digimn24">
|
||||
<description>Shùmǎ Bào Lóng 02 4 (China)</description>
|
||||
<year>200?</year>
|
||||
<publisher>Makon</publisher>
|
||||
<info name="alt_title" value="數碼暴龍02 4" />
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_ntnew" />
|
||||
<dataarea name="rom" size="0x100000">
|
||||
<rom name="shuma bao long 02 4.gbc" size="0x100000" crc="2ee18ab2" sha1="839f0880749735ba2113e437f8efede171b7474d" />
|
||||
</dataarea>
|
||||
<dataarea name="nvram" size="0x8000" />
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="shumabl24h" cloneof="digimn24">
|
||||
<!-- This version bypasses the protection, but I think it's been hacked by whoever dumped
|
||||
the real card, so it can be removed once we properly emulate the parent -->
|
||||
<description>Shùmǎ Bào Lóng 02 4 (China, hacked)</description>
|
||||
<year>20??</year>
|
||||
<publisher>Yong Yong</publisher>
|
||||
<info name="alt_title" value="數碼暴龍02 4" />
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_mbc5" />
|
||||
<dataarea name="rom" size="1048576">
|
||||
<rom name="digimon 4 (unl) (hacked).bin" size="1048576" crc="6f67dfc6" sha1="5c5d1675188a5f618f9babf2b3848942ce08c659"/>
|
||||
</dataarea>
|
||||
<dataarea name="ram" size="8192">
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- different title screen - hacked by Yong Yong? -->
|
||||
<software name="shumabl2fcb" cloneof="digimn24">
|
||||
<description>Shùmǎ Bào Lóng 02 Fěicuì Bǎn (China)</description>
|
||||
<year>20??</year>
|
||||
<publisher>Yong Yong</publisher>
|
||||
<info name="alt_title" value="數碼暴龍02 翡翠版" />
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_mbc5" />
|
||||
<dataarea name="rom" size="1048576">
|
||||
<rom name="digimon 02 jade (unl).bin" size="1048576" crc="c64818eb" sha1="314cf9deaf5c42905d412315fe701524ebd9e9ad"/>
|
||||
</dataarea>
|
||||
<dataarea name="ram" size="8192">
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="digimn2">
|
||||
<description>Digimon 2 (China)</description>
|
||||
<year>200?</year>
|
||||
<publisher>Makon</publisher>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_ntnew" />
|
||||
<dataarea name="rom" size="0x100000">
|
||||
<rom name="digimon 2.gbc" size="0x100000" crc="a43ab22b" sha1="8476385e380bee46f19f874dfed91b3aa61bbf66" />
|
||||
</dataarea>
|
||||
<dataarea name="nvram" size="0x8000" />
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- different title screen - hacked by Yong Yong? -->
|
||||
<software name="shumabl3" cloneof="digimn2">
|
||||
<description>Shùmǎ Bào Lóng 3 Shuǐjīng Bǎn (China)</description>
|
||||
<year>20??</year>
|
||||
<publisher>Yong Yong</publisher>
|
||||
<info name="alt_title" value="數碼暴龍3 水晶版" />
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_ntnew" />
|
||||
<dataarea name="rom" size="0x100000">
|
||||
<rom name="digimon 2 (unl).bin" size="0x100000" crc="aabbec08" sha1="b88393318c35fcd63b9bbe8ccd0ce89d971b6163" />
|
||||
</dataarea>
|
||||
<dataarea name="nvram" size="0x2000" />
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="shumabl2h" cloneof="digimn2">
|
||||
<!-- This version bypasses the protection, but I think it's been hacked by whoever dumped
|
||||
the real card, so it can be removed once we properly emulate the parent -->
|
||||
<description>Shùmǎ Bào Lóng 2 (China, hacked)</description>
|
||||
<year>20??</year>
|
||||
<publisher>Yong Yong</publisher>
|
||||
<info name="alt_title" value="數碼暴龍2" />
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_mbc5" />
|
||||
<dataarea name="rom" size="0x100000">
|
||||
<rom name="digimon 2 (unl) (hacked).bin" size="0x100000" crc="153ae99f" sha1="b78ba8f8f2b297a5a2847cbde27900531cfff584" />
|
||||
</dataarea>
|
||||
<dataarea name="ram" size="0x2000" />
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="hpotter3">
|
||||
<description>Harry Potter 3 (China)</description>
|
||||
<year>200?</year>
|
||||
<publisher>Makon</publisher>
|
||||
<info name="usage" value="Crashes in first level - not an emulation bug" />
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_ntnew" />
|
||||
<dataarea name="rom" size="0x100000">
|
||||
<rom name="harry potter 3.gbc" size="0x100000" crc="d0fece32" sha1="6820d9e05e60a380c52aa8a19a8397ec929a5b49" />
|
||||
</dataarea>
|
||||
<dataarea name="nvram" size="0x8000" />
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="mewtwosb">
|
||||
<description>Pokémon: Mewtwo Strikes Back (China)</description>
|
||||
<year>200?</year>
|
||||
<publisher>Makon</publisher>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_ntnew" />
|
||||
<dataarea name="rom" size="0x80000">
|
||||
<rom name="pokemon mewtwo strikes back.gbc" size="0x80000" crc="6e447a33" sha1="079b9d8190e8df451882f6eabc2799f82fbb9ec0" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- this is a reskin of Pokémon: Mewtwo Strikes Back with the stage order changed and battery save added -->
|
||||
<software name="digimnpk">
|
||||
<description>Digimon Pocket (China)</description>
|
||||
<year>200?</year>
|
||||
<publisher>Makon</publisher>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_ntnew" />
|
||||
<dataarea name="rom" size="0x100000">
|
||||
<rom name="digimon pocket.gbc" size="0x100000" crc="6791b106" sha1="87750928d5f005e67e51e4d08a6d82351effc7b2" />
|
||||
</dataarea>
|
||||
<dataarea name="nvram" size="0x8000" />
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="pkmndspe">
|
||||
<description>Pokémon Diamond: Special Pikachu Edition (China)</description>
|
||||
<year>2001</year>
|
||||
<publisher>Makon</publisher>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_ntnew" />
|
||||
<dataarea name="rom" size="0x80000">
|
||||
<rom name="pokemon diamond special pikachu edition.gbc" size="0x80000" crc="1b5bef4b" sha1="433e7991b706baedf59af8b91bc142ba2f72112f" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="smbbhzs" cloneof="pkmndspe">
|
||||
<description>Shùmǎ Bǎobèi: Hǎi Zhī Shén (China)</description>
|
||||
<year>200?</year>
|
||||
<publisher>Li Cheng</publisher>
|
||||
<info name="serial" value="CBA087"/>
|
||||
<info name="alt_title" value="数码宝贝 海之神"/>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_licheng" />
|
||||
<dataarea name="rom" size="0x80000">
|
||||
<rom name="shuma baobei - hai zhi shen (unlicensed, chinese) (cba087) [raw dump].bin" size="0x80000" crc="c3cedaed" sha1="4e7b7b361302e5e400047c9e668f23cbc885a9e0" />
|
||||
</dataarea>
|
||||
<dataarea name="nvram" size="0x8000"> <!-- Unconfirmed size -->
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="pkmnjspe">
|
||||
<description>Pokémon Jade: Special Pikachu Edition (China)</description>
|
||||
<year>2001</year>
|
||||
<publisher>Makon</publisher>
|
||||
<info name="usage" value="Crashes when finishing the first level - not an emulation bug" />
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_ntnew" />
|
||||
<dataarea name="rom" size="0x80000">
|
||||
<rom name="pokemon jade special pikachu edition.gbc" size="0x80000" crc="e9488e13" sha1="254355aac31a6a75481a6a14c5c5cae1e4f41adf" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- intro/title screens are a flickering mess on gbcolor (uses a high-colour trick), gameplay displays correctly -->
|
||||
<software name="sfz4">
|
||||
<description>Street Fighter Zero 4 (China)</description>
|
||||
<year>2000</year>
|
||||
<publisher>Makon</publisher>
|
||||
<info name="alt_title" value="街霸天王4" />
|
||||
<info name="alt_title" value="Jiē Bà Tiānwáng 4" />
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_ntnew" />
|
||||
<dataarea name="rom" size="0x100000">
|
||||
<rom name="street fighter zero 4.gbc" size="0x100000" crc="1a6fe765" sha1="b0862fc1cc856b904b2febd094d9453a2baacb85" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="sm3sp" supported="no">
|
||||
<!--
|
||||
There are various dumps of this:
|
||||
@ -27935,41 +28132,11 @@ license:CC0
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="digimn2" supported="no">
|
||||
<!-- This version should be the real dump, protected as the original cart -->
|
||||
<description>Digimon 2 (China)</description>
|
||||
<year>20??</year>
|
||||
<publisher>Yong Yong</publisher>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_digimon" />
|
||||
<dataarea name="rom" size="1048576">
|
||||
<rom name="digimon 2 (unl).bin" size="1048576" crc="aabbec08" sha1="b88393318c35fcd63b9bbe8ccd0ce89d971b6163"/>
|
||||
</dataarea>
|
||||
<dataarea name="ram" size="8192">
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="digimn2h" cloneof="digimn2">
|
||||
<!-- This version bypasses the protection, but I think it's been hacked by whoever dumped
|
||||
the real card, so it can be removed once we properly emulate the parent -->
|
||||
<description>Digimon 2 (China, Hacked)</description>
|
||||
<year>20??</year>
|
||||
<publisher>Yong Yong</publisher>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_mbc5" />
|
||||
<dataarea name="rom" size="1048576">
|
||||
<rom name="digimon 2 (unl) (hacked).bin" size="1048576" crc="153ae99f" sha1="b78ba8f8f2b297a5a2847cbde27900531cfff584"/>
|
||||
</dataarea>
|
||||
<dataarea name="ram" size="8192">
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="digimn3c">
|
||||
<description>Digimon 3 Crystal (China)</description>
|
||||
<year>20??</year>
|
||||
<publisher>Yong Yong</publisher>
|
||||
<info name="alt_title" value="數碼暴龍3 水晶版" />
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_mbc5" />
|
||||
<dataarea name="rom" size="2097152">
|
||||
@ -27980,51 +28147,6 @@ license:CC0
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="digimn4" supported="no">
|
||||
<!-- This version should be the real dump, protected as the original cart -->
|
||||
<description>Digimon 02 4 (China)</description>
|
||||
<year>20??</year>
|
||||
<publisher>Yong Yong</publisher>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_digimon" />
|
||||
<dataarea name="rom" size="1048576">
|
||||
<rom name="digimon 4 (unl).bin" size="1048576" crc="2ee18ab2" sha1="839f0880749735ba2113e437f8efede171b7474d"/>
|
||||
</dataarea>
|
||||
<dataarea name="ram" size="8192">
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="digimn4h" cloneof="digimn4">
|
||||
<!-- This version bypasses the protection, but I think it's been hacked by whoever dumped
|
||||
the real card, so it can be removed once we properly emulate the parent -->
|
||||
<description>Digimon 02 4 (China, Hacked)</description>
|
||||
<year>20??</year>
|
||||
<publisher>Yong Yong</publisher>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_mbc5" />
|
||||
<dataarea name="rom" size="1048576">
|
||||
<rom name="digimon 4 (unl) (hacked).bin" size="1048576" crc="6f67dfc6" sha1="5c5d1675188a5f618f9babf2b3848942ce08c659"/>
|
||||
</dataarea>
|
||||
<dataarea name="ram" size="8192">
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="digijade" cloneof="digimn4">
|
||||
<description>Digimon 02 Jade (China)</description>
|
||||
<year>20??</year>
|
||||
<publisher>Yong Yong</publisher>
|
||||
<part name="cart" interface="gameboy_cart">
|
||||
<feature name="slot" value="rom_mbc5" />
|
||||
<dataarea name="rom" size="1048576">
|
||||
<rom name="digimon 02 jade (unl).bin" size="1048576" crc="c64818eb" sha1="314cf9deaf5c42905d412315fe701524ebd9e9ad"/>
|
||||
</dataarea>
|
||||
<dataarea name="ram" size="8192">
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="digimn5">
|
||||
<description>Digimon 02 5 (China)</description>
|
||||
<year>20??</year>
|
||||
|
@ -3733,6 +3733,8 @@ if (BUSES["GAMEBOY"]~=null) then
|
||||
MAME_DIR .. "src/devices/bus/gameboy/mdslot.h",
|
||||
MAME_DIR .. "src/devices/bus/gameboy/mmm01.cpp",
|
||||
MAME_DIR .. "src/devices/bus/gameboy/mmm01.h",
|
||||
MAME_DIR .. "src/devices/bus/gameboy/ntnew.cpp",
|
||||
MAME_DIR .. "src/devices/bus/gameboy/ntnew.h",
|
||||
MAME_DIR .. "src/devices/bus/gameboy/rom.cpp",
|
||||
MAME_DIR .. "src/devices/bus/gameboy/rom.h",
|
||||
MAME_DIR .. "src/devices/bus/gameboy/slmulti.cpp",
|
||||
|
@ -350,6 +350,108 @@ void mbc_dual_uniform_device_base::set_bank_rom_high(u16 entry)
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// 16 KiB fixed at 0x0000, 8 KiB switchable at 0x4000 and 0x6000
|
||||
//**************************************************************************
|
||||
|
||||
mbc_8k_device_base::mbc_8k_device_base(
|
||||
machine_config const &mconfig,
|
||||
device_type type,
|
||||
char const *tag,
|
||||
device_t *owner,
|
||||
u32 clock) :
|
||||
device_t(mconfig, type, tag, owner, clock),
|
||||
device_gb_cart_interface(mconfig, *this),
|
||||
m_bank_rom(*this, { "romlow", "romhigh" }),
|
||||
m_bank_bits_rom(0U),
|
||||
m_bank_mask_rom(0U)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void mbc_8k_device_base::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool mbc_8k_device_base::check_rom(std::string &message)
|
||||
{
|
||||
memory_region *const romregion(cart_rom_region());
|
||||
if (!romregion || !romregion->bytes())
|
||||
{
|
||||
// setting default bank on reset causes a fatal error when no banks are configured
|
||||
message = "No ROM data found";
|
||||
return false;
|
||||
}
|
||||
|
||||
auto const rombytes(romregion->bytes());
|
||||
if ((rombytes & (PAGE_ROM_SIZE - 1)) || ((u32(PAGE_ROM_SIZE) << m_bank_bits_rom) < rombytes))
|
||||
{
|
||||
message = util::string_format(
|
||||
"Unsupported cartridge ROM size (must be a multiple of 8 KiB and no larger than %u pages)",
|
||||
1U << m_bank_bits_rom);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void mbc_8k_device_base::install_rom(
|
||||
address_space_installer &fixedspace,
|
||||
address_space_installer &lowspace,
|
||||
address_space_installer &highspace)
|
||||
{
|
||||
memory_region *const romregion(cart_rom_region());
|
||||
auto const rombytes(romregion->bytes());
|
||||
|
||||
// install the fixed ROM, mirrored if it’s too small
|
||||
if (0x4000 > rombytes)
|
||||
fixedspace.install_rom(0x0000, 0x1fff, 0x2000, romregion->base());
|
||||
else
|
||||
fixedspace.install_rom(0x0000, 0x3fff, 0x0000, romregion->base());
|
||||
|
||||
// configure both banks as views of the ROM
|
||||
m_bank_mask_rom = device_generic_cart_interface::map_non_power_of_two(
|
||||
unsigned(rombytes / PAGE_ROM_SIZE),
|
||||
[this, base = &romregion->as_u8()] (unsigned entry, unsigned page)
|
||||
{
|
||||
LOG(
|
||||
"Install ROM 0x%06X-0x%06X in bank entry %u\n",
|
||||
page * PAGE_ROM_SIZE,
|
||||
(page * PAGE_ROM_SIZE) + (PAGE_ROM_SIZE - 1),
|
||||
entry);
|
||||
m_bank_rom[0]->configure_entry(entry, &base[page * PAGE_ROM_SIZE]);
|
||||
m_bank_rom[1]->configure_entry(entry, &base[page * PAGE_ROM_SIZE]);
|
||||
});
|
||||
lowspace.install_read_bank(0x4000, 0x5fff, m_bank_rom[0]);
|
||||
highspace.install_read_bank(0x6000, 0x7fff, m_bank_rom[1]);
|
||||
}
|
||||
|
||||
|
||||
void mbc_8k_device_base::set_bank_rom_low(u16 entry)
|
||||
{
|
||||
entry &= m_bank_mask_rom;
|
||||
LOG(
|
||||
"%s: Set ROM bank low = 0x%06X\n",
|
||||
machine().describe_context(),
|
||||
entry * PAGE_ROM_SIZE);
|
||||
m_bank_rom[0]->set_entry(entry);
|
||||
}
|
||||
|
||||
|
||||
void mbc_8k_device_base::set_bank_rom_high(u16 entry)
|
||||
{
|
||||
entry &= m_bank_mask_rom;
|
||||
LOG(
|
||||
"%s: Set ROM bank high = 0x%06X\n",
|
||||
machine().describe_context(),
|
||||
entry * PAGE_ROM_SIZE);
|
||||
m_bank_rom[1]->set_entry(entry);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// 32 KiB switchable at 0x0000
|
||||
//**************************************************************************
|
||||
|
@ -141,6 +141,37 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// 16 KiB fixed at 0x0000, 8 KiB switchable at 0x4000 and 0x6000
|
||||
//**************************************************************************
|
||||
|
||||
class mbc_8k_device_base : public device_t, public device_gb_cart_interface
|
||||
{
|
||||
protected:
|
||||
mbc_8k_device_base(machine_config const &mconfig, device_type type, char const *tag, device_t *owner, u32 clock);
|
||||
|
||||
virtual void device_start() override ATTR_COLD;
|
||||
|
||||
void set_bank_bits_rom(unsigned bits) { m_bank_bits_rom = bits; }
|
||||
|
||||
bool check_rom(std::string &message) ATTR_COLD;
|
||||
void install_rom(address_space_installer &fixedspace, address_space_installer &lowspace, address_space_installer &highspace) ATTR_COLD;
|
||||
|
||||
void set_bank_rom_low(u16 entry);
|
||||
void set_bank_rom_high(u16 entry);
|
||||
|
||||
private:
|
||||
static inline constexpr unsigned PAGE_ROM_SIZE = 0x2000;
|
||||
|
||||
memory_bank_array_creator<2> m_bank_rom;
|
||||
|
||||
unsigned m_bank_bits_rom;
|
||||
u16 m_bank_mask_rom;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// 32 KiB switchable at 0x0000
|
||||
//**************************************************************************
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "mbc6.h"
|
||||
#include "mbc7.h"
|
||||
#include "mmm01.h"
|
||||
#include "ntnew.h"
|
||||
#include "rom.h"
|
||||
#include "slmulti.h"
|
||||
#include "tama5.h"
|
||||
@ -54,7 +55,7 @@ char const *const GB_CHONGWU = "rom_chong";
|
||||
char const *const GB_LICHENG = "rom_licheng";
|
||||
char const *const GB_NEWGBCHK = "rom_newgbchk";
|
||||
char const *const GB_VF001 = "rom_vf001";
|
||||
char const *const GB_DIGIMON = "rom_digimon";
|
||||
char const *const GB_NTNEW = "rom_ntnew";
|
||||
char const *const GB_SLMULTI = "rom_slmulti";
|
||||
char const *const GB_GBCK003 = "rom_gbck003";
|
||||
|
||||
@ -97,7 +98,7 @@ void gameboy_cartridges(device_slot_interface &device)
|
||||
device.option_add_internal(slotoptions::GB_LICHENG, GB_ROM_LICHENG);
|
||||
device.option_add_internal(slotoptions::GB_NEWGBCHK, GB_ROM_NEWGBCHK);
|
||||
device.option_add_internal(slotoptions::GB_VF001, GB_ROM_VF001);
|
||||
device.option_add_internal(slotoptions::GB_DIGIMON, GB_ROM_DIGIMON);
|
||||
device.option_add_internal(slotoptions::GB_NTNEW, GB_ROM_NTNEW);
|
||||
device.option_add_internal(slotoptions::GB_SLMULTI, GB_ROM_SLMULTI);
|
||||
device.option_add_internal(slotoptions::GB_GBCK003, GB_ROM_GBCK003);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ extern char const *const GB_CHONGWU;
|
||||
extern char const *const GB_LICHENG;
|
||||
extern char const *const GB_NEWGBCHK;
|
||||
extern char const *const GB_VF001;
|
||||
extern char const *const GB_DIGIMON;
|
||||
extern char const *const GB_NTNEW;
|
||||
extern char const *const GB_SLMULTI;
|
||||
extern char const *const GB_GBCK003;
|
||||
|
||||
|
@ -746,6 +746,9 @@ std::optional<char const *> probe_gbx_footer(std::string_view tag, util::random_
|
||||
case gbxfile::TYPE_VF001:
|
||||
result = slotoptions::GB_VF001;
|
||||
break;
|
||||
case gbxfile::TYPE_NTNEW:
|
||||
result = slotoptions::GB_NTNEW;
|
||||
break;
|
||||
case gbxfile::TYPE_SLMULTI:
|
||||
result = slotoptions::GB_SLMULTI;
|
||||
break;
|
||||
|
@ -65,6 +65,7 @@ enum : u32
|
||||
TYPE_MBC7 = 0x4d424337, // 'MBC7'
|
||||
TYPE_MMM01 = 0x4d4d4d31, // 'MMM1'
|
||||
TYPE_NEWGBCHK = 0x4e47484b, // 'NGHK'
|
||||
TYPE_NTNEW = 0x4e544e00, // 'NTN\0'
|
||||
TYPE_ROCKET = 0x524f434b, // 'ROCK'
|
||||
TYPE_PLAIN = 0x524f4d00, // 'ROM\0'
|
||||
TYPE_SACHEN1 = 0x53414d31, // 'SAM1'
|
||||
|
@ -49,7 +49,6 @@
|
||||
the strategies. Strategies implemented by each cartridge should be identified.
|
||||
* HK0701 and HK0819 seem to differ in that HK0819 fully decodes ROM addresses while HK0701 mirrors - we
|
||||
should probably emulated the difference at some point.
|
||||
* Digimon 2 mapper doesn't work
|
||||
|
||||
***********************************************************************************************************/
|
||||
|
||||
@ -1282,71 +1281,6 @@ private:
|
||||
u8 m_split_enable;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// Yong Yong Digimon 2 (and maybe 4?)
|
||||
//**************************************************************************
|
||||
/*
|
||||
Digimon 2 writes to 0x2000 to set the fine ROM bank, then writes a series
|
||||
of values to 0x2400 that the patched version does not write.
|
||||
Digimon 4 seems to share part of the 0x2000 behavior, but does not write
|
||||
to 0x2400.
|
||||
*/
|
||||
|
||||
class digimon_device : public rom_mbc_device_base
|
||||
{
|
||||
public:
|
||||
digimon_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) :
|
||||
rom_mbc_device_base(mconfig, GB_ROM_DIGIMON, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
virtual image_init_result load(std::string &message) override ATTR_COLD
|
||||
{
|
||||
// set up ROM and RAM
|
||||
if (!install_memory(message, 4, 7))
|
||||
return image_init_result::FAIL;
|
||||
|
||||
// install handlers
|
||||
cart_space()->install_write_handler(
|
||||
0x0000, 0x1fff,
|
||||
write8smo_delegate(*this, FUNC(digimon_device::enable_ram)));
|
||||
cart_space()->install_write_handler(
|
||||
0x2000, 0x2000,
|
||||
write8smo_delegate(*this, FUNC(digimon_device::bank_switch_fine)));
|
||||
cart_space()->install_write_handler(
|
||||
0x4000, 0x5fff,
|
||||
write8smo_delegate(*this, FUNC(digimon_device::bank_switch_coarse)));
|
||||
|
||||
// all good
|
||||
return image_init_result::PASS;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void device_reset() override ATTR_COLD
|
||||
{
|
||||
rom_mbc_device_base::device_reset();
|
||||
|
||||
set_bank_rom_coarse(0);
|
||||
set_bank_rom_fine(1);
|
||||
set_ram_enable(false);
|
||||
set_bank_ram(0);
|
||||
}
|
||||
|
||||
private:
|
||||
void enable_ram(u8 data)
|
||||
{
|
||||
set_ram_enable(0x0a == (data & 0x0f));
|
||||
}
|
||||
|
||||
void bank_switch_fine(u8 data)
|
||||
{
|
||||
data >>= 1;
|
||||
set_bank_rom_fine(data ? data : 1);
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
} // namespace bus::gameboy
|
||||
@ -1360,4 +1294,3 @@ DEFINE_DEVICE_TYPE_PRIVATE(GB_ROM_CHONGWU, device_gb_cart_interface, bus::gameb
|
||||
DEFINE_DEVICE_TYPE_PRIVATE(GB_ROM_LICHENG, device_gb_cart_interface, bus::gameboy::licheng_device, "gb_rom_licheng", "Game Boy Li Cheng MBC5 Cartridge")
|
||||
DEFINE_DEVICE_TYPE_PRIVATE(GB_ROM_NEWGBCHK, device_gb_cart_interface, bus::gameboy::ngbchk_device, "gb_rom_ngbchk", "Game Boy HK0701/HK0819 Cartridge")
|
||||
DEFINE_DEVICE_TYPE_PRIVATE(GB_ROM_VF001, device_gb_cart_interface, bus::gameboy::vf001_device, "gb_rom_vf001", "Game Boy Vast Fame VF001 Cartridge")
|
||||
DEFINE_DEVICE_TYPE_PRIVATE(GB_ROM_DIGIMON, device_gb_cart_interface, bus::gameboy::digimon_device, "gb_rom_digimon", "Game Boy Digimon 2 Cartridge")
|
||||
|
@ -16,6 +16,5 @@ DECLARE_DEVICE_TYPE(GB_ROM_CHONGWU, device_gb_cart_interface)
|
||||
DECLARE_DEVICE_TYPE(GB_ROM_LICHENG, device_gb_cart_interface)
|
||||
DECLARE_DEVICE_TYPE(GB_ROM_NEWGBCHK, device_gb_cart_interface)
|
||||
DECLARE_DEVICE_TYPE(GB_ROM_VF001, device_gb_cart_interface)
|
||||
DECLARE_DEVICE_TYPE(GB_ROM_DIGIMON, device_gb_cart_interface)
|
||||
|
||||
#endif // MAME_BUS_GAMEBOY_MBC_H
|
||||
|
@ -55,6 +55,8 @@
|
||||
#include "emu.h"
|
||||
#include "mbc6.h"
|
||||
|
||||
#include "cartbase.h"
|
||||
|
||||
#include "bus/generic/slot.h"
|
||||
#include "machine/intelfsh.h"
|
||||
|
||||
@ -69,7 +71,7 @@ namespace bus::gameboy {
|
||||
|
||||
namespace {
|
||||
|
||||
class mbc6_device : public device_t, public device_gb_cart_interface
|
||||
class mbc6_device : public mbc_8k_device_base
|
||||
{
|
||||
public:
|
||||
static constexpr feature_type imperfect_features() { return feature::ROM; }
|
||||
@ -85,7 +87,6 @@ protected:
|
||||
virtual void device_reset() override ATTR_COLD;
|
||||
|
||||
private:
|
||||
static inline constexpr unsigned PAGE_ROM_SIZE = 0x2000;
|
||||
static inline constexpr unsigned PAGE_RAM_SIZE = 0x1000;
|
||||
|
||||
template <unsigned Bank> u8 read_flash(offs_t offset);
|
||||
@ -97,18 +98,14 @@ private:
|
||||
void enable_flash_write(u8 data);
|
||||
void enable_ram(u8 data);
|
||||
|
||||
bool check_rom(std::string &message) ATTR_COLD;
|
||||
bool check_ram(std::string &message) ATTR_COLD;
|
||||
void install_rom() ATTR_COLD;
|
||||
void install_ram() ATTR_COLD;
|
||||
|
||||
required_device<intelfsh8_device> m_flash;
|
||||
memory_view m_view_rom_low;
|
||||
memory_view m_view_rom_high;
|
||||
memory_view m_view_ram;
|
||||
memory_bank_array_creator<2> m_bank_rom;
|
||||
memory_bank_array_creator<2> m_bank_ram;
|
||||
u8 m_bank_mask_rom;
|
||||
u8 m_bank_mask_ram;
|
||||
|
||||
u8 m_bank_sel_rom[2];
|
||||
@ -124,15 +121,12 @@ mbc6_device::mbc6_device(
|
||||
char const *tag,
|
||||
device_t *owner,
|
||||
u32 clock) :
|
||||
device_t(mconfig, GB_ROM_MBC6, tag, owner, clock),
|
||||
device_gb_cart_interface(mconfig, *this),
|
||||
mbc_8k_device_base(mconfig, GB_ROM_MBC6, tag, owner, clock),
|
||||
m_flash(*this, "flash"),
|
||||
m_view_rom_low(*this, "romlow"),
|
||||
m_view_rom_high(*this, "romhigh" ),
|
||||
m_view_ram(*this, "ram"),
|
||||
m_bank_rom(*this, { "romlow", "romhigh" }),
|
||||
m_bank_ram(*this, { "ramlow", "ramhigh" }),
|
||||
m_bank_mask_rom(0U),
|
||||
m_bank_mask_ram(0U),
|
||||
m_bank_sel_rom{ 0U, 0U },
|
||||
m_bank_sel_ram{ 0U, 0U },
|
||||
@ -146,6 +140,7 @@ mbc6_device::mbc6_device(
|
||||
image_init_result mbc6_device::load(std::string &message)
|
||||
{
|
||||
// first check that ROM/RAM regions are supportable
|
||||
set_bank_bits_rom(7);
|
||||
if (!check_rom(message) || !check_ram(message))
|
||||
return image_init_result::FAIL;
|
||||
|
||||
@ -155,7 +150,7 @@ image_init_result mbc6_device::load(std::string &message)
|
||||
cart_space()->install_view(0xa000, 0xbfff, m_view_ram);
|
||||
|
||||
// set up ROM and RAM as appropriate
|
||||
install_rom();
|
||||
install_rom(*cart_space(), m_view_rom_low[0], m_view_rom_high[0]);
|
||||
install_ram();
|
||||
|
||||
// install memory controller handlers
|
||||
@ -209,8 +204,11 @@ void mbc6_device::device_add_mconfig(machine_config &config)
|
||||
MACRONIX_29F008TC(config, m_flash);
|
||||
}
|
||||
|
||||
|
||||
void mbc6_device::device_start()
|
||||
{
|
||||
mbc_8k_device_base::device_start();
|
||||
|
||||
save_item(NAME(m_bank_sel_rom));
|
||||
save_item(NAME(m_bank_sel_ram));
|
||||
save_item(NAME(m_flash_select));
|
||||
@ -218,8 +216,11 @@ void mbc6_device::device_start()
|
||||
save_item(NAME(m_flash_writable));
|
||||
}
|
||||
|
||||
|
||||
void mbc6_device::device_reset()
|
||||
{
|
||||
mbc_8k_device_base::device_reset();
|
||||
|
||||
m_bank_sel_rom[0] = 0U;
|
||||
m_bank_sel_rom[1] = 0U;
|
||||
m_bank_sel_ram[0] = 0U;
|
||||
@ -233,17 +234,14 @@ void mbc6_device::device_reset()
|
||||
m_view_rom_high.select(0);
|
||||
m_view_ram.disable();
|
||||
|
||||
if (m_bank_mask_rom)
|
||||
{
|
||||
m_bank_rom[0]->set_entry(0);
|
||||
m_bank_rom[1]->set_entry(0);
|
||||
}
|
||||
|
||||
if (m_bank_mask_ram)
|
||||
{
|
||||
m_bank_ram[0]->set_entry(0);
|
||||
m_bank_ram[1]->set_entry(0);
|
||||
}
|
||||
|
||||
set_bank_rom_low(0);
|
||||
set_bank_rom_high(0);
|
||||
}
|
||||
|
||||
|
||||
@ -291,16 +289,10 @@ void mbc6_device::bank_switch_rom(offs_t offset, u8 data)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bank_mask_rom)
|
||||
{
|
||||
u8 const entry(data & m_bank_mask_rom);
|
||||
LOG(
|
||||
"%s: Set ROM bank %s = 0x%05X\n",
|
||||
machine().describe_context(),
|
||||
bank ? "high" : "low",
|
||||
entry * PAGE_ROM_SIZE);
|
||||
m_bank_rom[bank]->set_entry(entry);
|
||||
}
|
||||
if (bank)
|
||||
set_bank_rom_high(data & 0x7f);
|
||||
else
|
||||
set_bank_rom_low(data & 0x7f);
|
||||
}
|
||||
|
||||
|
||||
@ -441,23 +433,6 @@ void mbc6_device::enable_ram(u8 data)
|
||||
}
|
||||
|
||||
|
||||
bool mbc6_device::check_rom(std::string &message)
|
||||
{
|
||||
memory_region *const romregion(cart_rom_region());
|
||||
if (romregion)
|
||||
{
|
||||
auto const rombytes(romregion->bytes());
|
||||
if (((PAGE_ROM_SIZE < rombytes) && (rombytes & (PAGE_ROM_SIZE - 1))) || ((u32(PAGE_ROM_SIZE) << 7) < rombytes))
|
||||
{
|
||||
message = "Unsupported cartridge ROM size (must be no larger than 8 KiB, or a multiple of 8 KiB and no larger than 2 MiB)";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool mbc6_device::check_ram(std::string &message)
|
||||
{
|
||||
memory_region *const ramregion(cart_ram_region());
|
||||
@ -481,68 +456,6 @@ bool mbc6_device::check_ram(std::string &message)
|
||||
}
|
||||
|
||||
|
||||
void mbc6_device::install_rom()
|
||||
{
|
||||
memory_region *const romregion(cart_rom_region());
|
||||
auto const rombytes(romregion ? romregion->bytes() : 0);
|
||||
if (!rombytes)
|
||||
{
|
||||
// just avoid fatal errors
|
||||
m_view_rom_low[0];
|
||||
m_view_rom_high[0];
|
||||
m_bank_mask_rom = 0U;
|
||||
}
|
||||
else if (PAGE_ROM_SIZE >= rombytes)
|
||||
{
|
||||
// not big enough to need banking - install directly
|
||||
device_generic_cart_interface::install_non_power_of_two<0>(
|
||||
rombytes,
|
||||
PAGE_ROM_SIZE - 1,
|
||||
0,
|
||||
0,
|
||||
0x0000,
|
||||
[this, base = &romregion->as_u8()] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
|
||||
{
|
||||
LOG(
|
||||
"Install ROM 0x%04X-0x%04X at 0x%04X-0x%04X mirror 0x%04X\n",
|
||||
src,
|
||||
src + (end - begin),
|
||||
begin,
|
||||
end,
|
||||
mirror);
|
||||
cart_space()->install_rom(begin, end, 0x2000 | mirror, &base[src]);
|
||||
m_view_rom_low[0].install_rom(0x4000 | begin, 0x4000 | end, mirror, &base[src]);
|
||||
m_view_rom_high[0].install_rom(0x6000 | begin, 0x6000 | end, mirror, &base[src]);
|
||||
});
|
||||
m_bank_mask_rom = 0U;
|
||||
}
|
||||
else
|
||||
{
|
||||
// install the fixed ROM, mirrored if it’s too small
|
||||
if (0x4000 > rombytes)
|
||||
cart_space()->install_rom(0x0000, 0x1fff, 0x2000, romregion->base());
|
||||
else
|
||||
cart_space()->install_rom(0x0000, 0x3fff, 0x0000, romregion->base());
|
||||
|
||||
// configure both banks as views of the ROM
|
||||
m_bank_mask_rom = device_generic_cart_interface::map_non_power_of_two(
|
||||
unsigned(rombytes / PAGE_ROM_SIZE),
|
||||
[this, base = &romregion->as_u8()] (unsigned entry, unsigned page)
|
||||
{
|
||||
LOG(
|
||||
"Install ROM 0x%05X-0x%05X in bank entry %u\n",
|
||||
page * PAGE_ROM_SIZE,
|
||||
(page * PAGE_ROM_SIZE) + (PAGE_ROM_SIZE - 1),
|
||||
entry);
|
||||
m_bank_rom[0]->configure_entry(entry, &base[page * PAGE_ROM_SIZE]);
|
||||
m_bank_rom[1]->configure_entry(entry, &base[page * PAGE_ROM_SIZE]);
|
||||
});
|
||||
m_view_rom_low[0].install_read_bank(0x4000, 0x5fff, m_bank_rom[0]);
|
||||
m_view_rom_high[0].install_read_bank(0x6000, 0x7fff, m_bank_rom[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mbc6_device::install_ram()
|
||||
{
|
||||
memory_region *const ramregion(this->cart_ram_region());
|
||||
|
@ -227,7 +227,7 @@ void mmm01_device::device_reset()
|
||||
|
||||
set_bank_rom_low(0x01fe);
|
||||
set_bank_rom_high(0x01ff);
|
||||
set_bank_ram(0U);
|
||||
set_bank_ram(0);
|
||||
}
|
||||
|
||||
|
||||
|
166
src/devices/bus/gameboy/ntnew.cpp
Normal file
166
src/devices/bus/gameboy/ntnew.cpp
Normal file
@ -0,0 +1,166 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Vas Crabb
|
||||
/***************************************************************************
|
||||
|
||||
Memory controller used for newer NT/Makon games
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "ntnew.h"
|
||||
|
||||
#include "cartbase.ipp"
|
||||
|
||||
//#define VERBOSE 1
|
||||
//#define LOG_OUTPUT_FUNC osd_printf_info
|
||||
#include "logmacro.h"
|
||||
|
||||
|
||||
namespace bus::gameboy {
|
||||
|
||||
namespace {
|
||||
|
||||
class ntnew_device : public mbc_ram_device_base<mbc_8k_device_base>
|
||||
{
|
||||
public:
|
||||
ntnew_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
|
||||
|
||||
virtual image_init_result load(std::string &message) override ATTR_COLD;
|
||||
|
||||
protected:
|
||||
virtual void device_start() override ATTR_COLD;
|
||||
virtual void device_reset() override ATTR_COLD;
|
||||
|
||||
private:
|
||||
void enable_ram(offs_t offset, u8 data);
|
||||
void bank_switch_rom(offs_t offset, u8 data);
|
||||
void bank_switch_ram(u8 data);
|
||||
|
||||
memory_view m_view_ram;
|
||||
|
||||
u8 m_bank_8k;
|
||||
};
|
||||
|
||||
|
||||
ntnew_device::ntnew_device(
|
||||
machine_config const &mconfig,
|
||||
char const *tag,
|
||||
device_t *owner,
|
||||
u32 clock) :
|
||||
mbc_ram_device_base<mbc_8k_device_base>(mconfig, GB_ROM_NTNEW, tag, owner, clock),
|
||||
m_view_ram(*this, "ram"),
|
||||
m_bank_8k(0U)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
image_init_result ntnew_device::load(std::string &message)
|
||||
{
|
||||
// set up ROM and RAM
|
||||
set_bank_bits_rom(8);
|
||||
set_bank_bits_ram(4);
|
||||
if (!check_rom(message) || !check_ram(message))
|
||||
return image_init_result::FAIL;
|
||||
cart_space()->install_view(0xa000, 0xbfff, m_view_ram);
|
||||
install_rom(*cart_space(), *cart_space(), *cart_space());
|
||||
install_ram(m_view_ram[0]);
|
||||
|
||||
// install handlers
|
||||
cart_space()->install_write_handler(
|
||||
0x0000, 0x1fff,
|
||||
write8sm_delegate(*this, FUNC(ntnew_device::enable_ram)));
|
||||
cart_space()->install_write_handler(
|
||||
0x2000, 0x2fff,
|
||||
write8sm_delegate(*this, FUNC(ntnew_device::bank_switch_rom)));
|
||||
cart_space()->install_write_handler(
|
||||
0x4000, 0x5fff,
|
||||
write8smo_delegate(*this, FUNC(ntnew_device::bank_switch_ram)));
|
||||
|
||||
// all good
|
||||
return image_init_result::PASS;
|
||||
}
|
||||
|
||||
|
||||
void ntnew_device::device_start()
|
||||
{
|
||||
mbc_ram_device_base<mbc_8k_device_base>::device_start();
|
||||
|
||||
save_item(NAME(m_bank_8k));
|
||||
}
|
||||
|
||||
|
||||
void ntnew_device::device_reset()
|
||||
{
|
||||
mbc_ram_device_base<mbc_8k_device_base>::device_reset();
|
||||
|
||||
m_view_ram.disable();
|
||||
m_bank_8k = 0U;
|
||||
|
||||
set_bank_rom_low(2);
|
||||
set_bank_rom_high(3);
|
||||
set_bank_ram(0);
|
||||
}
|
||||
|
||||
|
||||
void ntnew_device::enable_ram(offs_t offset, u8 data)
|
||||
{
|
||||
// TODO: what range actually triggers this, and does it still trigger RAM enable?
|
||||
if (((offset & 0xff00) == 0x1400) & (0x55 == data))
|
||||
{
|
||||
LOG("%s: 8K ROM banking enabled\n", machine().describe_context());
|
||||
m_bank_8k = 1U;
|
||||
}
|
||||
|
||||
// TODO: how many bits are checked?
|
||||
bool const enable = 0x0a == (data & 0x0f);
|
||||
LOG(
|
||||
"%s: Cartridge RAM %s\n",
|
||||
machine().describe_context(),
|
||||
enable ? "enabled" : "disabled");
|
||||
if (enable)
|
||||
m_view_ram.select(0);
|
||||
else
|
||||
m_view_ram.disable();
|
||||
}
|
||||
|
||||
|
||||
void ntnew_device::bank_switch_rom(offs_t offset, u8 data)
|
||||
{
|
||||
if (m_bank_8k)
|
||||
{
|
||||
// TODO: what ranges does the controller actually respond to?
|
||||
switch (offset & 0xff00)
|
||||
{
|
||||
case 0x0000:
|
||||
if (!(data & 0xfe))
|
||||
data |= 0x02;
|
||||
set_bank_rom_low(data);
|
||||
return;
|
||||
|
||||
case 0x0400:
|
||||
if (!(data & 0xfe))
|
||||
data |= 0x02;
|
||||
set_bank_rom_high(data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
data <<= 1;
|
||||
if (!(data & 0xfe))
|
||||
data |= 0x02;
|
||||
set_bank_rom_low(data);
|
||||
set_bank_rom_high(data | 0x01);
|
||||
}
|
||||
|
||||
|
||||
void ntnew_device::bank_switch_ram(u8 data)
|
||||
{
|
||||
set_bank_ram(data & 0x0f);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
} // namespace bus::gameboy
|
||||
|
||||
|
||||
DEFINE_DEVICE_TYPE_PRIVATE(GB_ROM_NTNEW, device_gb_cart_interface, bus::gameboy::ntnew_device, "gb_rom_ntnew", "Game Boy newer NT/Makon Cartridge")
|
18
src/devices/bus/gameboy/ntnew.h
Normal file
18
src/devices/bus/gameboy/ntnew.h
Normal file
@ -0,0 +1,18 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Vas Crabb
|
||||
/***************************************************************************
|
||||
|
||||
Memory controller used for newer NT/Makon games
|
||||
|
||||
***************************************************************************/
|
||||
#ifndef MAME_BUS_GAMEBOY_NTNEW_H
|
||||
#define MAME_BUS_GAMEBOY_NTNEW_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "slot.h"
|
||||
|
||||
|
||||
DECLARE_DEVICE_TYPE(GB_ROM_NTNEW, device_gb_cart_interface)
|
||||
|
||||
#endif // MAME_BUS_GAMEBOY_NTNEW_H
|
Loading…
Reference in New Issue
Block a user