COA Lab Session 6
COA Lab Session 6
Objective
MOV AH, 1 MOV AH, 2 MOV AH, 8 MOV AH, 9 MOV AH, 9
INT 21h MOV DL, „?‟ INT 21h MOV DX, OFFSET MSG LEA DX, MSG
INT 21h INT 21h INT 21h
INT 21H is used to invoke a large number of DOS function. The type of called function is
specified by pulling a number in AH register.
Pre-lab Exercise
1. Which of the following input-output command that can print a single character?
A. 01 B. 02 C. 08 D. 09
2. Which of the following input-output command that can take input without echo?
A. 01 B. 02 C. 08 D. 09
3. Determine the memory size of the following data defining directives
A. DB (Define Byte)
B. DW (Define Word)
C. DD (Define Double Word)
D. DQ (Define Quad Word)
E. DT (Define Ten byte)
1|Page
4. Declare the following variables accordingly
A. „my_name‟ variable with initial value „abebe‟
B. „my_age‟ variable with initial value „20‟
C. „my_nymber‟ variable with empty initial value
Syntax: [variable-name] define-directive initial-value
5. Which of the following data movement instructions is incorrect?
A. Destiny: register. Source: register
B. Destiny: memory. Source: memory
C. Destiny: memory. Source: register
D. Destiny: register. Source: immediate data
E. Destiny: register. Source: memory
6. Determine the output of the following fragment of codes
A. … B. …
.DATA .DATA
HelloMessage1 DB 'Hello Ethiopia','$' HelloMessage1 DB 'Hello Ethiopia','$'
HelloMessage2 DB 'Hello Addis Ababa','$' HelloMessage2 DB 'Hello Addis Ababa','$'
NewLine DB 13,10,‟$’ NewLine DB 13,10,‟$’
… …
mov ah,9 mov ah,9
mov dx,OFFSET HelloMessage1 lea dx, HelloMessage1
int 21h int 21h
mov ah,9 mov ah,9
mov dx,OFFSET NewLine lea dx, NewLine
int 21h int 21h
mov ah,9 mov ah,9
mov dx,OFFSET HelloMessage2 mov dx, HelloMessage2
int 21h int 21h
C. … D. …
mov bx, 31h .DATA
mov cx, 32h prompt DB 'Enter Printable Character: ','$'
…
mov ah, 02h mov ah,9
mov dx, bx mov dx,OFFSET prompt
int 21h int 21h
2|Page
In-lab Exercise
7. Write an assembly language program that load the below values to the given register
and prints the content of each register?
Load the register with BX= 65h and CX=69h
8. Write the program that print the below outputs?
Output: Hello, Addis Ababa University
Hello, School Of Information Science
9. Write an assembly language program that takes a character from the user?
Output: Enter any printable character: a
The above output display when the user enters character „a‟
10. Write an assembly language program that takes a character from the user and display
“You entered character: „the character value‟”?
Output: Enter any printable character: a
You entered character: a
11. Write an assembly language program that prints the string “Assembly Language
Programming” (with LEA OPCODE)?
Output: Assembly Language Programming
Post-lab Exercise
12. Determine the difference between the below assembly language program lines
Line_1: mov dx,OFFSET prompt
Line_2: lea dx, prompt
13. Write two assembly programs that can accept user password from the user with echo
and without echo (display star (*) only)?
Sample Output:
1. Enter Your Password: 12345
2. Enter Your Password: *****
14. Determine the content of registers after the execution of the below program?
Line Program Content of AX AH AL BX BH BL
1 MOV AX, 0206h
2 MOV BX, AX
3 MOV AX, 4C00h
4 INT 21H
3|Page