mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
z80 timing change
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@84 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
2433f40912
commit
d915372968
6 changed files with 32 additions and 15 deletions
|
@ -392,10 +392,7 @@ static void CPU_CALL PicoWrite8(u32 a,u8 d)
|
|||
//if ((a&0xe0ffff)==0xe0a9ba+0x69c)
|
||||
// dprintf("w8 : %06x, %02x @%06x", a&0xffffff, d, SekPc);
|
||||
|
||||
|
||||
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
|
||||
if ((a&0xe00000)==0xe00000) { *(u8 *)(Pico.ram+((a^1)&0xffff))=d; return; } // Ram
|
||||
|
||||
a&=0xffffff;
|
||||
OtherWrite8(a,d,8);
|
||||
|
|
|
@ -149,16 +149,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();
|
||||
|
|
15
Pico/Pico.c
15
Pico/Pico.c
|
@ -430,11 +430,18 @@ static int PicoFrameHints(void)
|
|||
getSamples(y);
|
||||
|
||||
// Run scanline:
|
||||
if(Pico.m.dma_bytes) SekCycleCnt+=CheckDMA();
|
||||
if (Pico.m.dma_bytes) SekCycleCnt+=CheckDMA();
|
||||
SekRun(cycles_68k);
|
||||
if((PicoOpt&4) && Pico.m.z80Run) {
|
||||
Pico.m.z80Run|=2;
|
||||
z80CycleAim+=cycles_z80;
|
||||
if ((PicoOpt&4) && Pico.m.z80Run) {
|
||||
if (Pico.m.z80Run & 2) z80CycleAim+=cycles_z80;
|
||||
else {
|
||||
int cnt = SekCyclesDone() - z80startCycle;
|
||||
cnt = (cnt>>1)-(cnt>>5);
|
||||
//if (cnt > cycles_z80) printf("FIXME: z80 cycles: %i\n", cnt);
|
||||
if (cnt > cycles_z80) cnt = cycles_z80;
|
||||
Pico.m.z80Run |= 2;
|
||||
z80CycleAim+=cnt;
|
||||
}
|
||||
total_z80+=z80_run(z80CycleAim-total_z80);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -299,6 +299,7 @@ void PicoWriteCD32(unsigned int a, unsigned int d);
|
|||
extern struct Pico Pico;
|
||||
extern struct PicoSRAM SRam;
|
||||
extern int emustatus;
|
||||
extern int z80startCycle, z80stopCycle; // in 68k cycles
|
||||
int CheckDMA(void);
|
||||
|
||||
// cd/Pico.c
|
||||
|
|
|
@ -331,8 +331,15 @@ static int PicoFrameHintsMCD(void)
|
|||
}
|
||||
|
||||
if ((PicoOpt&4) && Pico.m.z80Run) {
|
||||
Pico.m.z80Run|=2;
|
||||
z80CycleAim+=cycles_z80;
|
||||
if (Pico.m.z80Run & 2) z80CycleAim+=cycles_z80;
|
||||
else {
|
||||
int cnt = SekCyclesDone() - z80startCycle;
|
||||
cnt = (cnt>>1)-(cnt>>5);
|
||||
//if (cnt > cycles_z80) printf("FIXME: z80 cycles: %i\n", cnt);
|
||||
if (cnt > cycles_z80) cnt = cycles_z80;
|
||||
Pico.m.z80Run |= 2;
|
||||
z80CycleAim+=cnt;
|
||||
}
|
||||
total_z80+=z80_run(z80CycleAim-total_z80);
|
||||
}
|
||||
|
||||
|
|
|
@ -788,7 +788,7 @@ int m68k_execute(int num_cycles)
|
|||
m68ki_set_address_error_trap(); /* auto-disable (see m68kcpu.h) */
|
||||
|
||||
/* Main loop. Keep going until we run out of clock cycles */
|
||||
while(GET_CYCLES() > 0)
|
||||
while(GET_CYCLES() >= 0)
|
||||
{
|
||||
/* Set tracing accodring to T1. (T0 is done inside instruction) */
|
||||
m68ki_trace_t1(); /* auto-disable (see m68kcpu.h) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue