Taeyun
Taeyun

Reputation: 211

how can I set label address in nasm

how can I set label address in nasm?

putting org in other location doesn't make any difference

;;some loading and jumping code here

    times 510-($-$$) db 0
    db 0x55
    db 0xaa

how can I treat my_label as 0x00?

org 0x00 acts like I put org directive on top of the code

    org 0x00
    my_label:
        %include 'main.s'

Upvotes: 1

Views: 1231

Answers (1)

Frank Kotler
Frank Kotler

Reputation: 3119

Dunno. I suppose I can make it an "answer".

Right. Nasm accepts only one org directive. You may be able to declare a new section with vstart=0. See: nasm.us/xdoc/2.11.06/html/nasmdoc7.html#section-7.1.3

Another approach might be to assemble "main.s" (any org you like) into, say "main.bin" and incbin "main.bin" where you want it.

Another approach would be to concatenate two separate files with cat or copy /b.

Happy bootin', Frank

Upvotes: 2

Related Questions