mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-28 04:01:48 +01:00
.MD cartridge hardware (SRAM, etc) should not be reseted when emulating MCD hardware (fixes random crash when loading Mode 1 cartridge)
This commit is contained in:
parent
f3756f260c
commit
2a381dd290
@ -258,8 +258,21 @@ void gen_reset(int hard_reset)
|
||||
/* 8-bit / 16-bit modes */
|
||||
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||
{
|
||||
/* reset cartridge hardware & mapping */
|
||||
md_cart_reset(hard_reset);
|
||||
if (system_hw == SYSTEM_MCD)
|
||||
{
|
||||
/* reset CD hardware */
|
||||
scd_reset(1);
|
||||
|
||||
/* reset & halt SUB-CPU */
|
||||
s68k.cycles = 0;
|
||||
s68k_pulse_reset();
|
||||
s68k_pulse_halt();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* reset MD cartridge hardware */
|
||||
md_cart_reset(hard_reset);
|
||||
}
|
||||
|
||||
/* Z80 bus is released & Z80 is reseted */
|
||||
m68k.memory_map[0xa0].read8 = m68k_read_bus_8;
|
||||
@ -301,17 +314,6 @@ void gen_reset(int hard_reset)
|
||||
}
|
||||
}
|
||||
|
||||
if (system_hw == SYSTEM_MCD)
|
||||
{
|
||||
/* reset CD hardware */
|
||||
scd_reset(1);
|
||||
|
||||
/* reset & halt SUB-CPU */
|
||||
s68k.cycles = 0;
|
||||
s68k_pulse_reset();
|
||||
s68k_pulse_halt();
|
||||
}
|
||||
|
||||
/* reset MAIN-CPU */
|
||||
m68k_pulse_reset();
|
||||
}
|
||||
@ -376,21 +378,29 @@ void gen_tmss_w(unsigned int offset, unsigned int data)
|
||||
|
||||
void gen_bankswitch_w(unsigned int data)
|
||||
{
|
||||
if (data & 1)
|
||||
if (system_hw == SYSTEM_MD)
|
||||
{
|
||||
/* enable cartridge ROM */
|
||||
m68k.memory_map[0].base = cart.base;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable internal BOOT ROM */
|
||||
m68k.memory_map[0].base = boot_rom;
|
||||
if (data & 1)
|
||||
{
|
||||
/* enable cartridge ROM */
|
||||
m68k.memory_map[0].base = cart.base;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable internal BOOT ROM */
|
||||
m68k.memory_map[0].base = boot_rom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int gen_bankswitch_r(void)
|
||||
{
|
||||
return (m68k.memory_map[0].base == cart.base);
|
||||
if (system_hw == SYSTEM_MD)
|
||||
{
|
||||
return (m68k.memory_map[0].base == cart.base);
|
||||
}
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
|
||||
|
@ -431,12 +431,6 @@ int load_bios(void)
|
||||
|
||||
/* loaded BIOS region */
|
||||
system_bios = (system_bios & 0xf0) | (region_code >> 4);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* CD BOOT ROM disabled (SYSTEM ERROR) */
|
||||
memset(scd.bootrom, 0xff, sizeof(scd.bootrom));
|
||||
}
|
||||
|
||||
return size;
|
||||
@ -543,13 +537,14 @@ int load_rom(char *filename)
|
||||
ggenie_shutdown();
|
||||
areplay_shutdown();
|
||||
|
||||
/* unload any existing disc */
|
||||
if (romtype == SYSTEM_MCD)
|
||||
{
|
||||
/* unload CD image */
|
||||
cdd_unload();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* no CD image loaded */
|
||||
cdd.loaded = 0;
|
||||
}
|
||||
|
||||
@ -590,11 +585,12 @@ int load_rom(char *filename)
|
||||
/* load file into ROM buffer */
|
||||
char extension[4];
|
||||
int size = load_archive(filename, cart.rom, sizeof(cart.rom), extension);
|
||||
if (!size) return(0);
|
||||
|
||||
/* mark CD BIOS as unloaded */
|
||||
system_bios &= ~0x10;
|
||||
|
||||
if (!size) return(0);
|
||||
|
||||
/* convert lower case to upper case */
|
||||
*(uint32 *)(extension) &= 0xdfdfdfdf;
|
||||
|
||||
@ -721,8 +717,11 @@ int load_rom(char *filename)
|
||||
/* boot from CD */
|
||||
scd.cartridge.boot = 0x00;
|
||||
|
||||
/* CD unloaded */
|
||||
/* no CD image loaded */
|
||||
cdd.loaded = 0;
|
||||
|
||||
/* clear CD TOC */
|
||||
cdd_unload();
|
||||
}
|
||||
|
||||
/* special ROM cartridges that use CD hardware */
|
||||
@ -737,9 +736,12 @@ int load_rom(char *filename)
|
||||
/* load CD BOOT ROM */
|
||||
if (load_bios())
|
||||
{
|
||||
/* CD unloaded */
|
||||
/* no CD image loaded */
|
||||
cdd.loaded = 0;
|
||||
|
||||
/* clear CD TOC */
|
||||
cdd_unload();
|
||||
|
||||
/* boot from cartridge */
|
||||
scd.cartridge.boot = 0x40;
|
||||
}
|
||||
@ -747,6 +749,9 @@ int load_rom(char *filename)
|
||||
{
|
||||
/* assume Mega Drive hardware */
|
||||
system_hw = SYSTEM_MD;
|
||||
|
||||
/* copy back to cartridge ROM area */
|
||||
memcpy(cart.rom, scd.cartridge.area, sizeof(scd.cartridge.area));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user