MBR does'nt load my kernel
Posted: Sun Jan 29, 2017 2:48 pm
Hello !
I'm trying to make a simple MBR wich loads a kernel. This is copied to a USB drive to be run by my PC. Here is my code :
I'm testing it with qemu and it work fine, my kernel is running perfectly but when i'm trying to run it on my computer, the MBR says "Loading kernel as 0x1000 ..." one time and then it seems that it's not doing anything. It seems that the copying process is "blocked" and I don't know why ...
Hope you will understand me (I'm French, i think you've noticed) and that you will help me finding a solution ! Thanks !
I'm trying to make a simple MBR wich loads a kernel. This is copied to a USB drive to be run by my PC. Here is my code :
Code: Select all
; bootsect.asm
;
; Simple MBR
; Loaded by the BIOS at 0000:7C00
; Real Mode addressing
;
; Loads the Kernel at 0x1000
;
BITS 16
org 0x0
jmp start
%include "afficher.inc"
start:
; init segments
mov ax, 0x07C0
mov ds, ax
mov es, ax
mov ax, 0x8000
mov ss, ax
mov ax, 0xF000
mov sp, ax ; stack 0x8F000 -> 0x80000
mov [drv], dl
mov si, msgBS
call afficher
; loading kernel at 0x1000, int 13h, f42h
load:
mov si, msgLK
call afficher
mov ah, 0x42
mov si, DAP
mov dl, [drv]
int 0x13
jb load
mov si, msgSK
call afficher
jmp dword 0x100:0x0
; data
msgBS: db "REMERY bootsect is running.", 13, 10, 0
msgLK: db "Loading kernel at 0x1000 ...", 13, 10, 0
msgSK: db "Starting Kernel ...", 13, 10, 0
drv: db 0
; Disk Address Packet for kernel loading
DAP:
db 0x10 ; dap lenght
db 0x0 ; unused, 0
dw 0x1 ; number of sectors to be readed (1)
dw 0x0 ; offset
dw 0x100 ; segment
dd 0x1 ; LBA address of the kernel
dd 0x0
; NOP until 510 bytes long
times 510-($-$$) db 144
dw 0xAA55 ; "this is a MBR"
Hope you will understand me (I'm French, i think you've noticed) and that you will help me finding a solution ! Thanks !