assemblynasmqemubootloaderprotected-mode

problem running a bootloader using nasm and qemu


I have an assembly language code where I switch to protected mode and print "Hello World " on the screen afterwards. I have saved this code in a file named boot2.asm. I need help in running and testing the code as I am unable to do so by the command given by the original coder himself.

The command I use is:

nasm -f bin boot2.asm && qemu-system-x86_64 -fda boot.bin

I should run this command in cmd, right? I have NASM and QEMU installed in my computer as well.


Solution

  • If you want to create a file named boot.bin from a file boot2.asm, nasm needs to be directed to do so by means of a -o boot.bin option. Otherwise, nasm just produces a file named boot2 which is not what you want. So the fixed command line is

    nasm -f bin -o boot.bin boot2.asm && qemu-system-x86_64 -fda boot.bin
    

    Refer to the nasm manual for further information.