mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-27 03:31:49 +01:00
[Core/CPU] improved 68K/Z80 synchronization
This commit is contained in:
parent
238e520a4a
commit
d0aa36acc3
@ -5,7 +5,7 @@
|
|||||||
* Support for SG-1000, Mark-III, Master System, Game Gear, Mega Drive & Mega CD hardware
|
* Support for SG-1000, Mark-III, Master System, Game Gear, Mega Drive & Mega CD hardware
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||||
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2007-2018 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -474,8 +474,8 @@ void gen_zbusreq_w(unsigned int data, unsigned int cycles)
|
|||||||
/* check if Z80 is going to be restarted */
|
/* check if Z80 is going to be restarted */
|
||||||
if (zstate == 3)
|
if (zstate == 3)
|
||||||
{
|
{
|
||||||
/* resynchronize with 68k */
|
/* resynchronize with 68k (Z80 cycles should remain a multiple of 15 MClocks) */
|
||||||
Z80.cycles = cycles;
|
Z80.cycles = ((cycles + 14) / 15) * 15;
|
||||||
|
|
||||||
/* disable 68k access to Z80 bus */
|
/* disable 68k access to Z80 bus */
|
||||||
m68k.memory_map[0xa0].read8 = m68k_read_bus_8;
|
m68k.memory_map[0xa0].read8 = m68k_read_bus_8;
|
||||||
@ -496,8 +496,8 @@ void gen_zreset_w(unsigned int data, unsigned int cycles)
|
|||||||
/* check if Z80 is going to be restarted */
|
/* check if Z80 is going to be restarted */
|
||||||
if (zstate == 0)
|
if (zstate == 0)
|
||||||
{
|
{
|
||||||
/* resynchronize with 68k */
|
/* resynchronize with 68k (Z80 cycles should remain a multiple of 15 MClocks) */
|
||||||
Z80.cycles = cycles;
|
Z80.cycles = ((cycles + 14) / 15) * 15;
|
||||||
|
|
||||||
/* reset Z80 & YM2612 */
|
/* reset Z80 & YM2612 */
|
||||||
z80_reset();
|
z80_reset();
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Support for SG-1000, Mark-III, Master System, Game Gear, Mega Drive & Mega CD hardware
|
* Support for SG-1000, Mark-III, Master System, Game Gear, Mega Drive & Mega CD hardware
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||||
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2007-2018 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Support for 16-bit & 8-bit hardware modes
|
* Support for 16-bit & 8-bit hardware modes
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||||
* Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2007-2018 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -467,10 +467,6 @@ void system_frame_gen(int do_skip)
|
|||||||
{
|
{
|
||||||
z80_run(788);
|
z80_run(788);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Z80.cycles = 788;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set VINT flag */
|
/* set VINT flag */
|
||||||
status |= 0x80;
|
status |= 0x80;
|
||||||
@ -493,10 +489,6 @@ void system_frame_gen(int do_skip)
|
|||||||
{
|
{
|
||||||
z80_run(MCYCLES_PER_LINE);
|
z80_run(MCYCLES_PER_LINE);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Z80.cycles = MCYCLES_PER_LINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Z80 interrupt is cleared at the end of the line */
|
/* Z80 interrupt is cleared at the end of the line */
|
||||||
Z80.irq_state = CLEAR_LINE;
|
Z80.irq_state = CLEAR_LINE;
|
||||||
@ -538,10 +530,6 @@ void system_frame_gen(int do_skip)
|
|||||||
{
|
{
|
||||||
z80_run(mcycles_vdp + MCYCLES_PER_LINE);
|
z80_run(mcycles_vdp + MCYCLES_PER_LINE);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Z80.cycles = mcycles_vdp + MCYCLES_PER_LINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* run SVP chip */
|
/* run SVP chip */
|
||||||
if (svp)
|
if (svp)
|
||||||
@ -590,10 +578,6 @@ void system_frame_gen(int do_skip)
|
|||||||
{
|
{
|
||||||
z80_run(mcycles_vdp + MCYCLES_PER_LINE);
|
z80_run(mcycles_vdp + MCYCLES_PER_LINE);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Z80.cycles = mcycles_vdp + MCYCLES_PER_LINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* run SVP chip */
|
/* run SVP chip */
|
||||||
if (svp)
|
if (svp)
|
||||||
@ -654,10 +638,6 @@ void system_frame_gen(int do_skip)
|
|||||||
{
|
{
|
||||||
z80_run(mcycles_vdp + MCYCLES_PER_LINE);
|
z80_run(mcycles_vdp + MCYCLES_PER_LINE);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Z80.cycles = mcycles_vdp + MCYCLES_PER_LINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* run SVP chip */
|
/* run SVP chip */
|
||||||
if (svp)
|
if (svp)
|
||||||
@ -826,10 +806,6 @@ void system_frame_scd(int do_skip)
|
|||||||
{
|
{
|
||||||
z80_run(788);
|
z80_run(788);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Z80.cycles = 788;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set VINT flag */
|
/* set VINT flag */
|
||||||
status |= 0x80;
|
status |= 0x80;
|
||||||
@ -854,10 +830,6 @@ void system_frame_scd(int do_skip)
|
|||||||
{
|
{
|
||||||
z80_run(MCYCLES_PER_LINE);
|
z80_run(MCYCLES_PER_LINE);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Z80.cycles = MCYCLES_PER_LINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Z80 interrupt is cleared at the end of the line */
|
/* Z80 interrupt is cleared at the end of the line */
|
||||||
Z80.irq_state = CLEAR_LINE;
|
Z80.irq_state = CLEAR_LINE;
|
||||||
@ -895,10 +867,6 @@ void system_frame_scd(int do_skip)
|
|||||||
{
|
{
|
||||||
z80_run(mcycles_vdp + MCYCLES_PER_LINE);
|
z80_run(mcycles_vdp + MCYCLES_PER_LINE);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Z80.cycles = mcycles_vdp + MCYCLES_PER_LINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update VDP cycle count */
|
/* update VDP cycle count */
|
||||||
mcycles_vdp += MCYCLES_PER_LINE;
|
mcycles_vdp += MCYCLES_PER_LINE;
|
||||||
@ -943,10 +911,6 @@ void system_frame_scd(int do_skip)
|
|||||||
{
|
{
|
||||||
z80_run(mcycles_vdp + MCYCLES_PER_LINE);
|
z80_run(mcycles_vdp + MCYCLES_PER_LINE);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Z80.cycles = mcycles_vdp + MCYCLES_PER_LINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update VDP cycle count */
|
/* update VDP cycle count */
|
||||||
mcycles_vdp += MCYCLES_PER_LINE;
|
mcycles_vdp += MCYCLES_PER_LINE;
|
||||||
@ -1003,10 +967,6 @@ void system_frame_scd(int do_skip)
|
|||||||
{
|
{
|
||||||
z80_run(mcycles_vdp + MCYCLES_PER_LINE);
|
z80_run(mcycles_vdp + MCYCLES_PER_LINE);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Z80.cycles = mcycles_vdp + MCYCLES_PER_LINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update VDP cycle count */
|
/* update VDP cycle count */
|
||||||
mcycles_vdp += MCYCLES_PER_LINE;
|
mcycles_vdp += MCYCLES_PER_LINE;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Support for 16-bit & 8-bit hardware modes
|
* Support for 16-bit & 8-bit hardware modes
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||||
* Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2007-2018 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
|
Loading…
Reference in New Issue
Block a user