[Core/CD] improved PAL Mega CD timing accuracy

This commit is contained in:
EkeEke 2016-06-22 01:15:15 +02:00
parent 01030f1a76
commit ece23d007e
7 changed files with 14 additions and 10 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.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -2,7 +2,7 @@
* Genesis Plus * Genesis Plus
* Mega CD / Sega CD hardware * Mega CD / Sega CD hardware
* *
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX) * Copyright (C) 2012-2016 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:

View File

@ -2,7 +2,7 @@
* Genesis Plus * Genesis Plus
* Mega CD / Sega CD hardware * Mega CD / Sega CD hardware
* *
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX) * Copyright (C) 2012-2016 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:
@ -50,12 +50,12 @@
#define scd ext.cd_hw #define scd ext.cd_hw
#endif #endif
/* 5000000 SCD clocks/s = ~3184 clocks/line with a Master Clock of 53.693175 MHz */ /* CD hardware Master Clock (50 MHz) */
/* This would be slightly (~30 clocks) more on PAL systems because of the slower */
/* Master Clock (53.203424 MHz) but not enough to really care about since clocks */
/* are not running in sync anyway. */
#define SCD_CLOCK 50000000 #define SCD_CLOCK 50000000
#define SCYCLES_PER_LINE 3184
/* ~3184 SCD clocks/line on NTSC-U system (53.693175 MHz Master Clock) */
/* ~3214 SCD clocks/line on PAL system (53.203424 MHz Master Clock) */
#define SCYCLES_PER_LINE scd.cycles_per_line
/* Timer & Stopwatch clocks divider */ /* Timer & Stopwatch clocks divider */
#define TIMERS_SCYCLES_RATIO (384 * 4) #define TIMERS_SCYCLES_RATIO (384 * 4)
@ -70,7 +70,8 @@ typedef struct
uint8 word_ram_2M[0x40000]; /* 256K Word RAM (2M mode) */ uint8 word_ram_2M[0x40000]; /* 256K Word RAM (2M mode) */
uint8 bram[0x2000]; /* 8K Backup RAM */ uint8 bram[0x2000]; /* 8K Backup RAM */
reg16_t regs[0x100]; /* 256 x 16-bit ASIC registers */ reg16_t regs[0x100]; /* 256 x 16-bit ASIC registers */
uint32 cycles; /* Master clock counter */ uint32 cycles; /* CD Master clock counter */
uint32 cycles_per_line; /* CD Master clock count per scanline */
int32 stopwatch; /* Stopwatch counter */ int32 stopwatch; /* Stopwatch counter */
int32 timer; /* Timer counter */ int32 timer; /* Timer counter */
uint8 pending; /* Pending interrupts */ uint8 pending; /* Pending interrupts */

View File

@ -3,7 +3,7 @@
* ROM Loading Support * ROM Loading Support
* *
* Copyright (C) 1998-2003 Charles Mac Donald (original code) * Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX) * Copyright (C) 2007-2016 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:
@ -1105,6 +1105,9 @@ void get_region(char *romheader)
/* force PAL/NTSC master clock if requested */ /* force PAL/NTSC master clock if requested */
if (config.master_clock == 1) system_clock = MCLOCK_NTSC; if (config.master_clock == 1) system_clock = MCLOCK_NTSC;
else if (config.master_clock == 2) system_clock = MCLOCK_PAL; else if (config.master_clock == 2) system_clock = MCLOCK_PAL;
/* reinitialize CD unit master clock count per scanline */
scd.cycles_per_line = (uint32) (MCYCLES_PER_LINE * ((float)SCD_CLOCK / (float)system_clock));
} }

View File

@ -3,7 +3,7 @@
* ROM Loading Support * ROM Loading Support
* *
* Copyright (C) 1998-2003 Charles Mac Donald (original code) * Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX) * Copyright (C) 2007-2016 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: