This is the structure of my project :
- "boot.asm" : enters 64-bit mode, make a CHS read and load "kernel" to 0x100000, then jmp to 0x100000
- "kernel.asm"
This is "kernel.asm" :
[bits 64]
msg: db "K"
mov al, [msg]
mov ah, 3 ; cyan
mov word [0xb8000], ax
jmp $
This code works when is put in "boot.asm". But only prints strange glyphs or an "S" when is put in "kernel.asm"... I don't know why. The problem seems to be with "msg" declaration. For example, when I replace " msg: db "K" " by " msg equ "K" " then it prints the good char, I can't figure out the problem, do you have any suggestions ?
Cheers,
SOLVED : The solution is just to put
[org 0x100000]
in kernel.asm to mention nasm where to put code, so that it's sure all memory access are in absolut addressing.