I managed to trace the error to the following peice of code, using dots printed to the screen:
Code: Select all
;Find the file we want
mov cx, WORD [MaxRootEntries] ;load loop counter
mov di, 0x0200 ;locate first root entry
.loop:
push cx
mov cx, 0x000B ;eleven character name
push di
rep cmpsb ;test for entry match
pop di
je file_found
pop cx
add di, 0x0020 ;queue next directory entry
loop .loop
jmp ERROR
file_found:
mov si, msg_dot ;write tracing dot
call WRITE
Code: Select all
prefetch: RIP > CS.limit
Code: Select all
LOAD_KERNEL:
mov si, kernel_image ;filename
mov ax, p_kernel ;memory offset
mov bx, ps_kernel ;memory segment
call LOAD_IMAGE
mov si, msg_dot
call WRITE ;print dot -> so we can trace errors
RET
LOAD_IMAGE: ;Loads a file from a fat12 disk (bx:ax - where to load | si - filename)
;Push input registers to the stack
push ax ;offset
push bx ;segment
;Get the root directory into memory
call GET_ROOT_DIRECTORY
mov si, msg_dot
call WRITE
;Find the file we want
mov cx, WORD [MaxRootEntries] ;load loop counter
mov di, 0x0200 ;locate first root entry
.loop:
push cx
mov cx, 0x000B ;eleven character name
push di
rep cmpsb ;test for entry match
pop di
je file_found
pop cx
add di, 0x0020 ;queue next directory entry
loop .loop
jmp ERROR
file_found:
mov si, msg_dot ;write tracing dot
call WRITE
Code: Select all
kernel_image db "KERNEL BIN"
p_kernel dw 0x1100
ps_kernel dw 0x0000
p_rootdir dw 0x900
Code: Select all
eax:0xe0e00
ebx:0x7
ecx:0xe0006
edx:0xfff
ebp:0x0
esi:0x59c
edi:0x5
esp:0xfff8
eflags:0x246
eip:0x5b5
cs:s=0x0, dl=0xffff, dh=0x9b00, valid=1
ss:s=0x0, dl=0xffff, dh=0x9300, valid=7
ds:s=0x0, dl=0xffff, dh=0x9300, valid=3
es:s=0x0, dl=0xffff, dh=0x9300, valid=1
fs:s=0x0, dl=0xffff, dh=0x9300, valid=1
gs:s=0x0, dl=0xffff, dh=0x9300, valid=1
ldtr:s=0x0, dl=0x0, dh=0x0, valid=0
tr:s=0x0, dl=0x0, dh=0x0, valid=0
gdtr:base=0x0, limit=0x0
idtr:base=0x0, limit=0x3ff
dr0:0x0
dr1:0x0
dr2:0x0
dr3:0x0
dr6:0xffff0ff0
dr7:0x400
tr3:0x0
tr4:0x0
tr5:0x0
tr6:0x0
tr7:0x0
cr0:0x60000010
cr1:0x0
cr2:0x0
cr3:0x0
cr4:0x0
inhibit_mask:0
done
Is there anyone who can see what is wrong here? (or even explain what the error means?)
Thanks for you help in advance,
OScoder