diff --git a/meka/compat.txt b/meka/compat.txt index ab16dc0f..f660f75b 100644 --- a/meka/compat.txt +++ b/meka/compat.txt @@ -1408,6 +1408,8 @@ Super Battletank Ok Super Columns Ok Super Columns (JP) Ok + Super GG 15 [Last Action] [Super GG 30 Gold & Green Label] *Ok + Super GG 30 [Last Action] [Gold & Green Label] *Ok Super Golf (JP) Ok Super Kick Off [SMS-GG] Ok Superman - The Man of Steel Ok @@ -1498,7 +1500,7 @@ Zoop (US) Ok Zoop [Proto] (US) Ok ----------------------------------------------------------------------------- - 517 games tested - 506 are "Ok" - Compatibility rate: 97.63% + 519 games tested - 508 are "Ok" - Compatibility rate: 97.88% ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- diff --git a/meka/meka.nam b/meka/meka.nam index 77c032bf..1a31f9c8 100644 --- a/meka/meka.nam +++ b/meka/meka.nam @@ -1291,6 +1291,8 @@ GG b421c057 96BD12C62621B8D6 Striker/COUNTRY=EU/PRODUCT_NO=2551-50 GG 73d6745a 18CC99C9849C9901 Super Battletank/COUNTRY=US/PRODUCT_NO=1239 GG 8ba43af3 DAA4C785B7042952 Super Columns/COUNTRY=US,EU/PRODUCT_NO=2449,2449-50 GG 2a100717 E7260408CEC8EE63 Super Columns/COUNTRY=JP/PRODUCT_NO=G-3226 +GG 079e81c7 A4D60FD57EA08DF7 Super GG 15 [Last Action] [Super GG 30 Gold & Green Label]/EMU_MAPPER=35 +GG 5346f695 30B066366A883161 Super GG 30 [Last Action] [Gold & Green Label]/EMU_MAPPER=35 GG 528cbbce FAE75543A7740E5E Super Golf/COUNTRY=JP/PRODUCT_NO=T-26017,T-26027 GG 73df5a15 43574420E8CF212A Superman - The Man of Steel/COUNTRY=EU/PRODUCT_NO=T-70068,70068-00 GG aa3f2172 0A5C6040EBCF152B Superman - The Man of Steel [Proto]/FLAGS=PROTO/COMMENT=Prototype version of the game. diff --git a/meka/srcs/machine.cpp b/meka/srcs/machine.cpp index f23e934f..137f415f 100644 --- a/meka/srcs/machine.cpp +++ b/meka/srcs/machine.cpp @@ -22,6 +22,7 @@ #include "tvtype.h" #include "sound/fmunit.h" #include "sound/psg.h" +#include "app_game.h" //----------------------------------------------------------------------------- // Data @@ -196,6 +197,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_GG_Super_GG_30_1FFx_FFFx: + WrZ80 = WrZ80_NoHook = Write_Mapper_GG_Super_GG_30_1FFx_FFFx; + break; } } @@ -485,6 +489,25 @@ void Machine_Set_Mapping (void) g_machine.mapper_regs[0] = 0; break; + case MAPPER_GG_Super_GG_30_1FFx_FFFx: + Map_8k_ROM(0, 0x00 & tsms.Pages_Mask_8k); + Map_8k_ROM(1, 0x01 & tsms.Pages_Mask_8k); + Map_8k_ROM(2, 0x02 & tsms.Pages_Mask_8k); + Map_8k_ROM(3, 0x03 & tsms.Pages_Mask_8k); + Map_8k_ROM(4, 0x00 & tsms.Pages_Mask_8k); + Map_8k_ROM(5, 0x01 & tsms.Pages_Mask_8k); + Map_8k_RAM(6, 0); + Map_8k_RAM(7, 0); + g_machine.mapper_regs_count = 6; + for (int i = 0; i != MAPPER_REGS_MAX; i++) + g_machine.mapper_regs[i] = 0; + g_machine.mapper_regs[2] = 1; + drv_set(DRV_GG); + gamebox_resize_all(); + VDP_UpdateLineLimits(); + Video_GameMode_UpdateBounds(); + 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..58b4206f 100644 --- a/meka/srcs/mappers.cpp +++ b/meka/srcs/mappers.cpp @@ -14,6 +14,9 @@ #include "shared.h" #include "mappers.h" #include "eeprom.h" +#include "vdp.h" +#include "video.h" +#include "app_game.h" //----------------------------------------------------------------------------- // Data @@ -952,6 +955,76 @@ WRITE_FUNC (Write_Mapper_SMS_Korean_MSX_32KB_2000) Write_Error (Addr, Value); } +// Mapper #35 +// Super GG 15 [Last Action] [Super GG 30 Gold & Green Label] +// Super GG 30 [Last Action] [Gold & Green Label] +WRITE_FUNC(Write_Mapper_GG_Super_GG_30_1FFx_FFFx) +{ + if ((Addr == 0x1FFE) || (Addr == 0xFFFE) || (Addr == 0xFFFF) || (Addr == 0x1FFF)) // Configurable segment ----------------------------------------------- + { + if (Addr == 0x1FFF) { + // TODO: Value & 0x01 may be "Sega mode" mapper locking + // Value & 0x40 indicates chip select/output enable for 2nd half of each megabyte of ROM + // Value & 0x10 indicates SMS-GG mode as opposed to native GG mode + g_machine.mapper_regs[0] = Value; + if (Value & 0x10) { + drv_set(DRV_SMS); + } else { + drv_set(DRV_GG); + } + gamebox_resize_all(); + VDP_UpdateLineLimits(); + Video_GameMode_UpdateBounds(); + } + else if (Addr == 0x1FFE) + { + // Value & 0x10 indicates chip select/output enable for 2nd megabyte of ROM + g_machine.mapper_regs[1] = Value; + // Value & 0x04 indicates "Sega mode" as opposed to "menu mode" + } + else if (Addr == 0xFFFF) + { + g_machine.mapper_regs[2] = Value; + } + else if (Addr == 0xFFFE) + { + g_machine.mapper_regs[3] = Value; + } + if (g_machine.mapper_regs[1] & 0x04) { + // "menu mode" + g_machine.mapper_regs[4] = g_machine.mapper_regs[2] & 0xF0; + if (! (g_machine.mapper_regs[4] & 0x30)) { + g_machine.mapper_regs[4] = g_machine.mapper_regs[2] & 0xFE; + } + g_machine.mapper_regs[5] = g_machine.mapper_regs[3] & 0xF0; + if (! (g_machine.mapper_regs[5] & 0x30)) { + g_machine.mapper_regs[5] = g_machine.mapper_regs[3] & 0xFE; + } + } + unsigned int rom_chip_select_and_enable = ((g_machine.mapper_regs[1] & 0x10) ? 0x40 : 0x00) | ((g_machine.mapper_regs[0] & 0x40) ? 0x20 : 0x00); + Map_8k_ROM(0, ((rom_chip_select_and_enable * 2) | (g_machine.mapper_regs[5] * 2)) & tsms.Pages_Mask_8k); + Map_8k_ROM(1, ((rom_chip_select_and_enable * 2) | (g_machine.mapper_regs[5] * 2) | 1) & tsms.Pages_Mask_8k); + Map_8k_ROM(2, ((rom_chip_select_and_enable * 2) | (g_machine.mapper_regs[5] * 2) | (g_machine.mapper_regs[3] * 2)) & tsms.Pages_Mask_8k); + Map_8k_ROM(3, ((rom_chip_select_and_enable * 2) | (g_machine.mapper_regs[5] * 2) | (g_machine.mapper_regs[3] * 2) | 1) & tsms.Pages_Mask_8k); + Map_8k_ROM(4, ((rom_chip_select_and_enable * 2) | (g_machine.mapper_regs[4] * 2) | (g_machine.mapper_regs[2] * 2)) & tsms.Pages_Mask_8k); + Map_8k_ROM(5, ((rom_chip_select_and_enable * 2) | (g_machine.mapper_regs[4] * 2) | (g_machine.mapper_regs[2] * 2) | 1) & tsms.Pages_Mask_8k); + if (Addr <= 0xBFFF) { + // no RAM shadowing for writes to this address + return; + } + } + + 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..58480d59 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_GG_Super_GG_30_1FFx_FFFx (35) // Registers at 0x1FFE, 0xFFFE, 0xFFFF, and 0x1FFF (Super GG 30 [Last Action] [Gold & Green Label], Super GG 15 [Last Action] [Super GG 30 Gold & Green Label]) #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_GG_Super_GG_30_1FFx_FFFx); //----------------------------------------------------------------------------- void Out_SC3000_SurvivorsMulticarts_DataWrite(u8 v); diff --git a/meka/srcs/saves.cpp b/meka/srcs/saves.cpp index 09bb14b8..0bfa052f 100644 --- a/meka/srcs/saves.cpp +++ b/meka/srcs/saves.cpp @@ -26,6 +26,7 @@ void Load_Game_Fixup(void) { int i; u8 b; + bool sms_gg_mode_in_mapper = false; // CPU #ifdef MARAT_Z80 @@ -144,13 +145,38 @@ void Load_Game_Fixup(void) case MAPPER_SMS_Korean_MSX_32KB_2000: WrZ80_NoHook(0x2000, g_machine.mapper_regs[0]); break; + case MAPPER_GG_Super_GG_30_1FFx_FFFx: + if (1) { + unsigned int mapper_mode_upper_1FFF = g_machine.mapper_regs[0]; + unsigned int mapper_mode_lower_1FFE = g_machine.mapper_regs[1]; + unsigned int slot_8000_page_offset_16k_FFFF = g_machine.mapper_regs[2]; + unsigned int slot_4000_page_offset_16k_FFFE = g_machine.mapper_regs[3]; + unsigned int slot_8000_base_16k_FFFF = g_machine.mapper_regs[4]; + unsigned int slot_0000_4000_base_16k_FFFE = g_machine.mapper_regs[5]; + WrZ80_NoHook(0x1FFE, 0x00); + WrZ80_NoHook(0x1FFF, 0x00); + WrZ80_NoHook(0x1FFE, 0x04); + WrZ80_NoHook(0xFFFF, slot_8000_base_16k_FFFF); + WrZ80_NoHook(0xFFFE, slot_0000_4000_base_16k_FFFE); + WrZ80_NoHook(0x1FFE, 0x00); + WrZ80_NoHook(0x1FFF, 0x00); + WrZ80_NoHook(0xFFFF, slot_8000_page_offset_16k_FFFF); + WrZ80_NoHook(0xFFFE, slot_4000_page_offset_16k_FFFE); + WrZ80_NoHook(0x1FFE, mapper_mode_lower_1FFE); + WrZ80_NoHook(0x1FFF, mapper_mode_upper_1FFF); + sms_gg_mode_in_mapper = true; + } + break; } } // VDP/Graphic related - tsms.VDP_Video_Change |= VDP_VIDEO_CHANGE_ALL; - VDP_UpdateLineLimits(); - // FALSE!!! // tsms.VDP_Line = 224; + + if (!sms_gg_mode_in_mapper) { + tsms.VDP_Video_Change |= VDP_VIDEO_CHANGE_ALL; + VDP_UpdateLineLimits(); + // FALSE!!! // tsms.VDP_Line = 224; + } // Rewrite all VDP registers (we can do that since it has zero side-effect) for (i = 0; i < 16; i ++) @@ -339,6 +365,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_GG_Super_GG_30_1FFx_FFFx: default: fwrite (RAM, 0x2000, 1, f); // Do not use g_driver->ram because of g_driver video mode change break; @@ -518,6 +545,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_GG_Super_GG_30_1FFx_FFFx: default: fread (RAM, 0x2000, 1, f); // Do not use g_driver->ram because of g_driver video mode change break;