X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fpico.c;h=00184e64771ad47f1ff7399044125983074b1e1c;hb=200772b7904a4851c1beff5ea90b233274639ef4;hp=08ba5106640dda2cd99486c3a9f547fb68e2dba9;hpb=1cfc5cc4ce06642b9bc45ca3b9d32793718e9455;p=picodrive.git diff --git a/pico/pico.c b/pico/pico.c index 08ba510..00184e6 100644 --- a/pico/pico.c +++ b/pico/pico.c @@ -141,14 +141,23 @@ int PicoReset(void) { unsigned char sram_reg=Pico.m.sram_reg; // must be preserved - if (Pico.romsize<=0) return 1; + if (Pico.romsize <= 0) + return 1; /* must call now, so that banking is reset, and correct vectors get fetched */ - if (PicoResetHook) PicoResetHook(); + if (PicoResetHook) + PicoResetHook(); PicoMemReset(); - SekReset(); memset(&PicoPadInt,0,sizeof(PicoPadInt)); + emustatus = 0; + + if (PicoAHW & PAHW_SMS) { + PicoResetMS(); + return 0; + } + + 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; @@ -156,7 +165,6 @@ int PicoReset(void) 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; @@ -169,7 +177,7 @@ int PicoReset(void) PsndReset(); // pal must be known here // create an empty "dma" to cause 68k exec start at random frame location - if (Pico.m.dma_xfers == 0 && !(PicoOpt&POPT_DIS_VDP_FIFO)) + if (Pico.m.dma_xfers == 0 && !(PicoOpt & POPT_DIS_VDP_FIFO)) Pico.m.dma_xfers = rand() & 0x1fff; SekFinishIdleDet(); @@ -258,35 +266,6 @@ static __inline void SekRunM68k(int cyc) #endif } - -// to be called on 224 or line_sample scanlines only -static __inline void getSamples(int y) -{ -#if SIMPLE_WRITE_SOUND - if (y != 224) return; - PsndRender(0, PsndLen); - if (PicoWriteSound) PicoWriteSound(PsndLen); - PsndClear(); -#else - static int curr_pos = 0; - - if(y == 224) { - if(emustatus & 2) - curr_pos += PsndRender(curr_pos, PsndLen-PsndLen/2); - else curr_pos = PsndRender(0, PsndLen); - if (emustatus&1) emustatus|=2; else emustatus&=~2; - if (PicoWriteSound) PicoWriteSound(curr_pos); - // clear sound buffer - PsndClear(); - } - else if(emustatus & 3) { - emustatus|= 2; - emustatus&=~1; - curr_pos = PsndRender(0, PsndLen/2); - } -#endif -} - #include "pico_cmn.c" int z80stopCycle; @@ -318,6 +297,10 @@ void PicoFrame(void) PicoFrameMCD(); return; } + else if (PicoAHW & PAHW_SMS) { + PicoFrameMS(); + return; + } //if(Pico.video.reg[12]&0x2) Pico.video.status ^= 0x10; // change odd bit in interlace mode