From 5e9008a37802ac40fc439d5e02f8893940000e46 Mon Sep 17 00:00:00 2001 From: angelosa Date: Sat, 25 Nov 2023 15:34:34 +0100 Subject: sega/sms_bootleg.cpp: simplify banking scheme, move menu roms inside game_data space, fix smssgamea game loading --- src/mame/sega/sms_bootleg.cpp | 115 +++++++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 52 deletions(-) diff --git a/src/mame/sega/sms_bootleg.cpp b/src/mame/sega/sms_bootleg.cpp index 8c1809b884f..d5cb76800ac 100644 --- a/src/mame/sega/sms_bootleg.cpp +++ b/src/mame/sega/sms_bootleg.cpp @@ -17,9 +17,10 @@ smssgame - 05 Super Mario: crashes, seemingly expects $8000-$bfff to be a copy of $0000-$3fff, open bus? btanb? - 29 Goonies: either boots (with bad title screen GFXs) or outright crashes (similar to Super Mario?) - SG-1000 "newer" conversions all sports dimmed main sprite, cfr. 15 Bomb Jack or 20 Pitfall II +- 03 Wonder Boy: minor GFX glitch on stage start screen for a split second, is the MCU also capable of VDP reset? smssgamea -- Different banking, TBD +- Same issues as smssgame there are also empty k9/k10/k11/k12 positions, but they were clearly never used. @@ -258,7 +259,6 @@ class smsbootleg_state : public sms_state public: smsbootleg_state(const machine_config &mconfig, device_type type, const char *tag) : sms_state(mconfig, type, tag) - , m_rom_view(*this, "rom_view") , m_game_bank(*this, "game_bank%u", 1U) , m_game_data(*this, "game_data") {} @@ -272,13 +272,13 @@ protected: virtual void machine_reset() override; virtual void refresh_banks(); - memory_view m_rom_view; required_memory_bank_array<3> m_game_bank; required_memory_region m_game_data; u8 m_rom_select = 0; - u8 m_main_bank_mailbox = 0; - u8 m_sub_bank_mailbox = 0; + u8 m_bank_mailbox[2] = { 0, 0 }; + // menu bank is presumed to initialize with bank 1 on this set (from MCU?) + virtual u16 menu_bank() { return 1; } private: void port08_w(uint8_t data); @@ -288,6 +288,17 @@ private: void sms_supergame_map(address_map &map); }; +class smsbootleg_a_state : public smsbootleg_state +{ +public: + smsbootleg_a_state(const machine_config &mconfig, device_type type, const char *tag) + : smsbootleg_state(mconfig, type, tag) + {} + +protected: + virtual u16 menu_bank() override { return 0; } +}; + void smsbootleg_state::machine_start() { sms_state::machine_start(); @@ -298,18 +309,18 @@ void smsbootleg_state::machine_start() void smsbootleg_state::machine_reset() { sms_state::machine_reset(); - m_rom_view.select(0); - for (auto &bank : m_game_bank) - bank->set_entry(0); - m_sub_bank_mailbox = 0; + m_bank_mailbox[0] = 1; + m_bank_mailbox[1] = 2; + m_rom_select = menu_bank(); + refresh_banks(); } // TODO: different for smssgamea, to be virtualized later void smsbootleg_state::refresh_banks() { const u16 base_rom_bank = ((m_rom_select & 0xf) << 5) + ((m_rom_select & 0xf0) >> 3); - const u8 main_bank = (m_main_bank_mailbox & 0x7) + ((m_main_bank_mailbox & 8) << 2); - const u8 sub_bank = (m_sub_bank_mailbox & 0x7) + ((m_sub_bank_mailbox & 8) << 2); + const u8 main_bank = (m_bank_mailbox[0] & 0xf); + const u8 sub_bank = (m_bank_mailbox[1] & 0xf); LOG("$0000-$3fff %08x $4000-$7fff %08x $8000-$bfff %08x\n" , base_rom_bank * 0x4000 @@ -327,26 +338,29 @@ void smsbootleg_state::refresh_banks() void smsbootleg_state::sms_supergame_map(address_map &map) { map.unmap_value_high(); - map(0x0000, 0xfff7).view(m_rom_view); - m_rom_view[0](0x0000, 0xbfff).rom().region("maincpu", 0); - m_rom_view[1](0x0000, 0x3fff).bankr("game_bank1"); - m_rom_view[1](0x4000, 0x7fff).bankr("game_bank2"); - m_rom_view[1](0x8000, 0xbfff).bankr("game_bank3"); + map(0x0000, 0x3fff).bankr("game_bank1"); + map(0x4000, 0x7fff).bankr("game_bank2"); + map(0x8000, 0xbfff).bankr("game_bank3"); map(0xc000, 0xfff7).ram(); // map(0xfffc, 0xffff).rw(FUNC(smsbootleg_state::sms_mapper_r), FUNC(smsbootleg_state::sms_mapper_w)); // Bankswitch control - map(0xfffe, 0xfffe).lw8( + // This is basically identical to the base SMS HW + // https://www.smspower.org/Development/Mappers#TheSegaMapper + map(0xfffe, 0xfffe).lrw8( + NAME([this] () { + return m_bank_mailbox[0]; + }), NAME([this] (u8 data) { - m_main_bank_mailbox = data; + m_bank_mailbox[0] = data; LOG("map $fffe: %02x\n", data); refresh_banks(); }) ); map(0xffff, 0xffff).lrw8( NAME([this] () { - return m_sub_bank_mailbox; + return m_bank_mailbox[1]; }), NAME([this] (u8 data) { - m_sub_bank_mailbox = data; + m_bank_mailbox[1] = data; LOG("map $ffff: %02x\n", data); refresh_banks(); }) @@ -356,7 +370,6 @@ void smsbootleg_state::sms_supergame_map(address_map &map) void smsbootleg_state::port08_w(uint8_t data) { // TODO: the MCU definitely controls this, including switch back to attract menu once timer expires - m_rom_view.select(1); m_rom_select = data; LOG("I/O $08: %02x\n", data); refresh_banks(); @@ -485,17 +498,9 @@ void smsbootleg_state::sms_supergame(machine_config &config) void smsbootleg_state::init_sms_supergame() { - uint8_t* rom = memregion("maincpu")->base(); uint8_t* game_roms = memregion("game_data")->base(); - - size_t size = memregion("maincpu")->bytes(); + size_t size = memregion("game_data")->bytes(); - for (int i = 0; i < size; i++) - { - rom[i] ^= 0x80; - } - - size = memregion("game_data")->bytes(); for (int i = 0; i < size; i++) { game_roms[i] ^= 0x80; @@ -504,12 +509,12 @@ void smsbootleg_state::init_sms_supergame() ROM_START( smssgame ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "rom1.bin", 0x00000, 0x10000, CRC(0e1f258e) SHA1(9240dc0d01e3061c0c8807c07c0a1d033ebe9116) ) // yes, this rom is smaller (menu rom) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) ROM_REGION( 0x800000, "game_data", ROMREGION_ERASEFF ) ROM_LOAD( "k2.bin", 0x000000, 0x20000, CRC(a12439f4) SHA1(e957d4fe275e982bedef28af8cc2957da27dc512) ) // Final Bubble Bobble (1/2) - ROM_LOAD( "k1.bin", 0x080000, 0x20000, CRC(dadffecd) SHA1(68ebb968539049a9e193da5200856b9f956f7e02) ) // Final Bubble Bobble (2/2) + ROM_LOAD( "k1.bin", 0x020000, 0x20000, CRC(dadffecd) SHA1(68ebb968539049a9e193da5200856b9f956f7e02) ) // Final Bubble Bobble (2/2) + ROM_LOAD( "rom1.bin", 0x80000, 0x10000, CRC(0e1f258e) SHA1(9240dc0d01e3061c0c8807c07c0a1d033ebe9116) ) // yes, this rom is smaller (menu rom) ROM_LOAD( "k3.bin", 0x100000, 0x20000, CRC(9bb92096) SHA1(3ca17b7a9aa20b97cac1f78ba13f70bed1b37463) ) // Solomon's Key ROM_LOAD( "k4.bin", 0x180000, 0x20000, CRC(e5903942) SHA1(d0c02f4b37c8a02142868459af14ba8ed0340ccd) ) // Magical Tree / Chustle Chumy / Congo Bongo / Charlie Circus ROM_LOAD( "k5.bin", 0x200000, 0x20000, CRC(a7b64d1c) SHA1(7c37ac3f37699c49492d4f4ea4e213670413041c) ) // Flicky / Galaxian / King's Valley / Pippos @@ -531,26 +536,32 @@ ROM_START( smssgame ) ROM_END +// On this version some games gets loaded from space mirrors (particularly the ones that were using mask roms on the other set) ROM_START( smssgamea ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "02.k2", 0x000000, 0x10000, CRC(66ed320e) SHA1(e838cb98fbd295259707f8f7ce433b28baa846e3) ) // menu is here on this one + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) ROM_REGION( 0x800000, "game_data", ROMREGION_ERASEFF ) - ROM_LOAD( "01.k1", 0x000000, 0x20000, CRC(18fd8607) SHA1(f24fbe863e19b513369858bf1260355e92444071) ) // Tri-Formation - ROM_LOAD( "03.k3", 0x080000, 0x20000, CRC(9bb92096) SHA1(3ca17b7a9aa20b97cac1f78ba13f70bed1b37463) ) // Solomon's Key - ROM_LOAD( "04.k4", 0x100000, 0x20000, CRC(28f6f4a9) SHA1(87809d93b8393b3186672c217fa1dec8b152af16) ) // Maisc Tree, Mouse, Invaders, Astro - ROM_LOAD( "05.k5", 0x180000, 0x20000, CRC(350591a4) SHA1(ceb3c4a0fc85c5fbc5a045e9c83c3e7ec4d535cc) ) // Congo Bongo, Circus, Super Mario, Ghost House - ROM_LOAD( "06.k6", 0x200000, 0x20000, CRC(9c5e7cc7) SHA1(4613928e30b7faaa41d550fa41906e13a6059513) ) // Flicky, Galaxian, Bomb Jack, Galaga - ROM_LOAD( "07.k7", 0x280000, 0x20000, CRC(8046a2c0) SHA1(c80298dd56db8c09cac5263e4c01a627ab1a4cda) ) // Kings Vally, Pippols, Goonies, Road Runner I - ROM_LOAD( "08.k8", 0x300000, 0x20000, CRC(ee366e0f) SHA1(3770aa71372e7dbdfd357b239a0fbdf8880dc135) ) // Dragon Story, Spy Vs Spy, Road Fighter - ROM_LOAD( "09.k9", 0x380000, 0x20000, CRC(50a66ef6) SHA1(8eb8d1a7ecca99d1722534be269a6264d49b9dd4) ) // Tetris, Teddy Boy, Pitfall 2 - ROM_LOAD( "10.k10", 0x400000, 0x10000, CRC(ca7ab2df) SHA1(11a85f03ec21d481c5cdfcfb749da20b8569d09a) ) // Drol, Pit Pot - ROM_LOAD( "11.k11", 0x480000, 0x10000, CRC(b03b612f) SHA1(537b7d72e1e06e17db6206a37f2480c14f46b9fc) ) // Hyper Sports, Super Tank - ROM_LOAD( "12.k12", 0x500000, 0x20000, CRC(eb1e8693) SHA1(3283cdcfc25f34a43f317093cd39e10a52bc3ae7) ) // Alex Kidd - ROM_LOAD( "13.rom4", 0x580000, 0x20000, CRC(8767f1c9) SHA1(683cedb001e859c2c7ccde2571104f1eb9f09c2f) ) // Wonderboy - ROM_LOAD( "14.rom3", 0x600000, 0x20000, CRC(889bb269) SHA1(0a92b339c19240bfea29ee24fee3e7d780b0cd5c) ) // Hello Kang Si - ROM_LOAD( "15.rom2", 0x680000, 0x20000, CRC(c1478323) SHA1(27b524a234f072e81ef41fb89a5fff5617e9b951) ) // Buk Doo Gun -// ROM_FILL( 0x200000, 0x80000, 0xff) // ROM1 position not populated + ROM_LOAD( "02.k2", 0x000000, 0x10000, CRC(66ed320e) SHA1(e838cb98fbd295259707f8f7ce433b28baa846e3) ) // menu is here on this one + + ROM_LOAD( "01.k1", 0x080000, 0x20000, CRC(18fd8607) SHA1(f24fbe863e19b513369858bf1260355e92444071) ) // Tri-Formation + ROM_LOAD( "03.k3", 0x100000, 0x20000, CRC(9bb92096) SHA1(3ca17b7a9aa20b97cac1f78ba13f70bed1b37463) ) // Solomon's Key + ROM_LOAD( "04.k4", 0x1a0000, 0x20000, CRC(28f6f4a9) SHA1(87809d93b8393b3186672c217fa1dec8b152af16) ) // Masic Tree, Mouse, Invaders, Astro + ROM_LOAD( "05.k5", 0x220000, 0x20000, CRC(350591a4) SHA1(ceb3c4a0fc85c5fbc5a045e9c83c3e7ec4d535cc) ) // Congo Bongo, Circus, Super Mario, Ghost House + ROM_LOAD( "06.k6", 0x2a0000, 0x20000, CRC(9c5e7cc7) SHA1(4613928e30b7faaa41d550fa41906e13a6059513) ) // Flicky, Galaxian, Bomb Jack, Galaga + ROM_LOAD( "07.k7", 0x320000, 0x20000, CRC(8046a2c0) SHA1(c80298dd56db8c09cac5263e4c01a627ab1a4cda) ) // Kings Vally, Pippols, Goonies, Road Runner I + ROM_LOAD( "08.k8", 0x380000, 0x20000, CRC(ee366e0f) SHA1(3770aa71372e7dbdfd357b239a0fbdf8880dc135) ) // Dragon Story, Spy Vs Spy, Road Fighter + ROM_RELOAD( 0x3a0000, 0x20000 ) + ROM_LOAD( "09.k9", 0x400000, 0x20000, CRC(50a66ef6) SHA1(8eb8d1a7ecca99d1722534be269a6264d49b9dd4) ) // Tetris, Teddy Boy, Pitfall 2 + ROM_RELOAD( 0x420000, 0x20000 ) + ROM_LOAD( "10.k10", 0x480000, 0x10000, CRC(ca7ab2df) SHA1(11a85f03ec21d481c5cdfcfb749da20b8569d09a) ) // Drol, Pit Pot + ROM_RELOAD( 0x4a0000, 0x10000 ) + ROM_LOAD( "11.k11", 0x500000, 0x10000, CRC(b03b612f) SHA1(537b7d72e1e06e17db6206a37f2480c14f46b9fc) ) // Hyper Sports, Super Tank + ROM_RELOAD( 0x520000, 0x10000 ) + ROM_LOAD( "12.k12", 0x580000, 0x20000, CRC(eb1e8693) SHA1(3283cdcfc25f34a43f317093cd39e10a52bc3ae7) ) // Alex Kidd + ROM_LOAD( "13.rom4", 0x600000, 0x20000, CRC(8767f1c9) SHA1(683cedb001e859c2c7ccde2571104f1eb9f09c2f) ) // Wonderboy + ROM_LOAD( "14.rom3", 0x680000, 0x20000, CRC(889bb269) SHA1(0a92b339c19240bfea29ee24fee3e7d780b0cd5c) ) // Hello Kang Si + ROM_LOAD( "15.rom2", 0x700000, 0x20000, CRC(c1478323) SHA1(27b524a234f072e81ef41fb89a5fff5617e9b951) ) // Buk Doo Gun +// ROM_FILL( 0x780000, 0x80000, 0xff) // ROM1 position not populated // there seems to be some kind of MCU for the timer? ROM_END @@ -559,5 +570,5 @@ ROM_END // these haven't been set as clones because they contain different games -GAME( 199?, smssgame, 0, sms_supergame, sms_supergame, smsbootleg_state, init_sms_supergame, ROT0, "Sono Corp Japan", "Super Game (Sega Master System Multi-game bootleg)", MACHINE_NOT_WORKING ) -GAME( 1990, smssgamea, 0, sms_supergame, sms_supergame, smsbootleg_state, init_sms_supergame, ROT0, "Seo Jin (TV-Tuning license)", "Super Game (Sega Master System Multi-game bootleg) (alt games)", MACHINE_NOT_WORKING ) // for German market? +GAME( 199?, smssgame, 0, sms_supergame, sms_supergame, smsbootleg_state, init_sms_supergame, ROT0, "Sono Corp Japan", "Super Game (Sega Master System Multi-game bootleg, 01 Final Bubble Bobble)", MACHINE_NOT_WORKING ) +GAME( 1990, smssgamea, 0, sms_supergame, sms_supergame, smsbootleg_a_state, init_sms_supergame, ROT0, "Seo Jin (TV-Tuning license)", "Super Game (Sega Master System Multi-game bootleg, 01 Tri Formation)", MACHINE_NOT_WORKING ) // for German market? -- cgit v1.2.3