cseg segment byte public
assume cs:cseg,ds:cseg
org 7c00h
Head:
KernelBoot proc far
Start:
jmp short Begin
db 90h
KernelID db 'OSKernel'
SecInByte dw 0200h
SecPerClr db 01h
ResClr dw 0001h
Dummy1 db 00h
Dummy2 dw 0000h
TotalSec dw 0b40h ;0 for Extend
FormatId db 0f0h
SecPerFat dw 0002h
SecPerTrk dw 0012h
Sides dw 0002h
HSector dw 0000h
db 2 dup(0)
DiskParaFix db 00h,00h,00h,00h,00h,00h,00h,00h
db 00h,00h,00h,00h,00h,00h,00h,00h
KernelTrack db 00h
KernelHeadNo db 00h
KernelSecNo db 03h
Begin:
cli
cld
xor ax,ax
mov ss,ax
mov sp,7c00h
lds si,dword ptr ss:diskpara
push ds
push si
mov es,ax
lea di,DiskParaFix
mov cx,0bh
FixParam:
lodsb
cmp byte ptr es:[di],0
je DoNotCare
mov al,es:[di]
DoNotCare:
stosb
loop FixParam
xor ax,ax
mov ds,ax
mov word ptr ds:diskpara+2,ax
mov word ptr ds:diskpara,7c20h
sti
int 13h
jnc Success
ReadKnl:
mov al,1
mov dl,0
mov ah,02h
mov bx,0
push ax
push bx
push cx
push dx
push es
int 13h
pop es
pop dx
pop cx
pop bx
pop ax
clc
mov ax,DataRemained
dec ax
jz ProcessKnl
mov DataRemained,ax
printstr proc
push ax
push bx
push cx
push dx
push si
pslb1:
cmp byte ptr ds:[si],bl
je pslb2
mov ah,0eh
mov al,byte ptr ds:[si]
push bx
int 10h
pop bx
inc si
jmp pslb1
pslb2:
pop si
pop dx
pop cx
pop bx
pop ax
ret
printstr endp
HeadTrack db 00h
HeadHeadNo db 00h
HeadSecNo db 02h
DataRemained dw 0h
BootMsg db 0ah,0dh,'Loading...',0ah,0dh,0
Tail:
Filler_Amount equ 512-(Tail-Head)-2
db Filler_Amount dup (0)
BootID db 55h,0aah