[A83] Re: Help....!


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

[A83] Re: Help....!




At 05:40 PM 3/16/01 EST, you wrote:
>
>(clines) is one byte
>(lines) is one byte
>I need to create the following math problem:
>
>(clines) / (lines) * 32 + 21
>
>clines <= lines    <--- always
>
>the only problem is, _divHLbyA orounds to nearest integer, so it will always 
>be 0 or 1, considering (clines)/(lines) <1.  Please help.  Thanks
>
>-Joel
>
>
>

You might store then as *10 or *100 (probably *100) and then drop precision
in the part where you us eit. It keeps the numbers whole, thus improving
speed and program size.  If you REALLY want to do it that way, use the
fpmath romcalls:

ld hl,(lines)
call _setxxxxop2
ld a,(clines)
call _setxxop1
call _fpdiv
ld a,32
call _setxxop2
call _fpmult
ld a,21
call _setxxop1
call _fpadd
call _convop1
ld hl,de

That dumps the result into hl.  I think it might end up still being
integer, but it is more precise than just using registers.





References: