Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Exp. No:
Basic Arithmetic Operations on two 16-bit data
Date:
Aim:
To write an assembly language program to find the sum, difference and product of two 16-
bit numbers and to divide a 16-bit number by another 16-bit number.
Apparatus Required:
Intel 8086 based ESA 86 Trainer Kit.
Algorithm:
1 Initialize the BX register with the offset of the starting address of the data.
2 Initialize the CL register with 00H to monitor whether the result will have a
carry or not.
3 Move the first operand to Accumulator (AX) from external data memory.
4 Update the BX register to access the second operand.
5 Add the content Memory pointed by BX Register with the current content of
Accumulator.
6 Check whether there is a carry. If there is no carry jump to Step 8 otherwise
continue.
7 Increment CL register content by 1.
8 Update the BX register to store the results.
9 Move the content of Accumulator to the next external data memory locations.
10 Move the content of CL register in to the next external data memory location.
11 Stop the program execution
1 Initialize the BX register with the offset of the starting address of the data.
2 Initialize the CL register with 00H to monitor whether the result will have a
borrow or not.
3 Move the first operand to Accumulator (AX) from external data memory.
4 Update the BX register to access the second operand.
5 Subtract the content Memory pointed by BX Register with the current content of
Accumulator.
6 Check whether there is a carry. If there is no carry jump to Step 9 otherwise
continue.
7 Find the two’s complement of Accumulator content
8 Increment CL register content by 1.
9 Update the BX register to store the results.
10 Move the content of Accumulator to the next external data memory locations.
11 Move the content of CL register in to the next external data memory location.
12 Stop the program execution.
1
EC2308: MICROPROCESSOR AND MICROCONTROLLER LAB
1 Initialize the SI register with the offset of the starting address of the data.
2 Move the first operand to Accumulator (AX) from external data memory.
3 Update the SI register to access the second operand.
4 Multiply the content Memory pointed by SI Register with the content of
Accumulator.
5 Update the SI register to store the results.
6 Move the content of Accumulator (AX) to the next external data memory
locations. (lower word of product)
7 Move the content of DX register in to the next external data memory locations.
(higher word of product)
8 Stop the program execution
1 Initialize the SI register with the offset of the starting address of the data.
2 Move the first operand to Accumulator (AX) from external data memory.
3 Convert the word operand in AX register to double word operand.
4 Update the SI register to access the second operand.
5 Divide the content of Accumulator by the content Memory pointed by SI
Register.
6 Update the SI register to store the results.
7 Move the content of Accumulator (AX) to the next external data memory
locations. (quotient)
8 Move the content of DX register in to the next external data memory locations.
(remainder)
9 Stop the program execution
2
EC2308: MICROPROCESSOR AND MICROCONTROLLER LAB
Program Name: 8086 – Basic Arithmetic Operations on 16-bit Binary Data
[AX] ←
2007 03 47 02 ADD AX, [BX]+02H [AX] + [ [BX]+02 ]
Check for carry
200A 73 02 JNC SKIP flag
Increment CL reg.
200C FE C1 INC CL by 1
[AX] ←
2007 2B 47 02 SUB AX, [BX]+02H [AX] - [ [BX]+02 ]
Check for carry
200A 73 04 JNC SKIP flag
Take 2’s
200C F7 D8 NEG AX complement of
[AX]
Increment CL reg.
200E FE C1 INC CL by 1
3
EC2308: MICROPROCESSOR AND MICROCONTROLLER LAB
[DX.AX] ←
2008 F7 E1 MUL CX [AX] × [CX]
[AX.DX] ←
2009 F7 F1 DIV CX [AX] ÷ [CX]
4
EC2308: MICROPROCESSOR AND MICROCONTROLLER LAB
5
EC2308: MICROPROCESSOR AND MICROCONTROLLER LAB
Result: