There are more problems in your code:
You should jump over string constant on the beginning
mov ebx, HELLO_MSG call print_string jmp $ HELLO_MSG: db 'Hello, world!', 0 print_string: ...
cdq
instruction is not for clearingDF
.cdq
is used to convert doubleword ineax
into sign-extendededx:eax
value. You shouldcld
instead. But you're right, when you don't use any string instructions (cmpsb
,movsb
...),DF
usually isn't important.I haven't setup base and stack pointers yet, because I'm not really using them within these printing strings.
Yes, but you use
call
instruction, which pushes return address on stack. Usually, BIOS "allocates" small space for stack before running bootloader, so it shouldn't affect anything.This line
mov al, byte bl
will set
AL
equal toBL
, which is not the thing you want. You should use indirect byte addressing withebx
.mov al, byte [ebx] int 0x10 inc ebx ...