1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-20 10:17:05 +00:00

Take yet another stab at wave/half-waves.

This commit is contained in:
Thomas Harte
2025-01-06 21:40:46 -05:00
parent 45f3ef6920
commit b37ed9ec60
2 changed files with 8 additions and 6 deletions
+3 -3
View File
@@ -42,12 +42,12 @@ CommodoreTAP::Serialiser::Serialiser(const std::string &file_name) :
// Pick clock rate.
current_pulse_.length.clock_rate = static_cast<unsigned int>(
[&] {
switch(platform_) { // TODO: Vic-20 numbers are inexact.
case Platform::Vic20: return video_ == VideoStandard::PAL ? 1'108'000 : 1'022'000;
switch(platform_) {
case Platform::Vic20: // It empirically seems like Vic-20 waves are counted with C64 timings?
case Platform::C64: return video_ == VideoStandard::PAL ? 985'248 : 1'022'727;
case Platform::C16: return video_ == VideoStandard::PAL ? 886'722 : 894'886;
}
}() * (half_waves() ? 1 : 2)
}() * (double_clock() ? 2 : 1)
);
reset();
}
+5 -3
View File
@@ -47,6 +47,7 @@ private:
enum class FileType {
C16, C64,
} type_;
uint8_t version_;
enum class Platform: uint8_t {
C64 = 0,
Vic20 = 1,
@@ -57,13 +58,14 @@ private:
NTSC1 = 1,
NTSC2 = 2,
} video_;
uint8_t version_;
bool updated_layout() const {
return version_ >= 1;
}
bool half_waves() const {
return type_ == FileType::C16;
// return version_ >= 2;
return version_ >= 2;
}
bool double_clock() const {
return platform_ == Platform::C16 && !half_waves();
}
Pulse current_pulse_;