You are on page 1of 2

ANAND ENGINEERING COLLEGE, AGRA

ELECTRONICS & COMMUNICATION DEPARTMENT

MICROPROCESSOR LAB (EEC-553)

EXPERIMENT NO: 4

OBJECT: Write a program using 8085 microprocessor to add an array of data and store
result in 16 bit.
APPARATUS REQUIRED: Microprocessor Kit, Power supply, Keyboard etc.

THEORY: If an array of numbers, stored in memory is added the result comes in more than 8
bit. After each addition we need to check the carry generated, also each carry generated are to
be accumulated. Suppose the array of 10 numbers are stored at memory locations 3000 to
3009, the result of addition is to be stored at 300A (lower byte) and 300B (Higher Byte).
For repeatedly calling and adding 10 numbers we can make a loop, which will run 10 times to
add 10 numbers.

PROCEDURE:
1. Connect the microprocessor kit with power supply.
2. Enter the program code properly at given memory locations.
3. Store the unknown numbers at input memory locations before executing the program.
4. Execute the program by: G starting address shift+4.
5. Check and verify the content of result memory locations.

ASSEMBLY LANGUAGE PROGRAM CODE:

1. Addition of an array of numbers

Algorithm:
1. Initialize a register to be used as loop counter.
2. Clear a register to accumulate carry generated.
3. Initialize memory pointer to start of data array location.
4. Clear the accumulator to store the sum generated.
5. Add first number to accumulator.
6. Check for carry. If carry is generated increment carry register.
7. Increment memory pointer, and decrement counter register by one.
8. Check if counter register is not zero, go back to add next number, otherwise come out of
loop.

Exp-4
Page 1 of 2
9. Store the result from Accumulator (lower Byte) and Carry register (Higher Byte) to
memory allocated for results.

Memory Machine
Assembly code Comments
Location code
2000 MVI C 0A 0E 05 Initialize loop counter
2001 MVI D 00 16 00 Clear carry reg.
2004 LXI H 3000 21 00 30 Initialize memory pointer
2007 MVI A 00 3E 00 Clear accumulator for sum
2009 (AGAIN) ADD M 86 Add a number from memory
200A JNC NEXT D2 0E 20 If no carry skip incrementing carry reg.
200D INR D 14 Increment carry reg.
200E (NEXT) INX H 23 Increment memory pointer
200F DCR C 0D Decrement loop counter
2010 JNZ AGAIN C2 09 20 If C≠00, go back and add next number
2013 MOV M,A 77 Store result (Lower byte ) to memory
2014 INX H 23 Increment pointer
2015 MOV M,D 72 Store result (higher byte) to memory
2016 RST 5 EF Stop the program

Observation Table

Input:
Memory Content Memory Content
Locations Locations
3000 3001
3002 3003
3004 3005
3006 3007
3008 3009

Output:
Memory Content Before After
Locations Execution Execution
300A Result (Lower Byte)
300B Result (Higher Byte)

RESULTS:

The contents of the memory registers are checked and results are verified.

Exp-4
Page 2 of 2

You might also like