X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FMemory.c;h=509fead95aa9c05b81594f65428d1e39a3776dc4;hb=1cd356a33daf2eec34e52c075b06d62866f5fb2f;hp=d3b931c172023400378df612dfa39f0168d09609;hpb=4f67228034eca76d85ff3e05571deb965e065791;p=picodrive.git diff --git a/Pico/Memory.c b/Pico/Memory.c index d3b931c..509fead 100644 --- a/Pico/Memory.c +++ b/Pico/Memory.c @@ -267,13 +267,16 @@ u32 OtherRead16(u32 a, int realsize) } // |=0x80 for Shadow of the Beast & Super Offroad; rotate fakes next fetched instruction for Time Killers if (a==0xa11100) { - extern int z80stopCycle; // TODO: tidy d=Pico.m.z80Run&1; +#if 0 if (!d) { + // do we need this? + extern int z80stopCycle; // TODO: tidy int stop_before = SekCyclesDone() - z80stopCycle; - if (stop_before > 0 && stop_before <= 16*2) // Gens uses 16 here + if (stop_before > 0 && stop_before <= 16) // Gens uses 16 here d = 1; // bus not yet available } +#endif d=(d<<8)|0x8000|Pico.m.rotate++; dprintf("get_zrun: %04x [%i|%i] @%06x", d, Pico.m.scanline, SekCyclesDone(), SekPc); goto end; } @@ -316,14 +319,16 @@ static void OtherWrite8(u32 a,u32 d,int realsize) //int lineCycles=(488-SekCyclesLeft)&0x1ff; d&=1; d^=1; if(!d) { - // hack: detect a nasty situation where Z80 was enabled and disabled in the same 68k timeslice (Golden Axe III) - // if((PicoOpt&4) && Pico.m.z80Run==1) z80_run(20); // FIXME: movies - z80stopCycle = SekCyclesDone(); - //z80ExtraCycles += (lineCycles>>1)-(lineCycles>>5); // only meaningful in PicoFrameHints() + // this is for a nasty situation where Z80 was enabled and disabled in the same 68k timeslice (Golden Axe III) + if (Pico.m.z80Run) { + int lineCycles=(488-SekCyclesLeft)&0x1ff; + z80stopCycle = SekCyclesDone(); + lineCycles=(lineCycles>>1)-(lineCycles>>5); + z80_run(lineCycles); + } } else { z80startCycle = SekCyclesDone(); //if(Pico.m.scanline != -1) - //z80ExtraCycles -= (lineCycles>>1)-(lineCycles>>5)+16; } dprintf("set_zrun: %02x [%i|%i] @%06x", d, Pico.m.scanline, SekCyclesDone(), /*mz80GetRegisterValue(NULL, 0),*/ SekPc); Pico.m.z80Run=(u8)d; return; @@ -569,7 +574,9 @@ static void CPU_CALL PicoWrite8(u32 a,u8 d) // dprintf("w8 : %06x, %02x @%06x", a&0xffffff, d, SekPc); - if ((a&0xe00000)==0xe00000) { u8 *pm=(u8 *)(Pico.ram+((a^1)&0xffff)); pm[0]=d; return; } // Ram + if ((a&0xe00000)==0xe00000) { + if((a&0xffff)==0xf62a) dprintf("(f62a) = %02x [%i|%i] @ %x", d, Pico.m.scanline, SekCyclesDone(), SekPc); + u8 *pm=(u8 *)(Pico.ram+((a^1)&0xffff)); pm[0]=d; return; } // Ram a&=0xffffff; OtherWrite8(a,d,8); @@ -616,7 +623,7 @@ static void CPU_CALL PicoWrite32(u32 a,u32 d) // ----------------------------------------------------------------- -int PicoMemInit() +void PicoMemSetup() { #ifdef EMU_C68K // Setup memory callbacks: @@ -628,7 +635,6 @@ int PicoMemInit() PicoCpu.write16=PicoWrite16; PicoCpu.write32=PicoWrite32; #endif - return 0; } #ifdef EMU_A68K