7 Commits

39 changed files with 924 additions and 726 deletions
+3 -3
View File
@@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.7.4.3</string>
<string>1.7.4.6</string>
<key>NSPrincipalClass</key>
<string>OEGameCoreController</string>
<key>OEGameCoreClass</key>
@@ -31,7 +31,7 @@
<key>OEGameCoreRequiresFiles</key>
<true/>
<key>OEGameCoreRewindBufferSeconds</key>
<integer>3600</integer>
<integer>60</integer>
<key>OEGameCoreRewindInterval</key>
<integer>0</integer>
<key>OEGameCoreSupportsCheatCode</key>
@@ -75,7 +75,7 @@
<key>openemu.system.sg</key>
<dict>
<key>OEGameCoreRewindBufferSeconds</key>
<integer>3600</integer>
<integer>60</integer>
<key>OEGameCoreRewindInterval</key>
<integer>0</integer>
<key>OEGameCoreSupportsCheatCode</key>
+11 -5
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* I2C serial EEPROM (24Cxx) boards
*
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -125,14 +125,14 @@ static const T_I2C_GAME i2c_database[] =
{"T-50396" , 0 , 0 , mapper_i2c_ea_init , EEPROM_X24C01 }, /* NHLPA Hockey 93 */
{"T-50446" , 0 , 0 , mapper_i2c_ea_init , EEPROM_X24C01 }, /* John Madden Football 93 */
{"T-50516" , 0 , 0 , mapper_i2c_ea_init , EEPROM_X24C01 }, /* John Madden Football 93 (Championship Ed.) */
{"T-50606" , 0 , 0 , mapper_i2c_ea_init , EEPROM_X24C01 }, /* Bill Walsh College Football */
{"T-12046" , 0 , 0 , mapper_i2c_sega_init , EEPROM_X24C01 }, /* Megaman - The Wily Wars */
{"T-12053" , 0 , 0xEA80 , mapper_i2c_sega_init , EEPROM_X24C01 }, /* Rockman Mega World */
{"T-50606" , 0 , 0 , mapper_i2c_ea_init , EEPROM_X24C01 }, /* Bill Walsh College Football (warning: invalid SRAM header !) */
{" T-12046" , 0 , 0 , mapper_i2c_sega_init , EEPROM_X24C01 }, /* Megaman - The Wily Wars (warning: SRAM hack exists !) */
{" T-12053" , 0 , 0 , mapper_i2c_sega_init , EEPROM_X24C01 }, /* Rockman Mega World (warning: SRAM hack exists !) */
{"MK-1215" , 0 , 0 , mapper_i2c_sega_init , EEPROM_X24C01 }, /* Evander 'Real Deal' Holyfield's Boxing */
{"MK-1228" , 0 , 0 , mapper_i2c_sega_init , EEPROM_X24C01 }, /* Greatest Heavyweights of the Ring (U)(E) */
{"G-5538" , 0 , 0 , mapper_i2c_sega_init , EEPROM_X24C01 }, /* Greatest Heavyweights of the Ring (J) */
{"PR-1993" , 0 , 0 , mapper_i2c_sega_init , EEPROM_X24C01 }, /* Greatest Heavyweights of the Ring (Prototype) */
{"G-4060" , 0 , 0 , mapper_i2c_sega_init , EEPROM_X24C01 }, /* Wonderboy in Monster World */
{" G-4060" , 0 , 0 , mapper_i2c_sega_init , EEPROM_X24C01 }, /* Wonderboy in Monster World (warning: SRAM hack exists !) */
{"00001211" , 0 , 0 , mapper_i2c_sega_init , EEPROM_X24C01 }, /* Sports Talk Baseball */
{"00004076" , 0 , 0 , mapper_i2c_sega_init , EEPROM_X24C01 }, /* Honoo no Toukyuuji Dodge Danpei */
{"G-4524" , 0 , 0 , mapper_i2c_sega_init , EEPROM_X24C01 }, /* Ninja Burai Densetsu */
@@ -198,6 +198,12 @@ void eeprom_i2c_init()
/* check game internal id code */
if (strstr(rominfo.product, i2c_database[i].id))
{
/* additional check for known SRAM-patched hacks */
if ((i2c_database[i].id[0] == ' ') && ((sram.end - sram.start) > 2))
{
break;
}
/* additional check for Codemasters games */
if (((i2c_database[i].chk == 0) || (i2c_database[i].chk == rominfo.checksum)) &&
((i2c_database[i].sp == 0) || (i2c_database[i].sp == READ_WORD_LONG(cart.rom, 0))))
+1 -1
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* I2C Serial EEPROM (24Cxx) boards
*
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+12 -17
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Mega Drive cartridge hardware support
*
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Many cartridge protections were initially documented by Haze
* (http://haze.mameworld.info/)
@@ -44,7 +44,6 @@
#include "shared.h"
#include "eeprom_i2c.h"
#include "eeprom_spi.h"
#include "gamepad.h"
/* Cart database entry */
typedef struct
@@ -395,17 +394,6 @@ void md_cart_init(void)
if (strstr(rominfo.international,"Virtua Racing"))
{
svp_init();
m68k.memory_map[0x30].base = svp->dram;
m68k.memory_map[0x30].read16 = NULL;
m68k.memory_map[0x30].write16 = svp_write_dram;
m68k.memory_map[0x31].base = svp->dram + 0x10000;
m68k.memory_map[0x31].read16 = NULL;
m68k.memory_map[0x31].write16 = svp_write_dram;
m68k.memory_map[0x39].read16 = svp_read_cell_1;
m68k.memory_map[0x3a].read16 = svp_read_cell_2;
}
/**********************************************
@@ -674,7 +662,7 @@ void md_cart_init(void)
}
else if (cart.romsize > 0x400000)
{
/* assume linear ROM mapper without bankswitching (max. 10MB) */
/* assume linear ROM mapping by default (max. 10MB) */
for (i=0x40; i<0xA0; i++)
{
m68k.memory_map[i].base = cart.rom + (i<<16);
@@ -1614,15 +1602,22 @@ static uint32 mapper_radica_r(uint32 address)
static void default_time_w(uint32 address, uint32 data)
{
/* enable multi-game cartridge mapper by default */
if (address < 0xa13040)
{
/* unlicensed cartridges mapper (default) */
mapper_64k_multi_w(address);
return;
}
/* official cartridges mapper (default) */
mapper_sega_w(data);
/* enable "official" cartridge mapper by default */
if (address > 0xa130f1)
{
mapper_512k_w(address, data);
}
else
{
mapper_sega_w(data);
}
}
+6 -6
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Mega Drive cartridge hardware support
*
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Most cartridge protections were initially documented by Haze
* (http://haze.mameworld.info/)
@@ -76,12 +76,12 @@ typedef struct
/* Cartridge type */
typedef struct
{
uint8 *base; /* ROM base (saved for OS/Cartridge ROM swap) */
uint32 romsize; /* ROM size */
uint32 mask; /* ROM mask */
uint8 special; /* custom external hardware (Lock-On, J-Cart, 3-D glasses, Terebi Oekaki,...) */
cart_hw_t hw; /* cartridge internal hardware */
uint8 rom[MAXROMSIZE]; /* ROM area */
uint8 *base; /* ROM base (saved for OS/Cartridge ROM swap) */
uint32 romsize; /* ROM size */
uint32 mask; /* ROM mask */
uint8 special; /* Lock-On, J-Cart or SMS 3-D glasses hardware */
cart_hw_t hw; /* Extra mapping hardware */
} md_cart_t;
+239 -240
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* SG-1000, Master System & Game Gear cartridge hardware support
*
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -72,285 +72,285 @@ typedef struct
{
uint8 fcr[4];
uint8 mapper;
uint8 pages;
uint16 pages;
} romhw_t;
static const rominfo_t game_list[] =
{
/* program requiring Mega Drive VDP (Mode 5) */
{0x47FA618D, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_PBC, REGION_USA}, /* Charles MacDonald's Mode 5 Demo Program */
{0x47FA618D, 0, 1, 0, MAPPER_SEGA, SYSTEM_PBC, REGION_USA}, /* Charles MacDonald's Mode 5 Demo Program */
/* game requiring SEGA mapper */
{0xFF67359B, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* DataStorm (homebrew) */
{0xFF67359B, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* DataStorm (homebrew) */
/* games requiring 315-5124 VDP (Mark-III, Master System I) */
{0x32759751, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Y's (J) */
{0xE8B82066, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Y's (J) [Demo] */
{0x32759751, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Y's (J) */
{0xE8B82066, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Y's (J) [Demo] */
/* games requiring Sega 315-5235 mapper without bank shifting */
{0x23BAC434, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA_X, SYSTEM_GG, REGION_USA}, /* Shining Force Gaiden - Final Conflict (JP) [T-Eng] */
{0x23BAC434, 0, 0, 0, MAPPER_SEGA_X, SYSTEM_GG, REGION_USA}, /* Shining Force Gaiden - Final Conflict (JP) [T-Eng] */
/* games using "Korean" mappers */
{0x445525E2, 0, 0, SYSTEM_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Penguin Adventure (KR) */
{0x83F0EEDE, 0, 0, SYSTEM_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Street Master (KR) */
{0xA05258F5, 0, 0, SYSTEM_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Won-Si-In (KR) */
{0x06965ED9, 0, 0, SYSTEM_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* F-1 Spirit - The way to Formula-1 (KR) */
{0x77EFE84A, 0, 0, SYSTEM_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Cyborg Z (KR) */
{0xF89AF3CC, 0, 0, SYSTEM_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Knightmare II - The Maze of Galious (KR) */
{0x9195C34C, 0, 0, SYSTEM_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Boy 3 (KR) */
{0xE316C06D, 0, 0, SYSTEM_GAMEPAD, MAPPER_MSX_NEMESIS, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Nemesis (KR) */
{0x0A77FA5E, 0, 0, SYSTEM_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Nemesis 2 (KR) */
{0x89B79E77, 0, 0, SYSTEM_GAMEPAD, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Dodgeball King (KR) */
{0x929222C4, 0, 0, SYSTEM_GAMEPAD, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Jang Pung II (KR) */
{0x18FB98A3, 0, 0, SYSTEM_GAMEPAD, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Jang Pung 3 (KR) */
{0x97D03541, 0, 0, SYSTEM_GAMEPAD, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Sangokushi 3 (KR) */
{0x192949D5, 0, 0, SYSTEM_GAMEPAD, MAPPER_KOREA_8K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Janggun-ui Adeul (KR) */
{0x76C5BDFB, 0, 0, SYSTEM_GAMEPAD, MAPPER_KOREA_16K, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Jang Pung II [SMS-GG] (KR) */
{0x9FA727A0, 0, 0, SYSTEM_GAMEPAD, MAPPER_KOREA_16K, SYSTEM_GGMS, REGION_USA}, /* Street Hero [Proto 0] [SMS-GG] (US) */
{0xFB481971, 0, 0, SYSTEM_GAMEPAD, MAPPER_KOREA_16K, SYSTEM_GGMS, REGION_USA}, /* Street Hero [Proto 1] [SMS-GG] (US) */
{0xA67F2A5C, 0, 0, SYSTEM_GAMEPAD, MAPPER_MULTI_16K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* 4-Pak All Action (KR) */
{0x98AF0236, 0, 0, SYSTEM_GAMEPAD, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 1) (KR) */
{0x6EBFE1C3, 0, 0, SYSTEM_GAMEPAD, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 2) (KR) */
{0x81A36A4F, 0, 0, SYSTEM_GAMEPAD, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 3) (KR) */
{0x8D2D695D, 0, 0, SYSTEM_GAMEPAD, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 4) (KR) */
{0x82C09B57, 0, 0, SYSTEM_GAMEPAD, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 5) (KR) */
{0x4088EEB4, 0, 0, SYSTEM_GAMEPAD, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 6) (KR) */
{0xFBA94148, 0, 0, SYSTEM_GAMEPAD, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 8-in-1 The Best Game Collection (Vol. 1) (KR) */
{0x8333C86E, 0, 0, SYSTEM_GAMEPAD, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 8-in-1 The Best Game Collection (Vol. 2) (KR) */
{0x00E9809F, 0, 0, SYSTEM_GAMEPAD, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 8-in-1 The Best Game Collection (Vol. 3) (KR) */
{0x445525E2, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Penguin Adventure (KR) */
{0x83F0EEDE, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Street Master (KR) */
{0xA05258F5, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Won-Si-In (KR) */
{0x06965ED9, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* F-1 Spirit - The way to Formula-1 (KR) */
{0x77EFE84A, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Cyborg Z (KR) */
{0xF89AF3CC, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Knightmare II - The Maze of Galious (KR) */
{0x9195C34C, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Boy 3 (KR) */
{0xE316C06D, 0, 0, 0, MAPPER_MSX_NEMESIS, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Nemesis (KR) */
{0x0A77FA5E, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Nemesis 2 (KR) */
{0x89B79E77, 0, 0, 0, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Dodgeball King (KR) */
{0x929222C4, 0, 0, 0, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Jang Pung II (KR) */
{0x18FB98A3, 0, 0, 0, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Jang Pung 3 (KR) */
{0x97D03541, 0, 0, 0, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Sangokushi 3 (KR) */
{0x192949D5, 0, 0, 0, MAPPER_KOREA_8K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Janggun-ui Adeul (KR) */
{0x76C5BDFB, 0, 0, 0, MAPPER_KOREA_16K, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Jang Pung II [SMS-GG] (KR) */
{0x9FA727A0, 0, 0, 0, MAPPER_KOREA_16K, SYSTEM_GGMS, REGION_USA}, /* Street Hero [Proto 0] [SMS-GG] (US) */
{0xFB481971, 0, 0, 0, MAPPER_KOREA_16K, SYSTEM_GGMS, REGION_USA}, /* Street Hero [Proto 1] [SMS-GG] (US) */
{0xA67F2A5C, 0, 0, 0, MAPPER_MULTI_16K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* 4-Pak All Action (KR) */
{0x98AF0236, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 1) (KR) */
{0x6EBFE1C3, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 2) (KR) */
{0x81A36A4F, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 3) (KR) */
{0x8D2D695D, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 4) (KR) */
{0x82C09B57, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 5) (KR) */
{0x4088EEB4, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 6) (KR) */
{0xFBA94148, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 8-in-1 The Best Game Collection (Vol. 1) (KR) */
{0x8333C86E, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 8-in-1 The Best Game Collection (Vol. 2) (KR) */
{0x00E9809F, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 8-in-1 The Best Game Collection (Vol. 3) (KR) */
/* games using Codemaster mapper */
{0x29822980, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Cosmic Spacehead */
{0x8813514B, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Excellent Dizzy Collection, The [Proto] */
{0xB9664AE1, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Fantastic Dizzy */
{0xA577CE46, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Micro Machines */
{0xEA5C3A6F, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_USA}, /* Dinobasher - Starring Bignose the Caveman [Proto] */
{0xAA140C9C, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_GGMS, REGION_USA}, /* Excellent Dizzy Collection, The [SMS-GG] */
{0xC888222B, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_GGMS, REGION_USA}, /* Fantastic Dizzy [SMS-GG] */
{0x6CAA625B, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Cosmic Spacehead [GG]*/
{0x152F0DCC, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Drop Zone */
{0x5E53C7F7, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Ernie Els Golf */
{0xD9A7F170, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Man Overboard! */
{0xF7C524F6, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Micro Machines [GG] */
{0xDBE8895C, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Micro Machines 2 - Turbo Tournament */
{0xC1756BEE, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Pete Sampras Tennis */
{0x72981057, 0, 0, SYSTEM_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* CJ Elephant Fugitive */
{0x29822980, 0, 0, 0, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Cosmic Spacehead */
{0x8813514B, 0, 0, 0, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Excellent Dizzy Collection, The [Proto] */
{0xB9664AE1, 0, 0, 0, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Fantastic Dizzy */
{0xA577CE46, 0, 0, 0, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Micro Machines */
{0xEA5C3A6F, 0, 0, 0, MAPPER_CODIES, SYSTEM_SMS2, REGION_USA}, /* Dinobasher - Starring Bignose the Caveman [Proto] */
{0xAA140C9C, 0, 0, 0, MAPPER_CODIES, SYSTEM_GGMS, REGION_USA}, /* Excellent Dizzy Collection, The [SMS-GG] */
{0xC888222B, 0, 0, 0, MAPPER_CODIES, SYSTEM_GGMS, REGION_USA}, /* Fantastic Dizzy [SMS-GG] */
{0x6CAA625B, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Cosmic Spacehead [GG]*/
{0x152F0DCC, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Drop Zone */
{0x5E53C7F7, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Ernie Els Golf */
{0xD9A7F170, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Man Overboard! */
{0xF7C524F6, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Micro Machines [GG] */
{0xDBE8895C, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Micro Machines 2 - Turbo Tournament */
{0xC1756BEE, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Pete Sampras Tennis */
{0x72981057, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* CJ Elephant Fugitive */
/* games using serial EEPROM */
{0x36EBCD6D, 0, 0, SYSTEM_GAMEPAD, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* Majors Pro Baseball */
{0x3D8D0DD6, 0, 0, SYSTEM_GAMEPAD, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball [v0] */
{0xBB38CFD7, 0, 0, SYSTEM_GAMEPAD, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball [v1] */
{0x578A8A38, 0, 0, SYSTEM_GAMEPAD, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball '95 */
{0x36EBCD6D, 0, 0, 0, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* Majors Pro Baseball */
{0x3D8D0DD6, 0, 0, 0, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball [v0] */
{0xBB38CFD7, 0, 0, 0, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball [v1] */
{0x578A8A38, 0, 0, 0, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball '95 */
/* games using Terebi Oekaki graphic board */
{0xDD4A661B, 0, 0, SYSTEM_GAMEPAD, MAPPER_TEREBI, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Terebi Oekaki */
{0xDD4A661B, 0, 0, 0, MAPPER_TEREBI, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Terebi Oekaki */
/* games using 2KB external RAM (volatile) */
{0x092F29D6, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_2K, SYSTEM_SG, REGION_JAPAN_NTSC}, /* The Castle (J) */
{0xAF4F14BC, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_2K, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Othello (J) */
{0x1D1A0CA3, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_2K, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Othello (TW) */
{0x092F29D6, 0, 0, 0, MAPPER_RAM_2K, SYSTEM_SG, REGION_JAPAN_NTSC}, /* The Castle (J) */
{0xAF4F14BC, 0, 0, 0, MAPPER_RAM_2K, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Othello (J) */
{0x1D1A0CA3, 0, 0, 0, MAPPER_RAM_2K, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Othello (TW) */
/* games requiring SG-1000 II 8K RAM extension adapter */
{0xCE5648C3, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Bomberman Special [DahJee] (TW) */
{0x223397A1, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* King's Valley (TW) */
{0x281D2888, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Knightmare (TW) */
{0x306D5F78, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Rally-X [DahJee] (TW) */
{0x29E047CC, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Road Fighter (TW) */
{0x5CBD1163, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Tank Battalion (TW) */
{0x2E7166D5, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* The Legend of Kage (TW) */
{0xC550B4F0, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* TwinBee (TW) */
{0xFC87463C, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Yie Ar Kung-Fu II (TW) */
{0x69FC1494, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Bomberman Special (TW) */
{0xFFC4EE3F, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Magical Kid Wiz (TW) */
{0x2E366CCF, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* The Castle (TW) */
{0xAAAC12CF, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Rally-X (TW) */
{0xD2EDD329, 0, 0, SYSTEM_GAMEPAD, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Road Fighter (TW) */
{0xCE5648C3, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Bomberman Special [DahJee] (TW) */
{0x223397A1, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* King's Valley (TW) */
{0x281D2888, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Knightmare (TW) */
{0x306D5F78, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Rally-X [DahJee] (TW) */
{0x29E047CC, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Road Fighter (TW) */
{0x5CBD1163, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Tank Battalion (TW) */
{0x2E7166D5, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* The Legend of Kage (TW) */
{0xC550B4F0, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* TwinBee (TW) */
{0xFC87463C, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Yie Ar Kung-Fu II (TW) */
{0x69FC1494, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Bomberman Special (TW) */
{0xFFC4EE3F, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Magical Kid Wiz (TW) */
{0x2E366CCF, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* The Castle (TW) */
{0xAAAC12CF, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Rally-X (TW) */
{0xD2EDD329, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Road Fighter (TW) */
/* games requiring 2K internal RAM (SG-1000 II clone hardware) */
{0x7F7F009D, 0, 0, SYSTEM_GAMEPAD, MAPPER_NONE, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Circus Charlie (KR) */
{0x77DB4704, 0, 0, SYSTEM_GAMEPAD, MAPPER_NONE, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Q*Bert */
{0xC5A67B95, 0, 0, SYSTEM_GAMEPAD, MAPPER_NONE, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Othello Multivision BIOS */
{0x7F7F009D, 0, 0, 0, MAPPER_NONE, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Circus Charlie (KR) */
{0x77DB4704, 0, 0, 0, MAPPER_NONE, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Q*Bert */
{0xC5A67B95, 0, 0, 0, MAPPER_NONE, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Othello Multivision BIOS */
/* games requiring Japanese region setting */
{0x71DEBA5A, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GG, REGION_JAPAN_NTSC}, /* Pop Breaker */
{0xC9DD4E5F, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Woody Pop (Super Arkanoid) */
{0x71DEBA5A, 0, 0, 0, MAPPER_SEGA, SYSTEM_GG, REGION_JAPAN_NTSC}, /* Pop Breaker */
{0xC9DD4E5F, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Woody Pop (Super Arkanoid) */
/* games requiring Japanese Master System I/O chip (315-5297) */
{0xBD1CC7DF, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Tetris (KR) */
{0x6D309AC5, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Power Boggle Boggle (KR) */
{0xBD1CC7DF, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Tetris (KR) */
{0x6D309AC5, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Power Boggle Boggle (KR) */
/* games requiring random RAM pattern initialization */
{0x08BF3DE3, 0, 0, SYSTEM_GAMEPAD, MAPPER_NONE, SYSTEM_MARKIII, REGION_JAPAN_NTSC}, /* Alibaba and 40 Thieves (KR) */
{0x643B6B76, 0, 0, SYSTEM_GAMEPAD, MAPPER_NONE, SYSTEM_MARKIII, REGION_JAPAN_NTSC}, /* Block Hole (KR) */
{0x08BF3DE3, 0, 0, 0, MAPPER_NONE, SYSTEM_MARKIII, REGION_JAPAN_NTSC}, /* Alibaba and 40 Thieves (KR) */
{0x643B6B76, 0, 0, 0, MAPPER_NONE, SYSTEM_MARKIII, REGION_JAPAN_NTSC}, /* Block Hole (KR) */
/* games requiring PAL timings */
{0x72420F38, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Addams Familly */
{0x2D48C1D3, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Back to the Future Part III */
{0x1CBB7BF1, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Battlemaniacs (BR) */
{0x1B10A951, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Bram Stoker's Dracula */
{0xC0E25D62, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* California Games II */
{0x45C50294, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Jogos de Verao II (BR) */
{0xC9DBF936, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Home Alone */
{0x0047B615, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Predator2 */
{0xF42E145C, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Quest for the Shaven Yak Starring Ren Hoek & Stimpy (BR) */
{0x9F951756, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* RoboCop 3 */
{0xF8176918, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sensible Soccer */
{0x1575581D, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Shadow of the Beast */
{0x96B3F29E, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic Blast (BR) */
{0x5B3B922C, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic the Hedgehog 2 [V0] */
{0xD6F2BFCA, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic the Hedgehog 2 [V1] */
{0xCA1D3752, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Space Harrier [50 Hz] */
{0x85CFC9C9, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Taito Chase H.Q. */
{0x332A847D, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* NBA Jam [Proto] */
{0x72420F38, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Addams Familly */
{0x2D48C1D3, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Back to the Future Part III */
{0x1CBB7BF1, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Battlemaniacs (BR) */
{0x1B10A951, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Bram Stoker's Dracula */
{0xC0E25D62, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* California Games II */
{0x45C50294, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Jogos de Verao II (BR) */
{0xC9DBF936, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Home Alone */
{0x0047B615, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Predator2 */
{0xF42E145C, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Quest for the Shaven Yak Starring Ren Hoek & Stimpy (BR) */
{0x9F951756, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* RoboCop 3 */
{0xF8176918, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sensible Soccer */
{0x1575581D, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Shadow of the Beast */
{0x96B3F29E, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic Blast (BR) */
{0x5B3B922C, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic the Hedgehog 2 [V0] */
{0xD6F2BFCA, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic the Hedgehog 2 [V1] */
{0xCA1D3752, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Space Harrier [50 Hz] */
{0x85CFC9C9, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Taito Chase H.Q. */
{0x332A847D, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* NBA Jam [Proto] */
/* games running in Game Gear MS compatibility mode */
{0x59840FD6, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Castle of Illusion - Starring Mickey Mouse [SMS-GG] */
{0x9C76FB3A, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Rastan Saga [SMS-GG] */
{0xC8381DEF, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Taito Chase H.Q [SMS-GG] */
{0xDA8E95A9, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* WWF Wrestlemania Steel Cage Challenge [SMS-GG] */
{0x1D93246E, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Olympic Gold [A][SMS-GG] */
{0xA2F9C7AF, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Olympic Gold [B][SMS-GG] */
{0x01EAB89D, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Out Run Europa [SMS-GG] */
{0xF037EC00, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Out Run Europa (US) [SMS-GG] */
{0xE5F789B9, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Predator 2 [SMS-GG] */
{0x311D2863, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Prince of Persia [A][SMS-GG] */
{0x45F058D6, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Prince of Persia [B][SMS-GG] */
{0x56201996, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* R.C. Grand Prix [SMS-GG] */
{0x10DBBEF4, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Super Kick Off [SMS-GG] */
{0x9942B69B, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Castle of Illusion - Starring Mickey Mouse (J) [SMS-GG] */
{0x7BB81E3D, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Taito Chase H.Q (J) [SMS-GG] */
{0x6F8E46CF, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Alex Kidd in Miracle World (TW) [SMS-GG] */
{0x3382D73F, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Olympic Gold (TW) [SMS-GG] */
{0x59840FD6, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Castle of Illusion - Starring Mickey Mouse [SMS-GG] */
{0x9C76FB3A, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Rastan Saga [SMS-GG] */
{0xC8381DEF, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Taito Chase H.Q [SMS-GG] */
{0xDA8E95A9, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* WWF Wrestlemania Steel Cage Challenge [SMS-GG] */
{0x1D93246E, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Olympic Gold [A][SMS-GG] */
{0xA2F9C7AF, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Olympic Gold [B][SMS-GG] */
{0x01EAB89D, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Out Run Europa [SMS-GG] */
{0xF037EC00, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Out Run Europa (US) [SMS-GG] */
{0xE5F789B9, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Predator 2 [SMS-GG] */
{0x311D2863, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Prince of Persia [A][SMS-GG] */
{0x45F058D6, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Prince of Persia [B][SMS-GG] */
{0x56201996, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* R.C. Grand Prix [SMS-GG] */
{0x10DBBEF4, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Super Kick Off [SMS-GG] */
{0x9942B69B, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Castle of Illusion - Starring Mickey Mouse (J) [SMS-GG] */
{0x7BB81E3D, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Taito Chase H.Q (J) [SMS-GG] */
{0x6F8E46CF, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Alex Kidd in Miracle World (TW) [SMS-GG] */
{0x3382D73F, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Olympic Gold (TW) [SMS-GG] */
/* games requiring 3-D Glasses */
{0x6BD5C2BF, 1, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Space Harrier 3-D */
{0x8ECD201C, 1, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Blade Eagle 3-D */
{0xFBF96C81, 1, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Blade Eagle 3-D (BR) */
{0x58D5FC48, 1, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Blade Eagle 3-D [Proto] */
{0x31B8040B, 1, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Maze Hunter 3-D */
{0xABD48AD2, 1, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Poseidon Wars 3-D */
{0xA3EF13CB, 1, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Zaxxon 3-D */
{0xBBA74147, 1, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Zaxxon 3-D [Proto] */
{0xD6F43DDA, 1, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Out Run 3-D */
{0x871562b0, 1, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Maze Walker */
{0x156948f9, 1, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Space Harrier 3-D (J) */
{0x6BD5C2BF, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Space Harrier 3-D */
{0x8ECD201C, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Blade Eagle 3-D */
{0xFBF96C81, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Blade Eagle 3-D (BR) */
{0x58D5FC48, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Blade Eagle 3-D [Proto] */
{0x31B8040B, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Maze Hunter 3-D */
{0xABD48AD2, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Poseidon Wars 3-D */
{0xA3EF13CB, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Zaxxon 3-D */
{0xBBA74147, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Zaxxon 3-D [Proto] */
{0xD6F43DDA, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Out Run 3-D */
{0x871562b0, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Maze Walker */
{0x156948f9, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Space Harrier 3-D (J) */
/* games requiring 3-D Glasses & Sega Light Phaser */
{0xFBE5CFBB, 1, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Missile Defense 3D */
{0xE79BB689, 1, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Missile Defense 3D [BIOS] */
{0xFBE5CFBB, 1, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Missile Defense 3D */
{0xE79BB689, 1, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Missile Defense 3D [BIOS] */
/* games requiring Sega Light Phaser */
{0x861B6E79, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Assault City [Light Phaser] */
{0x5FC74D2A, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Gangster Town */
{0xE167A561, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Hang-On / Safari Hunt */
{0x91E93385, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Hang-On / Safari Hunt [BIOS] */
{0xE8EA842C, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Marksman Shooting / Trap Shooting */
{0xE8215C2E, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Marksman Shooting / Trap Shooting / Safari Hunt */
{0x205CAAE8, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Operation Wolf */
{0x23283F37, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Operation Wolf [A] */
{0xDA5A7013, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Rambo 3 */
{0x79AC8E7F, 0, 1, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Rescue Mission */
{0x4B051022, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Shooting Gallery */
{0xA908CFF5, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Spacegun */
{0x5359762D, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Wanted */
{0x0CA95637, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Laser Ghost */
{0x861B6E79, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Assault City [Light Phaser] */
{0x5FC74D2A, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Gangster Town */
{0xE167A561, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Hang-On / Safari Hunt */
{0x91E93385, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Hang-On / Safari Hunt [BIOS] */
{0xE8EA842C, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Marksman Shooting / Trap Shooting */
{0xE8215C2E, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Marksman Shooting / Trap Shooting / Safari Hunt */
{0x205CAAE8, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Operation Wolf */
{0x23283F37, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Operation Wolf [A] */
{0xDA5A7013, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Rambo 3 */
{0x79AC8E7F, 0, 1, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Rescue Mission */
{0x4B051022, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Shooting Gallery */
{0xA908CFF5, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Spacegun */
{0x5359762D, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Wanted */
{0x0CA95637, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Laser Ghost */
/* games requiring Sega Paddle */
{0xF9DBB533, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Alex Kidd BMX Trial */
{0xA6FA42D0, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Galactic Protector */
{0x29BC7FAD, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Megumi Rescue */
{0x315917D4, 0, 0, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Woody Pop */
{0xF9DBB533, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Alex Kidd BMX Trial */
{0xA6FA42D0, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Galactic Protector */
{0x29BC7FAD, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Megumi Rescue */
{0x315917D4, 0, 0, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Woody Pop */
/* games requiring Sega Sport Pad */
{0x41C948BF, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Sports Pad Soccer */
{0x0CB7E21F, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Great Ice Hockey */
{0xE42E4998, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Sports Pad Football */
{0x41C948BF, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Sports Pad Soccer */
{0x0CB7E21F, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Great Ice Hockey */
{0xE42E4998, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Sports Pad Football */
/* games requiring Furrtek's Master Tap */
{0xFAB6F52F, 0, 0, SYSTEM_MASTERTAP, MAPPER_NONE, SYSTEM_SMS2, REGION_USA}, /* BOom (v1.0) */
{0x143AB50B, 0, 0, SYSTEM_MASTERTAP, MAPPER_NONE, SYSTEM_SMS2, REGION_USA}, /* BOom (v1.1) */
{0xFAB6F52F, 0, 0, SYSTEM_MASTERTAP, MAPPER_NONE, SYSTEM_SMS2, REGION_USA}, /* BOom (v1.0) */
{0x143AB50B, 0, 0, SYSTEM_MASTERTAP, MAPPER_NONE, SYSTEM_SMS2, REGION_USA}, /* BOom (v1.1) */
/* games requiring Sega Graphic Board */
{0x276AA542, 0, 0, SYSTEM_GRAPHIC_BOARD, MAPPER_NONE, SYSTEM_SMS, REGION_USA}, /* Sega Graphic Board v2.0 Software (Prototype) */
/* games supporting YM2413 FM */
{0x1C951F8E, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* After Burner */
{0xC13896D5, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Alex Kidd: The Lost Stars */
{0x5CBFE997, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Alien Syndrome */
{0xBBA2FE98, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Altered Beast */
{0xFF614EB3, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Aztec Adventure */
{0x3084CF11, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Bomber Raid */
{0xAC6009A7, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* California Games */
{0xA4852757, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Captain Silver */
{0xB81F6FA5, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Captain Silver (U) */
{0x3CFF6E80, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Casino Games */
{0xE7F62E6D, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Cloud Master */
{0x908E7524, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Cyborg Hunter */
{0xA55D89F3, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Double Dragon */
{0xB8B141F9, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Fantasy Zone II */
{0xD29889AD, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Fantasy Zone: The Maze */
{0xA4AC35D8, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Galaxy Force */
{0x6C827520, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Galaxy Force (U) */
{0x1890F407, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Game Box Série Esportes Radicais (BR) */
{0xB746A6F5, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Global Defense */
{0x91A0FC4E, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Global Defense [Proto] */
{0x48651325, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Golfamania */
{0x5DABFDC3, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Golfamania [Proto] */
{0xA51376FE, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Golvellius - Valley of Doom */
{0x98E4AE4A, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Great Golf */
{0x516ED32E, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Kenseiden */
{0xE8511B08, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Lord of The Sword */
{0x0E333B6E, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Miracle Warriors - Seal of The Dark Lord */
{0x301A59AA, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Miracle Warriors - Seal of The Dark Lord [Proto] */
{0x01D67C0B, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Mônica no Castelo do Dragão (BR) */
{0x5589D8D2, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Out Run */
{0xE030E66C, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Parlour Games */
{0xF97E9875, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Penguin Land */
{0x4077EFD9, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Power Strike */
{0xBB54B6B0, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* R-Type */
{0x42FC47EE, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Rampage */
{0xC547EB1B, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Rastan */
{0x9A8B28EC, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Scramble Spirits */
{0xAAB67EC3, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Shanghai */
{0x0C6FAC4E, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Shinobi */
{0x4752CAE7, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* SpellCaster */
{0x1A390B93, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Tennis Ace */
{0xAE920E4B, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Thunder Blade */
{0x51BD14BE, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Time Soldiers */
{0x22CCA9BB, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Turma da Mônica em: O Resgate (BR) */
{0xB52D60C8, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Ultima IV */
{0xDE9F8517, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Ultima IV [Proto] */
{0xDFB0B161, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Vigilante */
{0x679E1676, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Wonder Boy III: The Dragon's Trap */
{0x8CBEF0C1, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Wonder Boy in Monster Land */
{0x2F2E3BC9, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Zillion II - The Tri Formation */
{0x48D44A13, 0, 1, SYSTEM_GAMEPAD, MAPPER_NONE, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* BIOS (J) */
{0xD8C4165B, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Aleste */
{0x4CC11DF9, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Alien Syndrome (J) */
{0xE421E466, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Chouon Senshi Borgman */
{0x2BCDB8FA, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Doki Doki Penguin Land - Uchuu-Daibouken */
{0x56BD2455, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Doki Doki Penguin Land - Uchuu-Daibouken [Proto] */
{0xC722FB42, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Fantasy Zone II (J) */
{0x7ABC70E9, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Family Games (Party Games) */
{0x6586BD1F, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Masters Golf */
{0x4847BC91, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Masters Golf [Proto] */
{0xB9FDF6D9, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Haja no Fuuin */
{0x955A009E, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hoshi wo Sagashite */
{0x05EA5353, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Kenseiden (J) */
{0xD11D32E4, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Kujakuou */
{0xAA7D6F45, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Lord of Sword */
{0xBF0411AD, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Maou Golvellius */
{0x21A21352, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Maou Golvellius [Proto] */
{0x5B5F9106, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Nekyuu Kousien */
{0xBEA27D5C, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Opa Opa */
{0x6605D36A, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Phantasy Star (J) */
{0xE1FFF1BB, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Shinobi (J) */
{0x11645549, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Solomon no Kagi - Oujo Rihita no Namida */
{0x7E0EF8CB, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Racing */
{0xB1DA6A30, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Wonder Boy Monster World */
{0x8132AB2C, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Tensai Bakabon */
{0xC0CE19B1, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Thunder Blade (J) */
{0x07301F83, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_PBC, REGION_JAPAN_NTSC} /* Phantasy Star [Megadrive] (J) */
{0x1C951F8E, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* After Burner */
{0xC13896D5, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Alex Kidd: The Lost Stars */
{0x5CBFE997, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Alien Syndrome */
{0xBBA2FE98, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Altered Beast */
{0xFF614EB3, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Aztec Adventure */
{0x3084CF11, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Bomber Raid */
{0xAC6009A7, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* California Games */
{0xA4852757, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Captain Silver */
{0xB81F6FA5, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Captain Silver (U) */
{0x3CFF6E80, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Casino Games */
{0xE7F62E6D, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Cloud Master */
{0x908E7524, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Cyborg Hunter */
{0xA55D89F3, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Double Dragon */
{0xB8B141F9, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Fantasy Zone II */
{0xD29889AD, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Fantasy Zone: The Maze */
{0xA4AC35D8, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Galaxy Force */
{0x6C827520, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Galaxy Force (U) */
{0x1890F407, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Game Box Série Esportes Radicais (BR) */
{0xB746A6F5, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Global Defense */
{0x91A0FC4E, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Global Defense [Proto] */
{0x48651325, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Golfamania */
{0x5DABFDC3, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Golfamania [Proto] */
{0xA51376FE, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Golvellius - Valley of Doom */
{0x98E4AE4A, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Great Golf */
{0x516ED32E, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Kenseiden */
{0xE8511B08, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Lord of The Sword */
{0x0E333B6E, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Miracle Warriors - Seal of The Dark Lord */
{0x301A59AA, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Miracle Warriors - Seal of The Dark Lord [Proto] */
{0x01D67C0B, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Mônica no Castelo do Dragão (BR) */
{0x5589D8D2, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Out Run */
{0xE030E66C, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Parlour Games */
{0xF97E9875, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Penguin Land */
{0x4077EFD9, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Power Strike */
{0xBB54B6B0, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* R-Type */
{0x42FC47EE, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Rampage */
{0xC547EB1B, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Rastan */
{0x9A8B28EC, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Scramble Spirits */
{0xAAB67EC3, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Shanghai */
{0x0C6FAC4E, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Shinobi */
{0x4752CAE7, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* SpellCaster */
{0x1A390B93, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Tennis Ace */
{0xAE920E4B, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Thunder Blade */
{0x51BD14BE, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Time Soldiers */
{0x22CCA9BB, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Turma da Mônica em: O Resgate (BR) */
{0xB52D60C8, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Ultima IV */
{0xDE9F8517, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Ultima IV [Proto] */
{0xDFB0B161, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Vigilante */
{0x679E1676, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Wonder Boy III: The Dragon's Trap */
{0x8CBEF0C1, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Wonder Boy in Monster Land */
{0x2F2E3BC9, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Zillion II - The Tri Formation */
{0x48D44A13, 0, 1, 0, MAPPER_NONE, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* BIOS (J) */
{0xD8C4165B, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Aleste */
{0x4CC11DF9, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Alien Syndrome (J) */
{0xE421E466, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Chouon Senshi Borgman */
{0x2BCDB8FA, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Doki Doki Penguin Land - Uchuu-Daibouken */
{0x56BD2455, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Doki Doki Penguin Land - Uchuu-Daibouken [Proto] */
{0xC722FB42, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Fantasy Zone II (J) */
{0x7ABC70E9, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Family Games (Party Games) */
{0x6586BD1F, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Masters Golf */
{0x4847BC91, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Masters Golf [Proto] */
{0xB9FDF6D9, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Haja no Fuuin */
{0x955A009E, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hoshi wo Sagashite */
{0x05EA5353, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Kenseiden (J) */
{0xD11D32E4, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Kujakuou */
{0xAA7D6F45, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Lord of Sword */
{0xBF0411AD, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Maou Golvellius */
{0x21A21352, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Maou Golvellius [Proto] */
{0x5B5F9106, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Nekyuu Kousien */
{0xBEA27D5C, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Opa Opa */
{0x6605D36A, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Phantasy Star (J) */
{0xE1FFF1BB, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Shinobi (J) */
{0x11645549, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Solomon no Kagi - Oujo Rihita no Namida */
{0x7E0EF8CB, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Racing */
{0xB1DA6A30, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Wonder Boy Monster World */
{0x8132AB2C, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Tensai Bakabon */
{0xC0CE19B1, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Thunder Blade (J) */
{0x07301F83, 0, 1, 0, MAPPER_SEGA, SYSTEM_PBC, REGION_JAPAN_NTSC} /* Phantasy Star [Megadrive] (J) */
};
/* Cartridge & BIOS ROM hardware */
@@ -363,7 +363,7 @@ static struct
uint8 *rom;
uint8 *fcr;
uint8 mapper;
uint8 pages;
uint16 pages;
} slot;
/* Function prototypes */
@@ -426,18 +426,17 @@ void sms_cart_init(void)
/* auto-detect cartridge mapper */
cart_rom.mapper = game_list[i].mapper;
/* save current input settings */
if (old_system[0] == -1)
{
old_system[0] = input.system[0];
}
if (old_system[1] == -1)
{
old_system[1] = input.system[1];
}
/* auto-detect required peripherals */
input.system[0] = game_list[i].peripheral;
if (game_list[i].peripheral)
{
/* save current input settings */
if (old_system[0] == -1)
{
old_system[0] = input.system[0];
}
input.system[0] = game_list[i].peripheral;
}
/* auto-detect 3D glasses support */
cart.special = game_list[i].g_3d;
+1 -1
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* SG-1000, Master System & Game Gear cartridge hardware support
*
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+12 -2
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Backup RAM support
*
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -68,7 +68,17 @@ void sram_init()
sram.sram = cart.rom + 0x800000;
/* initialize Backup RAM */
memset(sram.sram, 0xFF, 0x10000);
if (strstr(rominfo.international,"Sonic 1 Remastered"))
{
/* Sonic 1 Remastered hack crashes if backup RAM is not initialized to zero */
memset(sram.sram, 0x00, 0x10000);
}
else
{
/* by default, assume backup RAM is initialized to 0xFF (Micro Machines 2, Dino Dini Soccer) */
memset(sram.sram, 0xFF, 0x10000);
}
sram.crc = crc32(0, sram.sram, 0x10000);
/* retrieve informations from header */
+1 -1
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Backup RAM support
*
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+58 -22
View File
@@ -12,12 +12,69 @@
#include "shared.h"
svp_t *svp = NULL;
svp_t *svp;
static void svp_write_dram(uint32 address, uint32 data)
{
*(uint16 *)(svp->dram + (address & 0x1fffe)) = data;
if (data)
{
if (address == 0x30fe06) svp->ssp1601.emu_status &= ~SSP_WAIT_30FE06;
else if (address == 0x30fe08) svp->ssp1601.emu_status &= ~SSP_WAIT_30FE08;
}
}
static uint32 svp_read_cell_1(uint32 address)
{
address = (address & 0xe002) | ((address & 0x7c) << 6) | ((address & 0x1f80) >> 5);
return *(uint16 *)(svp->dram + address);
}
static uint32 svp_read_cell_2(uint32 address)
{
address = (address & 0xf002) | ((address & 0x3c) << 6) | ((address & 0xfc0) >> 4);
return *(uint16 *)(svp->dram + address);
}
static uint32 svp_read_cell_byte(uint32 address)
{
uint16 data = m68k.memory_map[address >> 16].read16(address);
if (address & 0x01)
{
return (data & 0xff);
}
return (data >> 8);
}
void svp_init(void)
{
svp = (void *) ((char *)cart.rom + 0x200000);
memset(svp, 0, sizeof(*svp));
m68k.memory_map[0x30].base = svp->dram;
m68k.memory_map[0x30].read8 = NULL;
m68k.memory_map[0x30].read16 = NULL;
m68k.memory_map[0x30].write8 = NULL;
m68k.memory_map[0x30].write16 = svp_write_dram;
zbank_memory_map[0x30].read = NULL;
zbank_memory_map[0x30].write = NULL;
m68k.memory_map[0x31].base = svp->dram + 0x10000;
m68k.memory_map[0x31].read8 = NULL;
m68k.memory_map[0x31].read16 = NULL;
m68k.memory_map[0x31].write8 = NULL;
m68k.memory_map[0x31].write16 = NULL;
zbank_memory_map[0x31].read = NULL;
zbank_memory_map[0x31].write = NULL;
m68k.memory_map[0x39].read8 = svp_read_cell_byte;
m68k.memory_map[0x39].read16 = svp_read_cell_1;
zbank_memory_map[0x39].read = svp_read_cell_byte;
m68k.memory_map[0x3a].read8 = svp_read_cell_byte;
m68k.memory_map[0x3a].read16 = svp_read_cell_2;
zbank_memory_map[0x3a].read = svp_read_cell_byte;
}
void svp_reset(void)
@@ -26,24 +83,3 @@ void svp_reset(void)
ssp1601_reset(&svp->ssp1601);
}
void svp_write_dram(uint32 address, uint32 data)
{
*(uint16 *)(svp->dram + (address & 0x1fffe)) = data;
if ((address == 0x30fe06) && data) svp->ssp1601.emu_status &= ~SSP_WAIT_30FE06;
if ((address == 0x30fe08) && data) svp->ssp1601.emu_status &= ~SSP_WAIT_30FE08;
}
uint32 svp_read_cell_1(uint32 address)
{
address >>= 1;
address = (address & 0x7001) | ((address & 0x3e) << 6) | ((address & 0xfc0) >> 5);
return *(uint16 *)(svp->dram + (address & 0x1fffe));
}
uint32 svp_read_cell_2(uint32 address)
{
address >>= 1;
address = (address & 0x7801) | ((address & 0x1e) << 6) | ((address & 0x7e0) >> 4);
return *(uint16 *)(svp->dram + (address & 0x1fffe));
}
-3
View File
@@ -26,8 +26,5 @@ extern svp_t *svp;
extern void svp_init(void);
extern void svp_reset(void);
extern void svp_write_dram(uint32 address, uint32 data);
extern uint32 svp_read_cell_1(uint32 address);
extern uint32 svp_read_cell_2(uint32 address);
#endif
+1 -1
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* CD compatible ROM/RAM cartridge support
*
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+2 -2
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* CD compatible ROM/RAM cartridge support
*
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -40,7 +40,7 @@
/* CD compatible ROM/RAM cartridge */
typedef struct
{
uint8 area[0x840000]; /* cartridge ROM/RAM area (max. 8MB ROM / 64KB backup memory + Pro Action Replay 128KB ROM / 64KB RAM) */
uint8 area[0x840080]; /* cartridge ROM/RAM area (max. 8MB ROM + 64KB backup memory + Pro Action Replay 128KB ROM / 64KB RAM + cartridge infos) */
uint8 boot; /* cartridge boot mode (0x00: boot from CD with ROM/RAM cartridge enabled, 0x40: boot from ROM cartridge with CD enabled) */
uint8 id; /* RAM cartridge ID (related to RAM size, 0 if disabled) */
uint8 prot; /* RAM cartridge write protection */
+69 -25
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* CD drive processor & CD-DA fader
*
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -123,10 +123,10 @@ static const uint32 toc_ffightj[29] =
};
/* supported WAVE file header (16-bit stereo samples @44.1kHz) */
static const unsigned char waveHeader[32] =
static const unsigned char waveHeader[28] =
{
0x57,0x41,0x56,0x45,0x66,0x6d,0x74,0x20,0x10,0x00,0x00,0x00,0x01,0x00,0x02,0x00,
0x44,0xac,0x00,0x00,0x10,0xb1,0x02,0x00,0x04,0x00,0x10,0x00,0x64,0x61,0x74,0x61
0x57,0x41,0x56,0x45,0x66,0x6d,0x74,0x20,0x10,0x00,0x00,0x00,0x01,0x00,
0x02,0x00,0x44,0xac,0x00,0x00,0x10,0xb1,0x02,0x00,0x04,0x00,0x10,0x00
};
/* supported WAVE file extensions */
@@ -449,16 +449,39 @@ int cdd_load(char *filename, char *header)
if (!strstr(lptr,"BINARY") && !strstr(lptr,"MOTOROLA"))
{
/* read file header */
unsigned char head[32];
unsigned char head[28];
fseek(cdd.toc.tracks[cdd.toc.last].fd, 8, SEEK_SET);
fread(head, 32, 1, cdd.toc.tracks[cdd.toc.last].fd);
fread(head, 28, 1, cdd.toc.tracks[cdd.toc.last].fd);
fseek(cdd.toc.tracks[cdd.toc.last].fd, 0, SEEK_SET);
/* autodetect WAVE file header (44.1KHz 16-bit stereo format only) */
if (!memcmp(head, waveHeader, 32))
if (!memcmp(head, waveHeader, 28))
{
/* look for 'data' chunk id */
int dataOffset = 0;
fseek(cdd.toc.tracks[cdd.toc.last].fd, 36, SEEK_SET);
while (fread(head, 4, 1, cdd.toc.tracks[cdd.toc.last].fd))
{
if (!memcmp(head, "data", 4))
{
dataOffset = ftell(cdd.toc.tracks[cdd.toc.last].fd) + 4;
fseek(cdd.toc.tracks[cdd.toc.last].fd, 0, SEEK_SET);
break;
}
fseek(cdd.toc.tracks[cdd.toc.last].fd, -2, SEEK_CUR);
}
/* check if 'data' chunk has not been found */
if (!dataOffset)
{
/* invalid WAVE file */
fclose(cdd.toc.tracks[cdd.toc.last].fd);
cdd.toc.tracks[cdd.toc.last].fd = 0;
break;
}
/* adjust current track file read offset with WAVE header length */
cdd.toc.tracks[cdd.toc.last].offset -= 44;
cdd.toc.tracks[cdd.toc.last].offset -= dataOffset;
}
#if defined(USE_LIBTREMOR) || defined(USE_LIBVORBIS)
else if (!ov_open(cdd.toc.tracks[cdd.toc.last].fd,&cdd.toc.tracks[cdd.toc.last].vf,0,0))
@@ -699,14 +722,35 @@ int cdd_load(char *filename, char *header)
while (fd)
{
/* read file HEADER */
unsigned char head[32];
unsigned char head[28];
fseek(fd, 8, SEEK_SET);
fread(head, 32, 1, fd);
fread(head, 28, 1, fd);
fseek(fd, 0, SEEK_SET);
/* check if this is a valid WAVE file (44.1KHz 16-bit stereo format only) */
if (!memcmp(head, waveHeader, 32))
if (!memcmp(head, waveHeader, 28))
{
/* look for 'data' chunk id */
int dataOffset = 0;
fseek(fd, 36, SEEK_SET);
while (fread(head, 4, 1, fd))
{
if (!memcmp(head, "data", 4))
{
dataOffset = ftell(fd) + 4;
break;
}
fseek(fd, -2, SEEK_CUR);
}
/* check if 'data' chunk has not been found */
if (!dataOffset)
{
/* invalid WAVE file */
fclose(fd);
break;
}
/* initialize current track file descriptor */
cdd.toc.tracks[cdd.toc.last].fd = fd;
@@ -718,7 +762,7 @@ int cdd_load(char *filename, char *header)
/* current track end time */
fseek(fd, 0, SEEK_END);
cdd.toc.tracks[cdd.toc.last].end = cdd.toc.tracks[cdd.toc.last].start + ((ftell(fd) - 44 + 2351) / 2352);
cdd.toc.tracks[cdd.toc.last].end = cdd.toc.tracks[cdd.toc.last].start + ((ftell(fd) - dataOffset + 2351) / 2352);
/* initialize file read offset for current track */
cdd.toc.tracks[cdd.toc.last].offset = cdd.toc.tracks[cdd.toc.last].start * 2352;
@@ -738,7 +782,7 @@ int cdd_load(char *filename, char *header)
cdd.toc.end = cdd.toc.tracks[cdd.toc.last].end;
/* adjust file read offset for current track with WAVE header length */
cdd.toc.tracks[cdd.toc.last].offset -= 44;
cdd.toc.tracks[cdd.toc.last].offset -= dataOffset;
/* increment track number */
cdd.toc.last++;
@@ -1444,8 +1488,8 @@ void cdd_process(void)
/* unless RS1 indicated invalid track infos */
if (scd.regs[0x38>>1].byte.l == 0x0f)
{
/* and SEEK has ended */
if (cdd.status != CD_SEEK)
/* and drive is now ready */
if (!cdd.latency)
{
/* then return valid track infos, e.g current track number in RS2-RS3 (fixes Lunar - The Silver Star) */
scd.regs[0x38>>1].byte.l = 0x02;
@@ -1568,11 +1612,11 @@ void cdd_process(void)
/* CD drive latency */
if (!cdd.latency)
{
/* Fixes a few games hanging during intro because they expect data to be read with some delay */
/* Fixes a few games hanging because they expect data to be read with some delay */
/* Radical Rex needs at least one interrupt delay */
/* Wolf Team games (Anet Futatabi, Cobra Command, Road Avenger & Time Gal) need at least 7 interrupts delay */
/* Space Adventure Cobra (2nd morgue scene) needs at least 13 interrupts delay (incl. seek time, so 7 is OK) */
cdd.latency = 7;
/* Wolf Team games (Anet Futatabi, Cobra Command, Earnest Evans, Road Avenger & Time Gal) need at least 10 interrupts delay */
/* Space Adventure Cobra (2nd morgue scene) needs at least 13 interrupts delay (incl. seek time, so 10 is OK) */
cdd.latency = 10;
}
/* CD drive seek time */
@@ -1655,13 +1699,13 @@ void cdd_process(void)
/* update status */
cdd.status = CD_PLAY;
/* return track index in RS2-RS3 */
scd.regs[0x38>>1].w = (CD_PLAY << 8) | 0x02;
scd.regs[0x3a>>1].w = (cdd.index < cdd.toc.last) ? lut_BCD_16[index + 1] : 0x0A0A;
/* RS1=0xf to invalidate track infos in RS2-RS8 until drive is ready (fixes Snatcher Act 2 start cutscene) */
scd.regs[0x38>>1].w = (CD_PLAY << 8) | 0x0f;
scd.regs[0x3a>>1].w = 0x0000;
scd.regs[0x3c>>1].w = 0x0000;
scd.regs[0x3e>>1].w = 0x0000;
scd.regs[0x40>>1].byte.h = 0x00;
break;
scd.regs[0x40>>1].w = ~(CD_PLAY + 0xf) & 0x0f;
return;
}
case 0x04: /* Seek */
@@ -1753,7 +1797,7 @@ void cdd_process(void)
/* update status */
cdd.status = CD_SEEK;
/* unknown RS1-RS8 values (returning 0xF in RS1 invalidates track infos in RS2-RS8 and fixes Final Fight CD intro when seek time is emulated) */
/* RS1=0xf to invalidate track infos in RS2-RS8 while seeking (fixes Final Fight CD intro when seek time is emulated) */
scd.regs[0x38>>1].w = (CD_SEEK << 8) | 0x0f;
scd.regs[0x3a>>1].w = 0x0000;
scd.regs[0x3c>>1].w = 0x0000;
+1 -1
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* CD drive processor & CD-DA fader
*
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+20 -3
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Mega CD / Sega CD hardware
*
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -1010,11 +1010,18 @@ static void scd_write_byte(unsigned int address, unsigned int data)
default:
{
/* SUB-CPU communication words */
if ((address & 0xf0) == 0x20)
if ((address & 0x1f0) == 0x20)
{
s68k_poll_sync(1 << ((address - 0x10) & 0x1f));
}
/* MAIN-CPU communication words */
else if ((address & 0x1f0) == 0x10)
{
/* read-only (Sega Classic Arcade Collection) */
return;
}
/* default registers */
if (address & 1)
{
@@ -1297,11 +1304,18 @@ static void scd_write_word(unsigned int address, unsigned int data)
default:
{
/* SUB-CPU communication words */
if ((address & 0xf0) == 0x20)
if ((address & 0x1f0) == 0x20)
{
s68k_poll_sync(3 << ((address - 0x10) & 0x1e));
}
/* MAIN-CPU communication words */
else if ((address & 0x1f0) == 0x10)
{
/* read-only (Sega Classic Arcade Collection) */
return;
}
/* default registers */
scd.regs[(address >> 1) & 0xff].w = data;
return;
@@ -1506,6 +1520,9 @@ void scd_init(void)
cdc_init();
gfx_init();
/* Initialize CD hardware master clock count per scanline */
scd.cycles_per_line = (uint32) (MCYCLES_PER_LINE * ((float)SCD_CLOCK / (float)system_clock));
/* Clear RAM */
memset(scd.prg_ram, 0x00, sizeof(scd.prg_ram));
memset(scd.word_ram, 0x00, sizeof(scd.word_ram));
+8 -7
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Mega CD / Sega CD hardware
*
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -50,12 +50,12 @@
#define scd ext.cd_hw
#endif
/* 5000000 SCD clocks/s = ~3184 clocks/line with a Master Clock of 53.693175 MHz */
/* This would be slightly (~30 clocks) more on PAL systems because of the slower */
/* Master Clock (53.203424 MHz) but not enough to really care about since clocks */
/* are not running in sync anyway. */
/* CD hardware Master Clock (50 MHz) */
#define SCD_CLOCK 50000000
#define SCYCLES_PER_LINE 3184
/* ~3184 SCD clocks/line on NTSC system (53.693175 MHz Master Clock) */
/* ~3214 SCD clocks/line on PAL system (53.203424 MHz Master Clock) */
#define SCYCLES_PER_LINE scd.cycles_per_line
/* Timer & Stopwatch clocks divider */
#define TIMERS_SCYCLES_RATIO (384 * 4)
@@ -70,7 +70,8 @@ typedef struct
uint8 word_ram_2M[0x40000]; /* 256K Word RAM (2M mode) */
uint8 bram[0x2000]; /* 8K Backup RAM */
reg16_t regs[0x100]; /* 256 x 16-bit ASIC registers */
uint32 cycles; /* Master clock counter */
uint32 cycles; /* CD Master clock counter */
uint32 cycles_per_line; /* CD Master clock count per scanline */
int32 stopwatch; /* Stopwatch counter */
int32 timer; /* Timer counter */
uint8 pending; /* Pending interrupts */
+24 -9
View File
@@ -4,8 +4,8 @@
*
* Support for SG-1000, Mark-III, Master System, Game Gear, Mega Drive & Mega CD hardware
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -234,24 +234,39 @@ void gen_reset(int hard_reset)
/* System Reset */
if (hard_reset)
{
/* clear RAM (TODO: use random bit patterns for all systems, like on real hardware) */
/* On hard reset, 68k CPU always starts at the same point in VDP frame */
/* Tests performed on VA4 PAL MD1 showed that the first HVC value read */
/* with 'move.w #0x8104,0xC00004' , 'move.w 0xC00008,%d0' sequence was */
/* 0x9F21 in 60HZ mode (0x9F00 if Mode 5 is not enabled by first MOVE) */
/* 0x8421 in 50HZ mode (0x8400 if Mode 5 is not enabled by first MOVE) */
/* Same value is returned on every power ON, indicating VDP is always */
/* starting at the same fixed point in frame (probably at the start of */
/* VSYNC and HSYNC) while 68k /VRES line remains asserted a fixed time */
/* after /SRES line has been released (13 msec approx). The difference */
/* between PAL & NTSC is caused by the top border area being 27 lines */
/* larger in PAL mode than in NTSC mode. CPU cycle counter is adjusted */
/* to match these results (taking in account emulated frame is started */
/* on line 192 */
m68k.cycles = ((lines_per_frame - 192 + 159 - (27 * vdp_pal)) * MCYCLES_PER_LINE) + 1004;
/* clear RAM (on real hardware, RAM values are random / undetermined on Power ON) */
memset(work_ram, 0x00, sizeof (work_ram));
memset(zram, 0x00, sizeof (zram));
}
else
{
/* when RESET button is pressed, 68k could be anywhere in VDP frame (Bonkers, Eternal Champions, X-Men 2) */
m68k.cycles = (uint32)((MCYCLES_PER_LINE * lines_per_frame) * ((double)rand() / (double)RAND_MAX));
/* reset YM2612 (on hard reset, this is done by sound_reset) */
fm_reset(0);
}
/* 68k & Z80 could be anywhere in VDP frame (Bonkers, Eternal Champions, X-Men 2) */
m68k.cycles = Z80.cycles = (uint32)((MCYCLES_PER_LINE * lines_per_frame) * ((double)rand() / (double)RAND_MAX));
/* 68k cycles should be a multiple of 7 */
/* 68k M-cycles should be a multiple of 7 */
m68k.cycles = (m68k.cycles / 7) * 7;
/* Z80 cycles should be a multiple of 15 */
Z80.cycles = (Z80.cycles / 15) * 15;
/* Z80 M-cycles should be a multiple of 15 */
Z80.cycles = (m68k.cycles / 15) * 15;
/* 8-bit / 16-bit modes */
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
+2 -2
View File
@@ -4,8 +4,8 @@
*
* Support for SG-1000, Mark-III, Master System, Game Gear, Mega Drive & Mega CD hardware
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+102 -44
View File
@@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus
* 2-Buttons, 3-Buttons & 6-Buttons controller support
* Additional support for J-Cart, 4-Way Play & Master Tap adapters
* with support for J-Cart, 4-Way Play & Master Tap adapters
*
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -45,6 +45,7 @@ static struct
uint8 State;
uint8 Counter;
uint8 Timeout;
uint32 Latency;
} gamepad[MAX_DEVICES];
static struct
@@ -62,9 +63,10 @@ void gamepad_reset(int port)
gamepad[port].State = 0x40;
gamepad[port].Counter = 0;
gamepad[port].Timeout = 0;
gamepad[port].Latency = 0;
/* reset 4-WayPlay latch */
latch = 0;
/* reset 4-WayPlay latch (controller #0 used by default) */
latch = 0x00;
/* reset Master Tap flip-flop */
flipflop[port>>2].Latch = 0;
@@ -81,18 +83,43 @@ void gamepad_refresh(int port)
}
}
void gamepad_end_frame(int port, unsigned int cycles)
{
if (gamepad[port].Latency > cycles)
{
/* adjust TH direction switching latency for next frame */
gamepad[port].Latency -= cycles;
}
else
{
/* reset TH direction switching latency */
gamepad[port].Latency = 0;
}
}
INLINE unsigned char gamepad_read(int port)
{
/* D7 is not connected, D6 returns TH input state */
unsigned int data = gamepad[port].State | 0x3F;
/* pad value */
unsigned int val = input.pad[port];
/* pad state */
unsigned int pad = input.pad[port];
/* get current TH input pulse counter */
unsigned int step = gamepad[port].Counter | (data >> 6);
/* D-PAD & buttons status are returned on D5-D0 (active low) */
/* get current timestamp */
unsigned int cycles = ((system_hw & SYSTEM_PBC) == SYSTEM_MD) ? m68k.cycles : Z80.cycles;
/* TH direction switching latency */
if (cycles < gamepad[port].Latency)
{
/* TH internal state switching has not occured yet (Decap Attack) */
step &= ~1;
}
/* C/B or START/A buttons status is returned on D5-D4 (active low) */
/* D-PAD or extra buttons status is returned on D3-D0 (active low) */
switch (step)
{
case 1: /*** First High ***/
@@ -100,25 +127,24 @@ INLINE unsigned char gamepad_read(int port)
case 5: /*** Third High ***/
{
/* TH = 1 : ?1CBRLDU */
data &= ~(val & 0x3F);
data &= ~(pad & 0x3F);
break;
}
case 0: /*** First Low ***/
case 2: /*** Second Low ***/
case 0: /*** 3-button only ***/
case 2: /*** First Low ***/
case 4: /*** Second Low ***/
{
/* TH = 0 : ?0SA00DU */
data &= ~(val & 0x03);
data &= ~((val >> 2) & 0x30);
data &= ~0x0C;
data &= ~((pad & 0x03) | ((pad >> 2) & 0x30) | 0x0C);
break;
}
/* 6-buttons specific (taken from gen-hw.txt) */
/* A 6-button gamepad allows the extra buttons to be read based on how */
/* many times TH is switched from 1 to 0 (and not 0 to 1). Observe the */
/* following sequence */
/* many times TH is switched from 1 to 0. Observe the following sequence */
/*
TH = 1 : ?1CBRLDU 3-button pad return value
TH = 0 : ?0SA00DU 3-button pad return value
TH = 1 : ?1CBRLDU 3-button pad return value
TH = 0 : ?0SA00DU 3-button pad return value
TH = 1 : ?1CBRLDU 3-button pad return value
@@ -126,28 +152,33 @@ INLINE unsigned char gamepad_read(int port)
TH = 1 : ?1CBMXYZ Extra buttons returned in D3-0
TH = 0 : ?0SA1111 D3-D0 are forced to '1'
*/
case 4: /*** Third Low ***/
case 6: /*** Third Low ***/
{
/* TH = 0 : ?0SA0000 D3-D0 forced to '0' */
data &= ~((val >> 2) & 0x30);
data &= ~0x0F;
break;
}
case 6: /*** Fourth Low ***/
{
/* TH = 0 : ?0SA1111 D3-D0 forced to '1' */
data &= ~((val >> 2) & 0x30);
data &= ~(((pad >> 2) & 0x30) | 0x0F);
break;
}
case 7: /*** Fourth High ***/
{
/* TH = 1 : ?1CBMXYZ Extra buttons returned in D3-D0 */
data &= ~(val & 0x30);
data &= ~((val >> 8) & 0x0F);
data &= ~((pad & 0x30) | ((pad >> 8) & 0x0F));
break;
}
default: /*** D3-D0 forced to '1' ***/
{
if (data & 0x40)
{
/* TH = 1 : ?0CB1111 */
data &= ~(pad & 0x30);
}
else
{
/* TH = 0 : ?0SA1111 */
data &= ~((pad >> 2) & 0x30);
}
}
}
return data;
@@ -155,17 +186,38 @@ INLINE unsigned char gamepad_read(int port)
INLINE void gamepad_write(int port, unsigned char data, unsigned char mask)
{
/* retrieve TH input state (pulled high when not configured as output by I/O controller) */
data = ((data & mask) | ~mask) & 0x40;
/* 6-Buttons controller specific */
if (input.dev[port] == DEVICE_PAD6B)
/* Check TH pin direction */
if (mask & 0x40)
{
/* TH=0 to TH=1 transition */
if (!gamepad[port].State && data)
/* get TH output state */
data &= 0x40;
/* reset TH direction switching latency */
gamepad[port].Latency = 0;
/* 6-Buttons controller specific */
if (input.dev[port] == DEVICE_PAD6B)
{
gamepad[port].Counter = (gamepad[port].Counter + 2) & 6;
gamepad[port].Timeout = 0;
/* TH 1->0 transition */
if (!data && gamepad[port].State)
{
gamepad[port].Counter += 2;
gamepad[port].Timeout = 0;
}
}
}
else
{
/* retrieve current timestamp */
unsigned int cycles = ((system_hw & SYSTEM_PBC) == SYSTEM_MD) ? m68k.cycles : Z80.cycles;
/* TH is pulled high when not configured as output by I/O controller */
data = 0x40;
/* TH 0->1 internal switching does not occur immediately (verified on MK-1650 model) */
if (!gamepad[port].State)
{
gamepad[port].Latency = cycles + 172;
}
}
@@ -173,7 +225,6 @@ INLINE void gamepad_write(int port, unsigned char data, unsigned char mask)
gamepad[port].State = data;
}
/*--------------------------------------------------------------------------*/
/* Default ports handlers */
/*--------------------------------------------------------------------------*/
@@ -204,14 +255,14 @@ void gamepad_2_write(unsigned char data, unsigned char mask)
unsigned char wayplay_1_read(void)
{
/* check if TH on port B is HIGH */
/* check if latched TH input on port B is HIGH */
if (latch & 0x04)
{
/* 4-WayPlay detection : xxxxx00 */
return 0x7C;
}
/* TR & TL on port B select controller # (0-3) */
/* latched TR & TL input state on port B select controller # (0-3) on port A */
return gamepad_read(latch);
}
@@ -222,14 +273,21 @@ unsigned char wayplay_2_read(void)
void wayplay_1_write(unsigned char data, unsigned char mask)
{
/* TR & TL on port B select controller # (0-3) */
/* latched TR & TL input state on port B select controller # (0-3) on port A */
gamepad_write(latch & 0x03, data, mask);
}
void wayplay_2_write(unsigned char data, unsigned char mask)
{
/* latch TH, TR & TL state on port B */
latch = ((data & mask) >> 4) & 0x07;
/* pins not configured as output by I/O controller are pulled HIGH */
data |= ~mask;
/* check if both UP & DOWN inputs are LOW */
if (!(data & 0x03))
{
/* latch TH, TR & TL input state */
latch = (data >> 4) & 0x07;
}
}
@@ -285,7 +343,7 @@ void mastertap_2_write(unsigned char data, unsigned char mask)
/* update bits set as output only */
data = (flipflop[1].Latch & ~mask) | (data & mask);
/* check TH=1 to TH=0 transition */
/* check TH 1->0 transition */
if ((flipflop[1].Latch & 0x40) && !(data & 0x40))
{
flipflop[1].Counter = (flipflop[1].Counter + 1) & 0x03;
+3 -2
View File
@@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus
* 2-Buttons, 3-Buttons & 6-Buttons controller support
* Additional support for J-Cart, 4-Way Play & Master Tap adapters
* with support for J-Cart, 4-Way Play & Master Tap adapters
*
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -43,6 +43,7 @@
/* Function prototypes */
extern void gamepad_reset(int port);
extern void gamepad_refresh(int port);
extern void gamepad_end_frame(int port, unsigned int cycles);
extern unsigned char gamepad_1_read(void);
extern unsigned char gamepad_2_read(void);
extern void gamepad_1_write(unsigned char data, unsigned char mask);
+18 -1
View File
@@ -3,7 +3,7 @@
* Input peripherals support
*
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -464,3 +464,20 @@ void input_refresh(void)
}
}
}
void input_end_frame(unsigned int cycles)
{
int i;
for (i=0; i<MAX_DEVICES; i++)
{
switch (input.dev[i])
{
case DEVICE_PAD3B:
case DEVICE_PAD6B:
{
gamepad_end_frame(i, cycles);
break;
}
}
}
}
+2 -1
View File
@@ -3,7 +3,7 @@
* Input peripherals support
*
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -154,5 +154,6 @@ extern int old_system[2];
extern void input_init(void);
extern void input_reset(void);
extern void input_refresh(void);
extern void input_end_frame(unsigned int cycles);
#endif
+9 -9
View File
@@ -4,8 +4,8 @@
*
* Support for Master System (315-5216, 315-5237 & 315-5297), Game Gear & Mega Drive I/O chips
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -437,13 +437,6 @@ void io_z80_write(unsigned int offset, unsigned int data, unsigned int cycles)
/* Send TR/TH state to connected peripherals */
port[0].data_w((data << 1) & 0x60, (~data << 5) & 0x60);
port[1].data_w((data >> 1) & 0x60, (~data << 3) & 0x60);
/* Japanese model specific */
if (region_code == REGION_JAPAN_NTSC)
{
/* Reading TH & TR pins always return 0 when set as output */
data &= 0x0F;
}
/* Check for TH low-to-high transitions on both ports */
if ((!(io_reg[0x0F] & 0x80) && (data & 0x80)) ||
@@ -453,6 +446,13 @@ void io_z80_write(unsigned int offset, unsigned int data, unsigned int cycles)
hvc_latch = hctab[cycles % MCYCLES_PER_LINE] | 0x10000;
}
/* Japanese model specific */
if (region_code == REGION_JAPAN_NTSC)
{
/* Reading TH & TR pins always return 0 when set as output */
data &= 0x0F;
}
/* Update I/O Control register */
io_reg[0x0F] = data;
}
+2 -2
View File
@@ -4,8 +4,8 @@
*
* Support for Master System (315-5216, 315-5237 & 315-5297), Game Gear & Mega Drive I/O chips
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+2 -3
View File
@@ -3,7 +3,7 @@
* ROM Loading Support
*
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -646,7 +646,7 @@ int load_rom(char *filename)
{
/* remove header */
size -= 512;
memcpy (cart.rom, cart.rom + 512, size);
memmove (cart.rom, cart.rom + 512, size);
/* assume interleaved Mega Drive / Genesis ROM format (.smd) */
if (system_hw == SYSTEM_MD)
@@ -1107,7 +1107,6 @@ void get_region(char *romheader)
else if (config.master_clock == 2) system_clock = MCLOCK_PAL;
}
/****************************************************************************
* get_company (Softdev - 2006)
*
+1 -1
View File
@@ -3,7 +3,7 @@
* ROM Loading Support
*
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+7 -7
View File
@@ -632,13 +632,13 @@ static const uint16 m68ki_exception_cycle_table[256] =
4*MUL, /* 22: RESERVED */
4*MUL, /* 23: RESERVED */
44*MUL, /* 24: Spurious Interrupt */
44*MUL, /* 25: Level 1 Interrupt Autovector */
44*MUL, /* 26: Level 2 Interrupt Autovector */
44*MUL, /* 27: Level 3 Interrupt Autovector */
44*MUL, /* 28: Level 4 Interrupt Autovector */
44*MUL, /* 29: Level 5 Interrupt Autovector */
44*MUL, /* 30: Level 6 Interrupt Autovector */
44*MUL, /* 31: Level 7 Interrupt Autovector */
54*MUL, /* 25: Level 1 Interrupt Autovector */
54*MUL, /* 26: Level 2 Interrupt Autovector */
54*MUL, /* 27: Level 3 Interrupt Autovector */
54*MUL, /* 28: Level 4 Interrupt Autovector */
54*MUL, /* 29: Level 5 Interrupt Autovector */
54*MUL, /* 30: Level 6 Interrupt Autovector */
54*MUL, /* 31: Level 7 Interrupt Autovector */
34*MUL, /* 32: TRAP #0 -- ASG: chanaged from 38 */
34*MUL, /* 33: TRAP #1 */
34*MUL, /* 34: TRAP #2 */
+1 -1
View File
@@ -257,7 +257,7 @@ void s68k_run(unsigned int cycles)
REG_IR = m68ki_read_imm_16();
/* Execute instruction */
m68ki_instruction_jump_table[REG_IR]();
m68ki_instruction_jump_table[REG_IR]();
USE_CYCLES(CYC_INSTRUCTION[REG_IR]);
/* Trace m68k_exception, if necessary */
+18 -5
View File
@@ -2,8 +2,8 @@
* Genesis Plus
* Main 68k bus handlers
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -207,7 +207,7 @@ void z80_write_byte(unsigned int address, unsigned int data)
default: /* ZRAM */
{
zram[address & 0x1FFF] = data;
m68k.cycles += 8; /* ZRAM access latency (fixes Pacman 2: New Adventures) */
m68k.cycles += 2 * 7; /* ZRAM access latency (fixes Pacman 2: New Adventures & Puyo Puyo 2) */
return;
}
}
@@ -420,6 +420,19 @@ unsigned int ctrl_io_read_byte(unsigned int address)
case 0x44: /* RADICA */
case 0x50: /* SVP */
{
if ((address & 0xFC) == 0x00)
{
unsigned int data = svp->ssp1601.gr[SSP_XST].byte.h;
return (address & 1) ? (data & 0xFF) : (data >> 8);
}
if ((address & 0xFE) == 0x04)
{
unsigned int data = svp->ssp1601.gr[SSP_PM0].byte.h;
svp->ssp1601.gr[SSP_PM0].byte.h &= ~1;
return (address & 1) ? (data & 0xFF) : (data >> 8);
}
return m68k_read_bus_8(address);
}
@@ -536,12 +549,12 @@ unsigned int ctrl_io_read_word(unsigned int address)
case 0x50: /* SVP */
{
if ((address & 0xFD) == 0)
if ((address & 0xFC) == 0x00)
{
return svp->ssp1601.gr[SSP_XST].byte.h;
}
if ((address & 0xFF) == 4)
if ((address & 0xFE) == 0x04)
{
unsigned int data = svp->ssp1601.gr[SSP_PM0].byte.h;
svp->ssp1601.gr[SSP_PM0].byte.h &= ~1;
+2 -2
View File
@@ -2,8 +2,8 @@
* Genesis Plus
* Main 68k bus handlers
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+72 -25
View File
@@ -4,8 +4,8 @@
*
* Support for SG-1000, Mark-III, Master System, Game Gear & Mega Drive ports access
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -468,18 +468,43 @@ void z80_ms_port_w(unsigned int port, unsigned char data)
default:
{
/* write FM chip if enabled */
if (!(port & 4) && (config.ym2413 & 1))
/* check if YM2413 chip is enabled */
if (config.ym2413 & 1)
{
fm_write(Z80.cycles, port, data);
/* 315-5297 I/O chip decodes bit 1 to enable/disable PSG output */
if (region_code == REGION_JAPAN_NTSC)
{
io_reg[6] = (data & 2) ? 0xFF : 0x00;
SN76489_Config(Z80.cycles, config.psg_preamp, config.psgBoostNoise, io_reg[6]);
/* 315-5297 I/O chip decodes full address range */
port &= 0xFF;
/* internal YM2413 chip */
if ((port == 0xF0) || (port == 0xF1))
{
fm_write(Z80.cycles, port, data);
return;
}
/* Audio control register (315-5297 I/O chip specific) */
if (port == 0xF2)
{
/* D1 D0
-----
0 0 : enable only PSG output (power-on default)
0 1 : enable only FM output
1 0 : disable both PSG & FM output
1 1 : enable both PSG and FM output
*/
SN76489_Config(Z80.cycles, config.psg_preamp, config.psgBoostNoise, ((data + 1) & 0x02) ? 0x00 : 0xFF);
fm_write(Z80.cycles, 0x02, data);
io_reg[6] = data;
return;
}
}
else if (!(port & 4))
{
/* external FM board */
fm_write(Z80.cycles, port, data);
return;
}
return;
}
z80_unused_port_w(port & 0xFF, data);
@@ -520,32 +545,54 @@ unsigned char z80_ms_port_r(unsigned int port)
default:
{
uint8 data = 0xFF;
/* read FM chip if enabled */
if (!(port & 4) && (config.ym2413 & 1))
if (region_code == REGION_JAPAN_NTSC)
{
data = YM2413Read();
/* 315-5297 I/O chip decodes full address range */
if (region_code == REGION_JAPAN_NTSC)
port &= 0xFF;
if (port == 0xF2)
{
return data;
/* D7-D5 : C-SYNC counter (not emulated)
D4-D2 : Always zero
D1 : Mute control bit 1
D0 : Mute control bit 0
*/
return io_reg[0x06] & 0x03;
}
}
/* read I/O ports if enabled */
if (!(io_reg[0x0E] & 0x04))
if ((port == 0xC0) || (port == 0xC1) || (port == 0xDC) || (port == 0xDD))
{
/* read I/O ports if enabled */
if (!(io_reg[0x0E] & 0x04))
{
return io_z80_read(port & 1);
}
}
return z80_unused_port_r(port);
}
else
{
data &= io_z80_read(port & 1);
}
uint8 data = 0xFF;
return data;
/* read FM board if enabled */
if (!(port & 4) && (config.ym2413 & 1))
{
data = YM2413Read();
}
/* read I/O ports if enabled */
if (!(io_reg[0x0E] & 0x04))
{
data &= io_z80_read(port & 1);
}
return data;
}
}
}
}
/*--------------------------------------------------------------------------*/
/* Mark III port handlers */
/*--------------------------------------------------------------------------*/
+2 -2
View File
@@ -4,8 +4,8 @@
*
* Support for SG-1000, Mark-III, Master System, Game Gear & Mega Drive ports access
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+109 -114
View File
@@ -1,9 +1,11 @@
/***************************************************************************************
* Genesis Plus
* 8-bit & 16-bit (with & without CD) systems emulation
* Virtual System emulation
*
* Support for 16-bit & 8-bit hardware modes
*
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -137,7 +139,7 @@ void audio_set_rate(int samplerate, double framerate)
if (system_hw == SYSTEM_MCD)
{
/* number of SCD master clocks run per second */
mclk = framerate ? (SCYCLES_PER_LINE * (vdp_pal ? 313 : 262) * framerate) : SCD_CLOCK;
mclk = (mclk / system_clock) * SCD_CLOCK;
/* PCM core */
pcm_init(mclk, samplerate);
@@ -421,6 +423,9 @@ void system_frame_gen(int do_skip)
bitmap.viewport.y = (config.overscan & 1) * 24 * (vdp_pal + 1);
}
/* active screen width */
bitmap.viewport.w = 256 + ((reg[12] & 0x01) << 6);
/* check viewport changes */
if (bitmap.viewport.h != bitmap.viewport.oh)
{
@@ -429,13 +434,10 @@ void system_frame_gen(int do_skip)
}
}
/* initialize VCounter */
v_counter = bitmap.viewport.h;
/* first line of overscan */
if (bitmap.viewport.y)
{
blank_line(v_counter, -bitmap.viewport.x, bitmap.viewport.w + 2*bitmap.viewport.x);
blank_line(bitmap.viewport.h, -bitmap.viewport.x, bitmap.viewport.w + 2*bitmap.viewport.x);
}
/* clear DMA Busy, FIFO FULL & field flags */
@@ -476,33 +478,37 @@ void system_frame_gen(int do_skip)
/* refresh inputs just before VINT (Warriors of Eternal Sun) */
osd_input_update();
/* delay between VINT flag & Vertical Interrupt (Ex-Mutants, Tyrant) */
m68k_run(588);
/* set VINT flag */
status |= 0x80;
/* delay between VBLANK flag & Vertical Interrupt (Dracula, OutRunners, VR Troopers) */
m68k_run(788);
if (zstate == 1)
/* VDP always starts after VBLANK so VINT cannot occur on first frame after a VDP reset (verified on real hardware) */
if (v_counter != bitmap.viewport.h)
{
z80_run(788);
}
else
{
Z80.cycles = 788;
}
/* reinitialize VCounter */
v_counter = bitmap.viewport.h;
/* Vertical Interrupt */
vint_pending = 0x20;
if (reg[1] & 0x20)
{
/* level 6 interrupt */
m68k_set_irq(6);
}
/* delay between VBLANK flag & Vertical Interrupt (Dracula, OutRunners, VR Troopers) */
m68k_run(788);
if (zstate == 1)
{
z80_run(788);
}
else
{
Z80.cycles = 788;
}
/* assert Z80 interrupt */
Z80.irq_state = ASSERT_LINE;
/* set VINT flag */
status |= 0x80;
/* Vertical Interrupt */
vint_pending = 0x20;
if (reg[1] & 0x20)
{
/* level 6 interrupt */
m68k_set_irq(6);
}
/* assert Z80 interrupt */
Z80.irq_state = ASSERT_LINE;
}
/* run 68k & Z80 until end of line */
m68k_run(MCYCLES_PER_LINE);
@@ -515,6 +521,9 @@ void system_frame_gen(int do_skip)
Z80.cycles = MCYCLES_PER_LINE;
}
/* Z80 interrupt is cleared at the end of the line */
Z80.irq_state = CLEAR_LINE;
/* run SVP chip */
if (svp)
{
@@ -546,23 +555,6 @@ void system_frame_gen(int do_skip)
/* update 6-Buttons & Lightguns */
input_refresh();
if (Z80.irq_state)
{
/* Z80 interrupt is asserted for exactly one line */
m68k_run(mcycles_vdp + 788);
if (zstate == 1)
{
z80_run(mcycles_vdp + 788);
}
else
{
Z80.cycles = mcycles_vdp + 788;
}
/* clear Z80 interrupt */
Z80.irq_state = CLEAR_LINE;
}
/* run 68k & Z80 until end of line */
m68k_run(mcycles_vdp + MCYCLES_PER_LINE);
if (zstate == 1)
@@ -708,7 +700,8 @@ void system_frame_gen(int do_skip)
bitmap.viewport.changed |= 1;
}
/* adjust CPU cycle counters for next frame */
/* adjust timings for next frame */
input_end_frame(mcycles_vdp);
m68k.cycles -= mcycles_vdp;
Z80.cycles -= mcycles_vdp;
}
@@ -789,6 +782,9 @@ void system_frame_scd(int do_skip)
bitmap.viewport.y = (config.overscan & 1) * 24 * (vdp_pal + 1);
}
/* active screen width */
bitmap.viewport.w = 256 + ((reg[12] & 0x01) << 6);
/* check viewport changes */
if (bitmap.viewport.h != bitmap.viewport.oh)
{
@@ -797,13 +793,10 @@ void system_frame_scd(int do_skip)
}
}
/* initialize VCounter */
v_counter = bitmap.viewport.h;
/* first line of overscan */
if (bitmap.viewport.y)
{
blank_line(v_counter, -bitmap.viewport.x, bitmap.viewport.w + 2*bitmap.viewport.x);
blank_line(bitmap.viewport.h, -bitmap.viewport.x, bitmap.viewport.w + 2*bitmap.viewport.x);
}
/* clear DMA Busy, FIFO FULL & field flags */
@@ -844,33 +837,37 @@ void system_frame_scd(int do_skip)
/* refresh inputs just before VINT */
osd_input_update();
/* delay between VINT flag & Vertical Interrupt (Ex-Mutants, Tyrant) */
m68k_run(588);
/* set VINT flag */
status |= 0x80;
/* delay between VBLANK flag & Vertical Interrupt (Dracula, OutRunners, VR Troopers) */
m68k_run(788);
if (zstate == 1)
/* VDP always starts after VBLANK so VINT cannot occur on first frame after a VDP reset (verified on real hardware) */
if (v_counter != bitmap.viewport.h)
{
z80_run(788);
}
else
{
Z80.cycles = 788;
}
/* reinitialize VCounter */
v_counter = bitmap.viewport.h;
/* Vertical Interrupt */
vint_pending = 0x20;
if (reg[1] & 0x20)
{
/* level 6 interrupt */
m68k_set_irq(6);
}
/* delay between VBLANK flag & Vertical Interrupt (Dracula, OutRunners, VR Troopers) */
m68k_run(788);
if (zstate == 1)
{
z80_run(788);
}
else
{
Z80.cycles = 788;
}
/* assert Z80 interrupt */
Z80.irq_state = ASSERT_LINE;
/* set VINT flag */
status |= 0x80;
/* Vertical Interrupt */
vint_pending = 0x20;
if (reg[1] & 0x20)
{
/* level 6 interrupt */
m68k_set_irq(6);
}
/* assert Z80 interrupt */
Z80.irq_state = ASSERT_LINE;
}
/* run both 68k & CD hardware until end of line */
scd_update(MCYCLES_PER_LINE);
@@ -885,6 +882,9 @@ void system_frame_scd(int do_skip)
Z80.cycles = MCYCLES_PER_LINE;
}
/* Z80 interrupt is cleared at the end of the line */
Z80.irq_state = CLEAR_LINE;
/* update VDP cycle count */
mcycles_vdp = MCYCLES_PER_LINE;
@@ -910,23 +910,6 @@ void system_frame_scd(int do_skip)
/* update 6-Buttons & Lightguns */
input_refresh();
if (Z80.irq_state)
{
/* Z80 interrupt is asserted for exactly one line */
m68k_run(mcycles_vdp + 788);
if (zstate == 1)
{
z80_run(mcycles_vdp + 788);
}
else
{
Z80.cycles = mcycles_vdp + 788;
}
/* clear Z80 interrupt */
Z80.irq_state = CLEAR_LINE;
}
/* run both 68k & CD hardware until end of line */
scd_update(mcycles_vdp + MCYCLES_PER_LINE);
@@ -1060,10 +1043,9 @@ void system_frame_scd(int do_skip)
bitmap.viewport.changed |= 1;
}
/* prepare for next SCD frame */
/* adjust timings for next frame */
scd_end_frame(scd.cycles);
/* adjust CPU cycle counters for next frame */
input_end_frame(mcycles_vdp);
m68k.cycles -= mcycles_vdp;
Z80.cycles -= mcycles_vdp;
}
@@ -1178,7 +1160,10 @@ void system_frame_sms(int do_skip)
}
}
}
/* active screen width */
bitmap.viewport.w = 256 + ((reg[12] & 0x01) << 6);
/* check viewport changes */
if (bitmap.viewport.h != bitmap.viewport.oh)
{
@@ -1280,17 +1265,22 @@ void system_frame_sms(int do_skip)
/* update VCounter */
v_counter = line;
/* Master System & Game Gear VDP specific */
if ((system_hw < SYSTEM_MD) && (line > (lines_per_frame - 16)))
{
/* Sprites are still processed during top border */
render_obj((line - lines_per_frame) & 1);
parse_satb(line - lines_per_frame);
}
/* render overscan */
if ((line < end) || (line >= start))
{
/* Master System & Game Gear VDP specific */
if ((system_hw < SYSTEM_MD) && (line > (lines_per_frame - 16)))
{
/* Sprites are still processed during top border */
if (reg[1] & 0x40)
{
render_obj((line - lines_per_frame) & 1);
}
/* Sprites pre-processing occurs even when display is disabled */
parse_satb(line - lines_per_frame);
}
blank_line(line, -bitmap.viewport.x, bitmap.viewport.w + 2*bitmap.viewport.x);
}
@@ -1311,6 +1301,16 @@ void system_frame_sms(int do_skip)
/* last line of overscan */
if (bitmap.viewport.y > 0)
{
/* Master System & Game Gear VDP specific */
if (system_hw < SYSTEM_MD)
{
/* Sprites are still processed during top border */
if (reg[1] & 0x40)
{
render_obj(1);
}
}
blank_line(line, -bitmap.viewport.x, bitmap.viewport.w + 2*bitmap.viewport.x);
}
@@ -1360,13 +1360,7 @@ void system_frame_sms(int do_skip)
/* Master System & Game Gear VDP specific */
else
{
/* Sprites are still processed during vertical borders */
if (reg[1] & 0x40)
{
render_obj(1);
}
{
/* Sprites pre-processing occurs even when display is disabled */
parse_satb(-1);
}
@@ -1455,6 +1449,7 @@ void system_frame_sms(int do_skip)
bitmap.viewport.changed |= 1;
}
/* adjust Z80 cycle count for next frame */
/* adjust timings for next frame */
input_end_frame(mcycles_vdp);
Z80.cycles -= mcycles_vdp;
}
+4 -2
View File
@@ -1,9 +1,11 @@
/***************************************************************************************
* Genesis Plus
* 8-bit & 16-bit (with & without CD) systems emulation
* Virtual System emulation
*
* Support for 16-bit & 8-bit hardware modes
*
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+90 -145
View File
@@ -5,7 +5,7 @@
* Support for SG-1000 (TMS99xx & 315-5066), Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP
*
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -125,7 +125,7 @@ static const uint8 shift_table[] = { 6, 7, 0, 8 };
static const uint8 col_mask_table[] = { 0x0F, 0x1F, 0x0F, 0x3F };
static const uint16 row_mask_table[] = { 0x0FF, 0x1FF, 0x2FF, 0x3FF };
static uint8 bordrr; /* Border color index */
static uint8 border; /* Border color index */
static uint8 pending; /* Pending write flag */
static uint8 code; /* Code register */
static uint8 dma_type; /* DMA mode */
@@ -180,6 +180,26 @@ static void (*const dma_func[16])(unsigned int length) =
vdp_dma_copy,vdp_dma_copy,vdp_dma_copy,vdp_dma_copy
};
/* BG rendering functions */
static void (*const render_bg_modes[16])(int line) =
{
render_bg_m0, /* Graphics I */
render_bg_m2, /* Graphics II */
render_bg_m4, /* Mode 4 */
render_bg_m4, /* Mode 4 */
render_bg_m3, /* Multicolor */
render_bg_m3x, /* Multicolor (Extended PG) */
render_bg_m4, /* Mode 4 */
render_bg_m4, /* Mode 4 */
render_bg_m1, /* Text */
render_bg_m1x, /* Text (Extended PG) */
render_bg_m4, /* Mode 4 */
render_bg_m4, /* Mode 4 */
render_bg_inv, /* Invalid (1+3) */
render_bg_inv, /* Invalid (1+2+3) */
render_bg_m4, /* Mode 4 */
render_bg_m4, /* Mode 4 */
};
/*--------------------------------------------------------------------------*/
/* Init, reset, context functions */
@@ -219,7 +239,7 @@ void vdp_reset(void)
addr_latch = 0;
code = 0;
pending = 0;
bordrr = 0;
border = 0;
hint_pending = 0;
vint_pending = 0;
dmafill = 0;
@@ -451,12 +471,14 @@ int vdp_context_load(uint8 *state)
}
else
{
/* TMS-99xx registers are updated directly to prevent spurious 4K->16K VRAM switching */
for (i=0;i<0x08;i++)
{
pending = 1;
addr_latch = temp_reg[i];
vdp_tms_ctrl_w(0x80 | i);
reg[i] = temp_reg[i];
}
/* Rendering mode */
render_bg = render_bg_modes[((reg[0] & 0x02) | (reg[1] & 0x18)) >> 1];
}
}
else
@@ -498,7 +520,7 @@ int vdp_context_load(uint8 *state)
bg_list_index = 0x800;
/* reinitialize palette */
color_update_m5(0, *(uint16 *)&cram[bordrr << 1]);
color_update_m5(0, *(uint16 *)&cram[border << 1]);
for(i = 1; i < 0x40; i++)
{
color_update_m5(i, *(uint16 *)&cram[i << 1]);
@@ -514,10 +536,10 @@ int vdp_context_load(uint8 *state)
{
color_update_m4(i, *(uint16 *)&cram[i << 1]);
}
color_update_m4(0x40, *(uint16 *)&cram[(0x10 | (bordrr & 0x0F)) << 1]);
color_update_m4(0x40, *(uint16 *)&cram[(0x10 | (border & 0x0F)) << 1]);
}
/* invalidate cache */
/* invalidate tile cache */
for (i=0;i<bg_list_index;i++)
{
bg_name_list[i]=i;
@@ -534,7 +556,7 @@ int vdp_context_load(uint8 *state)
void vdp_dma_update(unsigned int cycles)
{
int dma_cycles, dma_bytes;
unsigned int dma_cycles, dma_bytes;
/* DMA transfer rate (bytes per line)
@@ -619,7 +641,7 @@ void vdp_dma_update(unsigned int cycles)
}
/* Process DMA */
if (dma_bytes > 0)
if (dma_bytes)
{
/* Update DMA length */
dma_length -= dma_bytes;
@@ -1006,62 +1028,7 @@ void vdp_sms_ctrl_w(unsigned int data)
}
/* Rendering mode */
switch (mode)
{
case 0x00: /* Graphics I */
{
render_bg = render_bg_m0;
break;
}
case 0x10: /* Text */
{
render_bg = render_bg_m1;
break;
}
case 0x02: /* Graphics II */
{
render_bg = render_bg_m2;
break;
}
case 0x12: /* Text (Extended PG) */
{
render_bg = render_bg_m1x;
break;
}
case 0x08: /* Multicolor */
{
render_bg = render_bg_m3;
break;
}
case 0x18: /* Invalid (1+3) */
{
render_bg = render_bg_inv;
break;
}
case 0x0A: /* Multicolor (Extended PG) */
{
render_bg = render_bg_m3x;
break;
}
case 0x1A: /* Invalid (1+2+3) */
{
render_bg = render_bg_inv;
break;
}
default: /* Mode 4 */
{
render_bg = render_bg_m4;
break;
}
}
render_bg = render_bg_modes[mode>>1];
/* Mode switching */
if (prev & 0x04)
@@ -1092,7 +1059,7 @@ void vdp_sms_ctrl_w(unsigned int data)
{
color_update_m4(i, *(uint16 *)&cram[i << 1]);
}
color_update_m4(0x40, *(uint16 *)&cram[(0x10 | (bordrr & 0x0F)) << 1]);
color_update_m4(0x40, *(uint16 *)&cram[(0x10 | (border & 0x0F)) << 1]);
}
}
}
@@ -1140,59 +1107,8 @@ void vdp_tms_ctrl_w(unsigned int data)
/* Check VDP mode changes */
if (data < 2)
{
int mode = (reg[0] & 0x02) | (reg[1] & 0x18);
/* Rendering mode */
switch (mode)
{
case 0x00: /* Graphics I */
{
render_bg = render_bg_m0;
break;
}
case 0x10: /* Text */
{
render_bg = render_bg_m1;
break;
}
case 0x02: /* Graphics II */
{
render_bg = render_bg_m2;
break;
}
case 0x12: /* Text (Extended PG) */
{
render_bg = render_bg_m1x;
break;
}
case 0x08: /* Multicolor */
{
render_bg = render_bg_m3;
break;
}
case 0x18: /* Invalid (1+3) */
{
render_bg = render_bg_inv;
break;
}
case 0x0A: /* Multicolor (Extended PG) */
{
render_bg = render_bg_m3x;
break;
}
case 0x1A: /* Invalid (1+2+3) */
{
render_bg = render_bg_inv;
break;
}
}
render_bg = render_bg_modes[((reg[0] & 0x02) | (reg[1] & 0x18)) >> 1];
}
}
}
@@ -1218,6 +1134,9 @@ unsigned int vdp_68k_ctrl_r(unsigned int cycles)
{
unsigned int temp;
/* Cycle-accurate VDP status read (68k read cycle takes four CPU cycles i.e 28 Mcycles) */
cycles += 4 * 7;
/* Update FIFO status flags if not empty */
if (fifo_write_cnt)
{
@@ -1244,14 +1163,25 @@ unsigned int vdp_68k_ctrl_r(unsigned int cycles)
/* Clear SOVR & SCOL flags */
status &= 0xFF9F;
/* Display OFF: VBLANK flag is set */
/* VBLANK flag is set when display is disabled */
if (!(reg[1] & 0x40))
{
temp |= 0x08;
}
/* HBLANK flag (Sonic 3 and Sonic 2 "VS Modes", Lemmings 2, Mega Turrican, V.R Troopers, Gouketsuji Ichizoku,...) */
/* NB: this is not 100% accurate and need to be verified on real hardware */
/* Cycle-accurate VINT flag (Ex-Mutants, Tyrant / Mega-Lo-Mania) */
/* this allows VINT flag to be read just before vertical interrupt is being triggered */
if ((v_counter == bitmap.viewport.h) && (cycles >= (mcycles_vdp + 788)))
{
/* check Z80 interrupt state to assure VINT has not already been triggered (and flag cleared) */
if (Z80.irq_state != ASSERT_LINE)
{
temp |= 0x80;
}
}
/* Cycle-accurate HBLANK flag (Sonic 3 & Sonic 2 "VS Modes", Bugs Bunny Double Trouble, Lemmings 2, Mega Turrican, V.R Troopers, Gouketsuji Ichizoku,...) */
/* NB: this is not 100% accurate (see hvc.h for horizontal events timings in H32 and H40 mode) but is close enough to make no noticeable difference for games */
if ((cycles % MCYCLES_PER_LINE) < 588)
{
temp |= 0x04;
@@ -1552,7 +1482,7 @@ static void vdp_reg_w(unsigned int r, unsigned int d, unsigned int cycles)
if (reg[1] & 0x04)
{
/* Mode 5 */
color_update_m5(0x00, *(uint16 *)&cram[bordrr << 1]);
color_update_m5(0x00, *(uint16 *)&cram[border << 1]);
for (i = 1; i < 0x40; i++)
{
color_update_m5(i, *(uint16 *)&cram[i << 1]);
@@ -1565,7 +1495,7 @@ static void vdp_reg_w(unsigned int r, unsigned int d, unsigned int cycles)
{
color_update_m4(i, *(uint16 *)&cram[i << 1]);
}
color_update_m4(0x40, *(uint16 *)&cram[(0x10 | (bordrr & 0x0F)) << 1]);
color_update_m4(0x40, *(uint16 *)&cram[(0x10 | (border & 0x0F)) << 1]);
}
}
}
@@ -1749,7 +1679,7 @@ static void vdp_reg_w(unsigned int r, unsigned int d, unsigned int cycles)
}
/* Reset color palette */
color_update_m5(0x00, *(uint16 *)&cram[bordrr << 1]);
color_update_m5(0x00, *(uint16 *)&cram[border << 1]);
for (i = 1; i < 0x40; i++)
{
color_update_m5(i, *(uint16 *)&cram[i << 1]);
@@ -1787,7 +1717,7 @@ static void vdp_reg_w(unsigned int r, unsigned int d, unsigned int cycles)
{
color_update_m4(i, *(uint16 *)&cram[i << 1]);
}
color_update_m4(0x40, *(uint16 *)&cram[(0x10 | (bordrr & 0x0F)) << 1]);
color_update_m4(0x40, *(uint16 *)&cram[(0x10 | (border & 0x0F)) << 1]);
/* Mode 4 bus access */
vdp_68k_data_w = vdp_68k_data_w_m4;
@@ -1888,10 +1818,10 @@ static void vdp_reg_w(unsigned int r, unsigned int d, unsigned int cycles)
/* Check if backdrop color changed */
d &= 0x3F;
if (d != bordrr)
if (d != border)
{
/* Update backdrop color */
bordrr = d;
border = d;
/* Reset palette entry */
if (reg[1] & 4)
@@ -1975,7 +1905,7 @@ static void vdp_reg_w(unsigned int r, unsigned int d, unsigned int cycles)
{
/* Reset color palette */
int i;
color_update_m5(0x00, *(uint16 *)&cram[bordrr << 1]);
color_update_m5(0x00, *(uint16 *)&cram[border << 1]);
for (i = 1; i < 0x40; i++)
{
color_update_m5(i, *(uint16 *)&cram[i << 1]);
@@ -2016,8 +1946,8 @@ static void vdp_reg_w(unsigned int r, unsigned int d, unsigned int cycles)
/* Update clipping */
window_clip(reg[17], 1);
/* Update active display width & max sprite pixels per line*/
max_sprite_pixels = bitmap.viewport.w = 320;
/* Update max sprite pixels per line*/
max_sprite_pixels = 320;
}
else
{
@@ -2033,15 +1963,30 @@ static void vdp_reg_w(unsigned int r, unsigned int d, unsigned int cycles)
/* Update clipping */
window_clip(reg[17], 0);
/* Update active display width & max sprite pixels per line*/
max_sprite_pixels = bitmap.viewport.w = 256;
/* Update max sprite pixels per line*/
max_sprite_pixels = 256;
}
/* Active display width modified during HBLANK (Bugs Bunny Double Trouble) */
if ((v_counter < bitmap.viewport.h) && (reg[1] & 0x40) && (cycles <= (mcycles_vdp + 860)))
if (v_counter >= bitmap.viewport.h)
{
/* Redraw entire line */
render_line(v_counter);
/* Active screen width modified during VBLANK will be applied on upcoming frame */
bitmap.viewport.w = max_sprite_pixels;
}
else if ((v_counter == 0) && (cycles <= (mcycles_vdp + 860)))
{
/* Active screen width modified during first line HBLANK (Bugs Bunny in Double Trouble) */
bitmap.viewport.w = max_sprite_pixels;
/* Redraw first line */
render_line(0);
}
else
{
/* Screen width changes during active display (Golden Axe 3 intro, Ultraverse Prime) */
/* should be applied on next frame since backend rendered framebuffer width is fixed */
/* and can not be modified mid-frame. This is not 100% accurate but games generally */
/* do this where the screen is blanked so it is likely unnoticeable. */
bitmap.viewport.changed |= 2;
}
}
break;
@@ -2237,7 +2182,7 @@ static void vdp_bus_w(unsigned int data)
}
/* Update backdrop color */
if (index == bordrr)
if (index == border)
{
color_update_m5(0x00, data);
}
@@ -2350,7 +2295,7 @@ static void vdp_68k_data_w_m4(unsigned int data)
color_update_m4(index, data);
/* Update backdrop color */
if (index == (0x10 | (bordrr & 0x0F)))
if (index == (0x10 | (border & 0x0F)))
{
color_update_m4(0x40, data);
}
@@ -2580,7 +2525,7 @@ static void vdp_z80_data_w_m4(unsigned int data)
color_update_m4(index, data);
/* Update backdrop color */
if (index == (0x10 | (bordrr & 0x0F)))
if (index == (0x10 | (border & 0x0F)))
{
color_update_m4(0x40, data);
}
@@ -2680,7 +2625,7 @@ static void vdp_z80_data_w_m5(unsigned int data)
}
/* Update backdrop color */
if (index == bordrr)
if (index == border)
{
color_update_m5(0x00, data);
}
@@ -2851,7 +2796,7 @@ static void vdp_z80_data_w_ms(unsigned int data)
color_update_m4(index, data);
/* Update backdrop color */
if (index == (0x10 | (bordrr & 0x0F)))
if (index == (0x10 | (border & 0x0F)))
{
color_update_m4(0x40, data);
}
@@ -2931,7 +2876,7 @@ static void vdp_z80_data_w_gg(unsigned int data)
color_update_m4(index, data);
/* Update backdrop color */
if (index == (0x10 | (bordrr & 0x0F)))
if (index == (0x10 | (border & 0x0F)))
{
color_update_m4(0x40, data);
}
@@ -3196,7 +3141,7 @@ static void vdp_dma_fill(unsigned int length)
}
/* Update backdrop color */
if (index == bordrr)
if (index == border)
{
color_update_m5(0x00, data);
}
+1 -1
View File
@@ -5,7 +5,7 @@
* Support for SG-1000 (TMS99xx & 315-5066), Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP
*
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+6 -6
View File
@@ -1,11 +1,11 @@
/***************************************************************************************
* Genesis Plus
* Video Display Processor (video output rendering)
* Video Display Processor (pixel output rendering)
*
* Support for all TMS99xx modes, Mode 4 & Mode 5 rendering
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -3725,14 +3725,14 @@ void parse_satb_m4(int line)
/* Sprite Y position */
ypos = st[i];
/* Check end of sprite list marker */
if (ypos == (bitmap.viewport.h + 16))
/* Check end of sprite list marker (no effect in extended modes) */
if ((ypos == 208) && (bitmap.viewport.h == 192))
{
break;
}
/* Wrap Y coordinate for sprites > 256-16 */
if (ypos >= 240)
/* Wrap Y coordinate (NB: this is likely not 100% accurate and needs to be verified on real hardware) */
if (ypos > (bitmap.viewport.h + 16))
{
ypos -= 256;
}
+2 -2
View File
@@ -1,11 +1,11 @@
/***************************************************************************************
* Genesis Plus
* Video Display Processor (video output rendering)
* Video Display Processor (pixel output rendering)
*
* Support for all TMS99xx modes, Mode 4 & Mode 5 rendering
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: