Title [lDOS] Trying to allocate a large file on a diskette succeeds unexpectedly
AuthorE. C. Masloch
Created2026-06-07 09:55:53 +0200 Jun Sun
State closed

A large write/truncate that wants >65_535 clusters may succeed on a file system that's much too small to allocate enough data.

Run testshrt.sld containing:

e 200 "A:\test.dat" 0
f 300 l 100 26
a
 mov ah, 3C
 mov cx, 0
 mov dx, 200
 int 21
 xchg bx, ax
 mov ax, 4200
 mov cx, 1000
 mov dx, cx
 int 21
 mov dx, 300
 mov cx, 10
 mov ah, 3F
 int 21
 .
r v0 := aao
a
 mov ah, 40
 int 21
 int3
 int3
 jmp (v0)
 .

For truncate test, change CX before last int 21h call to zero. The file should remain at zero bytes and zero clusters. On failure, the file size in the directory entry is set to 1000_1010h (256 MiB) despite the 1440 KiB drive not having as much space.

The error doesn't occur with large cluster sizes. MS-DOS v5 shares this bug, but MS-DOS v7.10 does not.

E. C. Masloch on 2026-06-07 09:58:09 +0200 Jun Sun

Fixed in hg 4e13885ef811 on 2026-04-21.