COA Lab Session 7
COA Lab Session 7
Objective
Pre-lab Exercise
1. What is the function of the below fragment of code? Describe each line of code?
Line1: MOV AH, 01H
Line2: INT 21H
Line3: MOV BL, AL
2. The user wants to print/display an addition result 9 which is stored in BL register. Which
line of code completes the task successfully?
MOV BL, 9
???
MOV AH, 02H
MOV DL, BL
INT 21H
1|Page
3. Write equivalent assembly language program for following high level language
programs?
A. X = X + Y B. Z = X + Y C. Z++ D. Y- - E. A/=B
4. Write a block of code that add the content of CL=12H and AL=2DH and store the result
inside CL?
5. Write the content of each register for each line (used in the program) after executing
the following fragment of code successfully
Line Program Content of AX AH AL BX BH BL
1 MOV AL, 45H
2 MOV BL, 70H
3 ADD AL, BL
In-lab Exercise
11. Write an assembly language program that accept a number from the user and print the
increment and decrement value of the number?
Sample Output:
Enter the number: 5
Number after increment: 6
Number after decrement: 4
2|Page
12. Write an assembly language program that accept two numbers from the user and print
the sum, difference and product of the number?
Sample Output:
Enter the first number: 3
Enter the first number: 2
The sum is: 5
The difference is: 1
The product is: 6
13. Write an assembly language program that accept two numbers from the user and print
the division of the number?
Sample Output:
Enter the first number: 8
Enter the first number: 5
The quotient is: 1
The remainder is: 3
Post-lab Exercise
14. Identify the error from the following assembly language fragment code, write the reason
why the programs return an error and re-write the correct program?
MOV BX,1410H MOV BL,1410H
MOV AX,2112H MOV AX,2112H
ADD BX,AX MUL BX
MOV AL, BX
15. Write the content of each register for each line (used in the program) after executing
the following fragment of code successfully
Line Program Content of AX AH AL BX BH BL
1 MOV AX, 002DH
2 MOV BL, 08H
3 DIV BL
3|Page