I work with c# professionally but I want to code in a "real language" on my spare time so I decided to take up the good ol' Assembly coding once again . I have "stealed" some code from different places to try and create a bootloader with loads a kernel from the second sector of the floppy drive. The only problem is that the kernel never get's loaded I think, I would be very grateful if any of you could take a look at it .
I know I'm very rusty when it comes to Assembly and especially os development, so please bare with me . I'm here to learn and improve, all help is much appreciated .
bootloader.asm
Code: Select all
org 0x7c00
jmp start
;Data
heading_message db ‘** bluberry Boot Loader **’, 0x0d, 0x0a, 0
loading_message db ‘ Loading kernel…’, 0x0d, 0x0a, 0
PrintString:
lodsb
or al, al
jz PrintString_Complete
mov ah, 0x0e
int 0×10
jmp PrintString
PrintString_Complete:
ret
LoadKernel:
mov ah, 0×2 ;BIOS read sector function
mov al, 0×1 ;Number of sectors to read
mov ch, 0×0 ;Track
mov cl, 0×2 ;Sector
mov dh, 0×0 ;Head
mov dl, 0×0 ;Drive
mov bx, 0×2000
mov es, bx
mov bx, 0×0000
int 0×13
mov ax, 0×2000
mov ds, ax
push word 0×2000
push word 0
retf
;jmp 0×2000:0×0000
start:
mov si, heading_message
call PrintString
mov si, loading_message
call PrintString
call LoadKernel
times 510 – ($ – $$) db 0
dw 0xAa55
Code: Select all
jmp start
kernel_loaded db ‘Welcome to blueberry’, 0
PrintString:
lodsb
or al, al
jz PrintString_Complete
mov ah, 0x0e
int 0×10
jmp PrintString
PrintString_Complete:
ret
start:
mov si, kernel_loaded
call PrintString
jmp $
dd if=bootloader.bin of=fda.bin bs=512 count=1
dd if=kernel.bin of=fda.bin bs=512 count=1 seek=512
D.S