diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.Render.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.Render.cs index 0cdd634880..4122f23bc8 100644 --- a/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.Render.cs +++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.Render.cs @@ -79,7 +79,7 @@ namespace BizHawk.Emulation.Cores.PCEngine } } - cpu.Execute(HBlankCycles); + cpu.Execute(24); if (InActiveDisplay) { @@ -92,11 +92,16 @@ namespace BizHawk.Emulation.Cores.PCEngine BackgroundY = Registers[BYR]; latch_bgy = false; } - BackgroundY++; BackgroundY &= 0x01FF; + } + } + cpu.Execute(HBlankCycles - 24); + + if (InActiveDisplay) + { if (render) RenderScanLine(); } diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs index eb4050f814..e8fda4374b 100644 --- a/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs +++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs @@ -323,6 +323,7 @@ namespace BizHawk.Emulation.Cores.PCEngine ser.Sync("ScanLine", ref ScanLine); ser.Sync("BackgroundY", ref BackgroundY); + ser.Sync("latch_bgy", ref latch_bgy); ser.Sync("RCRCounter", ref RCRCounter); ser.Sync("ActiveLine", ref ActiveLine); ser.EndSection(); diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs index 8ba32258b5..8c68463029 100644 --- a/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs +++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs @@ -175,7 +175,7 @@ namespace BizHawk.Emulation.Cores.PCEngine } } - CPU.Execute(VDC1.HBlankCycles); + CPU.Execute(24); if (InActiveDisplay) { @@ -203,10 +203,16 @@ namespace BizHawk.Emulation.Cores.PCEngine VDC2.BackgroundY++; VDC2.BackgroundY &= 0x01FF; } + } + CPU.Execute(VDC1.HBlankCycles - 24); + + if (InActiveDisplay) + { if (render) RenderScanLine(); } + if (ScanLine == VBlankLine && VDC1.VBlankInterruptEnabled) VDC1.StatusByte |= VDC.StatusVerticalBlanking;