mirror of
https://github.com/JaCzekanski/Avocado.git
synced 2024-05-20 12:57:38 -04:00
cdrom: 75/150 sectors per second speed
This commit is contained in:
parent
4ef44fb086
commit
e33cbf5aef
|
@ -12,8 +12,6 @@
|
|||
namespace device {
|
||||
namespace cdrom {
|
||||
|
||||
const int CPU_FREQ = 38'868'800;
|
||||
|
||||
CDROM::CDROM(System* sys) : sys(sys) {
|
||||
verbose = config.debug.log.cdrom;
|
||||
disc = std::make_unique<disc::Empty>();
|
||||
|
@ -151,9 +149,8 @@ void CDROM::step(int cycles) {
|
|||
}
|
||||
}
|
||||
|
||||
const int CD_SECTOR_SIZE = 2048;
|
||||
const int sectorsPerSecond = (44100 * 2 * 2) / CD_SECTOR_SIZE;
|
||||
const int cyclesPerSector = (CPU_FREQ / sectorsPerSecond) / (mode.speed ? 2 : 1); // not perfect division
|
||||
const int sectorsPerSecond = mode.speed ? 150 : 75;
|
||||
const int cyclesPerSector = timing::CPU_CLOCK / sectorsPerSecond;
|
||||
for (int i = 0; i < readcnt / cyclesPerSector; i++) {
|
||||
handleSector();
|
||||
}
|
||||
|
|
|
@ -13,14 +13,14 @@ const float CYCLES_PER_LINE_PAL = 3406.1f;
|
|||
const int LINES_TOTAL_NTSC = 263;
|
||||
const int LINES_TOTAL_PAL = 314;
|
||||
#else
|
||||
const float CYCLES_PER_LINE_NTSC = 3372;
|
||||
const float CYCLES_PER_LINE_NTSC = 3372.7f;
|
||||
const float CYCLES_PER_LINE_PAL = 3389;
|
||||
const int LINES_TOTAL_NTSC = 263;
|
||||
const int LINES_TOTAL_PAL = 314;
|
||||
#endif
|
||||
|
||||
const float NTSC_FRAMERATE = (float)GPU_CLOCK / (CYCLES_PER_LINE_NTSC * LINES_TOTAL_NTSC);
|
||||
const float PAL_FRAMERATE = (float)GPU_CLOCK / (CYCLES_PER_LINE_PAL * LINES_TOTAL_PAL);
|
||||
const double NTSC_FRAMERATE = (double)GPU_CLOCK / (CYCLES_PER_LINE_NTSC * LINES_TOTAL_NTSC);
|
||||
const double PAL_FRAMERATE = (double)GPU_CLOCK / (CYCLES_PER_LINE_PAL * LINES_TOTAL_PAL);
|
||||
|
||||
constexpr uint64_t usToCpuCycles(uint64_t us) { return us * CPU_CLOCK / US_IN_SECOND; }
|
||||
} // namespace timing
|
||||
|
|
Loading…
Reference in a new issue