12-09-2009, 10:03 AM
Ok, this is an interesting issue. I tried a supposed faster 8-bit multiplication taken from internet, but it was failing, so I implemented another by myself.
Let me repost your code here, for better clarification:
I will later study this case.
Let me repost your code here, for better clarification:
Code:
LD HL,0
LD DE, (NUM2)
LD A, (NUM1)
LOOP:
RR A ; (Divide A by 2 - copying the 1's column bit into the carry flag.)
JR NC, JP1; (Jump over the add if we have to)
ADD HL,DE
JP1:
RET Z ; (Leave when we finish - A has gone to zero)
SLA E
RL D ; Multiply DE*2
JR LOOP
I will later study this case.