Compact bootloader code

This commit is contained in:
Nero 2020-03-30 19:43:07 +00:00
parent 0b2a7e7b64
commit bc096f41d3
1 changed files with 15 additions and 20 deletions

View File

@ -203,36 +203,31 @@ loop: add si, 0x20
jne loop jne loop
ret ret
main: mov ax, 2 loadr: mov ax, 2
xor dx, dx xor dx, dx
call load jmp load
; search for an system directory loadf: call search
jne end
mov ax, [si+0x1A]
mov dx, [si+0x14]
jmp load
main: ; load root directory
call loadr
; search for first system directory
mov ah, 0x14 mov ah, 0x14
call search call loadf
jne end ; search for first system file
mov ax, [si+0x1A]
mov dx, [si+0x14]
call load
mov ah, 0x04 mov ah, 0x04
call search call loadf
jne end ; jump
mov ax, [si+0x1A]
mov dx, [si+0x14]
call load
jmp 0:0x7C00 jmp 0:0x7C00
end: call msg end: call msg
db "DIR", 0 db "DIR", 0
jmp err jmp err
; segment register for data
dest: dw 0x07c0
; Padding and signature ; Padding and signature
times (0x1FE - ($-$$)) db 0 times (0x1FE - ($-$$)) db 0
dw 0xAA55 dw 0xAA55