Reorder fat32 bootsector to reduce number of calls/rets
This commit is contained in:
parent
1e99086fc6
commit
3b438074ef
@ -198,26 +198,15 @@ l02e:
|
|||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
; Load root directory
|
||||||
loadr: mov ax, 2
|
loadr: mov ax, 2
|
||||||
xor dx, dx
|
xor dx, dx
|
||||||
jmp load
|
jmp load
|
||||||
|
|
||||||
loadf: call search
|
; Load file identified by fsattr
|
||||||
jne fserr
|
; Directory data is expected at 0x07C00
|
||||||
mov ax, [si+0x1A]
|
loadf: mov si, (0x7C00-0x20)
|
||||||
mov dx, [si+0x14]
|
sloop: add si, 0x20
|
||||||
|
|
||||||
; load cluster chain DX:AX to [dest]:0
|
|
||||||
load: mov bx, 0x07C0
|
|
||||||
lloop: call readc
|
|
||||||
call next
|
|
||||||
cmp word dx, 0x0FFF
|
|
||||||
jne lloop
|
|
||||||
ret
|
|
||||||
|
|
||||||
; Search for first entry with matching fsattr
|
|
||||||
search: mov si, (0x7C00-0x20)
|
|
||||||
loop: add si, 0x20
|
|
||||||
; check if entry is valid
|
; check if entry is valid
|
||||||
mov al, [si]
|
mov al, [si]
|
||||||
; unallocated direntry
|
; unallocated direntry
|
||||||
@ -225,12 +214,21 @@ loop: add si, 0x20
|
|||||||
jz fserr
|
jz fserr
|
||||||
; deleted files
|
; deleted files
|
||||||
cmp al, 0xE2
|
cmp al, 0xE2
|
||||||
je loop
|
je sloop
|
||||||
; check attr
|
; check attr
|
||||||
mov al, [si+11]
|
mov al, [si+11]
|
||||||
and al, 0x5C
|
and al, 0x5C
|
||||||
cmp al, ah
|
cmp al, ah
|
||||||
jne loop
|
jne sloop
|
||||||
|
mov ax, [si+0x1A]
|
||||||
|
mov dx, [si+0x14]
|
||||||
|
|
||||||
|
; Load cluster chain DX:AX to 0x07C00
|
||||||
|
load: mov bx, 0x07C0
|
||||||
|
lloop: call readc
|
||||||
|
call next
|
||||||
|
cmp word dx, 0x0FFF
|
||||||
|
jne lloop
|
||||||
ret
|
ret
|
||||||
|
|
||||||
main: mov bp, bpb
|
main: mov bp, bpb
|
||||||
@ -257,12 +255,6 @@ noebio: lea di, [bp-2]
|
|||||||
; search for first system file
|
; search for first system file
|
||||||
mov ah, 0x04
|
mov ah, 0x04
|
||||||
call loadf
|
call loadf
|
||||||
; jump
|
|
||||||
xor ax, ax
|
|
||||||
xor cx, cx
|
|
||||||
xor dx, dx
|
|
||||||
xor bx, bx
|
|
||||||
xor di, di
|
|
||||||
|
|
||||||
; restore drive number
|
; restore drive number
|
||||||
mov dl, [bp+bpb7_dn]
|
mov dl, [bp+bpb7_dn]
|
||||||
|
Loading…
Reference in New Issue
Block a user