A82: fast multiply...
[Prev][Next][Index][Thread]
A82: fast multiply...
Hello!
As the Z80 doesn't have a multiply instruction (which is almost
necessary for star-scrolls and things like that) then I've tried to do
my own routines. It surely works, but I think it takes more than 80
cycles to execute. (here's the code:)
Multiply:
; Multiplies b and de and gives the product in hl
ld hl,0
ld a,1
mulloop:
ld c,a
and b
jr z,noadd
add hl,de
noadd:
ld a,c
sla e
rl d
add a,a
jr nc,mulloop
ret
Someone must have written a faster way of mulitplying two 8-bit numbers
than this, or...? If so, could you reply to this and show your routines?
(by the way: is there a fast way for integer division, too?)
Lars Ahlzen
lars.ahlzen@swipnet.se
Follow-Ups: