Skip to content

Commit

Permalink
Mappers: Add mapper 40 MAPPER_SMS_Korean_MSX_SMS_8000 for "Zemina Bes…
Browse files Browse the repository at this point in the history
…t 25/39/88 (KR)" (#104)
  • Loading branch information
bsittler authored and ocornut committed May 29, 2023
1 parent ce1189d commit 218c8ae
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 1 deletion.
5 changes: 4 additions & 1 deletion meka/compat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -665,14 +665,17 @@
Zaxxon 3-D / Zaxxon 3D FM,(3D) Ok
Zaxxon 3-D / Zaxxon 3D [Proto] (3D) Ok
Zemina 4-in-1 (Q-Bert, Sports 3, Gulkave..)(KR)- *Ok
Zemina Best 25 (KR) - *Ok
Zemina Best 39 (KR) - *Ok
Zemina Best 88 (KR) - *Ok
Zillion [v0] / Akai Koudan Zillion - Ok
Zillion [v1] - Ok
Zillion [v2] - Ok
Zillion II: The Tri Formation / Tri Formation FM Ok
Zillion II: The Tri Formation [Proto] FM Ok
Zool - Ok
-----------------------------------------------------------------------------
651 games tested - 647 are "Ok"
654 games tested - 650 are "Ok"
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions meka/meka.nam
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
; 25 : sms korean xx-in-1, register at 0xFFF5, 0xFFFE, 0xFFFE (used in MD multicart with SMS games)
; 26 : sms korean xx-in-1, register at 0xFFFA, 0xFFFE, 0xFFFE (used in MD multicart with SMS games)
; 27 : sms korean xx-in-1, register at 0x2000
; 40 : sms korean xx-in-1, register at 0x8000
;-----------------------------------------------------------------------------

;-----------------------------------------------------------------------------
Expand Down Expand Up @@ -762,6 +763,9 @@ SMS e8b82066 06806D7C60FB9C9A Y's: The Vanished Omens [Demo]/COUNTRY=US/FLAGS=
SMS a3ef13cb 73E4CCD0CC1A69BE Zaxxon 3-D/NAME_JP=Zaxxon 3D/COUNTRY=JP,US,EU,BR/EMU_3D/PRODUCT_NO=G-1336,8002/COMMENT=The 3-D effect can be removed by pressing Pause on title screen. It works only on non-Japanese systems.
SMS bba74147 2D689EA985B828BF Zaxxon 3-D [Proto]/NAME_JP=Zaxxon 3D/FLAGS=PROTO/EMU_3D/COMMENT=Unfinished prototype version of the game.
SMS 7cd51467 488D49FF0599CE77 Zemina 4-in-1 (Q-Bert, Sports 3, Gulkave, Pooyan)/COUNTRY=KR/EMU_MAPPER=23
SMS e6c9c046 F4E9FC49C3C374E4 Zemina Best 25/COUNTRY=KR/EMU_MAPPER=40/COMMENT=This is the second 512KB of Zemina Best 88. Evidence of a physical release exist.
SMS d8169fe2 BF9411BD7824093A Zemina Best 39/COUNTRY=KR/EMU_MAPPER=40/COMMENT=This is the first 512KB of Zemina Best 88. No evidence yet of a physical release.
SMS 3c339d9e B37D0D063BE77D1E Zemina Best 88/COUNTRY=KR/EMU_MAPPER=40
SMS 60c19645 39A919D7DA6933B8 Zillion [v0]/NAME_JP=Akai Koudan Zillion/COUNTRY=JP,EU/PRODUCT_NO=G-1325,5075
SMS 5718762c 88E69FBAA2DA4974 Zillion [v1]/COUNTRY=US/PRODUCT_NO=5075 ; [EDITOR NOTE] Country listing for all 3 versions are based on what we found so far. It's probable that v1 and v2 were released in both US and EU.
SMS 7ba54510 8AE29FB6A2DC4B76 Zillion [v2]/COUNTRY=EU/PRODUCT_NO=5075
Expand Down
17 changes: 17 additions & 0 deletions meka/srcs/machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_Korean_MSX_SMS_8000:
WrZ80 = WrZ80_NoHook = Write_Mapper_SMS_Korean_MSX_SMS_8000;
break;
}
}

