I use VMWare Workstation Player 15.
I prepare such hello world boot loader as boot.s
:
.code16
.global init
init:
mov $0x0e, %ah
mov $0x41, %al
int $0x10
hlt
msg: .byte 0x41
.fill 510-(.-init), 1, 0
.word 0xaa55
Build it into binary:
$ as -o boot.o boot.s
$ ld -o boot.bin --oformat binary -e init -Ttext 0x7c00 -o boot.bin boot.o
In VMWare Workstation Player, create a virtual machine, adding floppy disk as the boot.bin is the content of it. Then power on that virtual machine, I can see character A
displayed.
Everything is good so far.
But when I change the following line:
mov $0x41, %al
into
mov $msg, %bx
mov (%bx), %al
The character A
will not be displayed. I want to ask what wrong of it?
The tutorial is here: https://medium.com/@g33konaut/writing-an-x86-hello-world-boot-loader-with-assembly-3e4c5bdd96cf
The explanation of that last two lines is:
" The first line loads the address of the first byte into the register bx (we use the entire register because addresses are 16 bit long).
The second line then loads the value that is stored at the address from bx into al, so the first character of the message ends up in al, because bx points to its address. "