Assembly Language Experiment #2
Assembly Language Experiment #2
2 | Page
EXPERIMENT 2
BASIC SCREEN OPERATION
I.
OBJECTIVES
1. To practice assembling, linking and executing a program in assembly
2. To introduce the requirements in displaying information on the screen
II.
INSTRUCTION / SERVICES
A. MOV Instruction
Format: MOV [DESTINATION], [SOURCE]
Data transfer instruction can be used in the following ways:
MOV [REGISTER], [REGISTER]
MOV [MEMORY LOCATION], [REGISTER]
MOV [REGISTER], [MEMORY LOCATION]
MOV [REGISTER], [IMMEDIATE DATA]
MOV [MEMORY LOCATION], [IMMEDIATE DATA]
B. LEA (Load Effective Address) Instruction
LEA [REGISTER], [MEMORY LOCATION]
C. Printing a character
MOV AH, 02
MOV DL, [CHARACTER]
INT 21H
HEX
07
08
0A
0D
DEC
7
8
10
13
NAME
BELL
BACKSPACE
LINE FEED
CARRIAGE RETURN
FUNCTION
Emits a one-second beep
Moves the cursor one column to the left
Moves the cursor down one row
Moves the cursor to the beginning of the line
D. Printing a string
MOV AH, 09
LEA DX, [STRING]
INT 21H
3 | Page
EXERCISE
NAME:
SECTION:
DATE:
INSTRUCTOR:
GRADE:
1. Encode the given assembly language program, assemble, link and execute.
cseg segment para 'code'
assume cs:cseg, ds:cseg, es:cseg,
ss:cseg
org 100h
start:
JMP begin
;data declaration
val1 db 'NCP$'
val2 db '311$'
val3 db '#'
begin:
;clear screen
mov ax, 0003h
int 10h
;BLOCK A
mov ah, 02h
mov dl, val1
int 21h
;BLOCK B
mov ah, 09
lea dx, val2
int 21h
;BLOCK C
mov ah, 02
mov dl, val3
int 21h
;exit
int 20h
cseg ends
end start
b. Add the following instructions after the bold faced instructions in BLOCK B. What is
the output?
mov ah, 02
mov dl ,10
int 21h
4 | Page
c. Remove the codes added in b. then add the following instructions after the bold
faced instructions in BLOCK B. What is the output?
mov
mov
int
mov
int
ah, 02
dl ,10
21h
dl, 13
21h
d. Remove the codes added in c. then add int 21h after the bold faced instructions in
each block
Also replace all the bold faced codes with only the following:
mov
mov
int
mov
lea
int
lea
int
ah,
dl,
21h
ah,
dx,
21h
dx,
21h
02
val1
09
val2
val3
5 | Page
6 | Page
ACTIVITY
NAME:
SECTION:
DATE:
INSTRUCTOR:
GRADE:
Create an assembly language program that will display your first name diagonally on
the screen.
7 | Page
ACTIVITY
NAME:
SECTION:
DATE:
INSTRUCTOR:
GRADE:
Design an assembly language program that will output your family name on the screen.
8 | Page