Expand Down Expand Up @@ -485,6 +488,20 @@ void Machine_Set_Mapping (void)
g_machine.mapper_regs[0] = 0;
break;

case MAPPER_SMS_Korean_MSX_SMS_8000:
Map_8k_ROM(0, 0x3c & tsms.Pages_Mask_8k);
Map_8k_ROM(1, 0x3c & tsms.Pages_Mask_8k);
Map_8k_ROM(2, 1 & tsms.Pages_Mask_8k);
Map_8k_ROM(3, 0 & tsms.Pages_Mask_8k);
Map_8k_ROM(4, 3 & tsms.Pages_Mask_8k);
Map_8k_ROM(5, 2 & tsms.Pages_Mask_8k);
Map_8k_RAM(6, 0);
Map_8k_RAM(7, 0);
g_machine.mapper_regs_count = 1;
for (int i = 0; i != MAPPER_REGS_MAX; i++)
g_machine.mapper_regs[i] = 0;
break;

case MAPPER_SC3000_Survivors_Multicart:
g_machine.mapper_regs_count = 1;
for (int i = 0; i != MAPPER_REGS_MAX; i++)
Expand Down
37 changes: 37 additions & 0 deletions meka/srcs/mappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,43 @@ WRITE_FUNC (Write_Mapper_SMS_Korean_MSX_32KB_2000)
Write_Error (Addr, Value);
}

// Mapper #40
// Zemina Best 88 (KR)
// Zemina Best 25 (KR)
// Zemina Best 39 (KR)
WRITE_FUNC (Write_Mapper_SMS_Korean_MSX_SMS_8000)
{
if (Addr == 0x8000) // Configurable segment -----------------------------------------------
{
// Special case to support Zemina Best 25 [Best 88] (KR)
if (g_machine.mapper_regs[0] == 0xFF) {
Value ^= 0x22;
}
g_machine.mapper_regs[0] = Value;
if (Value & 0x80) {
Map_8k_ROM(0, (Value ^ 3) & tsms.Pages_Mask_8k);
Map_8k_ROM(1, (Value ^ 2) & tsms.Pages_Mask_8k);
} else {
Map_8k_ROM(0, 0x3c & tsms.Pages_Mask_8k);
Map_8k_ROM(1, 0x3c & tsms.Pages_Mask_8k);
}
Map_8k_ROM(2, (Value ^ 1) & tsms.Pages_Mask_8k);
Map_8k_ROM(3, (Value ^ 0) & tsms.Pages_Mask_8k);
Map_8k_ROM(4, (Value ^ 3) & tsms.Pages_Mask_8k);
Map_8k_ROM(5, (Value ^ 2) & tsms.Pages_Mask_8k);
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.
Expand Down
2 changes: 2 additions & 0 deletions meka/srcs/mappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_Korean_MSX_SMS_8000 (40) // Register at 0x8000 with 8KB granularity and both MSX and SMS game support (Zemina Best 88 [MISSING 64K])

#define READ_FUNC(_NAME) u8 _NAME(register u16 Addr)
#define WRITE_FUNC(_NAME) void _NAME(register u16 Addr, register u8 Value)
Expand Down Expand Up @@ -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_Korean_MSX_SMS_8000);
//-----------------------------------------------------------------------------
void Out_SC3000_SurvivorsMulticarts_DataWrite(u8 v);

Expand Down
6 changes: 6 additions & 0 deletions meka/srcs/saves.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ void Load_Game_Fixup(void)
case MAPPER_SMS_Korean_MSX_32KB_2000:
WrZ80_NoHook(0x2000, g_machine.mapper_regs[0]);
break;
case MAPPER_SMS_Korean_MSX_SMS_8000:
WrZ80_NoHook(0x8000, 0x00); // reset the mapper to avoid the 0xFF special case
WrZ80_NoHook(0x8000, g_machine.mapper_regs[0]);
break;
}
}

Expand Down Expand Up @@ -339,6 +343,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_Korean_MSX_SMS_8000:
default:
fwrite (RAM, 0x2000, 1, f); // Do not use g_driver->ram because of g_driver video mode change
break;
Expand Down Expand Up @@ -518,6 +523,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_Korean_MSX_SMS_8000:
default:
fread (RAM, 0x2000, 1, f); // Do not use g_driver->ram because of g_driver video mode change
break;
Expand Down

0 comments on commit 218c8ae

Please sign in to comment.