add new i2c eeprom (e2prom) device, hook it up in d_coleco and megadrive
This commit is contained in:
parent
1111159c75
commit
37b23ddfac
|
@ -104,7 +104,7 @@ drvsrc = d_akkaarrh.o d_arcadecl.o d_atarig1.o d_badlands.o d_batman.o d_blstro
|
|||
depobj = burn.o burn_bitmap.o burn_gun.o burn_led.o burn_shift.o burn_memory.o burn_pal.o burn_sound.o burn_sound_c.o cheat.o debug_track.o hiscore.o \
|
||||
load.o burn_sha1.o tilemap_generic.o tiles_generic.o timer.o vector.o \
|
||||
\
|
||||
6821pia.o 6840ptm.o 8255ppi.o 8257dma.o c169.o atariic.o atarijsa.o atarimo.o atarirle.o atarivad.o avgdvg.o bsmt2000.o decobsmt.o ds2404.o dtimer.o earom.o eeprom.o epic12.o gaelco_crypt.o i4x00.o intelfsh.o \
|
||||
6821pia.o 6840ptm.o 8255ppi.o 8257dma.o c169.o atariic.o atarijsa.o atarimo.o atarirle.o atarivad.o avgdvg.o bsmt2000.o decobsmt.o ds2404.o dtimer.o earom.o eeprom.o epic12.o gaelco_crypt.o i2ceeprom.o i4x00.o intelfsh.o \
|
||||
joyprocess.o nb1414m4.o nb1414m4_8bit.o nmk004.o nmk112.o k1ge.o kaneko_hit.o kaneko_tmap.o mathbox.o mb87078.o mermaid.o midcsd.o midsat.o midsg.o midcvsd.o midssio.o midtcs.o \
|
||||
namco_c45.o namcoio.o pandora.o pic8259.o pit8253.o poly.o qs1000.o resnet.o rtc9701.o seibucop.o seibusnd.o serflash.o sknsspr.o slapstic.o st0020.o t5182.o timekpr.o tlc34076.o tms34061.o v3021.o vdc.o \
|
||||
tms9928a.o watchdog.o x2212.o \
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "ay8910.h" // sgm
|
||||
#include "tms9928a.h"
|
||||
#include "burn_gun.h" // trackball (Roller & Super Action controllers)
|
||||
#include "i2ceeprom.h"
|
||||
|
||||
static UINT8 *AllMem;
|
||||
static UINT8 *MemEnd;
|
||||
|
@ -42,7 +43,11 @@ static UINT32 MegaCartBank; // current Bank
|
|||
static UINT32 MegaCartBanks; // total banks
|
||||
static INT32 OCMBanks[4];
|
||||
|
||||
static INT32 use_EEPROM = 0;
|
||||
// for use_I2C (i2c 2-wire 24c02, +)
|
||||
static INT32 d_sda;
|
||||
static INT32 d_scl;
|
||||
|
||||
static INT32 use_I2C = 0; // i2c eeprom
|
||||
static INT32 use_SGM = 0;
|
||||
static INT32 use_SAC = 0; // 1 = SuperAction, 2 = ROLLER
|
||||
static INT32 use_OCM = 0;
|
||||
|
@ -472,6 +477,12 @@ static INT32 DrvDoReset()
|
|||
|
||||
TMS9928AReset();
|
||||
|
||||
if (use_I2C) {
|
||||
i2c_reset();
|
||||
d_sda = 1;
|
||||
d_scl = 1;
|
||||
}
|
||||
|
||||
memset (DrvZ80RAM, 0xff, 0x400); // ram initialized to 0xff
|
||||
if (!strncmp(BurnDrvGetTextA(DRV_NAME), "cv_heist", 8)) {
|
||||
bprintf(0, _T("*** The Heist kludge..\n"));
|
||||
|
@ -528,8 +539,8 @@ static void O_EepScan()
|
|||
static void __fastcall main_write(UINT16 address, UINT8 data)
|
||||
{
|
||||
// maybe we should support bankswitching on writes too?
|
||||
// bprintf(0, _T("%x %x\t\tfr %d cyc %d\n"), address, data, nCurrentFrame, ZetTotalCycles());
|
||||
if (use_EEPROM) { // for boxxle
|
||||
//bprintf(0, _T("%x %x\t\tfr %d cyc %d\n"), address, data, nCurrentFrame, ZetTotalCycles());
|
||||
if (use_I2C) { // for boxxle, black onyx, space shuttle, etc..
|
||||
switch (address)
|
||||
{
|
||||
case 0xff90:
|
||||
|
@ -537,6 +548,22 @@ static void __fastcall main_write(UINT16 address, UINT8 data)
|
|||
case 0xffb0:
|
||||
MegaCartBank = (address >> 4) & 3;
|
||||
return;
|
||||
case 0xffc0:
|
||||
d_scl = 0;
|
||||
i2c_write_bit(d_sda, d_scl);
|
||||
return;
|
||||
case 0xffd0:
|
||||
d_scl = 1;
|
||||
i2c_write_bit(d_sda, d_scl);
|
||||
return;
|
||||
case 0xffe0:
|
||||
d_sda = 0;
|
||||
i2c_write_bit(d_sda, d_scl);
|
||||
return;
|
||||
case 0xfff0:
|
||||
d_sda = 1;
|
||||
i2c_write_bit(d_sda, d_scl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -621,6 +648,10 @@ static UINT8 __fastcall main_read(UINT16 address)
|
|||
}
|
||||
}
|
||||
|
||||
if (use_I2C && address == 0xff80) {
|
||||
return DrvCartROM[i2c_read() ? 0xff80 : 0xbf80];
|
||||
}
|
||||
|
||||
if (address >= 0xffc0/* && address <= 0xffff*/) {
|
||||
MegaCartBank = (0xffff - address) & (MegaCartBanks - 1);
|
||||
|
||||
|
@ -694,10 +725,11 @@ static INT32 DrvInit()
|
|||
ZetMapMemory(DrvZ80RAM, i + 0x0000, i + 0x03ff, MAP_RAM);
|
||||
}
|
||||
|
||||
if (use_EEPROM) { // similar to MegaCart but with diff. mapper addresses
|
||||
if (use_I2C) { // similar to MegaCart but with diff. mapper addresses
|
||||
// Boxxle
|
||||
MegaCartBanks = MegaCart / 0x4000;
|
||||
bprintf(0, _T("ColecoVision BoxxleCart mapping.\n"));
|
||||
i2c_init((use_I2C == 1) ? I2C_24C02 : I2C_24C256);
|
||||
ZetMapMemory(DrvCartROM, 0x8000, 0xbfff, MAP_ROM);
|
||||
ZetSetReadHandler(main_read);
|
||||
ZetSetWriteHandler(main_write);
|
||||
|
@ -775,10 +807,16 @@ static INT32 DrvInitSGM() // w/SGM
|
|||
return DrvInit();
|
||||
}
|
||||
|
||||
static INT32 DrvInitEEPROM() // w/EEPROM (boxxle)
|
||||
static INT32 DrvInitI2CBoxxle() // w/EEPROM (boxxle)
|
||||
{
|
||||
// 24cXX e2prom isn't actually supported, but the game works fine (minus highscore saving)
|
||||
use_EEPROM = 1;
|
||||
use_I2C = 2;
|
||||
|
||||
return DrvInit();
|
||||
}
|
||||
|
||||
static INT32 DrvInitI2C() // w/EEPROM (boxxle)
|
||||
{
|
||||
use_I2C = 1;
|
||||
|
||||
return DrvInit();
|
||||
}
|
||||
|
@ -802,8 +840,12 @@ static INT32 DrvExit()
|
|||
|
||||
BurnTrackballExit();
|
||||
|
||||
if (use_I2C) {
|
||||
i2c_exit();
|
||||
}
|
||||
|
||||
use_SGM = 0;
|
||||
use_EEPROM = 0;
|
||||
use_I2C = 0;
|
||||
use_SAC = 0;
|
||||
use_OCM = 0;
|
||||
|
||||
|
@ -960,13 +1002,21 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
|
|||
SCAN_VAR(last_state);
|
||||
SCAN_VAR(MegaCartBank);
|
||||
SCAN_VAR(SGM_map_24k);
|
||||
SCAN_VAR(SGM_map_8k);
|
||||
SCAN_VAR(SGM_map_8k);
|
||||
if (use_I2C) {
|
||||
SCAN_VAR(d_scl);
|
||||
SCAN_VAR(d_sda);
|
||||
}
|
||||
}
|
||||
|
||||
if (nAction & ACB_NVRAM && use_OCM) {
|
||||
ScanVar(DrvEEPROM, 0x400, "NV RAM");
|
||||
}
|
||||
|
||||
if (use_I2C) {
|
||||
i2c_scan(nAction, pnMin);
|
||||
}
|
||||
|
||||
if (nAction & ACB_WRITE) {
|
||||
if (use_SGM) {
|
||||
ZetOpen(0);
|
||||
|
@ -5903,7 +5953,7 @@ struct BurnDriver BurnDrvcv_blackonyx = {
|
|||
NULL, NULL, NULL, NULL,
|
||||
BDF_GAME_WORKING | BDF_HOMEBREW, 1, HARDWARE_COLECO, GBF_RPG | GBF_MAZE, 0,
|
||||
CVGetZipName, cv_blackonyxRomInfo, cv_blackonyxRomName, NULL, NULL, NULL, NULL, ColecoInputInfo, ColecoDIPInfo,
|
||||
DrvInitEEPROM, DrvExit, DrvFrame, TMS9928ADraw, DrvScan, NULL, TMS9928A_PALETTE_SIZE,
|
||||
DrvInitI2C, DrvExit, DrvFrame, TMS9928ADraw, DrvScan, NULL, TMS9928A_PALETTE_SIZE,
|
||||
272, 228, 4, 3
|
||||
};
|
||||
|
||||
|
@ -6055,7 +6105,7 @@ struct BurnDriver BurnDrvcv_boxxle = {
|
|||
NULL, NULL, NULL, NULL,
|
||||
BDF_GAME_WORKING | BDF_HOMEBREW, 1, HARDWARE_COLECO, GBF_PUZZLE, 0,
|
||||
CVGetZipName, cv_boxxleRomInfo, cv_boxxleRomName, NULL, NULL, NULL, NULL, ColecoInputInfo, ColecoDIPInfo,
|
||||
DrvInitEEPROM, DrvExit, DrvFrame, TMS9928ADraw, DrvScan, NULL, TMS9928A_PALETTE_SIZE,
|
||||
DrvInitI2CBoxxle, DrvExit, DrvFrame, TMS9928ADraw, DrvScan, NULL, TMS9928A_PALETTE_SIZE,
|
||||
272, 228, 4, 3
|
||||
};
|
||||
|
||||
|
@ -10003,7 +10053,7 @@ STD_ROM_FN(cv_spaceshuttle)
|
|||
|
||||
static INT32 DrvInitSGMEEPROM() // Space Shuttle
|
||||
{
|
||||
use_EEPROM = 1;
|
||||
use_I2C = 1;
|
||||
use_SGM = 1;
|
||||
return DrvInit();
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "megadrive.h"
|
||||
#include "bitswap.h"
|
||||
#include "m68000_debug.h"
|
||||
#include "mdeeprom.h" // i2c eeprom for MD
|
||||
#include "i2ceeprom.h" // i2c eeprom for MD
|
||||
|
||||
//#define CYCDBUG
|
||||
|
||||
|
@ -1527,6 +1527,10 @@ static INT32 MegadriveResetDo()
|
|||
|
||||
BurnMD2612Reset();
|
||||
|
||||
if (RamMisc->SRamHasSerialEEPROM) {
|
||||
i2c_reset();
|
||||
}
|
||||
|
||||
#if 0
|
||||
BurnDump("Megadrive.bin", RomMain, 0x200000);
|
||||
//FILE * f = fopen("Megadrive.bin", "wb+");
|
||||
|
@ -1586,7 +1590,7 @@ static INT32 MegadriveResetDo()
|
|||
RamMisc->I2CClk = 0;
|
||||
RamMisc->I2CMem = 0;
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SSF2) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_SSF2) {
|
||||
for (INT32 i = 0; i < 7; i++) {
|
||||
Ssf2BankWriteByte(0xa130f3 + (i*2), i + 1);
|
||||
}
|
||||
|
@ -2508,7 +2512,7 @@ static void __fastcall TopfigWriteWord(UINT32 sekAddress, UINT16 wordValue)
|
|||
|
||||
static void SetupCustomCartridgeMappers()
|
||||
{
|
||||
if (((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CM_JCART) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CM_JCART_SEPROM)) {
|
||||
if (((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_CM_JCART) || ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_CM_JCART_SEPROM)) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0x38fffe, 0x38ffff, MAP_READ | MAP_WRITE);
|
||||
SekSetReadByteHandler(7, JCartCtrlReadByte);
|
||||
|
@ -2518,7 +2522,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SSF2) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_SSF2) {
|
||||
OriginalRom = (UINT8*)BurnMalloc(MAX_CARTRIDGE_SIZE);
|
||||
memcpy(OriginalRom, RomMain, MAX_CARTRIDGE_SIZE);
|
||||
|
||||
|
@ -2528,7 +2532,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SKINGKONG) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_SKINGKONG) {
|
||||
OriginalRom = (UINT8*)BurnMalloc(MAX_CARTRIDGE_SIZE);
|
||||
memcpy(OriginalRom, RomMain, MAX_CARTRIDGE_SIZE);
|
||||
memcpy(RomMain + 0x200000, OriginalRom, 0x200000);
|
||||
|
@ -2536,7 +2540,7 @@ static void SetupCustomCartridgeMappers()
|
|||
BurnFree(OriginalRom);
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SDK99) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_SDK99) {
|
||||
OriginalRom = (UINT8*)BurnMalloc(MAX_CARTRIDGE_SIZE);
|
||||
memcpy(OriginalRom, RomMain, MAX_CARTRIDGE_SIZE);
|
||||
memcpy(RomMain + 0x300000, OriginalRom, 0x100000);
|
||||
|
@ -2544,11 +2548,11 @@ static void SetupCustomCartridgeMappers()
|
|||
BurnFree(OriginalRom);
|
||||
}
|
||||
|
||||
if (((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_LIONK3) ||
|
||||
((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SKINGKONG) ||
|
||||
((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_POKEMON2) ||
|
||||
((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SDK99) ||
|
||||
((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_MULAN)) {
|
||||
if (((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_LIONK3) ||
|
||||
((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_SKINGKONG) ||
|
||||
((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_POKEMON2) ||
|
||||
((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_SDK99) ||
|
||||
((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_MULAN)) {
|
||||
|
||||
bprintf(0, _T("Lion King 3-style protection/mapper\n"));
|
||||
RamMisc->L3Reg[0] = RamMisc->L3Reg[1] = RamMisc->L3Reg[2] = 0;
|
||||
|
@ -2568,7 +2572,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_REDCL_EN) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_REDCL_EN) {
|
||||
if (RomSize == 0x200005) {
|
||||
bprintf(0, _T("Redcliff - decrypting rom\n"));
|
||||
OriginalRom = (UINT8*)BurnMalloc(0x200005);
|
||||
|
@ -2590,7 +2594,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_RADICA) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_RADICA) {
|
||||
OriginalRom = (UINT8*)BurnMalloc(RomSize);
|
||||
memcpy(OriginalRom, RomMain, RomSize);
|
||||
|
||||
|
@ -2605,8 +2609,8 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_KOF99 ||
|
||||
(BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_POKEMON) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_KOF99 ||
|
||||
(BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_POKEMON) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0xa13000, 0xa1303f, MAP_READ);
|
||||
SekSetReadByteHandler(7, Kof99A13000ReadByte);
|
||||
|
@ -2614,7 +2618,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SOULBLAD) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_SOULBLAD) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0x400002, 0x400007, MAP_READ);
|
||||
SekSetReadByteHandler(7, SoulbladReadByte);
|
||||
|
@ -2622,7 +2626,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_MJLOVER) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_MJLOVER) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0x400000, 0x400001, MAP_READ);
|
||||
SekSetReadByteHandler(7, MjloverProt1ReadByte);
|
||||
|
@ -2633,7 +2637,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SQUIRRELK) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_SQUIRRELK) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0x400000, 0x400007, MAP_READ | MAP_WRITE);
|
||||
SekSetReadByteHandler(7, SquirrelKingExtraReadByte);
|
||||
|
@ -2644,7 +2648,7 @@ static void SetupCustomCartridgeMappers()
|
|||
bNoDebug = 1; // Games make a lot of unmapped word-writes
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CHAOJIMJ) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_CHAOJIMJ) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0x400000, 0x400007, MAP_READ);
|
||||
SekSetReadByteHandler(7, ChaoJiMjReadByte);
|
||||
|
@ -2652,7 +2656,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SMOUSE) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_SMOUSE) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0x400000, 0x400007, MAP_READ);
|
||||
SekSetReadByteHandler(7, SmouseProtReadByte);
|
||||
|
@ -2660,7 +2664,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SMB) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_SMB) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0xa13000, 0xa13001, MAP_READ);
|
||||
SekSetReadByteHandler(7, SmbProtReadByte);
|
||||
|
@ -2668,7 +2672,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SMB2) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_SMB2) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0xa13000, 0xa13001, MAP_READ);
|
||||
SekSetReadByteHandler(7, Smb2ProtReadByte);
|
||||
|
@ -2676,7 +2680,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_KAIJU) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_KAIJU) {
|
||||
OriginalRom = (UINT8*)BurnMalloc(RomSize);
|
||||
memcpy(OriginalRom, RomMain, RomSize);
|
||||
|
||||
|
@ -2691,7 +2695,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CHINFIGHT3) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_CHINFIGHT3) {
|
||||
OriginalRom = (UINT8*)BurnMalloc(RomSize);
|
||||
memcpy(OriginalRom, RomMain, RomSize);
|
||||
|
||||
|
@ -2709,7 +2713,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_LIONK2) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_LIONK2) {
|
||||
RamMisc->Lionk2ProtData = 0;
|
||||
RamMisc->Lionk2ProtData2 = 0;
|
||||
|
||||
|
@ -2722,7 +2726,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_BUGSLIFE) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_BUGSLIFE) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0xa13000, 0xa13001, MAP_READ);
|
||||
SekSetReadByteHandler(7, BuglExtraReadByte);
|
||||
|
@ -2730,7 +2734,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_ELFWOR) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_ELFWOR) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0x400000, 0x400007, MAP_READ);
|
||||
SekSetReadByteHandler(7, Elfwor400000ReadByte);
|
||||
|
@ -2738,7 +2742,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_ROCKMANX3) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_ROCKMANX3) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0xa13000, 0xa13001, MAP_READ);
|
||||
SekSetReadByteHandler(7, RockmanX3ExtraReadByte);
|
||||
|
@ -2746,7 +2750,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SBUBBOB) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_SBUBBOB) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0x400000, 0x400003, MAP_READ);
|
||||
SekSetReadByteHandler(7, SbubExtraReadByte);
|
||||
|
@ -2754,7 +2758,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_KOF98) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_KOF98) {
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0x480000, 0x4fffff, MAP_READ);
|
||||
SekSetReadByteHandler(7, Kof98ReadByte);
|
||||
|
@ -2762,7 +2766,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_REALTEC) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_REALTEC) {
|
||||
RamMisc->RealtecBankAddr = 0;
|
||||
RamMisc->RealtecBankSize = 0;
|
||||
|
||||
|
@ -2782,7 +2786,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_MC_SUP19IN1) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_MC_SUP19IN1) {
|
||||
OriginalRom = (UINT8*)BurnMalloc(RomSize);
|
||||
memcpy(OriginalRom, RomMain, RomSize);
|
||||
|
||||
|
@ -2795,7 +2799,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_MC_SUP15IN1) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_MC_SUP15IN1) {
|
||||
OriginalRom = (UINT8*)BurnMalloc(RomSize);
|
||||
memcpy(OriginalRom, RomMain, RomSize);
|
||||
|
||||
|
@ -2808,7 +2812,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_MC_12IN1) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_MC_12IN1) {
|
||||
OriginalRom = (UINT8*)BurnMalloc(RomSize * 2); // add a little buffer on the end so memcpy @ the last bank doesn't crash
|
||||
memcpy(OriginalRom, RomMain, RomSize);
|
||||
|
||||
|
@ -2821,7 +2825,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_TOPFIGHTER) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_TOPFIGHTER) {
|
||||
OriginalRom = (UINT8*)BurnMalloc(RomSize);
|
||||
memcpy(OriginalRom, RomMain, RomSize);
|
||||
|
||||
|
@ -2840,7 +2844,7 @@ static void SetupCustomCartridgeMappers()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_16ZHANG) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_16ZHANG) {
|
||||
bprintf(0, _T("md 16zhang mapper\n"));
|
||||
SekOpen(0);
|
||||
SekMapHandler(7, 0x400000, 0x400004 | 0x3ff, MAP_READ);
|
||||
|
@ -2979,7 +2983,7 @@ static void __fastcall Megadrive6658ARegWriteWord(UINT32 sekAddress, UINT16 word
|
|||
static UINT8 __fastcall x200000EEPROMReadByte(UINT32 sekAddress)
|
||||
{
|
||||
if (sekAddress >= 0x200000 && sekAddress <= 0x200001) {
|
||||
return EEPROM_read8(sekAddress);
|
||||
return i2c_read_bus8(sekAddress);
|
||||
}
|
||||
|
||||
if (sekAddress < 0x300000) {
|
||||
|
@ -2992,7 +2996,7 @@ static UINT8 __fastcall x200000EEPROMReadByte(UINT32 sekAddress)
|
|||
static UINT16 __fastcall x200000EEPROMReadWord(UINT32 sekAddress)
|
||||
{
|
||||
if (sekAddress >= 0x200000 && sekAddress <= 0x200001) {
|
||||
return EEPROM_read();
|
||||
return i2c_read_bus16(sekAddress);
|
||||
}
|
||||
|
||||
if (sekAddress < 0x300000) {
|
||||
|
@ -3006,14 +3010,15 @@ static UINT16 __fastcall x200000EEPROMReadWord(UINT32 sekAddress)
|
|||
static void __fastcall x200000EEPROMWriteByte(UINT32 sekAddress, UINT8 byteValue)
|
||||
{
|
||||
if (sekAddress >= 0x200000 && sekAddress <= 0x200001) {
|
||||
EEPROM_write8(sekAddress, byteValue);
|
||||
i2c_write_bus8(sekAddress, byteValue);
|
||||
}
|
||||
}
|
||||
|
||||
static void __fastcall x200000EEPROMWriteWord(UINT32 sekAddress, UINT16 wordValue)
|
||||
{
|
||||
if (sekAddress >= 0x200000 && sekAddress <= 0x200001) {
|
||||
EEPROM_write16(wordValue);
|
||||
// bprintf(0, _T("WW %x %x\n"), sekAddress, wordValue);
|
||||
// i2c_write_bus16(wordValue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -3021,7 +3026,7 @@ static void __fastcall x200000EEPROMWriteWord(UINT32 sekAddress, UINT16 wordValu
|
|||
static UINT8 __fastcall CodemastersEEPROMReadByte(UINT32 sekAddress)
|
||||
{
|
||||
if (sekAddress == 0x380001) {
|
||||
return EEPROM_read8(sekAddress);
|
||||
return i2c_read_bus8(sekAddress);
|
||||
}
|
||||
|
||||
return 0xff;
|
||||
|
@ -3030,7 +3035,7 @@ static UINT8 __fastcall CodemastersEEPROMReadByte(UINT32 sekAddress)
|
|||
static UINT16 __fastcall CodemastersEEPROMReadWord(UINT32 sekAddress)
|
||||
{
|
||||
if (sekAddress == 0x380001) {
|
||||
return EEPROM_read();
|
||||
return i2c_read_bus16(sekAddress);
|
||||
}
|
||||
|
||||
return 0xffff;
|
||||
|
@ -3039,14 +3044,14 @@ static UINT16 __fastcall CodemastersEEPROMReadWord(UINT32 sekAddress)
|
|||
static void __fastcall CodemastersEEPROMWriteByte(UINT32 sekAddress, UINT8 byteValue)
|
||||
{
|
||||
if (sekAddress >= 0x300000 && sekAddress <= 0x300001) {
|
||||
EEPROM_write8(sekAddress, byteValue);
|
||||
i2c_write_bus8(sekAddress, byteValue);
|
||||
}
|
||||
}
|
||||
|
||||
static void __fastcall CodemastersEEPROMWriteWord(UINT32 sekAddress, UINT16 wordValue)
|
||||
{
|
||||
if (sekAddress >= 0x300000 && sekAddress <= 0x300001) {
|
||||
EEPROM_write16(wordValue);
|
||||
i2c_write_bus16(wordValue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -3108,7 +3113,7 @@ static void MegadriveSetupSRAM()
|
|||
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_BEGGAR) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_BEGGAR) {
|
||||
RamMisc->SRamStart = 0x400000;
|
||||
RamMisc->SRamEnd = 0x40ffff;
|
||||
|
||||
|
@ -3137,10 +3142,11 @@ static void MegadriveSetupSRAM()
|
|||
InstallSRAMHandlers(false);
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_SEGA_EEPROM) {
|
||||
// mask @ 0x3f because teamplayer/4wayplay uses 0x40/0x80/0xc0
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_SEGA_EEPROM) {
|
||||
RamMisc->SRamHasSerialEEPROM = 1;
|
||||
bprintf(PRINT_IMPORTANT, _T("Serial EEPROM, generic Sega.\n"));
|
||||
EEPROM_init(0, 1, 0, 0, SRam);
|
||||
i2c_init(I2C_X24C01, 0, 1, 0);
|
||||
SekOpen(0);
|
||||
SekMapHandler(5, 0x200000, 0x200001, MAP_READ | MAP_WRITE);
|
||||
SekSetReadByteHandler(5, x200000EEPROMReadByte);
|
||||
|
@ -3150,10 +3156,10 @@ static void MegadriveSetupSRAM()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_NBA_JAM) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_NBA_JAM) {
|
||||
RamMisc->SRamHasSerialEEPROM = 1;
|
||||
bprintf(PRINT_IMPORTANT, _T("Serial EEPROM, NBAJam.\n"));
|
||||
EEPROM_init(2, 1, 0, 1, SRam);
|
||||
i2c_init(I2C_X24C02, 0, 1, 1);
|
||||
SekOpen(0);
|
||||
SekMapHandler(5, 0x200000, 0x200001, MAP_READ | MAP_WRITE);
|
||||
SekSetReadByteHandler(5, x200000EEPROMReadByte);
|
||||
|
@ -3163,10 +3169,10 @@ static void MegadriveSetupSRAM()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if (((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_NBA_JAM_TE) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_NFL_QB_96) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_C_SLAM)) {
|
||||
if (((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_NBA_JAM_TE) || ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_NFL_QB_96) || ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_C_SLAM)) {
|
||||
RamMisc->SRamHasSerialEEPROM = 1;
|
||||
bprintf(PRINT_IMPORTANT, _T("Serial EEPROM, NBAJamTE.\n"));
|
||||
EEPROM_init(2, 8, 0, 0, SRam);
|
||||
i2c_init(I2C_24C04, 0, 8, 0); // verified (dink)
|
||||
SekOpen(0);
|
||||
SekMapHandler(5, 0x200000, 0x200001, MAP_READ | MAP_WRITE);
|
||||
SekSetReadByteHandler(5, x200000EEPROMReadByte);
|
||||
|
@ -3176,10 +3182,10 @@ static void MegadriveSetupSRAM()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_EA_NHLPA) {
|
||||
if ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_EA_NHLPA) {
|
||||
RamMisc->SRamHasSerialEEPROM = 1;
|
||||
bprintf(PRINT_IMPORTANT, _T("Serial EEPROM, NHLPA/Rings of Power.\n"));
|
||||
EEPROM_init(1, 6, 7, 7, SRam);
|
||||
i2c_init(I2C_24C01, 7, 6, 7);
|
||||
SekOpen(0);
|
||||
SekMapHandler(5, 0x200000, 0x200001, MAP_READ | MAP_WRITE);
|
||||
SekSetReadByteHandler(5, x200000EEPROMReadByte);
|
||||
|
@ -3189,10 +3195,10 @@ static void MegadriveSetupSRAM()
|
|||
SekClose();
|
||||
}
|
||||
|
||||
if (((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CODE_MASTERS) || ((BurnDrvGetHardwareCode() & 0xff) == HARDWARE_SEGA_MEGADRIVE_PCB_CM_JCART_SEPROM)) {
|
||||
if (((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_CODE_MASTERS) || ((BurnDrvGetHardwareCode() & 0x3f) == HARDWARE_SEGA_MEGADRIVE_PCB_CM_JCART_SEPROM)) {
|
||||
RamMisc->SRamHasSerialEEPROM = 1;
|
||||
bprintf(PRINT_IMPORTANT, _T("Serial EEPROM, Codemasters.\n"));
|
||||
EEPROM_init(2, 9, 8, 7, SRam);
|
||||
i2c_init(I2C_24C16, 8, 9, 7);
|
||||
SekOpen(0);
|
||||
SekMapHandler(5, 0x300000, 0x300001, MAP_WRITE);
|
||||
SekSetWriteByteHandler(5, CodemastersEEPROMWriteByte);
|
||||
|
@ -3388,6 +3394,10 @@ INT32 MegadriveExit()
|
|||
BurnMD2612Exit();
|
||||
SN76496Exit();
|
||||
|
||||
if (RamMisc->SRamHasSerialEEPROM) {
|
||||
i2c_exit();
|
||||
}
|
||||
|
||||
BurnFreeMemIndex();
|
||||
|
||||
if (OriginalRom) {
|
||||
|
@ -5123,7 +5133,6 @@ INT32 MegadriveScan(INT32 nAction, INT32 *pnMin)
|
|||
ZetScan(nAction);
|
||||
BurnMD2612Scan(nAction, pnMin);
|
||||
SN76496Scan(nAction, pnMin);
|
||||
EEPROM_scan();
|
||||
|
||||
SCAN_VAR(Scanline);
|
||||
SCAN_VAR(Z80HasBus);
|
||||
|
@ -5137,7 +5146,7 @@ INT32 MegadriveScan(INT32 nAction, INT32 *pnMin)
|
|||
BurnRandomScan(nAction);
|
||||
}
|
||||
|
||||
if ((nAction & ACB_NVRAM && RamMisc->SRamDetected) || RamMisc->SRamHasSerialEEPROM) {
|
||||
if ((nAction & ACB_NVRAM) && RamMisc->SRamDetected) {
|
||||
struct BurnArea ba;
|
||||
memset(&ba, 0, sizeof(ba));
|
||||
ba.Data = SRam;
|
||||
|
@ -5147,6 +5156,10 @@ INT32 MegadriveScan(INT32 nAction, INT32 *pnMin)
|
|||
BurnAcb(&ba);
|
||||
}
|
||||
|
||||
if (RamMisc->SRamHasSerialEEPROM) { // scan both nvram and volatile!
|
||||
i2c_scan(nAction, pnMin);
|
||||
}
|
||||
|
||||
if (psolarmode) // pier solar
|
||||
{
|
||||
md_eeprom_stm95_scan(nAction);
|
||||
|
|
Loading…
Reference in New Issue