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