0% found this document useful (0 votes)
11 views7 pages

8086 Microprocessor Arithmetic Operations

The document outlines an experiment using the 8086 microprocessor to perform basic arithmetic operations including addition, subtraction, multiplication, division, and 1's complement. It details the objectives, theory, apparatus, code examples, and results of each operation, emphasizing the status of flag registers after each calculation. The conclusion highlights the importance of understanding these operations and the role of flags in indicating the outcomes.

Uploaded by

Takrim hassan
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)
11 views7 pages

8086 Microprocessor Arithmetic Operations

The document outlines an experiment using the 8086 microprocessor to perform basic arithmetic operations including addition, subtraction, multiplication, division, and 1's complement. It details the objectives, theory, apparatus, code examples, and results of each operation, emphasizing the status of flag registers after each calculation. The conclusion highlights the importance of understanding these operations and the role of flags in indicating the outcomes.

Uploaded by

Takrim hassan
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

Experiment No: 02

Experiment Name: Introduction to basic arithmetic operation by using 8086.


Objective:
• To understand how arithmetic operations are done by using machine language.
• To understand the 1’s complement of a binary number.
• To understand the status of flag resisters after every operation.
Theory: The 8086 microprocessor is a 16-bit microprocessor that supports various
arithmetic operations. The arithmetic operations are fundamental to computer
programming and are executed using specific instructions. The operations performed
include:
• Addition: The ADD instruction is used to add two operands.
• Subtraction: The SUB instruction is used to subtract one operand from
another.
• Multiplication: The MUL instruction is used for unsigned multiplication.
• Division: DIV instruction is used for unsigned division.
• 1's Complement: The NOT instruction is used to find the 1's complement of
a binary number.
Addition and subtraction can be done in any of the AX and BX registers. For
multiplication and division only AX register can be used.
For the 8086-destination register is the place where any kind of operation is executed.
If any operation, has output of more than 16 bits then extra bits is stored to DX register.
The flag registers in the 8086 microprocessors to indicate the status of the processor
after arithmetic operations.
The important flags include:
• Carry Flag (CF): Indicates a carry out of the most significant bit.
• Zero Flag (ZF): Indicates if the result is zero.
• Sign Flag (SF): Indicates if the result is negative.
• Overflow Flag (OF): Indicates an overflow in signed arithmetic operations.
Apparatus:
• Emulator 8086 software
• A computer with Windows/Linux operating system

Code:
ADDITION operation:
MOV AX, 32Ah
MOV BX, 32Ah
ADD AX, BX

SUB TRACTION operation:


MOV AX, 35Ah
MOV BX, 32Ah
SUB AX, BX

MULTIPLE operation:
MOV AX, 2Ah
MOV BX, 2Bh
MUL BX
MOV AX, 2Ah
MOV BX,35Ah
MUL BX
MOV AX,32Ah
MUL AX

DIVISION operation:
MOV AX, 2Bh
MOV BX, 2Ah
DIV BX

MOV AX, 2Ah


MOV BX, 2Bh
DIV BX
INVERSION operation:
MOV AX, 10010011b
NEG AX

Emulations:

ADDITION
SUBTRACTION

MULTIPLICATION
DIVISION
INVERSION

Discussion: The operations were executed using 8086 microprocessors emulator. Each
arithmetic operation was performed one after another and on different window and the
results were stored in the result variable. The flags were pushed onto the stack after each
operation to observe their status.

• Addition: The addition of 32Ah and 32Ah resulted in 684h. The Carry Flag (CF)
was cleared, indicating no carry occurred. Parity flag is 1 as there is an even
number of 1 bit. Auxiliary flag is 1which indicate the result has carried from 3rd
bit to 4th bit. And interrupt is enabled.

• Subtraction: The subtraction of 32Ah from 35Ah resulted in 30h. The Zero Flag
(ZF) was cleared, indicating the result was not zero. Another subtraction of 35Ah
from 32Ah resulted in FFD0h. Here, Carry flag is 1 which means there is a borrow
occurring when execute the operation. Sign flag is 1 so the number is negative.
• Multiplication: The multiplication of 2Ah and 2Bh resulted in 070Eh. The
Overflow Flag (OF) was cleared, indicating no overflow occurred. Then, 2Ah
was multiplied by 35Ah. The result was 8CC4. Next square of 32Ah has been
done and the result is 02E4 and the extra bits are 0A stored in DX register. Here,
Carry flag is on as carry is created overflow flag is on as signed arithmetic is
overflowed.
• Division: The division of 2Bh by 2Ah resulted in 01h with a remainder of 01h.
The Zero Flag (ZF) was cleared, indicating the result was not zero. And the
division of 2Ah by 2Bh resulted in 0h with a remainder of 2Ah. As the divided
number is large
• 1's Complement: The 1's complement of 93h was calculated as FF6Dh. The
carry flag is 1 (produced carry). Sign flag is 1, number is negative. Auxiliary flag
is 1 which means there is a carry from 3 to 4 bit.
The basic arithmetic operations of addition, subtraction, multiplication, and division
were demonstrated using 8086 microprocessors. The 1's complement of a binary
number was also calculated. The status of the flag registers was observed after each
operation, providing valuable information regarding the results.
Conclusion: This highlighted the functionality of 8086 microprocessors in performing
fundamental arithmetic operations and the importance of flag registers indicating the
status of these operations. The status of the flags after each operation was crucial for
understanding the outcome of the arithmetic operations. The flags provided insights into
the results, such as whether an overflow occurred or if the result was zero.

References:
• Microprocessors and Interfacing by Douglas V Hall
SSSP Rao
• Assembly Language Programming and Organization of the IBM PC
by Ytha Yu
Charles Marut

You might also like