Skip to contentSkip to conversation

Translating nasm boot strap to as

DISCUSSION Daniel Hilst Selli 3 participants 6 messages Mar 19, 2011 – Mar 21, 2011

lore
Share & tools
lore
#0 lore raw

I got some little code in intel syntax(nasm) and want to translate it to AT&T syntax to assembly it with as.

The code is a bootstrap and can be found here: http://ideone.com/Qldvx

I got problem to translate 2 things ..
this:

jmp 07C0h:start

I try this

jmp 0x7C0, start

but got "Too memory operands error"
I also try all order combinations plus $ prefix combinations

and to fill the file:

times510-($-$$) db 0

I didn't find any $$ translation in as

Signature · 1 line
"Do or do not... there is no try" Yoda Master
#1 lore raw
Quoted 7 lines

this:

jmp 07C0h:start

I try this

jmp 0x7C0, start

I think what you need is:

    jmp     $0x07C0, $start

Assuming that 0x07C0 is the segment and start is the offset.

If that doesn't work, you may need to use ljmp instead of jmp (it's been a long time since I've thought about 16-bit assembly.)

Quoted 5 lines

and to fill the file:

times 510-($-$$) db 0

I didn't find any $$ translation in as

$$ just refers to the start of the current section, so I think the solution there is just to declare your own symbol at the top of the section, and use that in place of $$.

b

#2 lore raw
In reply to Daniel Hilst Selli
Quoted 5 lines

and to fill the file:

times510-($-$$) db 0

I didn't find any $$ translation in as

Actually, in this particular case, a more straightforward solution is to just assign . a new value, like this:

. = .data + 510

(assuming that this appears in your .data section)

b

#4 lore raw
Quoted 3 lines
Quoted 1 line

times510-($-$$) db 0

.org 510

Even better!

b

#5 lore raw

Thanks for all, now it works!

Quoted 5 lines · Brian Raiter
Quoted 2 lines
Quoted 1 line

times510-($-$$) db 0

.org 510

Even better!

b

Signature · 1 line
"Do or do not... there is no try" Yoda Master