Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Statement format:
Label:
Label:
Comments:
Begin with a ;.
Ignored by the assembler.
Maybe be on a line by itself or at the end of
a line:
Segment Definition
CS (code segment).
SS (stack segment).
DS (data segment).
ES (extra segment).
FS, GS (supplemental segments available
on 386s, 486s and Pentiums.
Segment Definition
.MODEL SMALL
.MODEL MEDIUM
.MODEL COMPACT
Segment Definition
.MODEL HUGE
.MODEL TINY
Segment Definition
.STACK
.DATA
.CODE
These directives mark the beginning of the
segments they represent.
Segment Definition
Constants
Examples:
PI EQU 3.1415
Radius EQU 25
Circumference EQU 2*PI*Radius
Variables
DB - define byte.
DW - define word.
DD define double word.
DQ Define quad word.
Form:
Examples:
Alpha db ABCDE
Alpha2 db A,B,C,D,E
Alpha3 db 41h,42h,43h,44h,45h
Word1 dw 3344h
Double_word1 dd 44332211h
Variables
Ex:
Duplicate Directive
Expression DUP(Operand,.,Operand)
Data Structures
Label STRUC
Label ENDS
Data Structures
Example:
INFO STRUC
NAMES DB 32 DUP(?)
STREET DB 32 DUP(?)
CITY DB 16 DUP(?)
STATE DB 2 DUP(?)
ZIP DB 5 DUP(?)
Label ENDS
Segment Definition
;SIMPLIFIED SEGMENT DEFINITION
.MODEL SMALL
.STACK 64
STSEG
SEGMENT
DB 64 DUP(?)
STSEG
ENDS
.DATA
N1
DW
N2
DW
SUM DW
1432H
4365H
0H
.CODE
BEGIN
PROC FAR
BEGIN
MOV AX,@DATA
MOV DS,AX
MOV AX,N1
ADD AX,N2
MOV SUM,AX
MOV AH,4CH
INT 21H
ENDP
END BEGIN
DTSEG
N1
N2
SUM
DTSEG
SEGMENT
DW
1432H
DW
4365H
DW
0H
ENDS
CDSEG SEGMENT
BEGIN
PROC FAR
ASSUME CS:CDSEG,DS:DTSEG,SS:STSEG
MOV AX,DTSEG
MOV DS,AX
MOVAX,N1
ADD AX,N2
MOV SUM,AX
MOV AH,4CH
INT 21H
BEGIN
ENDP
CDSEG
ENDS
END BEGIN