Skip to content

Commit

Permalink
boot, oemboot: fix to abort properly on file not found
Browse files Browse the repository at this point in the history
Prior to this commit the first cluster specified from the last
compared directory entry would be used if the file is not found.
Fix the wrong (boot.asm) or missing (oemboot.asm) jump to the
error handler so that on file not found an error is displayed.

Reference: https://sourceforge.net/p/freedos/bugs/97/
"Bugs in FAT12/16 boot sector loaders if file not found"
This commit fixes the most crucial bug of this 2012-09-27 report.
  • Loading branch information
ecm-pushbx authored and PerditionC committed Jul 29, 2021
1 parent f267341 commit 858934f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion boot/boot.asm
Expand Up @@ -266,7 +266,7 @@ next_entry: mov cx, 11
cmp byte [es:di], 0 ; if the first byte of the name is 0,
jnz next_entry ; there is no more files in the directory

jc boot_error ; fail if not found
jmp boot_error ; fail if not found
ffDone:
push ax ; store first cluster number

Expand Down
1 change: 1 addition & 0 deletions boot/oemboot.asm
Expand Up @@ -353,6 +353,7 @@ next_entry: mov cx, 11
jc boot_error ; fail if not found and si wraps
cmp byte [si], 0 ; if the first byte of the name is 0,
jnz next_entry ; there are no more files in the directory
jmp boot_error

ffDone:
mov [first_cluster], ax ; store first cluster number
Expand Down

0 comments on commit 858934f

Please sign in to comment.