[Core/CD] improved SUB-CPU synchronization with graphics processing when polling end of graphics operation

This commit is contained in:
ekeeke 2024-02-20 13:59:36 +01:00
parent 30dfba4966
commit 771452f7a1
5 changed files with 11 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

View File

@ -2,7 +2,7 @@
* Genesis Plus * Genesis Plus
* CD graphics processor * CD graphics processor
* *
* Copyright (C) 2012-2023 Eke-Eke (Genesis Plus GX) * Copyright (C) 2012-2024 Eke-Eke (Genesis Plus GX)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met:
@ -683,7 +683,7 @@ void gfx_update(int cycles)
/* update Vdot remaining size */ /* update Vdot remaining size */
scd.regs[0x64>>1].byte.l -= lines; scd.regs[0x64>>1].byte.l -= lines;
/* increment cycle counter */ /* update cycle counter */
gfx.cycles += lines * gfx.cyclesPerLine; gfx.cycles += lines * gfx.cyclesPerLine;
} }
else else
@ -694,14 +694,20 @@ void gfx_update(int cycles)
/* clear Vdot remaining size */ /* clear Vdot remaining size */
scd.regs[0x64>>1].byte.l = 0; scd.regs[0x64>>1].byte.l = 0;
/* update cycle counter */
gfx.cycles += lines * gfx.cyclesPerLine;
/* end of graphics operation */ /* end of graphics operation */
scd.regs[0x58>>1].byte.h = 0; scd.regs[0x58>>1].byte.h = 0;
/* SUB-CPU idle on register $58 polling ? */ /* SUB-CPU idle on register $58 polling ? */
if (s68k.stopped & (1<<0x08)) if (s68k.stopped & (1<<0x08))
{ {
/* sync SUB-CPU with GFX chip */ /* sync SUB-CPU with GFX chip (only if not already ahead) */
s68k.cycles = scd.cycles; if (s68k.cycles < gfx.cycles)
{
s68k.cycles = gfx.cycles;
}
/* restart SUB-CPU */ /* restart SUB-CPU */
s68k.stopped = 0; s68k.stopped = 0;

View File

@ -2,7 +2,7 @@
* Genesis Plus * Genesis Plus
* CD graphics processor * CD graphics processor
* *
* Copyright (C) 2012-2023 Eke-Eke (Genesis Plus GX) * Copyright (C) 2012-2024 Eke-Eke (Genesis Plus GX)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met: