Skip to content

[kernel] Allow DOS v3.31+ BPB to set floppy CHS in BIOS driver#2684

Merged
ghaerr merged 1 commit into
masterfrom
fatbpb331
May 14, 2026
Merged

[kernel] Allow DOS v3.31+ BPB to set floppy CHS in BIOS driver#2684
ghaerr merged 1 commit into
masterfrom
fatbpb331

Conversation

@ghaerr

@ghaerr ghaerr commented May 14, 2026

Copy link
Copy Markdown
Owner

This enhancement allows DOS FAT floppy images (specifically containing a validated v3.31 BPB or later) to set the CHS (cylinder, sector and head) values for the BIOS driver, instead of having to probe the floppy. Previously, a valid v4.0 DOS BPB was required.

This change allows the BIOS driver to be used with v3.3 DOS floppies on the MartyPC emulator, since a bug was confirmed in #2678 where MartyPC always returns success to the BIOS from its FDC emulation when a single sector is read, even if the sector is non-existent. This breaks ELKS' BIOS probe routine which results in accepting an incorrect CHS for the media, which results in data corruption on reading/writing that media.

Checking for a valid v3.31+ BPB includes validating the BPB sectors-per-track, head count and number of FATs fields, as well as requiring either 'MS' or 'IB' as the first two characters in the OEM name field.

All floppy images created by ELKS (both MINIX and FAT) contain an additional valid EPB (ELKS Parameter Block) which if present is used by the BIOS driver prior to validating any FAT BPB. Thus this enhancement usually only affects FAT floppies from "in the wild" created outside ELKS builds.

@ghaerr ghaerr merged commit 69dfd4f into master May 14, 2026
1 check passed
@ghaerr ghaerr deleted the fatbpb331 branch May 14, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant