Bootloader Issues
Posted: Mon Mar 04, 2013 2:08 am
I've been working on this small kernel for a couple of weeks now, but I cannot, for the life of me, figure out what is wrong with this bootloader. The structure stuff was smarter and much cleaner, but then i decided to op in for what i'm doing here to try to get rid of the ISR returning 1 in AH every time i try to read something to location 0x8000. Could someone take a look at it and tell me what i'm doing wrong that could result in it refusing to go beyond 0x7f80? (NOTE: i intentionally only posted the bootloader because i'm sure the problem is there.)
Also, i'm curious, to use the 0x18 byte version to use the qword, do i have to be on a processor capable of long mode? Also, offset 4 (location of where you want to put this stuff) is 4 bytes, but is that using flat style addressing or is it using realmode style addressing?
Code: Select all
use16
org 0x7c00
microkernelStart:
jmp xEntry
nop
db "ColKern "
xEntry: xor ax, ax
mov ds, ax ;set data segment to 0
mov es, ax
mov ss, ax
mov sp, 0x7c00
tryBoot:
mov ah, 0x42
mov si, meow
mov bx, 0x7c00
mov word [meow+2], 1
int 0x13
jc tryBoot
add word [meow+4], 0x80
add word [meow+8], 1
cmp word [meow+4], 0x9000
jne tryBoot
jmp boot
mov ah,0Fh
int 10h
mov si,bootErrorMsg
mov ah,0Eh
@@: mov al,[si]
int 10h
inc si
or al, al
jne @b
jmp tryBoot ;try again (i hope if it fails it doesn't actually write the failures to RAM)
meow: db 0x10
db 0
dw 0x1
dd 0x00007c00
dq 0x0000000000000000
bootErrorMsg db 'unable to read disk.', 0
times (7DFEh-$) db 0
dw 0xAA55
include "main.asm"