1

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.

davegson
  • 8,205
  • 4
  • 51
  • 71
Vanzef
  • 453
  • 1
  • 5
  • 17

2 Answers2

2

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
adriann
  • 396
  • 2
  • 12
-1

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.

Frank Kotler
  • 3,079
  • 2
  • 14
  • 9
  • 1
    *Bochs is probably looking for an entire 1.44M floppy image* - No, you can feed Bochs with smaller files. – rkhb May 22 '15 at 11:47