Assembly Intel vs. AT&T Syntax / GAS vs. NASM

Differences in Intel (NASM) vs AT&T (GAS) Syntax.

Linux assemblers: A comparison of GAS and NASM, A side-by-side look at GNU Assembler (GAS) and Netwide Assembler (NASM)

NASM Vs GAS (Practical differences)
Can I use Intel syntax of x86 assembly with GCC?
Using “.intel_syntax noprefix” how can I get memory address of a label?
Which variable size to use (db, dw, dd) with x86 assembly?
What’s the difference between equ and db in NASM?
“no such instruction error” when assembling an array declaration
Difference between .equ and .word in ARM Assembly?
Why are there empty address spaces between data sections in memory (x86 / nasm)?
What does the dollar sign ($) mean in x86 assembly when calculating string lengths like “$ – label”? [duplicate]

mov si, name              
mov si, [name]
mov si, word ptr [name]
mov si, offset name

EQU defines a symbol to a given constant value: when EQU is used, the source line must contain a label. The action of EQU is to define the given label name to the value of its (only) operand. This definition is absolute, and cannot change later. So, for example,

message         db      'hello, world' 
msglen          equ     $-message

defines msglen to be the constant 12. msglen may not then be redefined later. This is not a preprocessor definition either: the value of msglen is evaluated once, using the value of $ (see section 3.5 for an explanation of $) at the point of definition, rather than being evaluated wherever it is referenced and using the value of $ at the point of reference.

Operand  Format  6811/6812example
no operand accumulator and inherent clra
<expression> direct, extended, or relative ldaa 4
#<expression> immediate ldaa #4
<expression>,R indexed with address register ldaa 4,x
<expr>,<expr> bit set or clear bset 4,#$01
<expr>,<expr>,<expr> bit test and branch brset 4,#$01,there
<expr>,R,<expr>,<expr> bit test and branch brset 4,x,#$01,there

Leave a Reply

Your email address will not be published. Required fields are marked *