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