Basically, I have two computers, one a little bit older but it as still a 64 bits CPU and a modern one which also run on a 64 bit CPU. The problem is that on the older one, I can successfully read my boot sectors but on the modern one, it does not even print one of the first strings. Instead it print some garbage things all around the screen for like 2 seconds and then hangs.. I have the csm enabled in bios settings (in order to boot on my usb stick). Can someone help me ?
Bootloader.asm
Code: Select all
[org 0x7c00]
[bits 16]
section .text
global BOOTSECT
BOOTSECT:
; Making sure to reset every segment before loading.
; Because some BIOS tend to modify those..
cli
xor ax, ax
mov ss, ax
mov ds, ax
mov es, ax
cld
sti
; Changing the bios background color to the default black one...
mov ah, 0x0b ;Function Code
mov bh, 0x00 ; Function parameter
mov bl, 0x00 ;Background color
int 0x10
mov bx, MSG_START
call print
mov bx, MSG_READING
call print
mov al, 1
mov cl, 2
mov bx, 0x1000
call readSector
; Changing the bios background color if success (GREEN)
mov ah, 0x0b ;Function Code
mov bh, 0x00 ; Function parameter
mov bl, 0x08 ;Background color
int 0x10
mov bx, MSG_SUCCESS_DISK
call print
jmp $
%include "print.asm"
%include "readSector.asm"
MSG_START: db "[INFO] Starting in 16-bit Real Mode !",13 ,10 ,0
MSG_READING: db "[INFO] Reading Sectors...",13 ,10 ,0
MSG_ERROR_DISK: db "[ERROR] Error Loading Disk !", 13 ,10 ,0
MSG_SUCCESS_DISK: db "[SUCCESS] Loading Disk Into Memory Succeded !", 13 ,10 ,0
times 510-($-$$) db 0
dw 0xaa55
times 512 db 0
Code: Select all
readSector:
pusha
mov ah, 0x02
mov ch, 0
mov dh, 0
int 0x13
jc disk_error
popa
ret
disk_error:
; Changing the bios background color FAIL (RED)...
mov ah, 0x0b ;Function Code
mov bh, 0x00 ; Function parameter
mov bl, 0x04 ;Background color
int 0x10
mov bx, MSG_ERROR_DISK
call print
jmp $
Code: Select all
print:
pusha
printloop:
mov ah, 0x0e
mov al, [bx]
cmp al, 0
je done
int 0x10
inc bx
jmp printloop
done:
popa
ret