[A83] Re: Hex to decimal


[Prev][Next][Index][Thread]

[A83] Re: Hex to decimal




Nevermind I figured it out...if anyone has any optimization suggestions
feel free...
Thanks..
-Tom



;******************************
; Hex to decimal routine
;Inputs: A=1 less than number in hex
;C=number in decimal floating points format
;******************************
HexToDecimal:
 ld b,9
HexLoop:
 inc c
 dec a
 cp 0
 ret z ;Return if a=0
 djnz HexLoop
 ;c=9 now...increase first four bits, reset last four
 push af
 ld a,c
 and 11110000b
 add a,10h
 ld c,a
 ld b,9
 pop af
 jr HexLoop

Thomas Lutz wrote:

> What kind of code could I use for taking a hex value in the accumulator
> and transfering it to a real variable in floating point format? Thanks.
> -Tom




Follow-Ups: References: