HEX TO ASCII CONVERSION

To convert given Hexa decimal number into its equivalent ASCII number using
8085 instruction set.


ALGORITHM:
1. Load the given data in A- register and move to B – register
2. Mask the upper nibble of the Hexa decimal number in A – register
3. Call subroutine to get ASCII of lower nibble
4. Store it in memory

5. Move B –register to A – register and mask the lower nibble
6. Rotate the upper nibble to lower nibble position
7. Call subroutine to get ASCII of upper nibble
8. Store it in memory
9. Terminate the program.

PROGRAM:
LDA 4200 Get Hexa Data
MOV B,A
ANI 0F Mask Upper Nibble
CALL SUB1 Get ASCII code for upper nibble
STA 4201
MOV A,B
ANI F0 Mask Lower Nibble
RLC
RLC
RLC
RLC
CALL SUB1 Get ASCII code for lower nibble
STA 4202
HLT
SUB1: CPI 0A
JC SKIP
ADI 07
SKIP: ADI 30
RET

OBSERVATION:
Input: 4200 E4(Hexa data)
Output: 4201 34(ASCII Code for 4)
4202 45(ASCII Code for E)
HEX TO ASCII CONVERSION HEX TO ASCII CONVERSION Reviewed by enakta13 on August 20, 2012 Rating: 5

Search your question

Powered by Blogger.