Several assemblers are available for machine-level programming. This article compares three key assemblers: Microsoft Assembler (MASM), GNU Assembler (GAS), and Netwide Assembler (NASM). Their differences and similarities are highlighted for easier code conversion.
GAS follows a source-first, destination-second operand order, while MASM and NASM use destination-first, source-second.
GAS denotes operand sizes with suffixes: b, w, l, and q.
GAS and NASM are case-sensitive, whereas MASM is case-insensitive by default but can be made case-sensitive with the directive: option casemap: none.
FPU stack registers in NASM are written as ST0, ST1, etc., without parentheses, whereas GAS and MASM use %st(1) or ST(1).
Symbol assignment syntax varies: GAS uses .EQU, NASM uses EQU, and MASM uses = or EQU.
mov eax, [test] ; No size directive needed for source operand
mov eax, DWORD [test] ; Size directive can be used
mov DWORD [test], eax ; Size directive required for destination operand
Description
GAS
NASM
MASM
Identifiers are case-sensitive
Yes
Yes
No (default), Yes with option casemap: none
Operand order
Source, Destination
Destination, Source
Destination, Source
Operand size requirement
Explicitly defined for both operands
Required for destination, optional for source
Size assumed
Immediate value prefix
$ (e.g., movl $var, %eax)
None
None
Register clearing (eax)
xorl $eax, $eax
xor eax, eax
xor eax, eax
Include file syntax
include "file.txt"
%include "file.ext"
INCLUDE file.txt
This comparison is derived from Appendix-A of Assembly Programming and Computer Architecture for Software Engineers by Brian R. Hall and Kevin J. Slonka.
© 2025 TaJr.pk
Designed with WordPress