This is my bootloader code
Code: Select all
BITS 16
ORG 0x7C00
start:
XOR AX, AX
MOV DS, AX
MOV [bsDriveNumber], DL
PUSHA
MOV SI, loadmsg
CALL print
POPA
MOV AX, 0x1000
MOV ES, AX
MOV BX, 0
MOV AH, 0x02
MOV AL, 0x01
MOV DL, [bsDriveNumber]
MOV DH, 0
MOV CH, 0
MOV CL, 2
INT 0x13
JC err
MOV SI,donemsg
CALL print
MOV DL, [bsDriveNumber]
JMP 0x1000:0000
err:
MOV SI, errmsg
CALL print
hang:
JMP hang
print:
LODSB
OR AL, AL
JZ done
MOV AH, 0x0E
INT 0x10
JMP print
done:
RET
msg DB "No kernel ...", 0
errmsg DB "Error in reading 2nd sector ...", 0
loadmsg DB "Loading sector 2 ...",13,10, 0
donemsg DB "Done loading sector 2 ...",13,10, 0
bsDriveNumber DB 0
TIMES 510-($-$$) db 0
DB 0x55
DB 0xAA
Code: Select all
BITS 16
start:
MOV AX, 0x7C0
MOV ES, AX
MOV FS, AX
CALL Clrscr
hang:
jmp hang
Clrscr:
MOV AX, 0x0600
MOV BH,0x07
MOV CX,0x0000
MOV DX,0x184f
INT 10h
RET
SEGMENT .data
ALIGN 4
msg DB "Kernel is running...", 0