Vanzef
Vanzef

Reputation: 453

Simple bootloader and bochs

I have a simple bootloader written in AT&T syntax.

[bits 16]
[org   0x7c00]
jmp   $
times 510-($-$$) db 0
dw    0xaa55

I use yasm -f bin -o boot.bin loader.s to compile it, and bochs to run.

dd if=boot.bin bs=512 of=floppy.img
bochs -q

But bochs said that there is no bootable device.

So, I have the following questions:

  1. How can I rewrite it with AT&T syntax (which construction I must use instead times 510-($-$$) db 0)?
  2. What is wrong with bochs?

Thanks!

P.S. Bochs was compiled with x86_64 support, but it doesn't work with bochs from the official arch repo.

Upvotes: 1

Views: 1677

Answers (2)

adriann
adriann

Reputation: 446

I suggest you stick with the Intel syntax as it is usually more readable than AT&T. For a few basic differences between them you can check this and this.

On Ubuntu, bochs needs bochs-x and bochs-sdl in order to run without errors. Then you should be able to boot from your floppy image with:

bochs -q 'display_library: sdl' 'boot:a' 'floppya: 1_44=floppy.img, status=inserted'

Another option is to use qemu instead of bochs:

qemu -fda floppy.img

Upvotes: 2

Frank Kotler
Frank Kotler

Reputation: 3119

I can't imagine why you're trying to write AT&T syntax if you don't know AT&T syntax! I think the "times" line would be...

.org 0x7DFE
.word 0xAA55

Bochs is probably looking for an entire 1.44M floppy image.

Upvotes: -1

Related Questions