finally , the first try to write boot sector load kernel i wrote it using NASM and this is my code :
The boot sector :
Code: Select all
; The boot sector
jmp 07C0h:load
load:
mov ax,0x100
mov es,ax ; don't forget this agian !
mov bx,0
mov ah,2
mov al,1
mov ch,0
mov cl,2
mov dh,0
mov dl,0
int 13h
jc print_err ; Oh , error ok try again !
jmp 0x100:0 ; Woooooooooooow , Load the kernel
print_err:
mov ah,0Eh
mov bx,07h
mov al,'e'
int 10h
jmp load
times 510-($-$$) db 0
dw 0AA55h
Code: Select all
; I want it in C :(
; However , it's kernel :)
; Just print Hello .
[BITS 16]
ORG 0
mov ax,0x100
mov ds,ax
mov es,ax
mov ax,0x9000
mov ss,ax
mov sp,0xffff
mov ah,0Eh
mov bx,07h
mov al,'H'
int 10h
mov ah,0Eh
mov bx,07h
mov al,'e'
int 10h
mov ah,0Eh
mov bx,07h
mov al,'l'
int 10h
mov ah,0Eh
mov bx,07h
mov al,'l'
int 10h
mov ah,0Eh
mov bx,07h
mov al,'o'
int 10h
mov ah,0Eh
mov bx,07h
mov al,'!'
int 10h
and try the image using qemu , but it's don't work , i mean it's don't load the kernel and print Hello! . Why ? ???
Sorry for my bad English :-[