wok diff BootProg/stuff/boot32.asm @ rev 24945
fix BootProg
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Apr 22 16:00:56 2022 +0000 (2022-04-22) |
parents | 810e3d0a38f7 |
children | 6023b31d568c |
line diff
1.1 --- a/BootProg/stuff/boot32.asm Wed Apr 20 16:57:09 2022 +0000 1.2 +++ b/BootProg/stuff/boot32.asm Fri Apr 22 16:00:56 2022 +0000 1.3 @@ -59,12 +59,12 @@ 1.4 ;; ;; 1.5 ;; Boot Image Startup (register values): ;; 1.6 ;; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;; 1.7 -;; dl = BIOS boot drive number (e.g. 80H) ;; 1.8 +;; ax = 0ffffh (both FCB in the PSP don't have a valid drive identifier), ;; 1.9 +;; bx = cx = 0, dl = BIOS boot drive number (e.g. 0, 80H) ;; 1.10 ;; cs:ip = program entry point ;; 1.11 ;; ss:sp = program stack (don't confuse with boot sector's stack) ;; 1.12 ;; COM program defaults: cs = ds = es = ss = 50h, sp = 0, ip = 100h ;; 1.13 ;; EXE program defaults: ds = es = EXE data - 10h (fake MS-DOS psp), ;; 1.14 -;; ax = 0ffffh (both FCB in the PSP don't have a valid drive identifier), ;; 1.15 ;; cs:ip and ss:sp depends on EXE header ;; 1.16 ;; Magic numbers: ;; 1.17 ;; si = 16381 (prime number 2**14-3) ;; 1.18 @@ -73,6 +73,7 @@ 1.19 ;; The magic numbers let the program know whether it has been loaded by ;; 1.20 ;; this boot sector or by MS-DOS, which may be handy for universal, bare- ;; 1.21 ;; metal and MS-DOS programs. ;; 1.22 +;; The command line contains no arguments. ;; 1.23 ;; ;; 1.24 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1.25 1.26 @@ -303,8 +304,10 @@ 1.27 dec word [bx+06h] ; reloc items, 32768 max (128KB table) 1.28 jns ReloCycle 1.29 1.30 - add [bx+0Eh], bp 1.31 - lss sp, [bx+0Eh] ; ss:sp for EXE 1.32 + les si, [bx+0Eh] 1.33 + add si, bp 1.34 + mov ss, si ; ss for EXE 1.35 + mov sp, es ; sp for EXE 1.36 1.37 lea si, [bp-10h] ; ds and es both point to the segment 1.38 push si ; containing the PSP structure 1.39 @@ -336,7 +339,7 @@ 1.40 ReadCluster: 1.41 mov bp, [bx(bpbBytesPerSector)] 1.42 shr bp, 4 ; bp = paragraphs per sector 1.43 - add eax, byte 1 ; adjust LBA for next sector 1.44 + add eax, byte 1 ; adjust LBA for next sector 1.45 inc cx 1.46 loop ReadSectorLBA 1.47 1.48 @@ -349,7 +352,7 @@ 1.49 ;; BP -> para / sector ;; 1.50 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1.51 1.52 - imul ax, bp, byte 2 ; ax=# of FAT32 entries per sector 1.53 + imul ax, bp, byte 4 ; ax=# of FAT32 entries per sector 1.54 cwde 1.55 lea edi, [esi-2] ; esi=cluster # 1.56 xchg eax, esi 1.57 @@ -369,7 +372,7 @@ 1.58 1.59 xchg eax, edi 1.60 movzx ecx, byte [bx(bpbSectorsPerCluster)] 1.61 - mul ecx ; edx:eax=sector number in data area 1.62 + mul ecx ; edx:eax=sector number in data area 1.63 1.64 add eax, edi 1.65 adc word [bx(HiLBA)], dx 1.66 @@ -408,7 +411,7 @@ 1.67 int 13h ; extended read sectors (DL, DS:SI) 1.68 jnc ReadSuccess ; CF = 0 if no error 1.69 1.70 - cbw ; ah = 0 = reset function 1.71 + xor ax, ax ; ah = 0 = reset function 1.72 int 13h ; reset drive (DL) 1.73 1.74 dec bp