Program for adding 2 numbers input from keyboard in 8085 Microprocessor


We write an 8085 assembly language program of two input using two 2-digit hexadecimal numbers from the keyboard and then we add and the output results in the address field.

FILE NAME ADD2NUM.ASM
ORG C000H
CURAD: EQU FFF7H
UPDAD: EQU 06BCH
CLEAR: EQU 044AH
GTHEX: EQU 052FH
MVI A, 0EH
SIM
EI ; Unmask RST5.5 and enable interrupts
MVI B, 01
CALL GTHEX ; Input a 2 digit number and display in data field
MOV A, E
STA C100H ; Store the 2-digit hex number in C100H
MVI B, 01
CALL GTHEX ; Input a 2 digit number and display in data field
LDA C100H
ADD E
STA CURAD ; Add the two numbers and store in CURAD
JNC SKIP
MVI A, 01
STA CURAD+1 ; If Carry =1, store 1 in CURAD+1
SKIP: CALL CLEAR ; Blank the entire display
CALL UPDAD ; Display sum in address field.
HLT

 

Updated on: 30-Jul-2019

482 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements