0% found this document useful (0 votes)
4 views2 pages

Mpi Program Ashish

The document outlines various experiments using the 8085 microprocessor, including 8-bit and 16-bit addition, subtraction, multiplication, and division, as well as operations on arrays. Each experiment includes an aim and a detailed program with addresses and explanations for the instructions used. The document serves as a guide for performing arithmetic operations and data manipulation using assembly language programming on the 8085 architecture.

Uploaded by

ashish.shonak037
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)
4 views2 pages

Mpi Program Ashish

The document outlines various experiments using the 8085 microprocessor, including 8-bit and 16-bit addition, subtraction, multiplication, and division, as well as operations on arrays. Each experiment includes an aim and a detailed program with addresses and explanations for the instructions used. The document serves as a guide for performing arithmetic operations and data manipulation using assembly language programming on the 8085 architecture.

Uploaded by

ashish.shonak037
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
You are on page 1/ 2

Experiment No: 1) 8-BIT ADDITION USING ACCUMULATOR Experiment No: 5) 8-BIT BCD ADDITION 7) 16 Bit ADDITION USING REGISTER

Experiment No: 5) 8-BIT BCD ADDITION 7) 16 Bit ADDITION USING REGISTER PAIR
AIM: To perform 8-bit Addition of two hexadecimal numbers using accumulator in 8085 3) 8-BIT SUBTRACTION USING ACCUMULATOR AIM: To perform addition of two 8-bit BCD numbers using 8085 microprocessor. AIM: To add two 16 bit numbers (4 digits) using the register pairs in 8085 microprocessor.
PROGRAM: AIM: To perform 8-bit Subtraction of two hexadecimal numbers using accumulator in 8085
PROGRAM: Address Program Explanation Address Program Explanation
LDA 8200 Load Data 1 into accumulator LHLD 8201 Load HL register pair with data in 8201 & 8202
LDA 8201 Load the first data in the accumulator
Address Program Explanation MOV Move Accumulator contents to Register B XCHG Exchange contents of HL with DE Register Pair
MOV B, A Move contents of Accumulator to B
LDA 9000 Load contents of address 9000 (Input l) into the accumulator LDA 8201 Load Data 2 into accumulator LHLD 8203 Load HL register pair with data in 8203 & 8204
LDA 8200 Load the second data in the accumulator
MOV Shift contents of accumulator to register B MVI A, 00 Set Accumulator , A = '0' for carry
MVI C, 00 Set C = '0' for carry MVI C, 00 Clear register C to account for Carry
LDA 9001 Load contents of address 9001 (Input 2) into the accumulator DAD D Double Addition
SUB B Subtract B from Accumulator & Store in Accumulator ADD B Add Data 2 to Data 1 and store in
ADD B Add data in B to accumulator & store in the accumulator Accumulator JNC Ahead If carry is not set go Ahead
STA 9002 Store the (Result) contents of accumulator to address 9002 JNC Ahead If carry is not set go Ahead INR A if carry = '1' , increment Accumulator to 01
DAA Convert the accumulator value to BCD value
JC Loci Jump to LOCI if carry is I INR C if carry = 'l' , increment register C to 01 Ahead SHLD 8205 Store contents of HL Register pair in Memory
JNC Ahead If , go Ahead
MVI A,oo Store value 00 in accumulator CMA Get 2's complement for Accumulator STA 8207 Store Register C (Carry) content to memory
INR C If Increment register C by I
STA 9003 Store the (Carry) contents of accumulator to address 9003 ADD 01 Add one to accumulator HLT End of program
Ahead STA 8203 Store Accumulator content (Result) to memory
HLT End of Program Ahead STA 8202 Store result in given location MOV Move contents of Register C to
Loc l: MVI A,01 Store value 01 in accumulator 8) 16 Bit HEXADECIMAL SUBTRACTION
MOV A,c Move carry to Accumulator Accumulator
STA 9003 Store the (Carry) contents of accumulator to address 9003 AIM: To subtract two 16-bit hexadecimal numbers using Accumulator with 8085 Microprocessor
STA 8203 Store Carry in given location STA 8204 Store Register C (Carry) content to memory
HLT End of Program
HLT End of Program HLT End of program Program
Program Explanation
Experiment No: 2 8-BIT ADDITION WITH MEMORY POINTER 4) 8-BIT SUBTRACTION WITH MEMORY POINTER Experiment No: 6) 16 BIT ADDITION USING ACCUMULATOR LDA 8202 Load contents of Accumulator with Lower byte of Data 2
AIM: To perform 8-bit Addition of two hexadecimal numbers using memory pointer in 8085 AIM: To perform 8-bit Subtraction of two hexadecimal numbers using memory pointer in 8085 AIM: To add two 16 bit numbers ( 4 digits) using the accumulator with 8085 microprocessor. MOV Move contents of Accumulator to Register B
PROGRAM: PROGRAM: PROGRAM: LDA 8200 Load contents of Accumulator with Lower byte of
Address Program Explanation Data 1
Address Program Explanation
Address Program Explanation LDA 8201 Get Data 1 (lower byte) into accumulator SUB B Subtract contents of B from Accumulator
LXI H, 8201 Setting pointer for data
LXI H, 8201 Setting pointer for getting data MOV Move Data to Register B from Accumulator STA 8204 Store Accumulator content (Lower byte of difference) to Memory
MVI C, 00 Clear register C to account for Carry
MVI C, OO Clearing register C for carry LDA 8203 Get Data 2 (lower byte) into accumulator LDA 8203 Load contents of Accumulator with Higher byte of Data 2
MOV A, M Get Data I into Accumulator
MOV A, M Getting Data 1 into the accumulator from memory ADD B Add Lower Bytes of Data 1 & Data 2 MOV Move contents of Accumulator to Register B
INX H Increment the memory pointer
INX H Increment pointer to the next memory location STA 8205 Store content of Accumulator , Lower Byte Result in Memory LDA 8201 Load contents of Accumulator with Higher byte of
SUB M Subtract Data 2 from Data I and store in Accumulator
ADD M Add second data to Accumulator and store it in accumulator Data 1
MVI C, 00 Set C = '0' for carry
JNC Ahead If carry==() , go Ahead
JNC Ahead If carry is 'O' , go to location 'Ahead' LDA 8202 Get Data 1 (higher byte) into accumulator
INRC If Increment register C by 1 SBB B Subtract contents of B from Accumulator along with Borrow, if any
INRC If carry is 'l ' , Increment register C to I MOV Move Data to Register B from Accumulator
CMA Get 2's complement for Accumulator data STA 8205 Store Accumulator content (Higher byte of difference) to Memory
Ahead INX H Increment pointer to the next memory location LDA 8204 Get Data 2 (higher byte) into accumulator
ADI 01 Add I to accumulator content HLT End of Program
MOV Store Sum in memory ADC B Add Higher Bytes of Data 1 & Data 2 with carry of Lower Bytes
Ahead INX H Increment the memory pointer
INX H Increment pointer to the next memory location STA 8206 Store content of Accumulator , Lower Byte
MOV Store Accumulator content (Result) to memory
MOV M,c Store Carry in memory Result in Memory
INX H Increment the memory pointer
HLT End of Program JNC Ahead If carry is not set go Ahead
MOV M,c Store Register C (Carry) content to memory
HLT End of program INR C if carry = 'I' , increment register C to 01
Ahead MOV A,c Move contents of Register C to Accumulator
STA 8207 Store Register C (Carry) content to memory
HLT End of program

