mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-10 21:05:12 +01:00
[Core/VDP] improved VDP status read timing accuracy (fixes 'Marvel Land' demo mode)
This commit is contained in:
parent
f6f4556533
commit
527fd6ecd8
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 |
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user