How to know if an assembly code has particular syntax (emu8086, NASM, TASM, …)?

NASM/YASM is easy to distinguish from MASM/TASM/emu8086. YASM uses NASM syntax, with a few minor differences in what it accepts for constants and directives. I don’t know how to distinguish MASM from TASM, or TASM from emu8086, or FASM, so I’ll leave that for another answer to address. In NASM, explicit sizes on things like … Read more

How do GNU assembler x86 instruction suffixes like “.s” in “mov.s” work?

As of Binutils 2.29 the instruction suffixes are now deprecated in favor of pseudo-prefixes. You can find the older suffixes documented in the GNU Assembler (pre-2.29) info pages. Earlier info as pages say this: 9.15.4.1 Instruction Naming [snip] Different encoding options can be specified via optional mnemonic suffix. .s suffix swaps 2 register operands in … Read more

How to set gcc or clang to use Intel syntax permanently for inline asm() statements?

Use -masm=intel and don’t use any .att_syntax directives in your inline asm. This works with GCC and I think ICC, and with any constraints you use. Other methods don’t. (See Can I use Intel syntax of x86 assembly with GCC? for a simple answer saying that; this answer explores exactly what goes wrong, including with … Read more