X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FPico.c;h=d206fcb9bf15cb64a87fb7b0dad7556bc6311124;hb=170435846c8e2309dc4011f954287f9ea861a6b6;hp=4e34e511f124f4652f5dc403791fc0d7e690159f;hpb=9037e45d9f2752fdd6ebbc01328148839403a84f;p=picodrive.git diff --git a/Pico/Pico.c b/Pico/Pico.c index 4e34e51..d206fcb 100644 --- a/Pico/Pico.c +++ b/Pico/Pico.c @@ -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 @@ -536,15 +541,15 @@ void PicoFrameDrawOnly(void) for (y=0;y<224;y++) PicoLine(y); } -int PicoGetStat(pstat_t which) +void PicoGetInternal(pint_t which, pint_ret_t *r) { switch (which) { - case PS_PAL: return Pico.m.pal; - case PS_40_CELL: return Pico.video.reg[12]&1; - case PS_240_LINES: return Pico.m.pal && (Pico.video.reg[1]&8); + case PI_ROM: r->vptr = Pico.rom; break; + case PI_ISPAL: r->vint = Pico.m.pal; break; + case PI_IS40_CELL: r->vint = Pico.video.reg[12]&1; break; + case PI_IS240_LINES: r->vint = Pico.m.pal && (Pico.video.reg[1]&8); break; } - return 0; } // callback to output message from emu