Skip to content

Commit ad71d72

Browse files
committed
drives: fix floppy speed test warmup and OFS block size reporting
The floppy speed test warm-up read was previously attempting to read an entire track buffer. This large read could fail due to timing or settling issues, causing the speed test dialog to abort immediately because the error was treated as fatal. Reduce the warm-up read size to a single block (typically 512 bytes) to minimize failure risk while still ensuring the drive head is on track. Additionally, treat warm-up read errors as non-fatal warnings to allow the actual benchmark to proceed. Also fix an issue where the block size for OFS volumes was being reported incorrectly (e.g., 464 bytes instead of 488). The `Info()` call returns the logical block size (488 for OFS), which was overwriting the physical block size (512) obtained from `DosEnvec`. The display logic then subtracted the 24-byte overhead again. Prevent `Info()` from overwriting `bytes_per_block` if it has already been populated by `DosEnvec`, ensuring the display logic calculates the usable block size correctly from the physical size.
1 parent 95b15e4 commit ad71d72

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/drives.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,10 @@ void enumerate_drives(void)
301301
if (Info(lock, info)) {
302302
drive->total_blocks = info->id_NumBlocks;
303303
drive->blocks_used = info->id_NumBlocksUsed;
304-
drive->bytes_per_block = info->id_BytesPerBlock;
304+
/* Only update block size if not set by DosEnvec (which gives physical size) */
305+
if (drive->bytes_per_block == 0) {
306+
drive->bytes_per_block = info->id_BytesPerBlock;
307+
}
305308
drive->dos_type = info->id_DiskType;
306309
drive->fs_type = identify_filesystem(info->id_DiskType);
307310
drive->disk_errors = info->id_NumSoftErrors;
@@ -587,18 +590,12 @@ ULONG measure_drive_speed(ULONG index)
587590
if (is_floppy) {
588591
io->io_Command = CMD_READ;
589592
io->io_Data = buffer;
590-
io->io_Length = buffer_size;
593+
io->io_Length = block_size;
591594
io->io_Offset = read_offset;
592595

593596
error = DoIO((struct IORequest *)io);
594597
if (error != 0) {
595-
debug(" drives: Warm-up read error %ld\n", (LONG)error);
596-
FreeMem(buffer, buffer_size);
597-
CloseDevice((struct IORequest *)io);
598-
WaitTOF();
599-
DeleteIORequest((struct IORequest *)io);
600-
DeleteMsgPort(port);
601-
return 0;
598+
debug(" drives: Warm-up read error %ld (ignoring)\n", (LONG)error);
602599
}
603600
}
604601

0 commit comments

Comments
 (0)