Assembly Language Syntax and Structure
You'll learn: The four fundamental building blocks that make up every line of assembly code.
The Four Elements of Assembly Syntax
Think of assembly code like a recipe card: each instruction line has a specific format that the assembler (the translator) expects. Every assembly instruction is built from up to four components:
Labels
A label is an optional name for a memory location, marking a spot in your program you might want to jump to or reference. It ends with a colon:
start:
loop_begin:
Labels are like bookmarks—they let you say "remember this place" without dealing with raw memory addresses.
Mnemonics
The mnemonic is the human-readable operation name—the actual command you want the CPU to perform. These short abbreviations represent the opcodes we discussed earlier:
MOV
ADD
JMP
Think of mnemonics as verbs: they tell the CPU what to do.
Operands
Operands are the data or locations the instruction acts upon—typically one or two values separated by commas:
MOV AX, 5 ; destination, source
ADD BX, CX ; destination, source
These are like the nouns—the things being manipulated.
Comments
Comments explain what's happening and are ignored by the assembler. They usually start with a semicolon:
; This is a comment
ADD AX, 1 ; Increment AX by 1
Putting It Together
A complete line might look like:
loop_start: MOV AX, 10 ; Initialize counter
Key Takeaway: Assembly instructions consist of four syntax elements: labels (memory markers), mnemonics (operation names), operands (data being manipulated), and comments (human explanations)—creating a structured, readable way to write low-level machine instructions.