md, implement z80 cycle stealing when accessing 68k bus

this fixes sound issues in Overdrive 2
This commit is contained in:
kub 2023-04-05 20:02:47 +02:00
parent d515a352b3
commit 134092feb7
3 changed files with 37 additions and 7 deletions

View file

@ -1294,7 +1294,11 @@ static unsigned char z80_md_bank_read(unsigned short a)
unsigned int addr68k;
unsigned char ret;
// account for 68K bus access on both CPUs.
// don't use SekCyclesBurn(7) here since the Z80 doesn't run in cycle lock to
// the 68K. Count the stolen cycles to be accounted later in the 68k CPU runs
z80_subCLeft(3);
Pico.t.z80_buscycles += 7;
addr68k = Pico.m.z80_bank68k << 15;
addr68k |= a & 0x7fff;
@ -1335,6 +1339,12 @@ static void z80_md_bank_write(unsigned int a, unsigned char data)
{
unsigned int addr68k;
// account for 68K bus access on both CPUs.
// don't use SekCyclesBurn(7) here since the Z80 doesn't run in cycle lock to
// the 68K. Count the stolen cycles to be accounted later in the 68K CPU runs
z80_subCLeft(3);
Pico.t.z80_buscycles += 7;
addr68k = Pico.m.z80_bank68k << 15;
addr68k += a & 0x7fff;