EX.
NO: 16-BIT ADDITION USING 8085
DATE:
AIM:
To learn to write an assembly language program for adding two sixteen 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
;Load the HL register in
LHLD 4200 H
4100 2A,00.42 ;4200
4103 EB XCHG ;Exchange the contents
4104 2A,02,42 LHLD4202 H ;load the register in4202
4107 AF XRA A
4108 19 DAD D ;Add D with register
;Store the HL register
JNC L1
4109 D2,0D,41 in4204
;Increment the
INR A
410C 3C ;accumulator
;Store the HL register pair
L1 SHLD 4204 H ;location 4204 in the
410D 22,04,42 ;memory
;Store the accumulator
STA 4206 H ;location 4206 in the
4110 32,06,42 ;memory
4113 76 HLT ;Stop the execution
MANUAL CALCULATION:
DATA 1= 1C 15 H
DATA 2 =5A B7 H (+)
SUM = 76 CC H
ADDRESS DATA
Input
4200 15 H (LSB OF DATA 1)
4201 1C H (MSB OF DATA 1)
4202 B7 H (LSB OF DATA 2)
4203 5A H (MSB OF DATA 2)
Output
4204 CC H (LSB OF SUM)
4205 76 H (MSB OF SUM)
Result
Addition of two 16-bit numbers using 8085 is performed and the output is verified.