[Core/VDP] improved VDP status timing accuracy

This commit is contained in:
EkeEke 2016-05-01 20:21:45 +02:00
parent 381a9d114f
commit 9365ac2b55
6 changed files with 24 additions and 15 deletions

View File

@ -95,6 +95,7 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
* improved Mode 5 sprites rendering timings (fixes "Overdrive" demo)
* improved FIFO timings accuracy (fixes "Overdrive" Demo)
* improved H-Counter accuracy in H32 mode
* improved VDP status timing accuracy
* improved accuracy of Master System color palette brightness range (verified against real hardware)
* fixed misaligned buffer writes in Mode 4 when -DALIGN_LONG option is used
* fixed alpha channel for 15-bit (RGB555) and 32-bit (RGB888) color support

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 MiB

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -481,12 +481,6 @@ void system_frame_gen(int do_skip)
/* refresh inputs just before VINT (Warriors of Eternal Sun) */
osd_input_update();
/* delay between VINT flag & Vertical Interrupt (Ex-Mutants, Tyrant) */
m68k_run(588);
/* set VINT flag */
status |= 0x80;
/* delay between VBLANK flag & Vertical Interrupt (Dracula, OutRunners, VR Troopers) */
m68k_run(788);
if (zstate == 1)
@ -498,6 +492,9 @@ void system_frame_gen(int do_skip)
Z80.cycles = 788;
}
/* set VINT flag */
status |= 0x80;
/* Vertical Interrupt */
vint_pending = 0x20;
if (reg[1] & 0x20)
@ -853,12 +850,6 @@ void system_frame_scd(int do_skip)
/* refresh inputs just before VINT */
osd_input_update();
/* delay between VINT flag & Vertical Interrupt (Ex-Mutants, Tyrant) */
m68k_run(588);
/* set VINT flag */
status |= 0x80;
/* delay between VBLANK flag & Vertical Interrupt (Dracula, OutRunners, VR Troopers) */
m68k_run(788);
if (zstate == 1)
@ -870,6 +861,9 @@ void system_frame_scd(int do_skip)
Z80.cycles = 788;
}
/* set VINT flag */
status |= 0x80;
/* Vertical Interrupt */
vint_pending = 0x20;
if (reg[1] & 0x20)

View File

@ -1134,6 +1134,9 @@ unsigned int vdp_68k_ctrl_r(unsigned int cycles)
{
unsigned int temp;
/* Cycle-accurate VDP status read (68k read cycle takes four CPU cycles i.e 28 Mcycles) */
cycles += 4 * 7;
/* Update FIFO status flags if not empty */
if (fifo_write_cnt)
{
@ -1160,14 +1163,25 @@ unsigned int vdp_68k_ctrl_r(unsigned int cycles)
/* Clear SOVR & SCOL flags */
status &= 0xFF9F;
/* Display OFF: VBLANK flag is set */
/* VBLANK flag is set when display is disabled */
if (!(reg[1] & 0x40))
{
temp |= 0x08;
}
/* HBLANK flag (Sonic 3 and Sonic 2 "VS Modes", Lemmings 2, Mega Turrican, V.R Troopers, Gouketsuji Ichizoku,...) */
/* NB: this is not 100% accurate and need to be verified on real hardware */
/* Cycle-accurate VINT flag (Ex-Mutants, Tyrant / Mega-Lo-Mania) */
/* this allows VINT flag to be read just before vertical interrupt is being triggered */
if ((v_counter == bitmap.viewport.h) && (cycles >= (mcycles_vdp + 788)))
{
/* check Z80 interrupt state to assure VINT has not already been triggered (and flag cleared) */
if (Z80.irq_state != ASSERT_LINE)
{
temp |= 0x80;
}
}
/* Cycle-accurate HBLANK flag (Sonic 3 & Sonic 2 "VS Modes", Bugs Bunny Double Trouble, Lemmings 2, Mega Turrican, V.R Troopers, Gouketsuji Ichizoku,...) */
/* NB: this is not 100% accurate (see hvc.h for horizontal events timings in H32 and H40 mode) but is close enough to make no noticeable difference for games */
if ((cycles % MCYCLES_PER_LINE) < 588)
{
temp |= 0x04;