Skip to content

Commit

Permalink
Add mapper ocornut#29 MAPPER_GG_Super_GG_15_BFFF_FFFF for "Super GG…
Browse files Browse the repository at this point in the history
… 15 (Unl)"

This mapper has the ability to toggle between native GG move and
SMS-GG mode. This seems to mostly work though there are minor game
window size glitches after a switch back to native GG mode from SMS-GG
mode.

Mapper number `ocornut#27` is skipped because I hope a different mapper `ocornut#27` will land soon (ocornut#90)

Mapper number `ocornut#28` is skipped because I hope a different mapper `ocornut#28` will land soon (ocornut#91)
  • Loading branch information
bsittler committed Mar 16, 2023
1 parent 3cb1c30 commit 0e9a3b9
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 0 deletions.
1 change: 1 addition & 0 deletions meka/compat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,7 @@
Super Battletank Ok
Super Columns Ok
Super Columns (JP) Ok
Super GG 15 *Ok
Super Golf (JP) Ok
Super Kick Off [SMS-GG] Ok
Superman - The Man of Steel Ok
Expand Down
1 change: 1 addition & 0 deletions meka/meka.nam
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,7 @@ 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 c818109d 8CDA5761ECE8A46A Super GG 15/EMU_MAPPER=29
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.
Expand Down
21 changes: 21 additions & 0 deletions meka/srcs/machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ void Machine_Set_Handler_MemRW(void)
case MAPPER_SMS_Korean_MD_FFFA:
WrZ80 = WrZ80_NoHook = Write_Mapper_SMS_Korean_MD_FFFA;
break;
case MAPPER_GG_Super_GG_15_BFFF_FFFF:
WrZ80 = WrZ80_NoHook = Write_Mapper_GG_Super_GG_15_BFFF_FFFF;
break;
}
}

Expand Down Expand Up @@ -467,6 +470,24 @@ void Machine_Set_Mapping (void)
g_machine.mapper_regs[2] = 1;
break;

case MAPPER_GG_Super_GG_15_BFFF_FFFF:
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(0, 0x00 & tsms.Pages_Mask_8k);
Map_8k_ROM(1, 0x01 & tsms.Pages_Mask_8k);
Map_8k_RAM(6, 0);
Map_8k_RAM(7, 0);
g_machine.mapper_regs_count = 4;
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);
tsms.VDP_Video_Change |= VDP_VIDEO_CHANGE_ALL;
VDP_VideoMode_Change();
break;

case MAPPER_SC3000_Survivors_Multicart:
g_machine.mapper_regs_count = 1;
for (int i = 0; i != MAPPER_REGS_MAX; i++)
Expand Down
62 changes: 62 additions & 0 deletions meka/srcs/mappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "shared.h"
#include "mappers.h"
#include "eeprom.h"
#include "vdp.h"

//-----------------------------------------------------------------------------
// Data
Expand Down Expand Up @@ -928,6 +929,67 @@ WRITE_FUNC(Write_Mapper_SMS_Korean_MD_FFFA)
Write_Error(Addr, Value);
}

