You are on page 1of 4

EXPERIMENT No.

1
AlM: Write a program in 8085 to add two 8 bit numbers using:

i) Immediate addrossing
ii) Direct addressing
ii) Indirect adiressing

ALGORITHM:

L. Start the microprocessor.

2. Intialize the carry as Zero.

3. The first 8 bit data into the accurmulator

Copy the contents of accumulator into the register B.

Load the second 8 bit data into the accumulator.

6. Add the 2-8 bit data and check for carry.

7. Jump on if no carry

8. Increment carry if there is any.

9 Store the added request in accumulator

10. More the carry value to accumulator


A
11. Store the carry value in accumulator.

12 Stop the program execution.

PROGRAM CODE:

#UsingInumediate Addressing:
AGdress Label Mnemonies Hex Code Comments
2000 MVI C,00 OL, 00 Initialize the carry as zero
2002 MVi A, 04 3E. 04 Load the first 8 bit data in acc
2004 MVI B.02 06,02 Load the first 8 bit data in
register B
2006 ADD B 80 Add the twovalucs
2007 JNC D2,03, 20 Jump on il no carry
200A INR carry is there ineremeníI
20013
by one
Loop STA 2500 32(R).29) Storc the added value in ihe
ccumulator
AP &MC Iat heniual| fCr Dept
200E
MOV A,CC 79 Move the valuc of cary to
the accumulator from
200F register C
STA 2501 32 ()1, 25) | Store the value of carry in
2012 HLT the accumulator
76 Stop the program cxccution
#Using Direct Addressing:
Address Label Mnemonics Hex Code
2000 Comments
2032 MVIC,00 CE, 00 Initialize the carry as zero
2005 LDA2500 3A, K00, 25) Load the first
MOV, B,A 47
8 bit data
Copy the value of 8 bit data
2006
LDA 2501 into register B
3A, (O1, 25) Load the second 8 bit data
2009 ADD B into the accumulator
200A 80 Add the two values
200D JNC D2.OE, 20
INR C Jump on i[ no carry
OC If carry is there increment it i
200E by one
Loop STA 2502 32 (02,25) Store the added valuc in the
2011 accumulator
MOV A,C 79 More the vatue of
carry to
the accumulator
from
2012 Tegister C
STA 2503
32(03, 25) Store the value of
carry in
2015 HLT theaccumulator
16 Stop the program execution

Using Direet, Addressinge


Address Label Mncmonies
2000 Hex Code
InitializeComments
MVI C,00 OE, 00
2002
LXI H, 2500
the carry as zero
21, (00,
25)Initialisc HlL reg. with
memory address of first
2005 number.
MOV B,M 46
Copy the value of 8 bit data
2006 into register B
INX H
23
Increment HL contents to
pont to next memory
2007 location.
ADD M 86
2008 Add the two values
JNC D2, 0C, 20
20013
INR( Jump on if no caTy
Ifearry is there increment
i
by one
2
M AM Io Munua' Ct Dep
200C Loop STA 2502 32 (02, 25) Store the added vnlue in the
200 MOV A,C Accumulator
79 More the value of
the
carry to
nccumulator
200F from rogister C
STA 2503 32 (03, 25) Store the valuc of
2012 the accumulator
carry in
HLT 76 Stop the program cxecution
Input
without Input Address Value
carry 2500 04
2501 02

Output Output Address Value


2502 06
2503 00 (carry)

With caTy
Input Address Value
2.500 FF
2501 F

Output Address Value


2502
2503
01(carry)
Calculation 1111 1111
1111 1111

(1) 1111 1110

F E

Result:
The assembly language program tor 8 bit addition of
numbers was exccuted successfully by two
using 8085 micro processing kit.
Viva Questions: MP &MCtab Manuul ttig

. Name the various


2.
registers of 8085.
Which stack is used in
3.
8085
What happens when HLT
instruction is executed in processor.
4.What is the Clock
frequency of 8085.
5. Nanie the
various flags of 8085
microprocessor
3

You might also like