[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 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).
* A transition from < 7 to 7 will cause a non-maskable interrupt (NMI).
* Setting IRQ to 0 will clear an interrupt request.

View File

@ -280,7 +280,7 @@ void m68k_run(unsigned int cycles)
#ifdef LOGVDP
error("[%d][%d] m68k run to %d cycles (%x), irq mask = %x (%x)\n", v_counter, m68k.cycles, cycles, m68k.pc,FLAG_INT_MASK, CPU_INT_LEVEL);
#endif
while (m68k.cycles < cycles)
{
/* Set tracing accodring to T1. */
@ -291,7 +291,7 @@ void m68k_run(unsigned int cycles)
/* Decode next instruction */
REG_IR = m68ki_read_imm_16();
/* Execute instruction */
m68ki_instruction_jump_table[REG_IR]();
USE_CYCLES(CYC_INSTRUCTION[REG_IR]);
@ -301,6 +301,11 @@ void m68k_run(unsigned int cycles)
}
}
int m68k_cycles(void)
{
return CYC_INSTRUCTION[REG_IR];
}
void m68k_init(void)
{
#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)
{
#ifdef BUILD_TABLES

View File

@ -1151,8 +1151,8 @@ 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;
/* Cycle-accurate VDP status read (adjust CPU time with current instruction execution time) */
cycles += m68k_cycles();
/* Update FIFO status flags if not empty */
if (fifo_write_cnt)
@ -1186,7 +1186,7 @@ unsigned int vdp_68k_ctrl_r(unsigned int cycles)
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 */
if ((v_counter == bitmap.viewport.h) && (cycles >= (mcycles_vdp + 788)))
{