sms: improve irq handling

This commit is contained in:
notaz 2018-01-27 19:41:57 +02:00
parent 8fde2033ac
commit cf83610baa
3 changed files with 34 additions and 6 deletions

View file

@ -52,6 +52,8 @@ static unsigned int dz80_rebase_pc(unsigned short pc)
return drZ80.Z80PC_BASE;
}
static void dz80_noop_irq_ack(void) {}
#ifdef FAST_Z80SP
static u32 drz80_sp_base;
@ -107,8 +109,11 @@ void z80_reset(void)
drz80_sp_base = (PicoIn.AHW & PAHW_SMS) ? 0xc000 : 0x0000;
drZ80.Z80SP_BASE = z80_read_map[drz80_sp_base >> Z80_MEM_SHIFT] << 1;
#endif
if (PicoIn.AHW & PAHW_SMS)
drZ80.z80_irq_callback = NULL; // use auto-clear
if (PicoIn.AHW & PAHW_SMS) {
drZ80.Z80SP = drZ80.Z80SP_BASE + 0xdff0; // simulate BIOS
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