Re: A83: Opposite of _formreal
[Prev][Next][Index][Thread]
Re: A83: Opposite of _formreal
In a message dated 2/23/00 11:56:40 AM Eastern Standard Time, ahj@trition.dk
writes:
> Dose any one know of a romcall (or a routine) that dose the opposite of _
> formreal. A call that takes a string and converts it into a fp num.
> (I know of a routine for the 86 that dose the trick but a call would be
nice:
> ))
Wouldn't be too hard to right one. Just multiply a (or hl or whatever) by 10
and then add each digit until you reach the null terminator.
;de->start of string
ld hl,0
ld b,h
AddLineNum:
add hl,hl
ld b,h
ld c,l
add hl,hl
add hl,hl
add hl,bc ;hl=hl*10
ld a,(de)
sub '0'
jr c,DoneAddLineNum
ld c,a
add hl,bc ;add new number
inc de
jr AddLineNum
DoneAddLineNum:
----
Jonah Cohen
<ComAsYuAre@aol.com>
http://linux.hypnotic.org/~jonah/