- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Program for adding 4 hex digits of a 16-bit number in 8085 Microprocessor
We write an 8085 assembly language program for the addition of 4 hex digits of a 16-bit number whose input is given from the keyboard and the result is displayed in the data field.
FILE NAME ADDHEX.ASM ORG C000H CURDT: EQU FFF9H UPDDT: EQU 06D3H GTHEX: EQU 052FH HXDSP: EQU 05A1H OBUFF: EQU FFFAH MVI A, 0EH SIM EI ; Unmask RST5.5 and enable interrupts MVI B, 00 CALL GTHEX ; Input a 4 digit number and display in address field CALL HXDSP ; Store the 4 hex digits in 4 locations starting from OBUFF LXI H, OBUUF MOV A, M MVI C, 03 AGAIN: INX H ADD M DCR C JNZ AGAIN ; When we are out of this loop, A will have the sum. STA CURDT CALL UPDDT ; Display sum in DATA field. HLT
In the above program we use the HXDSP monitor routine for the first time.
HXDSP monitor routine: This routine is used for the conversion of the value in DE register pair and which stores in the location of 4 bytes starting from the output buffer. The Least Significant unpacked hex byte gets stored in the Output Buffer. On the ALS kit the OBUFF is of location FFFAH, and HXDSP routine which STARTS AT 05A1H. Hence if (DE) + 3456, we will have
Advertisements