From: kub Date: Sun, 24 Mar 2024 16:45:10 +0000 (+0100) Subject: sms, fix save/load bugs (irq, mapper) X-Git-Tag: v2.00~86 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da4148881e4308879b30864a30c76e264575df86;p=picodrive.git sms, fix save/load bugs (irq, mapper) --- diff --git a/pico/sms.c b/pico/sms.c index 615ba36e..6b1425b2 100644 --- a/pico/sms.c +++ b/pico/sms.c @@ -795,6 +795,9 @@ void PicoMemSetupMS(void) void PicoStateLoadedMS(void) { u8 mapper = Pico.ms.mapper; + u8 zram_dff0[16]; // TODO xwrite also writes to zram :-/ + + memcpy(zram_dff0, PicoMem.zram+0x1ff0, 16); if (mapper == PMS_MAP_8KBRAM || mapper == PMS_MAP_32KBRAM) { u16 a = Pico.ms.carthw[0] << 12; xwrite(a, *(unsigned char *)(PicoMem.vram+0x4000)); @@ -828,6 +831,7 @@ void PicoStateLoadedMS(void) xwrite(0xfffe, Pico.ms.carthw[0x0e]); xwrite(0xffff, Pico.ms.carthw[0x0f]); } + memcpy(PicoMem.zram+0x1ff0, zram_dff0, 16); } void PicoFrameMS(void) @@ -868,6 +872,7 @@ void PicoFrameMS(void) switch (is_pal ? -lines_vis : lines_vis) { case 192: if (y > 218) pv->v_counter = y - (lines-256); break; case 224: if (y > 234) pv->v_counter = y - (lines-256); break; +/* case 240: if (y > 252) pv->v_counter = y - (lines-256); break; ? */ case -192: if (y > 242) pv->v_counter = y - (lines-256); break; case -224: if (y > 258) pv->v_counter = y - (lines-256); break; case -240: if (y > 266) pv->v_counter = y - (lines-256); break; diff --git a/pico/state.c b/pico/state.c index 635c95d2..bd801b15 100644 --- a/pico/state.c +++ b/pico/state.c @@ -605,12 +605,13 @@ readend: Pico32xStateLoaded(0); if (PicoIn.AHW & PAHW_MCD) pcd_state_loaded(); + if (!(PicoIn.AHW & PAHW_SMS)) { + Pico.video.status &= ~(SR_VB | SR_F); + Pico.video.status |= ((Pico.video.reg[1] >> 3) ^ SR_VB) & SR_VB; + Pico.video.status |= (Pico.video.pending_ints << 2) & SR_F; + } Pico.m.dirtyPal = 1; - Pico.video.status &= ~(SR_VB | SR_F); - Pico.video.status |= ((Pico.video.reg[1] >> 3) ^ SR_VB) & SR_VB; - Pico.video.status |= (Pico.video.pending_ints << 2) & SR_F; - retval = 0; out: diff --git a/pico/z80if.c b/pico/z80if.c index 6243675c..558607c6 100644 --- a/pico/z80if.c +++ b/pico/z80if.c @@ -209,7 +209,7 @@ void z80_pack(void *data) s->iff1 = !!zIFF1; s->iff2 = !!zIFF2; s->im = zIM; - s->irq_pending = (Cz80_Get_Reg(&CZ80, CZ80_IRQ) == HOLD_LINE); + s->irq_pending = (Cz80_Get_Reg(&CZ80, CZ80_IRQ) != CLEAR_LINE); s->irq_vector[0] = 0xff; } #endif @@ -276,7 +276,8 @@ int z80_unpack(const void *data) Cz80_Set_Reg(&CZ80, CZ80_IFF1, s->iff1); Cz80_Set_Reg(&CZ80, CZ80_IFF2, s->iff2); zIM = s->im; - Cz80_Set_Reg(&CZ80, CZ80_IRQ, s->irq_pending ? HOLD_LINE : CLEAR_LINE); + Cz80_Set_Reg(&CZ80, CZ80_IRQ, s->irq_pending ? ASSERT_LINE : CLEAR_LINE); + Cz80_Set_IRQ(&CZ80, 0, Cz80_Get_Reg(&CZ80, CZ80_IRQ)); return 0; } #else