Exp no: 1 Program for 16-bit Addition & Subtraction in 8086 Microprocessor kit Aim : To write an Assembly Language Program for 16-bit Addition & Subtraction in 8086 Microprocessor kit Apparatus Required : 8086 Microprocessor Trainer Kit with Power Supply. Addition: Algorithm: 1. Start the Program 2. Initialize the contents of memory locations in AX & BX registers 3. Initialize the value 00 for CL register. 4. Add the value of AX and BX by using ADD Mnemonics and store the result in a memory location. 5. If there is carry Increment the value of CL register by 1, else move the content of AX to a location for result. 6. Move the value of CL to a location for output. 7. Stop the Program Program: Start: Mov AX,[2000H] Mov BX,[2002H] Mov CL,00
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Exp no: 1
Program for 16-bit Addition & Subtraction in 8086 Microprocessor kit
Aim:
To write an Assembly Language Program for 16-bit Addition & Subtraction in
8086 Microprocessor kit
Apparatus Required:
8086 Microprocessor Trainer Kit with Power Supply.
Addition:
Algorithm:
1. Start the Program
2. Initialize the contents of memory locations in AX & BX registers
3. Initialize the value 00 for CL register.
4. Add the value of AX and BX by using ADD Mnemonics and store the result in a
memory location.
5. If there is carry Increment the value of CL register by 1, else move the content of
AX to a location for result.
6. Move the value of CL to a location for output.
7. Stop the Program
Program:
Start: Mov AX,[2000H]
Mov BX,[2002H]
Mov CL,00
ADD AX,BX
JNC L1
INC CL
L1: Mov [2006H],AX
Mov [2008H],CL
End: HLT
Subtraction:
Algorithm:
1. Start the Program
2. Initialize the contents of memory locations in AX & BX registers
3. Initialize the value 00 for CL register.
4. Subtract the value of AX and BX by using SUB Mnemonics and store the result in
a memory location.
5. If there is carry Increment the value of CL register by 1, else move the content of
AX to a location for result.
6. Move the value of CL to a location for output.
7. Stop the Program
Program:
Strat: Mov AX,[2000H]
Mov BX,[2002H]
Mov CL,00H
SUB AX,BX
JNC L1
INC CL
L1: Mov [2006H],AX
Mov [2008H],CL
End: HLT
Result:
Thus the ALP to add and subtract 16 bit number using 8086 Microprocessor Kit
was written and executed successfully.
Exp no: 2
Program for 16-bit Division & Multiplication in 8086 Microprocessor kit.
Aim:
To write an Assembly Language Program for 16-bit Division & Multiplication in
8086 Microprocessor kit.
Apparatus Required:
8086 Microprocessor Trainer Kit with Power Supply.
Multiplication:
Algorithm:
1. start the program
2. initialize the contents for AX and BX from memory locations
3. Multiple the AX and BX value using MUL Mnemonics and store the result in a
memory location.
4. move the content of AX and DX to memory locations to check the result.
5. stop the program
Program:
Start: mov AX,[2000H]
mov BX,[2002H]
MUL BX
mov [2006H],AX
mov [2008H],DX
end: HLT
Division:
Algorithm:
1. start the program
2. initialize the contents for AX and BX from memory locations
3. Multiple the AX and BX value using MUL Mnemonics and store the result in a
memory location.
4. move the content of AX and DX to memory locations to check the result.
5. stop the program
Program:
Start: mov AX,[2000H]
mov BX,[2002H]
DIV BX
mov [2006H],AX
mov [2008H],DX
end: HLT
Result:
Thus the ALP to multiple and divide 16 bit number using 8086 Microprocessor Kit
was written and executed successfully.
Exp no: 3
Program for Ascending order and Descending order in 8086 Microprocessor kit.
Aim:
To write an Assembly Language Program for Ascending order and Descending
order in 8086 using MASM software.
Apparatus Required:
MASM Software
Ascending order:
Algorithm:
1. Start the program
2. Declare the set of elements in list and initialize the count value in the data
segment.
3. In code segment(CS), move the data segment values to data segment register.
4. Initialize the starting address of list to BX and count values to CX register.
5. Get the succesive elements in source index(BX) and sort the elements in
ascending order.
6. Termination interrupt is performed to terminate the program.
7. Stop the program.
Program:
Assume CS:code,DS:DataData Segment #Open the data segmentList dw 05h,07h,06h,02h #Declare the set of values to listCount equ 04h #Assign the control valuesData ends #end of data segmentCode segment #Open code segment
Start: Mov AX,data #Assign the value of data to DS through an
accumulatorMov DS,AX #Iniatilize AX value to DSMov DX,count-1 #Initialize the count register
L3 Mov CX,DX #Initialize the DX value to CXMov BX,offset list #Assign the first address of list to bx
L2 Mov AX,[BX] #Move the first value to AXCmp AX,[BX+2] #Compare AX with successive elementJL L1 #Jump if AX < [BX+2] the goto L1XCHG [BX+02],AX #excahnge the values of [BX],AXXCHG [BX],AX #excahnge the values of [BX],AX
L1 Add BX,02h #increment the value BX valueLoop L2 #goto L2Dec DX #Decrement by the value DxJNZ L3 #if DX is No Zere, goto L3Mov AH,4Ch #interrupt signalInt 21h # interrupt signalCode ends #end the code segment
End start #end of start
Descending order:
Algorithm:
1. Start the program
2. Declare the set of elements in list and initialize the count value in the data
segment.
3. In code segment(CS), move the data segment values to data segment register.
4. Initialize the starting address of list to BX and count values to CX register.
5. Get the succesive elements in source index(BX) and sort the elements in
descending order.
6. Termination interrupt is performed to terminate the program.
7. Stop the program.
Program:
Assume CS:code,DS:DataData Segment #Open the data segmentList dw 05h,07h,06h,02h #Declare the set of values to list
Count equ 04h #Assign the control valuesData ends #end of data segmentCode segment #Open code segment
Start: Mov AX,data #Assign the value of data to DS through an accumulator
Mov DS,AX #Iniatilize AX value to DSMov DX,count-1 #Initialize the count register
L3 Mov CX,DX #Initialize the DX value to CXMov BX,offset list #Assign the first address of list to bx
L2 Mov AX,[BX] #Move the first value to AXCmp AX,[BX+2] #Compare AX with successive elementJG L1 #Jump if AX > [BX+2] the goto L1XCHG [BX+02],AX #excahnge the values of [BX],AXXCHG [BX],AX #excahnge the values of [BX],AX
L1 Add BX,02h #increment the value BX valueLoop L2 #goto L2Dec DX #Decrement by the value DxJNZ L3 #if DX is No Zere, goto L3Mov AH,4Ch #interrupt signalInt 21h # interrupt signalCode ends #end the code segment
End start #end of start
Result:
Thus , the Assembly language program for sort the elements in ascending and
descending order was written , executed successfully and the output was verified.
Exp no:4
Program for String copy.
Aim:
To write an Assembly Language Program for String Copy in 8086 using MASM
software.
Apparatus Required:
MASM Software
Algorithm:
1. Start the program
2. In the data segment initialize the elements in array (source), initialize the
destination address to des and counter value.
3. In code segment(CS), move the data segment value to data segment register.
4. Initialize the starting address of source to SI and move the des, count value to
DI,CX.
5. Swap the elements to specified address with the use of cld rep MOVSW
command.
6. Use interrupt to terminate the program.
7. Stop the program.
Program:
Assume CS:code,DS:Data
Data segmentSource dw 01h,05h,06hDes equ 3000hCount equ 03hData endsCod segment
RESULT:Thus the ALP for reverse the string in 8086 was written and executed
successfully and the output was verified.
Exp no:6
Program for Searching an Element.
Aim:
To write an Assembly Language Program for Searching the given element in
8086 using MASM software.
Apparatus Required:
MASM Software
Algorithm:
1. Start the program.
2. Initialize all the elements of array and named them.
3. Define the messages in disp1 and disp2.
4. Initialize the counter value in data segment.
5. If counter reaches 0, goto step6, else do the following steps
Ø Load the list to accumulator and then load the counter value to counter register
Ø Compare the accumulator with given element, if it is present display the message as
“data is present” else jump to loop.
Ø If it is not present , display the message as “Data is not present”
6. Stop the program.
Program:
Assume cs: code, ds: dataData segmentList dw 05h, 06h, 07h, 08h, 09hDisp1 db “Data is present”,”&”Disp2 db “Data is not present”,”&”Count equ 05hData ends