[A83] Re: help for a routine
[Prev][Next][Index][Thread]
[A83] Re: help for a routine
guillaume.h@ifrance.com writes:
> Input :
> - h, e
> Output:
> - a=(h*256)/e
I don't see any shortcuts, so this should be the fastest way:
ld l,0
ld a,e
call _divHLbyA
This is the source to _divHLbyA (at least on the 86):
_divHLbyA:
push bc
ld c,a
sub a
ld b,16
_divHLbyA_loop:
add hl,hl
rla
cp c
jr c,_divHLbyA_jump
sub c
inc l
_divHLbyA_jump:
djnz _divHLbyA_loop
pop bc
ret
--
David Phillips <david@acz.org>
http://david.acz.org/
References: