X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FMemoryCmn.c;h=0fbec619fb9c7393a618b3113f3e33a0db1a695c;hb=721cd3963fa4ba82ca218345e8f543703dc46c90;hp=02d45d85dc2c7add42ca61b845c6bdb1c858e5e0;hpb=4ff2d52753e46bce5622a5935f3d3750b5848f8f;p=picodrive.git diff --git a/Pico/MemoryCmn.c b/Pico/MemoryCmn.c index 02d45d8..0fbec61 100644 --- a/Pico/MemoryCmn.c +++ b/Pico/MemoryCmn.c @@ -98,6 +98,7 @@ 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) { // z80 busreq d=Pico.m.z80Run&1; +#if 1 if (!d) { // needed by buggy Terminator (Sega CD) extern int z80stopCycle; @@ -106,6 +107,7 @@ u32 OtherRead16(u32 a, int realsize) if (stop_before > 0 && stop_before <= 32) // 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; @@ -149,16 +151,21 @@ void OtherWrite8(u32 a,u32 d,int realsize) return; } if (a==0xa11100) { - extern int z80startCycle, z80stopCycle; //int lineCycles=(488-SekCyclesLeft)&0x1ff; d&=1; d^=1; if(!d) { // 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; + int lineCycles; z80stopCycle = SekCyclesDone(); - lineCycles=(lineCycles>>1)-(lineCycles>>5); - z80_run(lineCycles); + if (Pico.m.z80Run&2) + lineCycles=(488-SekCyclesLeft)&0x1ff; + else lineCycles=z80stopCycle-z80startCycle; // z80 was started at current line + if (lineCycles > 0 && lineCycles <= 488) { + dprintf("zrun: %i/%i cycles", lineCycles, (lineCycles>>1)-(lineCycles>>5)); + lineCycles=(lineCycles>>1)-(lineCycles>>5); + z80_run(lineCycles); + } } } else { z80startCycle = SekCyclesDone();