From 66895d3ac74f1ca34e7c3ef1d6f8052e6d0a7b3d Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 10 Jul 2016 18:24:12 -0400 Subject: [PATCH] Actually, I think this is the correct conversion from received speed to clock rate. It'll become obvious if it's not when I get back to working on the 1541 itself. --- Storage/Disk/Formats/G64.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Storage/Disk/Formats/G64.cpp b/Storage/Disk/Formats/G64.cpp index 66fc7ba4b..e0806818c 100644 --- a/Storage/Disk/Formats/G64.cpp +++ b/Storage/Disk/Formats/G64.cpp @@ -120,7 +120,7 @@ std::shared_ptr G64::get_track_at_position(unsigned int position) PCMSegment segment; segment.duration.length = number_of_bytes * 8; - segment.duration.clock_rate = current_speed; + segment.duration.clock_rate = 4000000 / (13 + current_speed); // the speed zone divides a 4Mhz clock by 13, 14, 15 or 16; TODO: is this the right way around? Is zone 3 the fastest or the slowest? segment.data.reset(new uint8_t[number_of_bytes]); memcpy(segment.data.get(), &track_contents.get()[start_byte_in_current_speed], number_of_bytes); segments.push_back(std::move(segment)); @@ -142,6 +142,9 @@ std::shared_ptr G64::get_track_at_position(unsigned int position) resulting_track.reset(new PCMTrack(std::move(segment))); } + // TODO: find out whether it's possible for a G64 to supply only a partial track. I don't think it is, which would make the + // above correct but supposing I'm wrong, the above would produce some incorrectly clocked tracks + return resulting_track; }