core, fix crash bug in DrZ80 (SP wrap)

This commit is contained in:
kub 2024-03-07 20:36:00 +01:00
parent 83025d7abe
commit 02d578601b
2 changed files with 3 additions and 1 deletions

View file

@ -208,6 +208,7 @@ z80_xmap_read16: @ addr
bl z80_xmap_read8
mov r9,r0
add r0,r8,#1
bic r0,r0,#1<<16
bl z80_xmap_read8
orr r0,r9,r0,lsl #8
ldmfd sp!,{r2,r8,r9,pc}
@ -236,6 +237,7 @@ z80_xmap_write16: @ data, addr
bl z80_xmap_write8
mov r0,r8,lsr #8
add r1,r9,#1
bic r1,r1,#1<<16
bl z80_xmap_write8
ldmfd sp!,{r2,r8,r9,pc}

View file

@ -675,7 +675,7 @@ static void PicoWrite16_sram(u32 a, u32 d)
static u32 PicoRead8_z80(u32 a)
{
u32 d = 0xff;
if ((Pico.m.z80Run | Pico.m.z80_reset | (z80_cycles_from_68k() < Pico.t.z80c_cnt)) && !(PicoIn.quirks & PQUIRK_NO_Z80_BUS_LOCK)) {
if ((Pico.m.z80Run | Pico.m.z80_reset) && !(PicoIn.quirks & PQUIRK_NO_Z80_BUS_LOCK)) {
elprintf(EL_ANOMALY, "68k z80 read with no bus! [%06x] @ %06x", a, SekPc);
// open bus. Pulled down if MegaCD2 is attached.
return (PicoIn.AHW & PAHW_MCD ? 0 : d);