Assembly Language Syntax 

An assembly language program consists of statements. The syntax of an assembly language program statement obeys the following rules:

Only one statement is written per line
Each statement is either an instruction or an assembler directive
Each instruction has an opcode and possibly one or more operands
An opcode is known as a mnemonic
Each mnemonic represents a single machine instruction
Operands provide the data to work with.

Program Statement:

The general format for an assembly language program statement is as follows:

	Name mnemonic operand(destination), operand(source)  ; comment

Name Field:

This field is used for:
instruction label: if present, a label must be followed by a colon (:)
procedure names
variable names.

Examples of Name Fields
here:    MOV AX,0867H    ; Statement line with a label field
         JNC here        ; Statement with opcode and one operand
         INT 03H
SUM PROC NEAR            ; Procedure definition

Operation Field:

This field consists of a symbolic operation code, known as opcode
The opcode describes the operation’s function
Symbolic opcodes are translated into machine language opcode.

Operand Field:

This field specifies data to be acted on. It may have one, two or no operands at all.

Examples of instructions with different operand fields
	NOP       ; Instruction with no operand field 
	INC AX    ; Instruction with one operand field
	ADD AX, 2 ; Instruction with two operand field

Comment Field:

A semicolon marks the beginning of a comment
A semicolon in the beginning of a line makes it all a comment line
Good programming practice dictates the use of a comment on almost every line.

Key rules for the use of comments:

Do not say something that is obvious
Put instruction in context of program

Examples of good and bad Comments
	MOV CX, 0  ; Move 0 to CX. (This is not a good comment.)
	MOV CX, 0  ; CX counts terms, initially set to 0. (This is a good comment.)

Assembler Directives:

Pseudoinstructions or assembler directives are instructions that are directed to the assembler. Assembler directives affect the generated machine code, but are not translated directly into machine code. Directives can be used to declare variables, constants, segments, macros, and procedures as well as supporting conditional assembly.

In general, a directive:

contains pseudo-operation code,
tells the assembler to do a specific thing, and
is not translated into machine code.