Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am using Ubuntu as a virtual machine in VMWare.
I have used this code to write a boot loader which would write Hello world on the screen.

[BITS 16]
[ORG 0x7C00]

MOV SI, HelloString
CALL PrintString
JMP $


PrintCharacter:

MOV AH, 0x0E
MOV BH, 0x00
MOV BL, 0x07

INT 0x10
RET

PrintString:

next_character:
MOV AL, [SI]
INC SI
OR AL, AL
JZ exit_function
CALL PrintCharacter
JMP next_character
exit_function:
RET

HelloString db 'Hello World', 0

TIMES 510 - ($ - $$) db 0
DW 0xAA55

I wrote this code in the text editor in Ubuntu and saved the file as Boot.asm
Then i complied the Boot.asm to boot.bin file by using this command

nasm -f bin -o boot.bin Boot.asm

and it didn't gave me any errors. After that i copied the boot.bin file to my usb and took it to my Windows OS. After this i burned the boot.bin file to boot.img and boot.iso files.
Then i created a new virtual machhine and named it booter, when it asked for the .iso file of the OS i want to run i gave it the boot.iso file, about which i told above, then i powered on that virtual machine but it gave me this error

PXE-M0F: No boot filename received
PXE-M0F: Exiting Intel PXE ROM
Operating System not found

Please tell me what is the main problem and how can i over come that problem
Posted

1 solution

The assembler does not produce executable code, let alone bootable. The .bin file will need to be linked into an executable and then possibly post-processed into a bootable image. You also need to understand that you cannot make system calls (such as int 0x10) in a bootloader as there is no operating system to service them.

You need to get hold of some documentation about creating a boot loader and bootable images. There is a series of articles here on CodeProject which explains some of the techniques to do this.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900