:: fdchk

iczelia

floppy disk checker for Windows 9x

recent commits

2026-08-12 16:50optimised string routinesKamila Szewczyk
2026-08-12 16:45async vxdKamila Szewczyk
2026-08-12 13:41specify gpl3-onlyKamila Szewczyk
2026-08-12 12:10update versionKamila Szewczyk
2026-08-12 12:09ui, readme: hook up and describe new functionalityKamila Szewczyk
2026-08-12 12:04build aux: consistent styleKamila Szewczyk
2026-08-12 12:02scan.c: style, improve messagesKamila Szewczyk
2026-08-12 11:59fdchk.c: style, hook up the alt-whatever shortcutsKamila Szewczyk
2026-08-12 11:57fdchk.h: plumbing for the new APIsKamila Szewczyk
2026-08-12 11:54vxd: style, improved loading, expose required new functionalityKamila Szewczyk

branches

trunk (2026-08-12 16:50)

tags

1.0.2 (2026-08-12 12:10)1.0.1 (2026-05-22 19:05)1.0 (2026-05-21 12:40)
README.md

fdchk - Floppy Disk Checker for Windows 9x

A surface scanner, FAT12 consistency checker, file-recovery utility, defragmenter and raw-FDC head diagnostic for Windows 9x (95/98/Me). Licensed under version 3 of the GNU GPL, and that version only (GPL-3.0-only) - the "any later version" option is not granted. See LICENSE. Report bugs to <k@iczelia.net>.

screenshot

Test modes

  1. Standard - read-only verification. Reads every sector and reports

anything that does not come back cleanly.

  1. Thorough - destructive per-sector surface test: read the original,

then write-and-verify the original, its inverse, a PRNG block and that block's inverse, and finally restore the original.

  1. Diagnostic - probes the drive with raw FDC commands through

fdchk.vxd, surfacing the full ST0/ST1/ST2/C/H/R/N result phase.

  1. Check filesystem - walks FAT12 read-only for cross-linked clusters,

lost chains, size mismatches, chain cycles and bad FAT entries.

Other operations

  • Recover - after a surface scan, walks the directory tree, copies out

every file with zero-filled holes where bad sectors fell, and writes fdchk-recovery.log. With auto-fix on, new bad clusters are marked 0xFF7 in both FATs.

  • Format - FAT12 format at any capacity the drive supports. Quick

rewrites the boot sector, both FATs and the root directory. Full first re-lays every track through the driver's track formatter (Int 21h 440Dh CX=0842h, then CX=0862h to verify), which rewrites the sector ID address marks, data address marks and CRCs.

  • Defrag - repacks files and subdirectories into contiguous low

clusters (depth-first, alphabetical at each level) and zeroes every free cluster.

  • Batch mode - after each scan, prompts to insert the next disk.
  • Logs - an in-app viewer for the log files in <exe-dir>\logs.

Diagnostic colours

In Diagnostic mode the grid becomes a cyl x head map, sized from the drive (160 cells for an 80-cylinder drive, 80 for a 40-cylinder one):

ColourMeaning
GreyOK - ST0 & 0xC0 == 0 and C matches
Yellowcurrently testing
OrangeWrong Cylinder - ST2 bit 4, or C != cyl. Head misalignment
PurpleNo Address Mark - ST1/ST2 bit 0. Track unformatted/severe
Redother failure (CRC, timeout, controller fault)

Build

Requires i686-w64-mingw32-gcc and nasm; mtools is needed only for make floppy.

make           fdchk.exe + fdchk.vxd
make floppy    fdchk.img - a 1.44 MB FAT12 image carrying the EXE
make debug     with-CRT build carrying symbols
make clean
tab: 248 wrap: offon