// Mapper #29
// Super GG 15
WRITE_FUNC(Write_Mapper_GG_Super_GG_15_BFFF_FFFF)
{
// TODO: implement the various restrictions found in the hardware,
// e.g. requiring mode bit 0x04 to access the second 512KB of the
// ROM.
if ((Addr == 0xBFFF) || (Addr == 0xFFFE) || (Addr == 0xFFFF)) // Configurable segment -----------------------------------------------
{
if (Addr == 0xBFFF) {
unsigned int high_page_offset = 0;
if (g_machine.mapper_regs[0] == 0x0c) {
unsigned int mask = (g_machine.mapper_regs[1] & 0xF0) ? 0xF0 : 0xFE;
g_machine.mapper_regs[3] = g_machine.mapper_regs[1] & mask;
if (mask == 0xF0) {
high_page_offset = g_machine.mapper_regs[1] & 0x0F;
}
}
g_machine.mapper_regs[0] = Value;
g_machine.mapper_regs[1] = high_page_offset;
g_machine.mapper_regs[2] = 1;
if (Value & 0x10) {
drv_set(DRV_SMS);
tsms.VDP_Video_Change |= VDP_VIDEO_CHANGE_SIZE;
VDP_VideoMode_Change();
} else {
drv_set(DRV_GG);
tsms.VDP_Video_Change |= VDP_VIDEO_CHANGE_ALL;
VDP_VideoMode_Change();
}
}
else if (Addr == 0xFFFF)
{
g_machine.mapper_regs[1] = Value;
}
else if (Addr == 0xFFFE)
{
g_machine.mapper_regs[2] = Value;
}
Map_8k_ROM(0, (g_machine.mapper_regs[3] * 2) & tsms.Pages_Mask_8k);
Map_8k_ROM(1, (g_machine.mapper_regs[3] * 2 + 1) & tsms.Pages_Mask_8k);
Map_8k_ROM(2, (g_machine.mapper_regs[3] * 2 + g_machine.mapper_regs[2] * 2) & tsms.Pages_Mask_8k);
Map_8k_ROM(3, (g_machine.mapper_regs[3] * 2 + g_machine.mapper_regs[2] * 2 + 1) & tsms.Pages_Mask_8k);
Map_8k_ROM(4, (g_machine.mapper_regs[3] * 2 + g_machine.mapper_regs[1] * 2) & tsms.Pages_Mask_8k);
Map_8k_ROM(5, (g_machine.mapper_regs[3] * 2 + g_machine.mapper_regs[1] * 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.
Expand Down
2 changes: 2 additions & 0 deletions meka/srcs/mappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#define MAPPER_SMS_Korean_MD_FFF0 (24) // Registers at 0xFFF0 and 0xFFFF (Mega Mode Super Game 30 [SMS-MD])
#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_GG_Super_GG_15_BFFF_FFFF (29) // Registers at 0xBFFF, 0xFFFF, and 0xFFFE (Super GG 15)

#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 @@ -94,6 +95,7 @@ WRITE_FUNC (Write_Mapper_SMS_Korean_0000_xor_FF);
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_GG_Super_GG_15_BFFF_FFFF);
//-----------------------------------------------------------------------------
void Out_SC3000_SurvivorsMulticarts_DataWrite(u8 v);

Expand Down
15 changes: 15 additions & 0 deletions meka/srcs/saves.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ void Load_Game_Fixup(void)
WrZ80_NoHook(0xFFFF, g_machine.mapper_regs[1]);
WrZ80_NoHook(0xFFFE, g_machine.mapper_regs[2]);
break;
case MAPPER_GG_Super_GG_15_BFFF_FFFF:
if (1) {
unsigned int mapper_mode = g_machine.mapper_regs[0];
unsigned int slot_8000_page_offset_16k = g_machine.mapper_regs[1];
unsigned int slot_4000_page_offset_16k = g_machine.mapper_regs[2];
unsigned int game_number = g_machine.mapper_regs[3];
WrZ80_NoHook(0xBFFF, 0x0C);
WrZ80_NoHook(0xFFFF, game_number);
WrZ80_NoHook(0xBFFF, mapper_mode);
WrZ80_NoHook(0xFFFF, slot_8000_page_offset_16k);
WrZ80_NoHook(0xFFFE, slot_4000_page_offset_16k);
}
break;
}
}

Expand Down Expand Up @@ -335,6 +348,7 @@ int Save_Game_MSV(FILE *f)
case MAPPER_SMS_Korean_MD_FFF0:
case MAPPER_SMS_Korean_MD_FFF5:
case MAPPER_SMS_Korean_MD_FFFA:
case MAPPER_GG_Super_GG_15_BFFF_FFFF:
default:
fwrite (RAM, 0x2000, 1, f); // Do not use g_driver->ram because of g_driver video mode change
break;
Expand Down Expand Up @@ -513,6 +527,7 @@ int Load_Game_MSV(FILE *f)
case MAPPER_SMS_Korean_MD_FFF0:
case MAPPER_SMS_Korean_MD_FFF5:
case MAPPER_SMS_Korean_MD_FFFA:
case MAPPER_GG_Super_GG_15_BFFF_FFFF:
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 0e9a3b9

Please sign in to comment.