Sie sind auf Seite 1von 7

The UNIVERSITY of MINDANAO

College of Engineering Education

CpE 321
Computer System Organization with
Assembly Language
Laboratory

Laboratory Exercise # 3

Advance Arithmetic

Student Name
(LN, FN MI)

Laboratory Rm No. Subject Code

Subject Teacher

Date Submitted

Score
Objective:

To be able to know to compute using advance arithmetic particularly using the


multiplication and division process.

Material:
Emulator 8086

Introduction:

In this section you will know how to multiplyand divide numbers.

Mul Instruction

The mul instruction multiplies an 8-bit, 16-bit operand by either al, ax.

Instruction formats are:

MUL r/m8 ; r-register or memory[8 bits]

MUL r/m16 ; r-register or memory[16-bits]

Implied Operands:

Div Instruction
The div instruction performs 8-bit, 16-bit division on integers
A single operand is supplied which is assumed to be the divisor.
Instruction formats are:
DIV r/m8 ; r-register or memory[8-bits]
DIV r/m16 ; r-register or memory[16-bit]

Default Operands:

Conditional Jump:

Following are the conditional jump instructions used on signed data used for
arithmetic operations.

Following are the conditional jump instructions used on unsigned data used for
logical operations .
The following conditional jump instructions have special uses and check the
value of flags.
Sample Program:

Sample 1: Single Digit Input and Result

.data
multiplydb 13,10, ' MULTIPLICATION $'
firstdb 13,10,10, ' Enter First Number: $'
seconddb 13,10, ' Enter Second Number: $'
answerdb 13,10,10,10, ' The product is $'
num1db ?

.code mov ah, 01


int 21h
main:
mov ax, @data mov ah, 0
mov ds, ax and al, 0fh
mulbl
mov dx, offset multiply aam
mov ah, 09 and al, 0fh
int 21h mov num1, al

;multiplication mov dx, offset answer


mov dx, offset first mov ah, 09
mov ah, 09 int 21h
int 21h
mov al, num1
mov ah, 01
int 21h mov dl, al
mov ah, 02
movbl, al int 21h
andbl, 0fh
mov ah, 4ch
mov dx, offset second int 21h
mov ah, 09
int 21h
end main
Laboratory Exercise # 3
Advance Arithmetic Operation
Task:
Create a Menu Selection program that will allow the user to multiply and
divide single and double digit numbers. For the first number to enter it
should be double digit while the second number to enter should be a single
digit only.
Source Code:

Output:

Questions:
1. What particular commands did you use to make a selection?
Answer:

2. How did you multiply or divide a double digit value which is


basically a 16-bit register to the single digit number which is an 8-bit
register?
Answer:

3. How did you check if the input of the user is a number or a letter?
Answer:
4. In the given task what particular code or part of the code you have
difficulty dealing with?
Answer:

5. How did you solve the difficulty you encountered during making the
program?
Answer:

Observations:

Das könnte Ihnen auch gefallen