]> Untitled Git - pico1541.git/commitdiff
Tighten drive lookahead, improve track stepping
authorMaxwell Beck <max@rastertail.net>
Mon, 30 Dec 2024 21:21:14 +0000 (15:21 -0600)
committerMaxwell Beck <max@rastertail.net>
Mon, 30 Dec 2024 21:21:14 +0000 (15:21 -0600)
src/drive.c
src/drive.h

index cc85635bda58be331fca68d3d6cdf6215732c55f..64b765aeba0197b95f429f107847eec9cda40ba6 100644 (file)
@@ -55,7 +55,7 @@ void drive_step_up(drive_t *drive) {
        if (drive->track < 39 && drive->halftrack == 0) {
                drive->image_ptr += SECTORS_PER_TRACK[drive->track] << 8;
                drive->track += 1;
-               drive->sector = drive->sector % SECTORS_PER_TRACK[drive->track];
+               drive->sector = drive->sector * SECTORS_PER_TRACK[drive->track] / SECTORS_PER_TRACK[drive->track - 1];
        }
 }
 
@@ -64,7 +64,7 @@ void drive_step_down(drive_t *drive) {
        if (drive->track > 0 && drive->halftrack == 0) {
                drive->image_ptr -= SECTORS_PER_TRACK[drive->track - 1] << 8;
                drive->track -= 1;
-               drive->sector = drive->sector % SECTORS_PER_TRACK[drive->track];
+               drive->sector = drive->sector * SECTORS_PER_TRACK[drive->track] / SECTORS_PER_TRACK[drive->track + 1];
        }
 }
 
index c41712ae00999d685c7ee6fffd38fc46c577404a..e131c5c5ef2bf2fb5f5c38121d7af429a24dd277 100644 (file)
@@ -4,7 +4,7 @@
 #include <stdbool.h>
 #include <stdint.h>
 
-#define DRIVE_LOOKAHEAD 16
+#define DRIVE_LOOKAHEAD 8
 
 extern const uint8_t SECTORS_PER_TRACK[40];
 extern const uint8_t BITRATE_PER_TRACK[40];