Code: Select all
jmp 0x08:0x00010000
Brodeur235
Code: Select all
jmp 0x08:0x00010000
Code: Select all
jmp dword 0x0008:0x00010000
Code: Select all
xor bx,bx
mov es,bx
mov bx,kern_offset
Code: Select all
mov ebx,kern_offset
shr ebx,0x00000010
mov es,bx
mov ebx,kern_offset
Code: Select all
kernel_loader:
; determine # of sectors to load
; dx:ax / bx = ax remainder dx
mov dx,0x0000
mov ax,KERNEL_SIZE
mov bx,SECTOR_SIZE
div bx
; ensure size is even number of sectors
cmp dx,0x0000
jnz .kl_error
; setup to loop thru sectors
mov cx,ax
mov BYTE [ BLOC( sector_current ) ], KERNEL_SECTOR
mov DWORD [ BLOC( offset_current ) ], KERNEL_OFFSET
.kl_copy_sector:
push cx
; copy current sector
; disk loc -> es:bx in mem
mov dh,KERNEL_DRIVE
mov dl,KERNEL_HEAD
mov ch,KERNEL_TRACK
mov cl,[ BLOC( sector_current ) ]
; setup destination ( es:bx)
mov eax,DWORD [ BLOC( offset_current ) ]
shr eax,0x00000010
mov es,ax
mov ebx,DWORD [ BLOC( offset_current ) ]
mov ah,0x02
mov al,0x01
int 0x13
; prepare for next sector
add DWORD [ BLOC( offset_current ) ],SECTOR_SIZE
inc BYTE [ BLOC( sector_current ) ]
pop cx
loop .kl_copy_sector
; completed
jmp .kl_success
; error section
.kl_error:
jmp $
; success section
.kl_success:
ret
bl_data:
; kernel_load data
sector_current db 0x00 ; KERNEL_SECTOR
offset_current dd 0x00000000 ; KERNEL_OFFSET
Code: Select all
add bx,0200h ; bh,02h
jnz @f
mov ax,es
add ax,1000h ; ah,10h
mov es,ax
@@: