MP Experiment 3
MP Experiment 3
MP EXPERIMENT NO:03
Aim: Write an 8086 assembly program to perform 16-bit arithmetic operations.
Theory:
8086 Microprocessor is an enhanced version of 8085 Microprocessor that was designed by
Intel in 1976. It is a 16-bit Microprocessor having 20 address lines and16 data lines that
provides up to 1MB storage. It consists of powerful instruction set, which provides operations
like multiplication and division easily.
It supports two modes of operation, i.e. Maximum mode and Minimum mode. Maximum
mode is suitable for system having multiple processors and Minimum mode is suitable for
system having a single processor.
Features of 8086
The most prominent features of an 8086 microprocessor are as follows −
➢ It has an instruction queue, which is capable of storing six instruction bytes from the
memory resulting in faster processing.
➢ It was the first 16-bit processor having 16-bit ALU, 16-bit registers, internal data bus,
and 16-bit external data bus resulting in faster processing.
➢ It is available in 3 versions based on the frequency of operation −
❖ 8086 → 5MHz
❖ 8086-2 → 8MHz
❖ (c)8086-1 → 10 MHz
➢ It uses two stages of pipelining, i.e. Fetch Stage and Execute Stage, which improves
performance.
➢ Fetch stage can prefetch up to 6 bytes of instructions and stores them in the queue.
➢ Execute stage executes these instructions.
➢ It has 256 vectored interrupts.
➢ It consists of 29,000 transistors.
Comparison between 8085 & 8086 Microprocessor
➢ Size − 8085 is 8-bit microprocessor, whereas 8086 is 16-bit microprocessor.
➢ Address Bus − 8085 has 16-bit address bus while 8086 has 20-bit address bus.
➢ Memory − 8085 can access up to 64Kb, whereas 8086 can access up to 1 Mb of
memory.
➢ Instruction − 8085 doesn’t have an instruction queue, whereas 8086 has an
instruction queue.
➢ Pipelining − 8085 doesn’t support a pipelined architecture while 8086 supports a
pipelined architecture.
➢ I/O − 8085 can address 2^8 = 256 I/O's, whereas 8086 can access 2^16 = 65,536 I/O's.
➢ Cost − The cost of 8085 is low whereas that of 8086 is high.
1
Name- Tanmay Keny Roll no.- 29 XIE I’d- 202001053
Architecture of 8086
The following diagram depicts the architecture of a 8086 Microprocessor −
2
Name- Tanmay Keny Roll no.- 29 XIE I’d- 202001053
ADDITION:
ADD:- add byte or word
ADC:- add with carry
ADC:- add with carry:-
➢ Mnemonic:- ADC destination, source.
➢ Algorithm:- destination= destination+source+CY.
➢ Flags:- all flags are affected
➢ Operation:- destination <-- destination+source+CY.
➢ Addressing mode:- register immediate addressing mode
➢ Example:-
ADD BL,CL :- this instruction adds the data in register CL and BL and contents of CY
(AL <-- AL+BL+CY)
SUBTRACTION:
SUB:- subtract byte or word
SBB:- subtract word or byte with borrow
➢ Mnemonic:- SBB destination , source
➢ Algorithm:- destination = destination - source - CY
➢ Flags:- SF flag is not affected
➢ Addressing mode:- Register Addressing mode.
➢ Operation:- destination - source - CY
(This instruction subtracts a source and carry flag from the destination)
➢ Example:- SBB BL,CL
MULTIPLICATION:
MUL:- multiply byte or word unsigned
❖ Multiply byte unsigned:
➢ Mnemonic:- MUL source
➢ Algorithm:- when operand is a byte:
AX=AL*operand
➢ Addressing mode: register addressing mode
This instruction multiplies an unsigned byte from source with an unsigned byte in the
AL register .
When a byte is multiplied by content of AL, the result is stored in AX. The MSB of the
result is stored in AH and the LSB of result is stored in the AL register.
The source can be a register or memory location.
➢ Example:- MUL CX
DIVISION:
DIV:- divide byte or word unsigned
➢ Mnemonic:-DIV source
➢ Algorithm:-
When operand is a byte:
AL=AX/operand (quotient)
AH = remainder (modulus)
➢ Flags:- all flags are undefined
➢ Addressing mode: Register addressing mode
3
Name- Tanmay Keny Roll no.- 29 XIE I’d- 202001053
Output:
Addition:
Subtraction:
4
Name- Tanmay Keny Roll no.- 29 XIE I’d- 202001053
Multiplication:
Division:
Conclusion:
After the completion of this experiment we were able to do arithmetic operations on 16 bit
numbers using the assembly level language in 8086 microprocessor.
Why do we need arithmetic instructions?
➢ Arithmetic instructions are needed to deal with different data located in memory
addresses. They helps us in addition, subtraction, increment, decrement of Data.