From 28526d60b9b8939f80d6768089254bee1825cfbc Mon Sep 17 00:00:00 2001 From: "Benjamin C. Wiley Sittler" Date: Sun, 14 May 2023 15:08:55 -0700 Subject: [PATCH] Add mapper `#47` MAPPER_SMS_Power_256KB_FFFF_FFFE for power-cycling multicarts of 256KB SMS games (Super 2 in 1 - Sonic & Alien Storm [SMS-GG], Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG], Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG]) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As Meka does not yet expose keyboard shortcuts for power-cycling, nor mapper hooks for responding to it, the mapper is currently implemented in terms of reset instead of power-cycle. As the Game Gear did not have a reset button, this does not end up actually breaking any functionality Scroll down for descriptions of each multicart --- I've been calling this menu-less SMS-GG multicart "Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl)" but the actual name is not known The cartridge label lists the contents in English and Traditional Chinese: SONIC 超音鼠 (i.e. "sonic mouse") ALIEN STORM 異形風暴 (i.e. "alien storm") Other label contents: PORTABLE VIDEO GAME SYSTEM ゲームギア (i.e. Game Gear, in Japanese) GAME GEAR COLOR VIDEO GAME I have a second cartridge with identical contents. The label on that one does not include chinese, and lists the games as: Super 2 in 1 - Sonic - Alienstorm Despite the cartridge being Game Gear-shaped, it operates exclusively in SMS-GG mode and the games are both unmodified copies of standard SMS releases This is a 512KB ROM containing two 256KB SMS games: Sonic The Hedgehog and Alien Storm There does not seem to be any sort of menu, and switching games is accomplished by power-cycling the console Each game uses the Sega mapper registers for paging. This paging does not cross game boundaries, it wraps at 256KB instead ROM fingerprint info: 512K Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl).sms Checking for export header with matching CRC... YES sha256:7382900a9f84653eae7f621aea31da0b17db74357857fdce4ebfafdef6f831e8 Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl).sms sha1:9deeb3ef00feeeaebd33d289ed266201aa62bdf3 Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl).sms md5:19ee7015deaef4cd7b2df4edad3e1aef Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl).sms mekacrc:414DF3905F54E953 Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl).sms crc32:c5c66fa8 Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl).sms 256K Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl)/part-00-Sonic The Hedgehog (EU,US,BR)-256k.sms Checking for export header with matching CRC... YES sha256:6ad738965ece231427ee046b9905cfee470d5c01220afdd934da4673e4a2458b Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl)/part-00-Sonic The Hedgehog (EU,US,BR)-256k.sms sha1:6b9677e4a9abb37765d6db4658f4324251807e07 Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl)/part-00-Sonic The Hedgehog (EU,US,BR)-256k.sms md5:dc13a61eafe75c13c15b5ece419ac57b Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl)/part-00-Sonic The Hedgehog (EU,US,BR)-256k.sms mekacrc:2F2C8E1A0AE456B9 Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl)/part-00-Sonic The Hedgehog (EU,US,BR)-256k.sms crc32:b519e833 Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl)/part-00-Sonic The Hedgehog (EU,US,BR)-256k.sms 256K Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl)/part-10-Alien Storm (EU,BR)-256k.sms Checking for export header with matching CRC... YES sha256:6ce161836437106b3cef1e0e71e4045b97f4f2aeb851e9106a99751aba0abcc8 Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl)/part-10-Alien Storm (EU,BR)-256k.sms sha1:aece64ecbfbe08b199b29df9bc75743773ea3d34 Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl)/part-10-Alien Storm (EU,BR)-256k.sms md5:c60380642a89805f569124a875248d71 Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl)/part-10-Alien Storm (EU,BR)-256k.sms mekacrc:122165765570939A Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl)/part-10-Alien Storm (EU,BR)-256k.sms crc32:7f30f793 Super 2 in 1 - Sonic & Alien Storm [SMS-GG] (Unl)/part-10-Alien Storm (EU,BR)-256k.sms --- I've been calling it "Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)" I have this as a loose cartridge only. There appears to be no collection title. The cartridge label has pictures for each of the four included games Also on the label: GEAR GAME This is a 1MB Game Gear-shaped multicart with no menu. Rotating through the included games is accomplished by power-cycling. Each of the four included games is an unmodified 256KB SMS release and runs in SMS-GG mode; the games are: SMS: Moonwalker, Double Dragon, Sagaia, Spider-Man The individual games use the Sega mapper, but that does not map across game boundaries ROM fingerprint info: 1.0M Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl).sms Checking for export header with matching CRC... YES sha256:9f113a6cc339941b0bdc9d12910ea32f02e7d34c8ed1a7931e45075340d54cad Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl).sms sha1:d5ff9f75ecc39b23d4ed7f7ce3ba847b5026b1d4 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl).sms md5:79732827c33b2d8babe8edbdb2ecac93 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl).sms mekacrc:F0B71C1C94F56830 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl).sms crc32:f4de22f1 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl).sms 256K Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-00-Moonwalker (Michael Jackson's) (US,EU,BR,KR)-256k.sms Checking for export header with matching CRC... YES sha256:1b9c2fffeb533a086e078188e9747112b4320f7c9c5d5f1e98bd1ac7157ed3b6 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-00-Moonwalker (Michael Jackson's) (US,EU,BR,KR)-256k.sms sha1:939416cebb381458d28ff628afb3d1f80293afa9 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-00-Moonwalker (Michael Jackson's) (US,EU,BR,KR)-256k.sms md5:aa3bc8467e80a6aaab02051818ecb035 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-00-Moonwalker (Michael Jackson's) (US,EU,BR,KR)-256k.sms mekacrc:FA387D6C37963DDB Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-00-Moonwalker (Michael Jackson's) (US,EU,BR,KR)-256k.sms crc32:56cc906b Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-00-Moonwalker (Michael Jackson's) (US,EU,BR,KR)-256k.sms 256K Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-01-Double Dragon (JP,US,EU,BR,KR)-256k.sms Checking for export header with matching CRC... YES sha256:26290f94a597ad015da5b74e8d3649aa50b033c280c81fbfa460f947376b776a Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-01-Double Dragon (JP,US,EU,BR,KR)-256k.sms sha1:cad5532af94ed75c0ada8820a83fa04d22f7bef5 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-01-Double Dragon (JP,US,EU,BR,KR)-256k.sms md5:fe9aa8044951b10f876b15f4456161a9 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-01-Double Dragon (JP,US,EU,BR,KR)-256k.sms mekacrc:3488F258EC375C7B Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-01-Double Dragon (JP,US,EU,BR,KR)-256k.sms crc32:a55d89f3 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-01-Double Dragon (JP,US,EU,BR,KR)-256k.sms 256K Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-02-Sagaia (EU,BR)-256k.sms Checking for export header with matching CRC... YES sha256:6038714821cbd5cecc862527496463d9404e79ec814781655741863f66cadf99 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-02-Sagaia (EU,BR)-256k.sms sha1:2a3e859139f8ca83494bb800dc848fe4d02db82a Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-02-Sagaia (EU,BR)-256k.sms md5:d8a4c95203bbe294760085189f9544fa Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-02-Sagaia (EU,BR)-256k.sms mekacrc:D28E2F698C014338 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-02-Sagaia (EU,BR)-256k.sms crc32:66388128 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-02-Sagaia (EU,BR)-256k.sms 256K Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-03-Spider-Man - vs. The Kingpin (EU,US,BR,AU)-256k.sms Checking for export header with matching CRC... YES sha256:cbc3ccef0f16d33153239f2f6ce7bc96059b23383da06cd99f93b40316b8bfbe Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-03-Spider-Man - vs. The Kingpin (EU,US,BR,AU)-256k.sms sha1:02ebee891d88bacdadd37a3e75e05763b7ad3c9b Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-03-Spider-Man - vs. The Kingpin (EU,US,BR,AU)-256k.sms md5:fa10ee70e43385e88e5d1a008716668b Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-03-Spider-Man - vs. The Kingpin (EU,US,BR,AU)-256k.sms mekacrc:F0697EEFE5278CA2 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-03-Spider-Man - vs. The Kingpin (EU,US,BR,AU)-256k.sms crc32:908ff25c Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] (Unl)/part-03-Spider-Man - vs. The Kingpin (EU,US,BR,AU)-256k.sms --- I've been calling this "Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl)" but its actual name is unclear The label says: 双截龍 (shuang jie long, i.e. "twin dragons"/"dragon twins", the Chinese title characters for Double Dragon) SUPER 2 IN 1 魔界村 (Makai Mura, i.e. "Demon World Village", the Japanese title for Ghouls'n Ghosts) This is a menu-less power-cycling 512KB SMS-GG multicart containing two 256KB SMS games: Ghouls'n Ghosts, Double Dragon The boot-up game from a discharged state seems to be Ghouls'n Ghosts. Each power-cycle rotates to the other game The PCB appears to use a capacitor to preserve mapper state across the power-cycles used to rotate through the games Both games are unmodified compared to their official releases 512K Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl).sms Checking for export header with matching CRC... YES sha256:5f88de3df4e627ae70c3787e4803458cc0f089ba301ae054bbd1355808101f73 Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl).sms sha1:279eb9deba7d59f05d81062e62952ddbccf1dda7 Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl).sms md5:0d8135a36ff768de78643a7dd25cbb5d Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl).sms mekacrc:0FE54D8F9C2ED591 Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl).sms crc32:4f72c1fc Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl).sms 256K Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl)/part-00-Ghouls'n Ghosts (US,EU,BR,KR)-256k.sms Checking for export header with matching CRC... YES sha256:d5730a00b6f54aa7a68d815db358f82aa4e8b45dd3bc8712b4f1de18658b8ffe Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl)/part-00-Ghouls'n Ghosts (US,EU,BR,KR)-256k.sms sha1:b193e624795b2beb741249981d621cb650c658db Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl)/part-00-Ghouls'n Ghosts (US,EU,BR,KR)-256k.sms md5:85707b3a74483910699ccc4ba20c64ff Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl)/part-00-Ghouls'n Ghosts (US,EU,BR,KR)-256k.sms mekacrc:DB5D5B37B0F77916 Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl)/part-00-Ghouls'n Ghosts (US,EU,BR,KR)-256k.sms crc32:7a92eba6 Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl)/part-00-Ghouls'n Ghosts (US,EU,BR,KR)-256k.sms 256K Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl)/part-10-Double Dragon (JP,US,EU,BR,KR)-256k.sms Checking for export header with matching CRC... YES sha256:26290f94a597ad015da5b74e8d3649aa50b033c280c81fbfa460f947376b776a Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl)/part-10-Double Dragon (JP,US,EU,BR,KR)-256k.sms sha1:cad5532af94ed75c0ada8820a83fa04d22f7bef5 Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl)/part-10-Double Dragon (JP,US,EU,BR,KR)-256k.sms md5:fe9aa8044951b10f876b15f4456161a9 Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl)/part-10-Double Dragon (JP,US,EU,BR,KR)-256k.sms mekacrc:3488F258EC375C7B Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl)/part-10-Double Dragon (JP,US,EU,BR,KR)-256k.sms crc32:a55d89f3 Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] (Unl)/part-10-Double Dragon (JP,US,EU,BR,KR)-256k.sms --- meka/compat.txt | 5 ++++- meka/meka.nam | 3 +++ meka/srcs/machine.cpp | 34 ++++++++++++++++++++++++++++++++++ meka/srcs/mappers.cpp | 30 ++++++++++++++++++++++++++++++ meka/srcs/mappers.h | 2 ++ meka/srcs/saves.cpp | 13 +++++++++++++ 6 files changed, 86 insertions(+), 1 deletion(-) diff --git a/meka/compat.txt b/meka/compat.txt index ab16dc0f..15fd6de4 100644 --- a/meka/compat.txt +++ b/meka/compat.txt @@ -549,6 +549,8 @@ Summer Games [Proto 0] - Ok (No audio) Summer Games [Proto 1] FM Ok Suho Jeonsa (KR) - Ok + Super 2 in 1 - Sonic & Alien Storm [SMS-GG] - *Ok + Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG] - *Ok Super Basketball [Demo] - Ok Super Bioman I (KR) - Ok Super Boy I (KR) - Ok @@ -622,6 +624,7 @@ Ultima IV FM Ok Ultima IV [Proto] FM Ok Ultimate Soccer - Ok + Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] - *Ok Vigilante FM Ok Virtua Fighter Animation - Ok Walter Payton Football - Ok @@ -672,7 +675,7 @@ Zillion II: The Tri Formation [Proto] FM Ok Zool - Ok ----------------------------------------------------------------------------- - 651 games tested - 647 are "Ok" + 654 games tested - 650 are "Ok" ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- diff --git a/meka/meka.nam b/meka/meka.nam index 77c032bf..5439e36f 100644 --- a/meka/meka.nam +++ b/meka/meka.nam @@ -641,6 +641,8 @@ SMS 8da5c93f AF2D01D4A78C8B91 Summer Games/NAME_BR=Jogos Olímpicos/COUNTRY=EU SMS 4f530cb2 D1B42E8EF4C358B0 Summer Games [Proto 0]/FLAGS=PROTO/COMMENT=Early prototype version of the game. No audio. SMS 80eb1fff 420EEF0B240F3152 Summer Games [Proto 1]/FLAGS=PROTO/COMMENT=Prototype version of the game. SMS 01686d67 88E8E8D0608B22CB Suho Jeonsa/COUNTRY=KR/PRODUCT_NO=DS-G402 +SMS c5c66fa8 414DF3905F54E953 Super 2 in 1 - Sonic & Alien Storm [SMS-GG]/FLAGS=SMSGG_MODE/EMU_MAPPER=47 +SMS 4f72c1fc 0FE54D8F9C2ED591 Super 2 in 1 - Double Dragon, Ghouls'n Ghosts [SMS-GG]/FLAGS=SMSGG_MODE/EMU_MAPPER=47 SMS 0dbf3b4a 01EF5A009C6701B2 Super Basketball [Demo]/FLAGS=PROTO/COUNTRY=US/COMMENT=Rolling non-interactive demo to advertise unreleased game. Was shown at the CES exposition floor in USA (around 1989?). SMS a66d26cf 5E7FE6D39D642445 Super Bioman I/COUNTRY=KR SMS bf5a994a 8DF09E55615029B6 Super Boy I/COUNTRY=KR @@ -717,6 +719,7 @@ SMS e1714a88 830DC65B43CD65DA TV Colosso (As Aventuras da)/COUNTRY=BR/PRODUCT_ SMS b52d60c8 3EEC41D938FA3456 Ultima IV/COUNTRY=EU,BR/PRODUCT_NO=9501 SMS de9f8517 A9FD5B95131658E9 Ultima IV [Proto]/FLAGS=PROTO/COMMENT=Prototype version of the game. SMS 15668ca4 7638A4C78062F114 Ultimate Soccer/COUNTRY=EU,BR/PRODUCT_NO=7119,024440 +SMS f4de22f1 F0B71C1C94F56830 Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG]/FLAGS=SMSGG_MODE/EMU_MAPPER=47 SMS dfb0b161 826B0C3B91EAF65B Vigilante/COUNTRY=US,EU,BR/PRODUCT_NO=7023 SMS 57f1545b 63CE90266CDA3B98 Virtua Fighter Animation/COUNTRY=BR/PRODUCT_NO=030020/COMMENT=This is a port from the Game Gear version. SMS 3d55759b 2893A79D37A62301 Walter Payton Football/COUNTRY=US/PRODUCT_NO=7020/COMMENT=US version of "American Pro Football". diff --git a/meka/srcs/machine.cpp b/meka/srcs/machine.cpp index f23e934f..662ff339 100644 --- a/meka/srcs/machine.cpp +++ b/meka/srcs/machine.cpp @@ -196,6 +196,9 @@ void Machine_Set_Handler_MemRW(void) case MAPPER_SMS_Korean_MSX_32KB_2000: WrZ80 = WrZ80_NoHook = Write_Mapper_SMS_Korean_MSX_32KB_2000; break; + case MAPPER_SMS_Power_256KB_FFFF_FFFE: + WrZ80 = WrZ80_NoHook = Write_Mapper_SMS_Power_256KB_FFFF_FFFE; + break; } } @@ -485,6 +488,37 @@ void Machine_Set_Mapping (void) g_machine.mapper_regs[0] = 0; break; + case MAPPER_SMS_Power_256KB_FFFF_FFFE: + if (true) { + // FIXME: Right now this uses reset rather than power-cycle to + // trigger the outer multicart cycling. This is because Meka + // does not yet have hooks for mappers to respond reliably to + // power-cycling, nor does it have key bindings to allow easy + // use of power-cycling multicarts + g_machine.mapper_regs_count = 3; + for (int i = 0; i != MAPPER_REGS_MAX; i++) + g_machine.mapper_regs[i] = 0; + g_machine.mapper_regs[1] = 1; + if (SRAM[0x7FFF] != 0xAA) { + SRAM[0x7FFF] = 0xAA; + SRAM[0x7FFE] = 0x00; + } else { + SRAM[0x7FFE] += 0x10; + SRAM[0x7FFE] = ((SRAM[0x7FFE] * 2) & tsms.Pages_Mask_8k) / 2; + } + g_machine.mapper_regs[0] = SRAM[0x7FFE]; + unsigned int base_page_8k = g_machine.mapper_regs[0] * 2; + Map_8k_ROM(0, base_page_8k & tsms.Pages_Mask_8k); + Map_8k_ROM(1, (base_page_8k | 1) & tsms.Pages_Mask_8k); + Map_8k_ROM(2, (base_page_8k | 2) & tsms.Pages_Mask_8k); + Map_8k_ROM(3, (base_page_8k | 3) & tsms.Pages_Mask_8k); + Map_8k_ROM(4, base_page_8k & tsms.Pages_Mask_8k); + Map_8k_ROM(5, (base_page_8k | 1) & tsms.Pages_Mask_8k); + Map_8k_RAM(6, 0); + Map_8k_RAM(7, 0); + } + break; + case MAPPER_SC3000_Survivors_Multicart: g_machine.mapper_regs_count = 1; for (int i = 0; i != MAPPER_REGS_MAX; i++) diff --git a/meka/srcs/mappers.cpp b/meka/srcs/mappers.cpp index 00bf3386..4ae50f82 100644 --- a/meka/srcs/mappers.cpp +++ b/meka/srcs/mappers.cpp @@ -952,6 +952,36 @@ WRITE_FUNC (Write_Mapper_SMS_Korean_MSX_32KB_2000) Write_Error (Addr, Value); } +// Mapper #47 +// Super 2 in 1 - Sonic & Alien Storm [SMS-GG] +// Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG] +WRITE_FUNC(Write_Mapper_SMS_Power_256KB_FFFF_FFFE) +{ + if (Addr == 0xFFFF) // Upper reconfigurable segment ----------------------------------------------- + { + g_machine.mapper_regs[1] = Value & 0x0f; + unsigned int upper_page_8k = (g_machine.mapper_regs[0] + g_machine.mapper_regs[1]) * 2; + Map_8k_ROM(4, upper_page_8k & tsms.Pages_Mask_8k); + Map_8k_ROM(5, (upper_page_8k | 1) & tsms.Pages_Mask_8k); + } + else if (Addr == 0xFFFE) // Lower reconfigurable segment ----------------------------------------------- + { + g_machine.mapper_regs[2] = Value & 0x0f; + unsigned int lower_page_8k = (g_machine.mapper_regs[0] + g_machine.mapper_regs[2]) * 2; + Map_8k_ROM(2, lower_page_8k & tsms.Pages_Mask_8k); + Map_8k_ROM(3, (lower_page_8k | 1) & tsms.Pages_Mask_8k); + } + + switch (Addr >> 13) + { + // RAM [0xC000] = [0xE000] ------------------------------------------------ + case 6: Mem_Pages[6][Addr] = Value; return; + case 7: Mem_Pages[7][Addr] = Value; return; + } + + Write_Error (Addr, Value); +} + // Based on MSX ASCII 8KB mapper? http://bifi.msxnet.org/msxnet/tech/megaroms.html#ascii8 // - This mapper requires 4 registers to save bank switching state. // However, all other mappers so far used only 3 registers, stored as 3 bytes. diff --git a/meka/srcs/mappers.h b/meka/srcs/mappers.h index 3711266f..d88aec18 100644 --- a/meka/srcs/mappers.h +++ b/meka/srcs/mappers.h @@ -50,6 +50,7 @@ #define MAPPER_SMS_Korean_MD_FFF5 (25) // Registers at 0xFFF5 and 0xFFFF (Jaemiissneun Game Mo-eumjip 42/65 Hap [SMS-MD], Pigu Wang Hap ~ Jaemiiss-neun Game Mo-eumjip [SMS-MD]) #define MAPPER_SMS_Korean_MD_FFFA (26) // Registers at 0xFFFA and 0xFFFF (Game Jiphap 30 Hap [SMS-MD]) #define MAPPER_SMS_Korean_MSX_32KB_2000 (27) // Register at 0x2000 (2 Hap in 1 (Moai-ui bomul, David-2)) +#define MAPPER_SMS_Power_256KB_FFFF_FFFE (47) // Power-cycling multicart of 256KB SMS games (Super 2 in 1 - Sonic & Alien Storm [SMS-GG], Untitled 4-in-1 (Moonwalker, Double Dragon, Sagaia & Spider-Man) [SMS-GG]) #define READ_FUNC(_NAME) u8 _NAME(register u16 Addr) #define WRITE_FUNC(_NAME) void _NAME(register u16 Addr, register u8 Value) @@ -96,6 +97,7 @@ WRITE_FUNC (Write_Mapper_SMS_Korean_MD_FFF0); WRITE_FUNC (Write_Mapper_SMS_Korean_MD_FFF5); WRITE_FUNC (Write_Mapper_SMS_Korean_MD_FFFA); WRITE_FUNC (Write_Mapper_SMS_Korean_MSX_32KB_2000); +WRITE_FUNC (Write_Mapper_SMS_Power_256KB_FFFF_FFFE); //----------------------------------------------------------------------------- void Out_SC3000_SurvivorsMulticarts_DataWrite(u8 v); diff --git a/meka/srcs/saves.cpp b/meka/srcs/saves.cpp index 09bb14b8..44248eea 100644 --- a/meka/srcs/saves.cpp +++ b/meka/srcs/saves.cpp @@ -144,6 +144,17 @@ void Load_Game_Fixup(void) case MAPPER_SMS_Korean_MSX_32KB_2000: WrZ80_NoHook(0x2000, g_machine.mapper_regs[0]); break; + case MAPPER_SMS_Power_256KB_FFFF_FFFE: + if (true) { + SRAM[0x7FFF] = 0xAA; + SRAM[0x7FFE] = g_machine.mapper_regs[0]; + unsigned int base_page_8k = g_machine.mapper_regs[0] * 2; + Map_8k_ROM(0, base_page_8k & tsms.Pages_Mask_8k); + Map_8k_ROM(1, (base_page_8k | 1) & tsms.Pages_Mask_8k); + WrZ80_NoHook(0xFFFF, g_machine.mapper_regs[1]); + WrZ80_NoHook(0xFFFE, g_machine.mapper_regs[2]); + } + break; } } @@ -339,6 +350,7 @@ int Save_Game_MSV(FILE *f) case MAPPER_SMS_Korean_MD_FFF5: case MAPPER_SMS_Korean_MD_FFFA: case MAPPER_SMS_Korean_MSX_32KB_2000: + case MAPPER_SMS_Power_256KB_FFFF_FFFE: default: fwrite (RAM, 0x2000, 1, f); // Do not use g_driver->ram because of g_driver video mode change break; @@ -518,6 +530,7 @@ int Load_Game_MSV(FILE *f) case MAPPER_SMS_Korean_MD_FFF5: case MAPPER_SMS_Korean_MD_FFFA: case MAPPER_SMS_Korean_MSX_32KB_2000: + case MAPPER_SMS_Power_256KB_FFFF_FFFE: default: fread (RAM, 0x2000, 1, f); // Do not use g_driver->ram because of g_driver video mode change break;