wok diff BootProg/stuff/boot16.asm @ rev 25569
BootProg: fix boot16.asm
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri May 12 21:35:09 2023 +0000 (13 months ago) |
parents | 3c71bb4367c3 |
children | 82f370bad6b5 |
line diff
1.1 --- a/BootProg/stuff/boot16.asm Thu May 11 15:58:49 2023 +0000 1.2 +++ b/BootProg/stuff/boot16.asm Fri May 12 21:35:09 2023 +0000 1.3 @@ -11,7 +11,7 @@ 1.4 ;; ;; 1.5 ;; Features: ;; 1.6 ;; ~~~~~~~~~ ;; 1.7 -;; - FAT12 and FAT16 supported using BIOS int 13h function 42h or 02h. ;; 1.8 +;; - FAT12 and/or FAT16 supported using BIOS int 13h function 42h or 02h. ;; 1.9 ;; ;; 1.10 ;; - Loads a 16-bit executable file in the MS-DOS .COM or .EXE format ;; 1.11 ;; from the root directory of a disk and transfers control to it ;; 1.12 @@ -31,7 +31,8 @@ 1.13 ;; - Need a up to date field bpbHiddenSectors to work in a partition ; ;; 1.14 ;; most formatters don't update it correcly in extended partitions. ;; 1.15 ;; ;; 1.16 -;; - Partition must fit in the first 8GB disk for CHS reads. ;; 1.17 +;; - Partition must fit in the first 8GB disk of the for CHS reads. ;; 1.18 +;; (or 2TB for LBA reads). ;; 1.19 ;; ;; 1.20 ;; ;; 1.21 ;; Known Bugs: ;; 1.22 @@ -93,10 +94,10 @@ 1.23 %define bx(label) bx+label-boot 1.24 %define si(label) si+label-boot 1.25 NullEntryCheck equ 1 ; +2 bytes 1.26 -ReadRetry equ 1 ; +9/+10 bytes 1.27 -LBAsupport equ 1 ; +16 bytes 1.28 +ReadRetry equ 1 ; +9/+13 bytes 1.29 +LBAsupport equ 1 ; +18 bytes 1.30 CHSsanityCheck equ 1 ; +12/+16 bytes 1.31 -GeometryCheck equ 1 ; +18 bytes 1.32 +GeometryCheck equ 1 ; +20 bytes 1.33 CheckAttrib equ 0 ; +6 bytes 1.34 WaitForKey equ 0 ; +5 bytes 1.35 SectorOf512Bytes equ 0 ; -4/-6 bytes 1.36 @@ -210,7 +211,7 @@ 1.37 1.38 %if GeometryCheck != 0 1.39 %if ((main-boot) & 3Fh) != 0 1.40 - xchg ax, cx ; ax & 3Fh == 0 1.41 + xor cx, cx 1.42 %endif 1.43 mov ah, 8 ; update AX,BL,CX,DX,DI, and ES registers 1.44 int 13h ; may destroy SI,BP, and DS registers 1.45 @@ -597,18 +598,19 @@ 1.46 dec bx 1.47 push di 1.48 %endif 1.49 + mov si, sp 1.50 1.51 xchg ax, cx ; save low LBA 1.52 xchg ax, dx ; get high LBA 1.53 cwd ; clear dx (LBA offset <1TB) 1.54 idiv word [bx(bpbSectorsPerTrack)] ; up to 8GB disks 1.55 1.56 - %if CHSsanityCheck != 0 1.57 +%if CHSsanityCheck != 0 1.58 inc ax 1.59 cmp ax, [bx(bpbHeadsPerCylinder)] 1.60 ja CHSoverflow 1.61 dec ax 1.62 - %endif 1.63 +%endif 1.64 xchg ax, cx ; restore low LBA, save high LBA / SPT 1.65 idiv word [bx(bpbSectorsPerTrack)] 1.66 ; ax = LBA / SPT 1.67 @@ -637,16 +639,13 @@ 1.68 %endif 1.69 %endif 1.70 CHSoverflow: 1.71 - mov dl, [bx(DriveNumber)] 1.72 - ; dl = drive no. 1.73 - mov si, sp 1.74 -%if CHSsanityCheck != 0 1.75 - %if ReadRetry != 0 || LBAsupport != 0 1.76 +%if CHSsanityCheck != 0 && (ReadRetry != 0 || LBAsupport != 0) 1.77 pushf 1.78 - %endif 1.79 %endif 1.80 1.81 ReadSectorRetry: 1.82 + mov dl, [bx(DriveNumber)] 1.83 + ; dl = drive no. 1.84 %if LBAsupport != 0 1.85 mov ah, 42h ; ah = 42h = extended read function no. 1.86 int 13h ; extended read sectors (DL, DS:SI)