Why my bootloader can't find the kernel?
Posted: Wed Aug 17, 2016 4:58 pm
I wrote a simple bootloader and i tried it and it works very well but when i copy 2 files to the floppy drive the bootloader failed to catch the kernel
I copy the kernel.bin file to the floppy drive then write the bootloader to the bootsector using debug command
And this is the root directory and FAT setup, what's wrong?
Thanks
I copy the kernel.bin file to the floppy drive then write the bootloader to the bootsector using debug command
And this is the root directory and FAT setup, what's wrong?
Code: Select all
MOV [BOOT_DEVICE], DL
;1- SETTING UP AND LOADING THE ROOT DIR.
MOV AH, 02H
MOV AL, 14
MOV BX, TEMP
MOV CH, 0
MOV CL, 2
MOV DH, 1
PUSHA
LOAD_RD:
INT 13H
JNC LOAD_RD_DONE
CALL RESET_DRIVE
JMP LOAD_RD
LOAD_RD_DONE:
POPA
MOV DI, TEMP
MOV CX, 224
FIND_KERNEL:
PUSH CX
POP DX
MOV SI, FILE_NAME
MOV CX, 11
REP CMPSB
JE FOUND_KERNEL
ADD AX, 32
MOV DI, TEMP
ADD DI, AX
PUSH DX
POP CX
LOOP FIND_KERNEL
MOV SI, FAILED_TO_LOAD_KERNEL
CALL ECHO
CLI
INT 18H
FOUND_KERNEL:
MOV AX, WORD [DI+15]
MOV [ENTERY_POINT], AX
MOV AX, 1
MOV BX, TEMP
CALL LOG_TO_HTS
MOV AH, 2
MOV AL, 9
PUSHA
LOAD_FAT:
INT 13H
JNC LOAD_FAT_DONE
CALL RESET_DRIVE
JMP LOAD_FAT
LOAD_FAT_DONE:
MOV AH, 2
MOV AL, 1
PUSH AX
LOAD_SECTOR:
MOV AX, WORD [ENTERY_POINT]
ADD AX, 31
LOG_TO_HTS:
PUSH BX
PUSH AX
MOV BX, AX
MOV DX, 0
DIV WORD[ALL_SECTORS]
ADD DL, 01H
MOV CL, DL
MOV AX, BX
MOV DX, 0
DIV WORD [ALL_SECTORS]
MOV DX, 0
DIV WORD[FACES]
MOV DH, DL
MOV CH, AL
POP AX
POP BX
MOV DL, BYTE [BOOT_DEVICE]
RET
Thanks