11) ADDITION OF 'n' NUMBERS IN Array 13) LARGEST in Array


9) 8 BIT MULTIPLICATION AIM: To add 'n' numbers in array and find the sum of those numbers using 8085 Microprocessor with AIM: To find the Largest element in an array of size 'n' using 8085 Microprocessor. 15) 16 BIT ADDITION USING 8086
AIM: To multiply two 8-bit hexadecimal numbers using memory pointer with 8085 microprocessor memory pointer. AIM: To add two 16 bit numbers (4 digits) using the 8086 microprocessor.
PROGRAM: PROGRAM: Pro ram Explanation
Address Program Explanation
Address Program Explanation Address Program Explanation MOV Sl, 1500 Set source index as 1500
LXI H, 8200 Setting pointer for data
LXI H, 8201 Setting pointer for data LXI H, 8201 Setting pointer for data LODSW Load data from source memory and auto increment memory pointer
MOV Move number of data to Register B from
MVI C, 00 Clear register C to account for Carry MOV Move number of data to Register B from MOV AX,BX Move data from AX to BX
Memory
Memory
XRA A Set Accumulator to '0' to account for product INX H Increment the memory pointer LODSW Load data from source memo
MVI C, 00 Clear register C to account for Carry
MOV Move Data 1 to Register B from Memory MOV Move contents of memory to Accumulator ADD BX,AX Add contents of AX, BX
XRA A Set Accumulator to '0' to account for product
INX H Increment the memory pointer DCR B Decrement Register B content by I MOV
Repeat INX H Increment the memory pointer
MOV Move Data 2 to Register D from Memory Loop INX H Increment the memory pointer DI, 1520 Set Destination index as address in 1520
Repeat ADD D Add contents of Register D to Accumulator ADD M Add Contents of Memory to Accumulator & store in
CMP M Compare contents of memory with Accumulator MOV [DI], BX Move Result in BX to location pointed by Destination Index
Accumulator
JNC Ahead If carry==0 , go Ahead JNC Ahead If carry==0, go Ahead i.e., number is smaller INT 3 Break Point
JNC Ahead If carry==() , go Ahead
INR C If carry==l, Increment register C by I
INRC Increment register C by 1, If carry MOV Move contents of memory to Accumulator
Ahead DCR B Decrement Register B content by I 16) MOVE CONTENTS OF ARRAY
Ahead DCR B Decrement Register B content by 1
JNZ Repeat If B is not Zero, got back to Repeat Ahead DCR B Decrement Register B content by I AIM: To move contents of array from one memory location to another memory location.
JNZ Repeat If B is not Zero, got back to Repeat JNZ Loop If Register B is not equal to '0', go to Loop
INX H Increment the memory pointer
STA 8300 Store Accumulator content (Sum) to Memory STA 8300 Store Accumulator content (Sum) to Address Pro am Explanation
MOV Store Accumulator content (Product) to memory Memory
MOV A,c Move contents of Register C to Accumulator MOV CL, 08 Set number of data i.e., count
INX H Increment the memory pointer STA 8301 Store Accumulator content (Carry) to Memory HLT End of Program MOV Sl, 1400 Set source index as 1400
MOV M,c Store Register C (Carry) content to memory HLT End of Program MOV DI, 1450 Set Destination index as memo address 1500
HTL End of program
14) SORTING IN ASCENDING ORDER Loo LODSB Load data from source memo
12 ) SMALLEST In Array
AIM: To Sort an array of 'n' element in ascending order Move content of address pointed by destination Index to lower b
10 ) 8-BIT DIVISION AIM: To find the smallest element in an array of size 'n' using 8085 Microprocessor.
I-XI H, 8200 Setting pointer for data MOV [DI], AL te of accumulator
AIM: To divide two 8-bit hexadecimal numbers using 8085 microprocessor.
MOV Move contents of memory size of array to Register E
Address Program Explanation INC DI Increment Destination index
MOV Move number of data to Register B from Memo
Address Program Explanation LXI H, 8200 Setting pointer for data DEC CL Decrement count
Next MOV Move register E content to Register C
LDA 8201 Load contents of Accumulator with Divisor from memory MOV Move number of data to Register B from Memory INX H Increment the memory pointer JNC Loo Jum if not zero to Loo
MOV Move contents of Accumulator to Register B INX H Increment the memory pointer DCR C Decrement Register C b I INT 3 Break Point
LDA 8200 Load contents of Accumulator with Dividend from memory MOV Move contents of memory to Accumulator Com are MOV Move contents of memo to Accumulator
INX H Increment the memory pointer 17) SUM OF N CONSECUTIVE NUMBERS
MVI C, 00 Clear register C to account for Carry DCR B Decrement Register B content by I AIM: To find the sum of N consecutive numbers with 8086 microprocessor
CMP M Com are contents of memo with Accumulator
Again CMP B Compare Register B with Accumulator Loop INX H Increment the memory pointer JC Ahead Jum on Carry to Ahead
JC Store If , jump to Store CMP M Compare contents of memory with Accumulator MOV Move contents of Memory to Register D Address Pro ram Explanation
SUB B If carry==0, subtract Register B from Accumulator JC Ahead If carry==l , go Ahead i.e., number is larger MOV Move contents of Accumulator to Memo MOV Sl, 2000 Set source index as 2000
INR C Increment register C by 1 MOV Move contents of memory to Accumulator DCX H Decrement the memointer
MOV CL, s Move content of address pointed by source index to CL
MOV Move contents of Register D to Memo
JMP Again Jump to Again , unconditionally MOV AL,00 Clear AL to store sum
INX H Increment the memory pointer
Store STA 8203 Store Accumulator content (Reminder) to Ahead DCR B Decrement Register B content by I MOV BL, 01 Move 'l ' to BL , as it's the first number
Ahead DCR C Decrement Register C b 1
Memory JNZ Loop If Register B is not equal to '0', go to Loop LOOP ADD AL, BL Add content of BL to AL
JNZ Com are If Register C is note ual to '0', o to Com are
MOV A,c Move contents of Register C to Accumulator STA 8300 Store Accumulator content (Smallest No) to Memory DCR B Decrement Register B content b I INC BL increment BL
STA 8202 Store Accumulator content (Quotient) to HLT End of Program JNZ Next If Register B is note equal to '0', o to Next DEC CL Decrement the count
Memory HLT End of Program
JNZ LOOP Jum if not zero to Loo
HLT End of Program MOV DI, 2002 Set Destination index as memo address 2002
Move content of Register A to destination, which is the
MOV [DI], AX total sum
INT 3 Break Point
18) CONVERSION OF BCD TO HEXADECIMAL
AIM: To convert a BCD number into hexadecimal with 8086 microprocessor

Pro ram Explanation


MOV Sl, 1600 Set source index as 1600
MOV DI, 1500 Set Destination index as memo address 1500
MOV AL, Sl Load BCD number into AL register
MOV AH, AL Move content of AL to AH
AND AH, OF Mask MSD of BCD number
MOV BL, AH Save LSD in BL register
AND AL, FO Mask LSD of BCD number
MOV CL, 04 Load 04 to counter
ROR AL, CL rotate AL b counter times
MOV BH, OA move OA to BH register
MUL BH Multi I BH register
ADD AL, BL Add AL, BL
MOV DI , AL Move result to Destination
INT 3 Break Point

You might also like