Professional Documents
Culture Documents
Chapter 4 Assembly Language Programming Summary
Chapter 4 Assembly Language Programming Summary
Directives
Instructions
Examples:
Examples:
.MODEL SMALL
ADD
.STACK 64
MOV
.DATA
. MODEL SMALL
. STACK 64
. DATA
.CODE
MAIN PROC FAR ; This is the program entry point
MOV AX, @DATA ; Load the data segment address
MOV DS, AX ; Assign value to DS
Directives or Pseudo-Instructions
▪ ORG Directive
o ORG; indicates the beginning of the offset address.
segment معين يتخزن فيه داتا بداخل الoffset لما أكون عاوز احددORG بستخدم ال
DATA
ORG 30H
X DB 10
30h offset علي مسافةDATA Segment يتخزن في الX variable هنا انا قدرت أخلي ال
▪ DUP Directive
o DUP is used to allocate (create space for) an array or string.
از قيمة ابتدائية ثابتة, بدون أن بكون لها قيمة ابتدائيةbytes لو عاوز احجز عدد معبن من الDUP بستخدم ال
Examples
? ? ? ? ?
▪ EQU Directive
o defines a constant without occupying a memory location.
Example
COUNT EQU 25
▪ MODEL Directive
o This directive selects the size of the memory model.
. MODEL SMALL uses a maximum of 64K bytes of memory for code and another 64K bytes of memory for data.
. MODEL MEDIUM uses a maximum of 64K bytes of memory for data and the code can exceed 64K bytes of
memory.
. MODEL COMPACT uses a maximum of 64K bytes of memory for code and the data can exceed 64K bytes of
memory.
. MODEL LARGE both data & code can exceed 64K bytes of memory, but no single set of data should exceed 64k
bytes.
. MODEL HUGE both data & code can exceed 64K bytes of memory and data items such as arrays can exceed 64k
bytes.
. MODEL TINY used with COM files in which data & code must fit into 64k bytes.
Data Types
DB DW DD DQ DT
byte Word Double word Ten byte
Quad word
1-bytes (2-bytes) (4-bytes) (10-bytes)
(8-bytes)
Extra Segment
Stack Segment
Data Segment
Code Segment