From 2a3984933e9b39cd37a136dd2a95645bff0d3774 Mon Sep 17 00:00:00 2001 From: Maxwell Beck Date: Mon, 30 Dec 2024 15:21:14 -0600 Subject: [PATCH] Tighten drive lookahead, improve track stepping --- src/drive.c | 4 ++-- src/drive.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/drive.c b/src/drive.c index cc85635..64b765a 100644 --- a/src/drive.c +++ b/src/drive.c @@ -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]; } } diff --git a/src/drive.h b/src/drive.h index c41712a..e131c5c 100644 --- a/src/drive.h +++ b/src/drive.h @@ -4,7 +4,7 @@ #include #include -#define DRIVE_LOOKAHEAD 16 +#define DRIVE_LOOKAHEAD 8 extern const uint8_t SECTORS_PER_TRACK[40]; extern const uint8_t BITRATE_PER_TRACK[40]; -- 2.47.2