wok diff BootProg/stuff/bootex.asm @ rev 25458

Update some web_site
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Sep 27 16:21:52 2022 +0000 (19 months ago)
parents ad0bc3efbf37
children 7dd01dedad38
line diff
     1.1 --- a/BootProg/stuff/bootex.asm	Fri Sep 23 08:28:09 2022 +0000
     1.2 +++ b/BootProg/stuff/bootex.asm	Tue Sep 27 16:21:52 2022 +0000
     1.3 @@ -80,6 +80,7 @@
     1.4  %define si(label)       si+label-boot
     1.5  NullEntryCheck          equ     1               ; +3 bytes
     1.6  ReadRetry               equ     1               ; +8 bytes
     1.7 +SectorOf512Bytes        equ     1               ; -13 bytes
     1.8  
     1.9  [BITS 16]
    1.10  [CPU 386]
    1.11 @@ -98,7 +99,7 @@
    1.12  DriveNumber:
    1.13          jmp     short   start                   ; Windows checks for this jump
    1.14          nop
    1.15 -bsOemName               DB      "EXFAT   "      ; 0x03
    1.16 +bsOemName               times   8  db " "       ; 0x03 "EXFAT   "
    1.17                          times   53 db 0         ; 0x0B
    1.18  
    1.19  ;;;;;;;;;;;;;;;;;;;;;
    1.20 @@ -182,7 +183,6 @@
    1.21  
    1.22  RootDirReadContinue:
    1.23          call    ReadCluster             ; read one sector of root dir
    1.24 -        pushf                           ; save carry="not last sector" flag
    1.25  
    1.26  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.27  ;; Look for the COM/EXE file to load and run ;;
    1.28 @@ -237,7 +237,8 @@
    1.29          add     di, byte 32
    1.30          cmp     di, bp
    1.31          jne     FindNameCycle           ; next root entry
    1.32 -        popf                            ; restore carry="not last sector" flag
    1.33 +        loop    RootDirReadContinue     ; continue to the next root dir sector
    1.34 +        cmp     esi, byte -10           ; carry=0 if last cluster, and carry=1 otherwise
    1.35          jc      RootDirReadContinue     ; continue to the next root dir cluster
    1.36  FindNameFailed:                         ; end of root directory (dir end reached)
    1.37          mov     dl, [bx(DriveNumber)]   ; restore BIOS boot drive number
    1.38 @@ -251,14 +252,24 @@
    1.39  ;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.40  
    1.41          push    es
    1.42 +%if SectorOf512Bytes == 0
    1.43          xor     bp, bp
    1.44  FileReadContinue:
    1.45          shr     bp, 4                   ; bytes to paragraphs
    1.46          mov     di, es
    1.47          add     di, bp                  ; adjust segment for next sector
    1.48          mov     es, di                  ; es:0 updated
    1.49 +%else
    1.50 +FileReadContinue:
    1.51 +%endif
    1.52          call    ReadCluster             ; read one more sector of the boot file
    1.53 +        dec     cx
    1.54          sub     [bx+FileSize], ebp      ; max FileSize is < 640KB : check low 32 bits only
    1.55 +%if SectorOf512Bytes != 0
    1.56 +        mov     bp, es
    1.57 +        lea     bp, [bp+32]
    1.58 +        mov     es, bp                  ; es:0 updated
    1.59 +%endif
    1.60          ja      FileReadContinue
    1.61          mov     dx, [bx(DriveNumber)]   ; restore BIOS boot drive number
    1.62          xchg    ax, di
    1.63 @@ -340,6 +351,29 @@
    1.64  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.65          retf
    1.66  
    1.67 +;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.68 +;; Error Messaging Code ;;
    1.69 +;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.70 +
    1.71 +Error:
    1.72 +        pop     si
    1.73 +
    1.74 +PutStr:
    1.75 +        mov     ah, 0Eh
    1.76 +        mov     bl, 7
    1.77 +        lodsb
    1.78 +        int     10h
    1.79 +        cmp     al, "."
    1.80 +        jne     PutStr
    1.81 +
    1.82 +        cbw
    1.83 +        int     16h                     ; wait for a key...
    1.84 +        int     19h                     ; bootstrap
    1.85 +
    1.86 +Stop:
    1.87 +        hlt
    1.88 +        jmp     short Stop
    1.89 +
    1.90  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.91  ;; Reads a exFAT cluster         ;;
    1.92  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.93 @@ -362,9 +396,13 @@
    1.94          loop    ReadSectorC
    1.95  
    1.96          mul     ebx                             ; edx:eax = 0
    1.97 +%if SectorOf512Bytes != 0
    1.98 +        mov     al, 128
    1.99 +%else
   1.100          mov     cl, -2
   1.101          add     cl, [bx(bpbSectorSizeBits)]
   1.102          bts     ax, cx                          ; eax=# of exFAT entries per sector
   1.103 +%endif
   1.104          lea     edi, [esi-2]                    ; edi=cluster #-2
   1.105          xchg    eax, esi
   1.106          div     esi                             ; eax=FAT sector #, edx=entry # in sector
   1.107 @@ -402,8 +440,11 @@
   1.108  ;;         ES:0   -> next address    ;;
   1.109  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   1.110  
   1.111 -        xor     ebp, ebp
   1.112 -        inc     bp
   1.113 +%if SectorOf512Bytes != 0
   1.114 +        lea     ebp, [bx+512]
   1.115 +%else
   1.116 +        lea     ebp, [bx+1]
   1.117 +%endif
   1.118  
   1.119          pushad
   1.120  
   1.121 @@ -414,7 +455,11 @@
   1.122          push    eax
   1.123          push    es
   1.124          push    bx
   1.125 +%if SectorOf512Bytes != 0
   1.126 +        push    byte 1                  ; sector count word = 1
   1.127 +%else
   1.128          push    bp                      ; sector count word = 1
   1.129 +%endif
   1.130          push    byte 16                 ; packet size byte = 16, reserved byte = 0
   1.131  ReadSectorRetry:        
   1.132          mov     si, sp
   1.133 @@ -428,53 +473,30 @@
   1.134          xor     ax, ax
   1.135          int     13h                     ; reset drive (DL)
   1.136          dec     bp
   1.137 + %if SectorOf512Bytes != 0
   1.138 +        jne     ReadSectorRetry         ; up to 511 tries
   1.139 + %else
   1.140          jpe     ReadSectorRetry         ; up to 3 tries
   1.141 + %endif
   1.142  %endif
   1.143  
   1.144          call    Error
   1.145          db      "Read error."
   1.146  
   1.147  ReadSuccess:
   1.148 +%if SectorOf512Bytes == 0
   1.149          mov     cl, [bx(bpbSectorSizeBits)]
   1.150          shl     word [si+16+8], cl      ; (e)bp si+16: EDI ESI EBP ESP EBX EDX ECX EAX
   1.151 +%endif
   1.152          popa                            ; sp += 16
   1.153          popad                           ; real registers
   1.154 -
   1.155 -        stc
   1.156 -        loop    ReadSectorNext
   1.157 -
   1.158 -        cmp     esi, byte -10           ; carry=0 if last cluster, and carry=1 otherwise
   1.159 -ReadSectorNext:
   1.160          ret
   1.161  
   1.162  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   1.163  ;; Fill free space with zeroes ;;
   1.164  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   1.165  
   1.166 -                times (512-13-20-($-$$)) db 0
   1.167 -
   1.168 -;;;;;;;;;;;;;;;;;;;;;;;;;;
   1.169 -;; Error Messaging Code ;;
   1.170 -;;;;;;;;;;;;;;;;;;;;;;;;;;
   1.171 -
   1.172 -Error:
   1.173 -        pop     si
   1.174 -
   1.175 -PutStr:
   1.176 -        mov     ah, 0Eh
   1.177 -        mov     bl, 7
   1.178 -        lodsb
   1.179 -        int     10h
   1.180 -        cmp     al, "."
   1.181 -        jne     PutStr
   1.182 -
   1.183 -        cbw
   1.184 -        int     16h                     ; wait for a key...
   1.185 -        int     19h                     ; bootstrap
   1.186 -
   1.187 -Stop:
   1.188 -        hlt
   1.189 -        jmp     short Stop
   1.190 +                times (512-13-($-$$)) db 0
   1.191  
   1.192  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   1.193  ;; Name of the file to load and run ;;