wok-current rev 25572
BootProg: fix boot16.asm (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat May 13 13:34:41 2023 +0000 (15 months ago) |
parents | c45b858c787a |
children | 67d9840ef3ac |
files | BootProg/stuff/boot16.asm BootProg/stuff/boot32.asm |
line diff
1.1 --- a/BootProg/stuff/boot16.asm Sat May 13 11:12:29 2023 +0100 1.2 +++ b/BootProg/stuff/boot16.asm Sat May 13 13:34:41 2023 +0000 1.3 @@ -23,7 +23,7 @@ 1.4 ;; and waits for a key to be pressed, then executes the Int 19h ;; 1.5 ;; instruction and lets the BIOS continue bootstrap. ;; 1.6 ;; ;; 1.7 -;; - cpu 8086 is supported ;; 1.8 +;; - cpu 8088 is supported ;; 1.9 ;; ;; 1.10 ;; ;; 1.11 ;; Known Limitation: ;; 1.12 @@ -31,7 +31,7 @@ 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 of the for CHS reads. ;; 1.17 +;; - Partition must fit in the first 8GB of the disk for CHS reads. ;; 1.18 ;; (or 2TB for LBA reads). ;; 1.19 ;; ;; 1.20 ;; ;; 1.21 @@ -96,7 +96,7 @@ 1.22 NullEntryCheck equ 1 ; +2 bytes 1.23 ReadRetry equ 1 ; +9/+13 bytes 1.24 LBAsupport equ 1 ; +18 bytes 1.25 -CHSsanityCheck equ 1 ; +12/+16 bytes 1.26 +CHSsanityCheck equ 1 ; +10/+14 bytes 1.27 GeometryCheck equ 1 ; +20 bytes 1.28 CheckAttrib equ 0 ; +6 bytes 1.29 WaitForKey equ 0 ; +5 bytes 1.30 @@ -342,6 +342,9 @@ 1.31 FAT16 equ 1 1.32 TINYFAT16 equ 1 ; < 4072 clusters fat16 support 1.33 push di ; up to 2 * 635K / BytesPerCluster = 2540 bytes 1.34 +%if FAT12 != 1 && FAT16 != 1 1.35 + %error "FAT12 and/or FAT16 must be set" 1.36 +%endif 1.37 %if FAT12 == 1 1.38 mov cl, 12 1.39 %else 1.40 @@ -598,7 +601,6 @@ 1.41 dec bx 1.42 push di 1.43 %endif 1.44 - mov si, sp 1.45 1.46 xchg ax, cx ; save low LBA 1.47 xchg ax, dx ; get high LBA 1.48 @@ -606,10 +608,8 @@ 1.49 idiv word [bx(bpbSectorsPerTrack)] ; up to 8GB disks 1.50 1.51 %if CHSsanityCheck != 0 1.52 - inc ax 1.53 cmp ax, [bx(bpbHeadsPerCylinder)] 1.54 - ja CHSoverflow 1.55 - dec ax 1.56 + jnc CHSoverflow 1.57 %endif 1.58 xchg ax, cx ; restore low LBA, save high LBA / SPT 1.59 idiv word [bx(bpbSectorsPerTrack)] 1.60 @@ -632,13 +632,10 @@ 1.61 ; dh = head no. 1.62 1.63 %if CHSsanityCheck != 0 1.64 - %if LBAsupport != 0 1.65 - or ah, [si+8+3] ; 8GB max, last cylinder 1023 1.66 - %else 1.67 - or ah, [si+2+3] ; 8GB max, last cylinder 1023 1.68 - %endif 1.69 + sub ah, 1 ; set C if cylinder < 1024 (8GB max) 1.70 +CHSoverflow: 1.71 %endif 1.72 -CHSoverflow: 1.73 + mov si, sp 1.74 %if CHSsanityCheck != 0 && (ReadRetry != 0 || LBAsupport != 0) 1.75 pushf 1.76 %endif 1.77 @@ -651,24 +648,21 @@ 1.78 int 13h ; extended read sectors (DL, DS:SI) 1.79 jnc ReadSectorNextSegment 1.80 %endif 1.81 + mov ax, 201h ; al = sector count = 1 1.82 + ; ah = 2 = read function no. 1.83 %if CHSsanityCheck != 0 1.84 %if ReadRetry != 0 || LBAsupport != 0 1.85 popf 1.86 pushf 1.87 %endif 1.88 - jne SkipCHS 1.89 + jnc SkipCHS 1.90 %endif 1.91 - 1.92 - mov ax, 201h ; al = sector count = 1 1.93 - ; ah = 2 = read function no. 1.94 int 13h ; read sectors (AL, CX, DX, ES:BX) 1.95 - 1.96 jnc ReadSectorNextSegment 1.97 SkipCHS: 1.98 %if ReadRetry != 0 1.99 cbw ; ah = 0 = reset function 1.100 int 13h ; reset drive (DL) 1.101 - 1.102 dec di 1.103 jnz ReadSectorRetry ; up to 15 extra attempt 1.104 %endif
2.1 --- a/BootProg/stuff/boot32.asm Sat May 13 11:12:29 2023 +0100 2.2 +++ b/BootProg/stuff/boot32.asm Sat May 13 13:34:41 2023 +0000 2.3 @@ -90,7 +90,7 @@ 2.4 ExtraBootSector equ 1 2.5 ClusterMask equ 1 ; +9 bytes 2.6 NullEntryCheck equ 1 ; +5 bytes 2.7 -CheckAttrib equ 1 ; +6 bytes 2.8 +CheckAttrib equ 0 ; +6 bytes 2.9 NonMirroredFATs equ 1 ; +20 bytes 2.10 ReadRetry equ 1 ; +6/7 bytes 2.11 LBA48bits equ 1 ; +10 bytes 2.12 @@ -601,12 +601,12 @@ 2.13 jnc ReadSuccess ; CF = 0 if no error 2.14 2.15 %if CHSsupport != 0 2.16 + mov ax, 201h ; al = sector count = 1 2.17 + ; ah = 2 = read function no. 2.18 %if CHSsanityCheck != 0 2.19 cmp eax, 0FFFFh ; max cylinder = 1023 2.20 ja SkipCHS 2.21 %endif 2.22 - mov ax, 201h ; al = sector count = 1 2.23 - ; ah = 2 = read function no. 2.24 int 13h ; read sectors (AL, CX, DX, ES:BX) 2.25 2.26 jnc ReadSuccess ; CF = 0 if no error