Ex - No: Multi-Byte Addition in BCD Mode Date: Aim

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

EX.

NO: MULTI-BYTE ADDITION IN BCD MODE


DATE:

AIM:
To learn to write an assembly language program for adding two 24 bit numbers.

APPARATUS REQUIRED:
 8085 Microprocessor kit,
 Power supply

ALGORITHM:
 Start the program.
 Enter the 1st input in one memory location.
 Enter another input in other memory location.
 Add two inputs.
 Store the result and carry in different memory locations.
 Stop the program.

FLOWCHART:
START

Get the 1stnumber

Get the2ndnumber

Add two number

Is
carry=1

Store the carry

Store the result

STOP
PROGRAM

ADDRESS OPCODE LABEL MNEMONICS COMMENTS


4100 AF XRA A Start the accumulator
4101 21,50,41 LXI H, 4150 Load the HL pair into 4150
Move the content of M in
MOV B,M
4104 46 B
Load the XL pair into
LXI D, 4160
4105 11 4160
4106 60
4107 41
4108 23 INX H ;Increment the HL pair
4109 1A L1 LDAX D Load the AX pair into D
410A 8E ADC M Add C with the register
410B 77 MOV M,A Move the A contents to M
410C 23 INX H Increment H
410D 13 INX D Increment D
410E 05 DCR B Decrement B register
410F C2 JN2 LOOP Jump on to L1
4110 09
4111 41
4112 76 HLT ;Stop the execution

MANUAL CALCULATION:

DATA 1= 50 A4 H 29
DATA 2 =28 37 H FB (+)

SUM = 78 DC H 24
ADDRESS DATA
Input
4150 03
4151 29
4152 A4
4153 50
4160 FB
4161 37
4162 28
Output
4151 24
4152 DCH
4153 78

Result

Addition of two 24-bit numbers using 8085 is performed and the output is verified.

You might also like