0% found this document useful (0 votes)
12 views3 pages

COA Lab Session 7

Uploaded by

beshahashenafi32
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

COA Lab Session 7

Uploaded by

beshahashenafi32
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Lab session 7: Assembly language Arithmetic Instructions

Objective

The objective of lab session 7 is


 To understand the basic concept of numbering in assembly programming language
 To differentiate the type and mnemonic of arithmetic and counting instructions
 To know how the processor used different register to operate arithmetic and counting
instructions
 To write assembly language program with arithmetic and counting instructions,
assemble, link and run.

Important Numbering concept in low-level language


 When we take an input or display an output the character automatically converted to
equivalent ASCII code.
 So we need a mechanism to convert the character to a number.
 Numbering program considers the manipulation is ASCII code manipulation. To convert
into number we should
 Add 48(30H) for displaying
 Subtract 48(30H) for input

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

A. ADD BL, 9 C. ADD BL, 48


B. SUB BL, 30H D. EMPTY

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

6. Determine the destination registers of the following arithmetic instructions?


A. ADD AL, BL C. MUL BL
B. SUB CL, DL D. DIV CL
7. Write a block of code that increment the content of AL=04H by 1?
8. Having the multiplication rule: “Multiplication result = Multiplicand * Multiplier”, which
register will be used as multiplicand if the multiplier is 8 bit?
A. AL B. AX C. AH D. All
9. Which register will be used for storing the multiplication result if the multiplier is 16 bit?
A. AX B. DX C. AX:DX D. DX:AX
10. Having the division rule: “Division result = Dividend * Divider”, which registers will be used
as dividend, quotient and remainder respectively if the divider is 8 bit?
A. AX, AL, AH C. DX:AX, AX, DX
B. DX, DL, DH D. AX, AH, AL

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

1 MOV AX, 70H


2 MOV BL, 12H
3 DIV BL

3|Page

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy