EXP2 - HEX To ASCII Conversion
EXP2 - HEX To ASCII Conversion
Ex
(1F)H 3146
Since HEX numbers are 0-9 then A-F which gives as two ASCII ranges (30-39 for 0-9,41 to 46
for A-F) we need to compare each value with 10 if it is lower than 10 ASCII is 30 +Value else
ASCII is 41h+ value - Ah or 37+value
In this experiment we convert only numbers from 00-0F .
Example
1
1<10 then ASCII = 30+1= 31
B
B>10 then ASCII = 37+B = 42h
Experiment:
Convert the series of hex numbers in memory 1200 to 120F to ASCII and store the results
in 1300-130F
Flow chart
Start
Set SI = 1200
DI = 1300
Set counter CL=0F
AL < 0A No AL = AL + 07H
yes
AL = AL+ 30H
Store AL ->
[DI]
DCR CL
If CL=0
END
Instruction used in this experiment
1- INC , DEC:
INC REG
DEC REG
INC MEM
DEC MEM
REG could be 8 bit [AL, AH, BL, BH, CL, CH, DL, DH] or 16 bit [AX, BX, CX, DX, SP,
BP, SI, DI]
Procedure
Discussion