I tried to develop a bootloader using this, but when it is run it shows:
disk read error!
If I ignore it, in a later part, it shows me wrong memory mapping. I also followed some other sources too but in vain. It feels like I'm just copying what they are doing. If I do even a little different a new kind of error generates every time.
Should I use an already built bootloader or what to do?
The code of disk load error is as follow:
[org 0x7c00]
    KERNEL_OFFSET equ 0x1000    
    mov [BOOT_DRIVE], dl        
    mov bp, 0x9000          
    mov sp, bp  
    mov bx, MSG_REAL_MODE       
    call print_string           
    call load_kernel            
    jmp $
print_string:
    pusha
    mov ah, 0x0e
loop:
    mov al,[bx]
    cmp al, 0
    je return
    int 0x10
    inc bx
    jmp loop
return:
    popa
    ret
disk_load: 
    push dx                                              
    mov ah, 0x02                                   
    mov al, dh                                          
    mov ch, 0x00                                    
    mov dh, 0x00                                     
    mov cl, 0x02                                    
    int 0x13                                           
    jc disk_error                                  
    pop dx                                               
    cmp dh, al                                         
    jne disk_error                                 
    ret
 disk_error :
   mov bx, DISK_ERROR_MSG 
   call print_string 
   jmp $
DISK_ERROR_MSG db "Disk read error!", 0
[bits 16]
load_kernel: 
    mov bx, KERNEL_OFFSET       
    mov dh, 15           
    mov dl, [BOOT_DRIVE]                      
    call disk_load                                                  
    ret
; Global variables
BOOT_DRIVE     db 0 
MSG_REAL_MODE db "Started in 16-bit Real Mode", 0 
; Bootsector padding 
times 510-($-$$) db 0 
dw 0xaa55
I use this command to assemble and run my bootloader:
nasm boot.asm -f bin -o boot.bin && qemu-system-i386 boot.bin
I get stuck at this point. My bootloader display disk read error. If I ignore it at this point in time, then it creates problems while executing my kernel.c It seems to use wrong memory mapping.
 
     
    