X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FPico.c;h=2a18818310ae893050c43cd097fe07185154e1bf;hb=582890c000105f81c34c88d18924f7a3dc3b66b2;hp=7fa152ab9e00770d71e3c9bb466ad1bc17e2cf3d;hpb=583ab72c0b42549235191fd4fad239074dd896af;p=picodrive.git diff --git a/Pico/Pico.c b/Pico/Pico.c index 7fa152a..2a18818 100644 --- a/Pico/Pico.c +++ b/Pico/Pico.c @@ -16,7 +16,7 @@ int PicoOpt = 0; int PicoSkipFrame = 0; // skip rendering frame? int emustatus = 0; // rapid_ym2612, multi_ym_updates int PicoPad[2]; // Joypads, format is SACB RLDU -int PicoAHW = 0; // active addon hardware: scd_active, 32x_active, svp_active +int PicoAHW = 0; // active addon hardware: scd_active, 32x_active, svp_active, pico_active int PicoRegionOverride = 0; // override the region detection 0: Auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe int PicoAutoRgnOrder = 0; int z80startCycle, z80stopCycle; // in 68k cycles @@ -80,39 +80,19 @@ void PicoPower(void) PicoReset(); } -int PicoReset(void) +PICO_INTERNAL void PicoDetectRegion(void) { - unsigned int region=0; - int support=0,hw=0,i=0; + int support=0, hw=0, i; unsigned char pal=0; - unsigned char sram_reg=Pico.m.sram_reg; // must be preserved - - if (Pico.romsize<=0) return 1; - - /* must call now, so that banking is reset, and correct vectors get fetched */ - if (PicoResetHook) PicoResetHook(); - - PicoMemReset(); - SekReset(); - // s68k doesn't have the TAS quirk, so we just globally set normal TAS handler in MCD mode (used by Batman games). - SekSetRealTAS(PicoAHW & PAHW_MCD); - SekCycleCntT=0; - if (PicoAHW & PAHW_MCD) - // needed for MCD to reset properly, probably some bug hides behind this.. - memset(Pico.ioports,0,sizeof(Pico.ioports)); - emustatus = 0; - - Pico.m.dirtyPal = 1; - - if(PicoRegionOverride) + if (PicoRegionOverride) { support = PicoRegionOverride; } else { // Read cartridge region data: - region=PicoRead32(0x1f0); + int region=PicoRead32(0x1f0); for (i=0;i<4;i++) { @@ -153,7 +133,32 @@ int PicoReset(void) Pico.m.hardware=(unsigned char)(hw|0x20); // No disk attached Pico.m.pal=pal; - Pico.video.status = 0x3408 | pal; // 'always set' bits | vblank | pal +} + +int PicoReset(void) +{ + unsigned char sram_reg=Pico.m.sram_reg; // must be preserved + + if (Pico.romsize<=0) return 1; + + /* must call now, so that banking is reset, and correct vectors get fetched */ + if (PicoResetHook) PicoResetHook(); + + PicoMemReset(); + SekReset(); + // s68k doesn't have the TAS quirk, so we just globally set normal TAS handler in MCD mode (used by Batman games). + SekSetRealTAS(PicoAHW & PAHW_MCD); + SekCycleCntT=0; + + if (PicoAHW & PAHW_MCD) + // needed for MCD to reset properly, probably some bug hides behind this.. + memset(Pico.ioports,0,sizeof(Pico.ioports)); + emustatus = 0; + + Pico.m.dirtyPal = 1; + + PicoDetectRegion(); + Pico.video.status = 0x3408 | Pico.m.pal; // 'always set' bits | vblank | pal PsndReset(); // pal must be known here