wok-current diff BootProg/stuff/bootex.asm @ rev 25454

oldrunner: add apple2 keys mapping
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Sep 22 07:58:57 2022 +0000 (21 months ago)
parents e3609bca2577
children ad0bc3efbf37
line diff
     1.1 --- a/BootProg/stuff/bootex.asm	Thu Sep 15 10:06:54 2022 +0000
     1.2 +++ b/BootProg/stuff/bootex.asm	Thu Sep 22 07:58:57 2022 +0000
     1.3 @@ -59,7 +59,7 @@
     1.4  ;;                   Boot Image Startup (register values):                  ;;
     1.5  ;;                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                  ;;
     1.6  ;;  ax = 0ffffh (both FCB in the PSP don't have a valid drive identifier),  ;;
     1.7 -;;  bx = cx = 0, dl = BIOS boot drive number (e.g. 0, 80H)                  ;;
     1.8 +;;  bx = 0, dl = BIOS boot drive number (e.g. 0, 80H)                       ;;
     1.9  ;;  cs:ip = program entry point                                             ;;
    1.10  ;;  ss:sp = program stack (don't confuse with boot sector's stack)          ;;
    1.11  ;;  COM program defaults: cs = ds = es = ss = 50h, sp = 0, ip = 100h        ;;
    1.12 @@ -188,7 +188,7 @@
    1.13  ;; Look for the COM/EXE file to load and run ;;
    1.14  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.15  
    1.16 -        xor     di, di                  ; es:di -> root entries array
    1.17 +                                        ; es:di -> root entries array
    1.18  
    1.19  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.20  ;; Looks for the file/dir ProgramName    ;;
    1.21 @@ -240,7 +240,7 @@
    1.22          popf                            ; restore carry="not last sector" flag
    1.23          jc      RootDirReadContinue     ; continue to the next root dir cluster
    1.24  FindNameFailed:                         ; end of root directory (dir end reached)
    1.25 -        mov     dx, [bx(DriveNumber)]   ; restore BIOS boot drive number
    1.26 +        mov     dl, [bx(DriveNumber)]   ; restore BIOS boot drive number
    1.27          call    Error
    1.28          db      "File not found."
    1.29  FindNameFound:
    1.30 @@ -261,7 +261,7 @@
    1.31          sub     [bx+FileSize], ebp      ; max FileSize is < 640KB : check low 32 bits only
    1.32          ja      FileReadContinue
    1.33          mov     dx, [bx(DriveNumber)]   ; restore BIOS boot drive number
    1.34 -        xor     ax, ax
    1.35 +        xchg    ax, di
    1.36          pop     bp
    1.37  
    1.38  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.39 @@ -279,8 +279,8 @@
    1.40  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.41  ;; Setup and run a .COM program ;;
    1.42  ;; Set CS=DS=ES=SS SP=0 IP=100h ;;
    1.43 -;; AX=0ffffh BX=0 CX=0 DX=drive ;;
    1.44 -;; and cmdline=void             ;;
    1.45 +;; AX=0ffffh BX=0 DX=drive and  ;;
    1.46 +;; cmdline=void                 ;;
    1.47  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.48  
    1.49          mov     di, 100h                ; ip
    1.50 @@ -294,7 +294,7 @@
    1.51  ;; Relocate, setup and run a .EXE program     ;;
    1.52  ;; Set CS:IP, SS:SP, DS, ES and AX according  ;;
    1.53  ;; to wiki.osdev.org/MZ#Initial_Program_State ;;
    1.54 -;; AX=0ffffh BX=0 CX=0 DX=drive cmdline=void  ;;
    1.55 +;; AX=0ffffh BX=0 DX=drive cmdline=void       ;;
    1.56  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.57  
    1.58  ReloCycle:
    1.59 @@ -373,7 +373,7 @@
    1.60  
    1.61          cdq
    1.62          add     eax, [bx(bpbFatSectorStart)]    ; sector # relative to exFAT
    1.63 -        call    ReadSectorC                     ; read 1 exFAT sector
    1.64 +        call    ReadSectorFAT                   ; read 1 exFAT sector, keep edx=0, set C
    1.65  
    1.66          mov     esi, [es:si]                    ; esi=next cluster #
    1.67  
    1.68 @@ -385,6 +385,8 @@
    1.69  
    1.70          add     eax, [bx(bpbClusterSectorStart)]
    1.71  ReadSectorC:
    1.72 +        mov     di, bx
    1.73 +ReadSectorFAT:
    1.74          adc     edx, ebx
    1.75  
    1.76  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    1.77 @@ -413,12 +415,11 @@
    1.78          push    es
    1.79          push    bx
    1.80          push    bp                      ; sector count word = 1
    1.81 +        push    byte 16                 ; packet size byte = 16, reserved byte = 0
    1.82  %if ReadRetry != 0
    1.83 -        mov     cx, 16
    1.84 -        push    cx                      ; packet size byte = 16, reserved byte = 0
    1.85 +        pop     cx
    1.86 +        push    cx
    1.87  ReadSectorRetry:        
    1.88 -%else
    1.89 -        push    byte 16
    1.90  %endif
    1.91          mov     si, sp
    1.92          mov     ah, 42h                 ; ah = 42h = extended read function no.