mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-13 06:15:07 +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 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.
|
||||||
|
@ -280,7 +280,7 @@ void m68k_run(unsigned int cycles)
|
|||||||
#ifdef LOGVDP
|
#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);
|
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
|
#endif
|
||||||
|
|
||||||
while (m68k.cycles < cycles)
|
while (m68k.cycles < cycles)
|
||||||
{
|
{
|
||||||
/* Set tracing accodring to T1. */
|
/* Set tracing accodring to T1. */
|
||||||
@ -291,7 +291,7 @@ void m68k_run(unsigned int cycles)
|
|||||||
|
|
||||||
/* Decode next instruction */
|
/* Decode next instruction */
|
||||||
REG_IR = m68ki_read_imm_16();
|
REG_IR = m68ki_read_imm_16();
|
||||||
|
|
||||||
/* Execute instruction */
|
/* Execute instruction */
|
||||||
m68ki_instruction_jump_table[REG_IR]();
|
m68ki_instruction_jump_table[REG_IR]();
|
||||||
USE_CYCLES(CYC_INSTRUCTION[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)
|
void m68k_init(void)
|
||||||
{
|
{
|
||||||
#ifdef BUILD_TABLES
|
#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)
|
void s68k_init(void)
|
||||||
{
|
{
|
||||||
#ifdef BUILD_TABLES
|
#ifdef BUILD_TABLES
|
||||||
|
@ -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)))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user