[Core/VDP] improved VDP status read timing accuracy (fixes 'Marvel Land' demo mode)

This commit is contained in:
EkeEke 2017-09-20 10:53:08 +02:00
parent f6f4556533
commit 527fd6ecd8
7 changed files with 20 additions and 5 deletions

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.4 MiB

After

Width:  |  Height:  |  Size: 3.4 MiB

View File

@ -356,6 +356,10 @@ extern void s68k_pulse_reset(void);
extern void m68k_run(unsigned int cycles); extern void m68k_run(unsigned int cycles);
extern void s68k_run(unsigned int cycles); extern void s68k_run(unsigned int cycles);
/* Get current instruction execution time */
extern int m68k_cycles(void);
extern int s68k_cycles(void);
/* Set the IPL0-IPL2 pins on the CPU (IRQ). /* Set the IPL0-IPL2 pins on the CPU (IRQ).
* A transition from < 7 to 7 will cause a non-maskable interrupt (NMI). * A transition from < 7 to 7 will cause a non-maskable interrupt (NMI).
* Setting IRQ to 0 will clear an interrupt request. * Setting IRQ to 0 will clear an interrupt request.

View File

@ -301,6 +301,11 @@ void m68k_run(unsigned int cycles)
} }
} }
int m68k_cycles(void)
{
return CYC_INSTRUCTION[REG_IR];
}
void m68k_init(void) void m68k_init(void)
{ {
#ifdef BUILD_TABLES #ifdef BUILD_TABLES

View File

@ -265,6 +265,12 @@ void s68k_run(unsigned int cycles)
} }
} }
int s68k_cycles(void)
{
return CYC_INSTRUCTION[REG_IR];
}
void s68k_init(void) void s68k_init(void)
{ {
#ifdef BUILD_TABLES #ifdef BUILD_TABLES

View File

@ -1151,8 +1151,8 @@ unsigned int vdp_68k_ctrl_r(unsigned int cycles)
{ {
unsigned int temp; unsigned int temp;
/* Cycle-accurate VDP status read (68k read cycle takes four CPU cycles i.e 28 Mcycles) */ /* Cycle-accurate VDP status read (adjust CPU time with current instruction execution time) */
cycles += 4 * 7; cycles += m68k_cycles();
/* Update FIFO status flags if not empty */ /* Update FIFO status flags if not empty */
if (fifo_write_cnt) if (fifo_write_cnt)
@ -1186,7 +1186,7 @@ unsigned int vdp_68k_ctrl_r(unsigned int cycles)
temp |= 0x08; temp |= 0x08;
} }
/* Cycle-accurate VINT flag (Ex-Mutants, Tyrant / Mega-Lo-Mania) */ /* Cycle-accurate VINT flag (Ex-Mutants, Tyrant / Mega-Lo-Mania, Marvel Land) */
/* this allows VINT flag to be read just before vertical interrupt is being triggered */ /* this allows VINT flag to be read just before vertical interrupt is being triggered */
if ((v_counter == bitmap.viewport.h) && (cycles >= (mcycles_vdp + 788))) if ((v_counter == bitmap.viewport.h) && (cycles >= (mcycles_vdp + 788)))
{ {