Faculty of Engineering Mahsa University
Faculty of Engineering Mahsa University
Faculty of Engineering Mahsa University
MAHSA UNIVERSITY
BEE 3013
LAB MANUAL
Year 3
Semester 1
1|Page
Doc No:
MAHSA/ENG/FM/
Date:
2|Page
EXPERIMENT 3: ARITHMETIC OPERATION OF TWO 16-BIT NUMBERS USING
8086 MICROPROCESSORS
Experiment 3.1 for 8086 Microprocessor
Objective: To understand how arithmetic operations are performed in assembly language
using 8086 simulators.
Equipment required: PC with 8086 Microprocessor Simulator
Procedure:
1. RUN THE FOLLOWING ASSEMBLY CODE
LABEL MNEMONICS
START: MOV AX, 4343H
SUB AX, BX
LABEL MNEMONICS
START: MOV AX, 0043H
MUL BX
LABEL MNEMONICS
START: MOV AX, 0043H
DIV BX
1|Page
2. CAPTURE AND DISCUSS THE RESULT IN THE LAB REPORT.
2|Page
Figure (4) Subtract the first number from the second and store it at AX.
3|Page
Figure (3) Store the second value at BX.
Figure (4) Multiply the first number and the second and store at AX.
4|Page
Figure (2) Store the first value at AX.
Figure (4) Divide the first number by the second and store at AX.
5|Page
3. DISCUSSION:
In this experiment, to understand how arithmetic operations are performed in
assembly language using 8086 simulators, the program is to perform several arithmetic
operations, subtract, multiply, addition, and division operations.
The code is an assembly code used to subtract two numbers, the first step, the
assembly code, and the emulation window indicating the start of the program. And then by
moving the value (4343H) to AX using (MOV) command, the H will be assigned to (43) and
the L will be assigned to (43), then by moving the value (1111H) to Bx using (MOV)
command, the H will be assigned to (11) and the L will be assigned to (11).
So, to subtract both values in AX and Bx, by using the (SUB) command, then the
resulted value will always be stored at the accumulator, and in the case of 8086, the
accumulator is AX, (4343H – 1111H = 3232H), 32 stored at L, and 32 stored at H.
The code is an assembly code used to multiply two numbers, the first step, the
assembly code, and the emulation window indicating the start of the program. And then by
moving the value (0043H) to AX using (MOV) command, the H will be assigned to (00) and
the L will be assigned to (43), then by moving the value (0011H) to Bx using (MOV)
command, the H will be assigned to (00) and the L will be assigned to (11).
So, to multiply both values in AX and Bx, by using the (MUL) command, then the
resulted value will always be stored at the accumulator, and in the case of 8086, the
accumulator is AX, (0043H × 0011H = 0473H), 04 stored at L, and 73 stored at H.
The code is an assembly code used to divide two numbers, first step, the assembly
code and the emulation window indicating the start for the program. And then by moving the
value (0043H) to AX using (MOV) command, the H will be assigned to (00) and the L will
be assigned to (43), then by moving the value (0011H) to Bx using (MOV) command, the H
will be assigned to (00) and the L will be assigned to (11).
6|Page
So, to divide both values in AX and Bx, by using the (DIV) command, then the
resulted value will always be stored at the accumulator, and in the case of 8086, the
accumulator is AX, (0043H ÷ 0011H = 0003H), 00 stored at L, and 03 stored at H.
7|Page
Experiment 3.2 for 8086 Microprocessor
Objective: To write an assembly language to solve arithmetic operations of (6 * 5) – (12 / 4)
and store the result in the CX register in 8086 microprocessors.
Equipment required: PC with 8086 Microprocessor Simulator
Procedure:
1. DRAW A FLOWCHART BASED ON THE QUESTIONS.
START
END
8|Page
2. WRITE THE ASSEMBLY CODE TO SOLVE THE ARITHMETIC
OPERATIONS.
LABEL MNEMONICS FUNCTION
MOV AX, CX Move the new value from AX to CX and halt the
program.
3. CALCULATIONS:
Hexadecimal Values:
Decimal Values:
9|Page
4. CAPTURE AND DISCUSS THE RESULT IN THE LAB REPORT.
10 | P a g e
Figure (4) Divide AX by Bx and store the value at AX.
11 | P a g e
Figure (7) Store 05H at Bx.
Figure (8) Multiply AX and Bx together and store the value at AX.
12 | P a g e
5. DISCUSSION:
In this experiment, to write an assembly language to solve arithmetic operations for
the given problem (6 × 5) – (18 ÷ 4) and store the result in CX register in 8086
microprocessors.
The code is assembly code used with a compound of three arithmetic operations
subtraction, multiplication, and division to solve several numbers, first step, the assembly
code and the emulation window indicating the start for the program, move the value of 12 (18
in decimal) to AX using (MOV) command, the H will be (00) and the L will be (12), and
move the value of 02 to Bx using (MOV) command, the H will be (00) and the L will be (02),
then divide AX value (12) by Bx value (02) using (DIV) command, and store the value at AX
(12H ÷ 02H = 09H), 00 is assigned to (H) and 09 is assigned to (L), then move the value to
CX.
Then, Move the value of 06 to AX using the (MOV) command, the H will be (00) and
the L will be (06), and move the value of 05 to Bx using (MOV) command, the H will be (00)
and the L will be (05), then multiply AX value (06) with Bx value (05) using (MUL)
command, and store the value at AX (06H × 05H = 1EH), 00 is assigned to (H) and 1E is
assigned to (L).
Then, subtract the value stored at AX (1E) from the value stored at CX (09) using the
(SUB) command, the manual calculation is as follow (1EH – 09H = 15H), the value stored at
AX, (00) is assigned to (H) and (15) is assigned to L, then move the value stored at AX back
to CX and halt the program.
6. CONCLUSION:
In summary, the objective of those experiments 3.1 and 3.2, to understand
how arithmetic operations are performed in assembly language using 8086 simulators, and to
write an assembly language to solve arithmetic operations of (6 * 5) – (12 / 4).
The 8086 microprocessor is used to copy the data and perform arithmetic operations,
the results are always stored at the accumulator register, and in 8086 microprocessors, the
accumulator is AX register, for experiment 3.1 is used to perform an individual operand, and
obtain the output stored at Ax, but in experiment 3.2 is used to perform several operands and
obtain the output stored at AX register.
13 | P a g e