Professional Documents
Culture Documents
TITLE MYPROG.ASM
DOSSEG
.MODEL SMALL
.STACK 0100h
.DATA
X
DB
.CODE
MOV AX, @DATA
MOV DS, AX
Kamusta,
AdU!$
1.
Code
Output
TITLE MYPROG.ASM
DOSSEG
.MODEL SMALL
.STACK 0100h
.DATA
.CODE
MOV AX, @DATA
MOV DS, AX
MOV AH, 02h
MOV DL, A
INT 21h
Code
Output
TITLE MYPROG.ASM
DOSSEG
.MODEL SMALL
.STACK 0100h
.DATA
.CODE
MOV AX, @DATA
MOV DS, AX
MOV AH, 02h
MOV DL, a
INT 21h
MOV AX, 4C00h
INT 21h
END
3.
Code
Output
TITLE MYPROG.ASM
DOSSEG
.MODEL SMALL
.STACK 0100h
.DATA
.CODE
MOV AX, @DATA
MOV DS, AX
MOV
MOV
INT
MOV
INT
MOV
INT
MOV
INT
MOV
INT
MOV
INT
MOV
INT
AH,
DL,
21h
DL,
21h
DL,
21h
DL,
21h
DL,
21h
DL,
21h
DL,
21h
02h
A
0Ah
;line feed
0Dh
;carriage return
D
0Ah
;line feed
0Dh
;carriage return
Code
Output
TITLE MYPROG.ASM
DOSSEG
.MODEL SMALL
.STACK 0100h
.DATA
.CODE
MOV AX, @DATA
MOV DS, AX
MOV CX, 001Eh
;setting number of loops, 001E-Hexadecimal=30
MOV AH, 02h
;calls interrupt service 02
MOV DL, z
A:
INT 21h
LOOP A
;go to label A
MOV AX, 4C00h
INT 21h
END
EXERCISE 1
Code
Output
TITLE MYPROG.ASM
DOSSEG
.MODEL SMALL
.STACK 0100h
.DATA
A
DB
B
DB
C
DB
.CODE
MOV AX, @DATA
MOV DS, AX
MOV
MOV
INT
MOV
MOV
INT
MOV
INT
MOV
MOV
INT
MOV
MOV
INT
MOV
INT
MOV
MOV
INT
AH,
DX,
21h
AH,
DL,
21h
DL,
21h
AH,
DX,
21h
AH,
DL,
21h
DL,
21h
AH,
DX,
21h
Shenel A. Sambrano$
2nd year-CS$
09**-***-****$
09h
OFFSET A
02h
0Ah
0Dh
;carriage return
09h
OFFSET B
02h
0Ah
0Dh
;carriage return
09h
OFFSET C
Reserved Words
A. Instructions
Statements translated to machine language (i.e. MOV, ADD, SUB, MUL, DIV, INC, DEC, LOOP, CMP)
B. Directives
Give information to the assembler.
o
TITLE title for the program (max of 60 characters).
o
DOSSEG tells the compiler to ignore all other request and to adopt the DOS segment sequence stack, data, and code.
o
.MODEL specifies and initializes the memory model before defining any segment.
MEMORY MODEL
Tiny
Small
Medium
Compact
Large
C.
D.
o
o
.STACK defines the size of the stack (default: 1,024 bytes but you can overrule).
.DATA defines and marks the beginning of data segment.
DIRECTIVES LENGTH(bytes)
DESCRIPTION
DB
1
Define Byte
DW
2
Define Word
DD
4
Define Doubleword
DF
6
Define Farword
DQ
8
Define Quadword
DT
10
Define Tenbytes
o
o
.CODE defines and marks the code segment which consists of a set of instructions.
END placed at the last line of the source code.
Operators
Used at assembly time to affect the value of the operand (i.e. OFFSET, SIZE, LENGTH, PTR, MOD, +, -, *, /).
Pre-defined symbols
Symbols that return information to your program (i.e. @data, @model).