nasmgnugnu-assembler

GNU as equivalent to times X db 0


I'm writing a small bootloader in GNU as and I need to make the binary output "BIOS-compatible". Here is how I do it in nasm:

...
times 510 - ($-$$) db 0
dw 0xAA55

But how can I do it in GNU as?


Solution

  • After some Google-searching, I figured out how to do it:

    _start:
    ...
    /* .fill repeat, size, value */
    .fill 510 - (. - _start), 1, 0
    .word 0xAA55