From 583ab72c0b42549235191fd4fad239074dd896af Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 26 Apr 2008 20:11:19 +0000 Subject: [PATCH] eeprom crash fix, PacMan2 hack git-svn-id: file:///home/notaz/opt/svn/PicoDrive@431 be3aeb3a-fb24-0410-a615-afba39da0efa --- Pico/MemoryCmn.c | 11 +++++++---- Pico/Pico.c | 3 +++ Pico/PicoFrameHints.c | 4 +++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Pico/MemoryCmn.c b/Pico/MemoryCmn.c index 67cb925c..62e68671 100644 --- a/Pico/MemoryCmn.c +++ b/Pico/MemoryCmn.c @@ -122,7 +122,7 @@ u32 OtherRead16(u32 a, int realsize) if ((a&0xff0000)==0xa00000) { if (Pico.m.z80Run&1) - elprintf(EL_ANOMALY, "68k z80 read with no bus! [%06x]", a); + elprintf(EL_ANOMALY, "68k z80 read with no bus! [%06x] @ %06x", a, SekPc); if ((a&0x4000)==0x0000) { d=z80Read8(a); d|=d<<8; goto end; } // Z80 ram (not byteswaped) if ((a&0x6000)==0x4000) { // 0x4000-0x5fff, Fudge if disabled if(PicoOpt&POPT_EN_FM) d=YM2612Read(); @@ -145,7 +145,7 @@ static void IoWrite8(u32 a, u32 d) { a=(a>>1)&0xf; // 6 button gamepad: if TH went from 0 to 1, gamepad changes state - if(PicoOpt&POPT_6BTN_PAD) + if (PicoOpt&POPT_6BTN_PAD) { if (a==1) { Pico.m.padDelay[0] = 0; @@ -168,7 +168,10 @@ void OtherWrite8(u32 a,u32 d) if ((a&0xe700f9)==0xc00011||(a&0xff7ff9)==0xa07f11) { if(PicoOpt&2) SN76496Write(d); return; } // PSG Sound if ((a&0xff4000)==0xa00000) { // z80 RAM if (!(Pico.m.z80Run&1)) Pico.zram[a&0x1fff]=(u8)d; - else elprintf(EL_ANOMALY, "68k z80 write with no bus! [%06x] %02x", a, d); + else { + elprintf(EL_ANOMALY, "68k z80 write with no bus! [%06x] %02x @ %06x", a, d, SekPc); + SekCyclesBurn(4); // hack? + } return; } if ((a&0xff6000)==0xa04000) { if(PicoOpt&1) emustatus|=YM2612Write(a&3, d)&1; return; } // FM Sound @@ -216,7 +219,7 @@ void OtherWrite16(u32 a,u32 d) if ((a&0xff6000)==0xa04000) { if(PicoOpt&1) emustatus|=YM2612Write(a&3, d)&1; return; } // FM Sound (??) if ((a&0xff4000)==0xa00000) { // Z80 ram (MSB only) if (!(Pico.m.z80Run&1)) Pico.zram[a&0x1fff]=(u8)(d>>8); - else elprintf(EL_ANOMALY, "68k z80 write with no bus! [%06x] %02x", a, d); + else elprintf(EL_ANOMALY, "68k z80 write with no bus! [%06x] %02x @ %06x", a, d, SekPc); return; } if (a==0xa11200) { diff --git a/Pico/Pico.c b/Pico/Pico.c index 2edc8ee8..7fa152ab 100644 --- a/Pico/Pico.c +++ b/Pico/Pico.c @@ -57,6 +57,8 @@ void PicoExit(void) void PicoPower(void) { + unsigned char sram_reg=Pico.m.sram_reg; // must be preserved + // clear all memory of the emulated machine memset(&Pico.ram,0,(unsigned int)&Pico.rom-(unsigned int)&Pico.ram); @@ -74,6 +76,7 @@ void PicoPower(void) if (PicoAHW & PAHW_MCD) PicoPowerMCD(); + Pico.m.sram_reg=sram_reg; PicoReset(); } diff --git a/Pico/PicoFrameHints.c b/Pico/PicoFrameHints.c index 32bd2356..d1efa9ad 100644 --- a/Pico/PicoFrameHints.c +++ b/Pico/PicoFrameHints.c @@ -209,8 +209,10 @@ static int PicoFrameHints(void) elprintf(EL_INTS, "vint: @ %06x [%i]", SekPc, SekCycleCnt); SekInterrupt(6); } - if (Pico.m.z80Run && (PicoOpt&POPT_EN_Z80)) + if (Pico.m.z80Run && (PicoOpt&POPT_EN_Z80)) { + elprintf(EL_INTS, "zint"); z80_int(); + } if (PicoOpt&POPT_EN_FM) Psnd_timers_and_dac(y); -- 2.39.5