+Changes in 1.32:
+ * FAT16 is now supported.
+
Changes in 1.31:
* Now compiles under Linux, using NASM, rather than using
Turbo Assembler under DOS. See http://www.cryogen.com/Nasm
Currently scheduled for inclusion in 1.40:
-- FAT16 support (for LS120 floppies mainly).
+- FAT16 support (for LS120 floppies mainly). DONE!
- "Comboot" style boot files.
- Booting DOS for a DOS/Linux dual rescue disk.
- Cleaned up documentation, with a real man page.
+
+For a later release, perhaps:
+
+- Support for clusters larger than 16K. This would require changing
+ a lot of the SYSLINUX internals so we can read partial clusters;
+ change the current "cluster pointers" to become
+ "cluster:sector pointers".
+
ldlinux_magic db 'LDLINUX'
missing_dot db ' '
db 'SYS ', version_str, ' ', date
-magic_eof db 0, 0Dh, 0Ah, 01Ah
+magic_eof db 0,
+crlf db 0Dh, 0Ah, 0, 01Ah
align 4
ldlinux_ent:
; All loaded up
;
all_read_jmp:
- mov si,copyright_str
- call writestr
jmp all_read
;
; -----------------------------------------------------------------------------
pop ax
nc_return: ret
+;
+; FAT16 decoding routine. Note that a 16-bit FAT can be up to 128K,
+; so we have to decide if we're in the "low" or the "high" 64K-segment...
+;
nextcluster_fat16:
push ax
push ds
- mov ax,(fat_seg >> 12)
+ mov ax,fat_seg
shl si,1
- adc ax,byte 0
- mov ds,ax
+ jnc .seg0
+ mov ax,fat_seg+1000h
+.seg0: mov ds,ax
mov si,[si]
cmp si,0FFF0h
cmc
jmp dumpregs
%endif
-;
-; Data that has to be in the first sector
-;
-copyright_str db ' Copyright (C) 1994-', year, ' H. Peter Anvin'
-crlf db 0Dh, 0Ah, 0
-
rl_checkpt equ $ ; Must be <= 400h
; ----------------------------------------------------------------------------
all_read:
;
+; Let the user (and programmer!) know we got this far. This used to be
+; in Sector 1, but makes a lot more sense here.
+;
+ mov si,copyright_str
+ call writestr
+;
; Check that no moron is trying to boot Linux on a 286 or so. According
; to Intel, the way to check is to see if the high 4 bits of the FLAGS
; register are either all stuck at 1 (8086/8088) or all stuck at 0
; We still need to check if this is a 486 or higher, and if it isn't, blank
; out the WBINVD subroutine
;
+%if 0
pushfd
pushfd
pop eax
jne is_486 ; Is a 486 or higher, assume WBINVD works
mov word [flush_cache.wbinvd],09090h ; NOP out
is_486:
+%else
+
+%define wbinvd nop
+
+%endif
;
; Initialization that does not need to go into the any of the pre-load
;
; Various initialized or semi-initialized variables
;
+copyright_str db ' Copyright (C) 1994-', year, ' H. Peter Anvin'
+ db 0Dh, 0Ah, 0
boot_prompt db 'boot: ',0
wipe_char db 08h, ' ', 08h, 0
err_notfound db 'Could not find kernel image: ',0
and al,al
jnz filesystem_error
- cmp word [bx+dpbMaxCluster],4087 ; FAT16 not supported yet
- ja fat16_error
-
cmp word [bx+dpbSectorSize],512 ; Sector size = 512 required
jne sectorsize_error
filesystem_error:
mov dx,msg_filesystem_err
jmp die
-fat16_error:
- mov dx,msg_fat16_err
- jmp die
sectorsize_error:
mov dx,msg_sectorsize_err
jmp die
section .data
msg_error: db 'ERROR: $'
msg_filesystem_err: db 'Filesystem not found on disk', 0Dh, 0Ah, '$'
-msg_fat16_err: db 'FAT16 filesystems not supported at this time', 0Dh, 0Ah, '$'
msg_sectorsize_err: db 'Sector sizes other than 512 bytes not supported', 0Dh, 0Ah, '$'
msg_hugeclust_err: db 'Clusters larger than 16K not supported', 0Dh, 0Ah, '$'
msg_read_err: db 'Disk read failed', 0Dh, 0Ah, '$'
device);
exit(1);
}
+ } else if ( !memcmp(sectbuf+bsFileSysType, "FAT16 ", 8) ) {
+ if ( clusters <= 4086 ) {
+ fprintf(stderr, "%s: ERROR: FAT16 but claims less than 4086 clusters\n",
+ device);
+ exit(1);
+ }
} else {
fprintf(stderr, "%s: filesystem type \"%8.8s\" not supported\n",
device, sectbuf+bsFileSysType);