From: Maxwell Beck Date: Mon, 30 Dec 2024 21:21:14 +0000 (-0600) Subject: Tighten drive lookahead, improve track stepping X-Git-Url: https://rastertail.net/scm/?a=commitdiff_plain;h=2a3984933e9b39cd37a136dd2a95645bff0d3774;p=pico1541.git Tighten drive lookahead, improve track stepping --- 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];