mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-07 08:08:04 -04:00
sms, fixes to bios initialisation and mapper autodetection
This commit is contained in:
parent
1eb630c232
commit
b72095041e
2 changed files with 13 additions and 14 deletions
11
pico/z80if.c
11
pico/z80if.c
|
@ -106,6 +106,7 @@ void z80_init(void)
|
|||
|
||||
void z80_reset(void)
|
||||
{
|
||||
int is_sms = (PicoIn.AHW & (PAHW_SMS|PAHW_SG|PAHW_SC)) == PAHW_SMS;
|
||||
#ifdef _USE_DRZ80
|
||||
drZ80.Z80I = 0;
|
||||
drZ80.Z80IM = 0;
|
||||
|
@ -115,22 +116,20 @@ void z80_reset(void)
|
|||
// other registers not changed, undefined on cold boot
|
||||
#ifdef FAST_Z80SP
|
||||
// drZ80 is locked in single bank
|
||||
drz80_sp_base = (PicoIn.AHW & PAHW_SMS) ? 0xc000 : 0x0000;
|
||||
drz80_sp_base = (PicoIn.AHW & PAHW_8BIT) ? 0xc000 : 0x0000;
|
||||
drZ80.Z80SP_BASE = z80_read_map[drz80_sp_base >> Z80_MEM_SHIFT] << 1;
|
||||
#endif
|
||||
drZ80.Z80SP = drZ80.Z80SP_BASE + 0xffff;
|
||||
drZ80.Z80SP = drZ80.Z80SP_BASE + (is_sms ? 0xdff0 : 0xffff); // simulate BIOS
|
||||
drZ80.z80_irq_callback = NULL; // use auto-clear
|
||||
if (PicoIn.AHW & PAHW_SMS) {
|
||||
drZ80.Z80SP = drZ80.Z80SP_BASE + 0xdff0; // simulate BIOS
|
||||
if (PicoIn.AHW & PAHW_8BIT)
|
||||
drZ80.z80_irq_callback = dz80_noop_irq_ack;
|
||||
}
|
||||
// XXX: since we use direct SP pointer, it might make sense to force it to RAM,
|
||||
// but we'll rely on built-in stack protection for now
|
||||
#endif
|
||||
#ifdef _USE_CZ80
|
||||
Cz80_Reset(&CZ80);
|
||||
Cz80_Set_Reg(&CZ80, CZ80_SP, 0xffff);
|
||||
if (PicoIn.AHW & PAHW_SMS)
|
||||
if (is_sms)
|
||||
Cz80_Set_Reg(&CZ80, CZ80_SP, 0xdff0);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue