Optional part of a program that is ignored
by the assembler; it is used throughout a
program to improve the readability and
clarity.
It begins with a (;) semi colon
Any statement whose first non-blank
character is a semi colon]
Example:
; This program displays <message>
At the end of instruction
Example:
MOV AX, 8053h ;Initializes the value of AX to 8053h
Words in which the assembler assigns a
special meaning and it cannot be used as
identifiers. Using them for wrong purposes
causes the assembler to generate an error
message.
1. Instructions
These statements that will be
translated into machine language
and executed by the computers.
Example:
MOV ADD SUB
MUL DIV INC
DEC LOOP CMP
2. Directives
➢ Statements that give information to the
assembler.
➢ Example:
TITLE DOSSEG .MODEL
.STACK DATA .CODE
3. Operators
➢ Used at assembly time to affect the value of an
operand. Like directives, the assembler
organizes operators and they do not
correspond to machine instructions
➢ Example:
➢ OFFSET SIZE LENGTH
➢ PTR MOD +,-,*,/
4. Pre-defined Symbols
➢ These are symbols that return information to
your program.
➢ Example:
@data @model
The user defined name or variable that you apply on it in the
program used as reference.
Type of Identifier
Name – refers to the address of a data item
Example
X db 0
Msg db “Aloha!$”
Label – it refers to address of instruction or procedure
Example
MOV DL, 41h
A: INT 21H
ADD DL, 20h
INT 21H
SUB DL, 20H
LOOP A
It must use letters (A..Z, a…z), number (0,9) and/
or special characters like underscore (_), question
mark(?) and at sign(@).
It must always starts with a letter
It must not use reserved words
It must not exceed to 31 characters.
Example valid identifier:
Chan Num_1 c2t2 msg 8
Example invalid identifier:
4ever num+1
Two types of statement instructions and
directives.
A statement may begin anywhere on the line.
Each line may contain one statement
Example:
ADD AX, BX ; uses 2 operands
DEC CX ; using single operand
RET ; no operand
1. TITLE
It creates a title up to 60 characters of source
listing.
Format: Title <text>
Example: TITLE PROGRAM1,ASM
TITLE This program display ITE, Henyo!
2. DOSSEG
It tells the assembler to ignore all other request
and to adopt the DOS segment sequence –
stack, data and code.
Format: DOSSEG
Example: DOSSEG
3. .MODEL
It specifies and initializes the memory mode
before defining any segment
Format: .MODEL <memory model>
Example: .MODEL TINY
.MODEL SMALL
.MODEL MEDIUM
MEMORY MODEL NO. OF DATA NO. OF CODE
SEGMENT SEGMENT
Tiny 0 0
Small 1 1
Medium 1 More than 1
Compact More than 1 1
Large More than 1 More than 1
4. .STACK
It defines the size of the stack. The default
size is 1,024 bytes which you can overrule.
Format: .STACK <size>
Example: .STACK 0100h
5. .DATA
It defines and marks the beginning of data
segment.
Format: .DATA
Example: .DATA
6. .CODE
It defines and marks the code segment
which consists of a set of instructions
Format: .CODE
Example: .CODE
7. END
It is placed at the last line of the source
code
Format: END
Example: END
8. FOR DEFINING DATA
DIRECTIVE LENGTH (IN BYTES) DESCRIPTION
DB 1 Define Byte
DW 2 Define Word
DD 4 Define Double Word
DF 6 Define Far Word
DQ 8 Define Quad Word
DT 10 Define Ten Bytes
It is used for descriptive data such as
person’s name or simply a message. DB is
the conventional format for defining string of
any length
Example: chan db “Hello”
ted db “Hi”
They are used to define arithmetic values
and memory address. It is defined with a
radix specifier such as d for decimal, b for
binary and h for hexadecimal.
Example
Msg db “ITE DEPARTMENT, COD MEMBER”, 0Ah, 0Dh, “$”
Msg db “ITE Department, COD Member”, 10d, 13d, “$”