core md, assert z80 vint for complete scanline

This commit is contained in:
kub 2024-02-20 22:05:33 +01:00
parent a0abaf2ada
commit d97d056c46
2 changed files with 25 additions and 21 deletions

View file

@ -678,7 +678,7 @@ static u32 PicoRead8_z80(u32 a)
if (((Pico.m.z80Run & 1) || Pico.m.z80_reset) && !(PicoIn.quirks & PQUIRK_NO_Z80_BUS_LOCK)) { if (((Pico.m.z80Run & 1) || Pico.m.z80_reset) && !(PicoIn.quirks & PQUIRK_NO_Z80_BUS_LOCK)) {
elprintf(EL_ANOMALY, "68k z80 read with no bus! [%06x] @ %06x", a, SekPc); elprintf(EL_ANOMALY, "68k z80 read with no bus! [%06x] @ %06x", a, SekPc);
// open bus. Pulled down if MegaCD2 is attached. // open bus. Pulled down if MegaCD2 is attached.
return 0; return (PicoIn.AHW & PAHW_MCD ? 0 : d);
} }
if ((a & 0x4000) == 0x0000) { if ((a & 0x4000) == 0x0000) {
@ -755,13 +755,13 @@ u32 PicoRead8_io(u32 a)
d ^= d << 6; d ^= d << 6;
if ((a & 0xfc00) == 0x1000) { if ((a & 0xfc00) == 0x1000) {
// bit8 seems to be readable in this range
if (!(a & 1))
d &= ~0x01;
if ((a & 0xff01) == 0x1100) { // z80 busreq (verified) if ((a & 0xff01) == 0x1100) { // z80 busreq (verified)
d |= (Pico.m.z80Run | Pico.m.z80_reset) & 1; // bit8 seems to be readable in this range
elprintf(EL_BUSREQ, "get_zrun: %02x [%u] @%06x", d, SekCyclesDone(), SekPc); if (!(a & 1)) {
d &= ~0x01;
d |= (Pico.m.z80Run | Pico.m.z80_reset) & 1;
elprintf(EL_BUSREQ, "get_zrun: %02x [%u] @%06x", d, SekCyclesDone(), SekPc);
}
} }
goto end; goto end;
} }
@ -788,9 +788,8 @@ u32 PicoRead16_io(u32 a)
// bit8 seems to be readable in this range // bit8 seems to be readable in this range
if ((a & 0xfc00) == 0x1000) { if ((a & 0xfc00) == 0x1000) {
d &= ~0x0100;
if ((a & 0xff00) == 0x1100) { // z80 busreq if ((a & 0xff00) == 0x1100) { // z80 busreq
d &= ~0x0100;
d |= ((Pico.m.z80Run | Pico.m.z80_reset) & 1) << 8; d |= ((Pico.m.z80Run | Pico.m.z80_reset) & 1) << 8;
elprintf(EL_BUSREQ, "get_zrun: %04x [%u] @%06x", d, SekCyclesDone(), SekPc); elprintf(EL_BUSREQ, "get_zrun: %04x [%u] @%06x", d, SekCyclesDone(), SekPc);
} }
@ -855,22 +854,22 @@ void PicoWrite16_io(u32 a, u32 d)
// TODO: verify if lower byte goes to PSG on word writes // TODO: verify if lower byte goes to PSG on word writes
u32 PicoRead8_vdp(u32 a) u32 PicoRead8_vdp(u32 a)
{ {
u32 d = 0;
if ((a & 0x00f0) == 0x0000) { if ((a & 0x00f0) == 0x0000) {
switch (a & 0x0d) switch (a & 0x0d)
{ {
case 0x00: return PicoVideoRead8DataH(0); case 0x00: d = PicoVideoRead8DataH(0); break;
case 0x01: return PicoVideoRead8DataL(0); case 0x01: d = PicoVideoRead8DataL(0); break;
case 0x04: return PicoVideoRead8CtlH(0); case 0x04: d = PicoVideoRead8CtlH(0); break;
case 0x05: return PicoVideoRead8CtlL(0); case 0x05: d = PicoVideoRead8CtlL(0); break;
case 0x08: case 0x08:
case 0x0c: return PicoVideoRead8HV_H(0); case 0x0c: d = PicoVideoRead8HV_H(0); break;
case 0x09: case 0x09:
case 0x0d: return PicoVideoRead8HV_L(0); case 0x0d: d = PicoVideoRead8HV_L(0); break;
} }
} } else
elprintf(EL_UIO|EL_ANOMALY, "68k bad read [%06x] @%06x", a, SekPc);
elprintf(EL_UIO|EL_ANOMALY, "68k bad read [%06x] @%06x", a, SekPc); return d;
return 0;
} }
static u32 PicoRead16_vdp(u32 a) static u32 PicoRead16_vdp(u32 a)

View file

@ -250,9 +250,10 @@ static int PicoFrameHints(void)
SekInterrupt(6); SekInterrupt(6);
} }
if (Pico.m.z80Run && !Pico.m.z80_reset && (PicoIn.opt&POPT_EN_Z80)) { // assert Z80 interrupt for one scanline even in busrq hold (Teddy Blues)
if (/*Pico.m.z80Run &&*/ !Pico.m.z80_reset && (PicoIn.opt&POPT_EN_Z80)) {
elprintf(EL_INTS, "zint"); elprintf(EL_INTS, "zint");
z80_int(); z80_int_assert(1);
} }
// Run scanline: // Run scanline:
@ -262,6 +263,10 @@ static int PicoFrameHints(void)
if (PicoLineHook) PicoLineHook(); if (PicoLineHook) PicoLineHook();
pevt_log_m68k_o(EVT_NEXT_LINE); pevt_log_m68k_o(EVT_NEXT_LINE);
if (Pico.m.z80Run && !Pico.m.z80_reset && (PicoIn.opt&POPT_EN_Z80))
PicoSyncZ80(Pico.t.m68c_aim);
z80_int_assert(0);
// === VBLANK === // === VBLANK ===
lines = Pico.m.pal ? 313 : 262; lines = Pico.m.pal ? 313 : 262;
for (y++; y < lines - 1; y++) for (y++; y < lines - 1; y++)