Page 1 of 1

gas & nasm syntaxes

Posted: Sun Aug 17, 2003 11:00 pm
by Adek336
I know that

db 0x12 -> .byte 0x12

How can I translate dw 0x1234 and dd 0x12345678 to gas syntax?

anyways, which do you reckon better: as or nasm?

Cheers,
Adrian.

RE:gas & nasm syntaxes

Posted: Sun Aug 17, 2003 11:00 pm
by VE3MTM
dw => .word
dd => .dword

Thus,
dw 0x1234 => .word 0x1234
dd 0x12345678 => .dword 0x12345678

As for which is better, that's totally a matter of choice. NASM seems to be the most popular, probably because the syntax is simpler, but you should be familiar with both (GCC uses as's syntax for inline assembly, for example). You'll also find that most code examples use NASM syntax

RE:gas & nasm syntaxes

Posted: Sun Aug 17, 2003 11:00 pm
by mikeleany
dw 0x1234 -> .short 0x1234 OR .word 0x1234
dd 0x12345678 -> .long 0x12345678 OR .int 0x12345678

Most people will tell you that nasm is better and it's what I prefer, but gcc uses gas (of course) for its inline asm. So you won't really be able to get away from it completely if you use gcc.