Prev: ABE5 Up: Map Next: AC75
AC68: Multiply A By DE
Used by the routines at Position_Rope_End and Move_Rope.
Multiplies A by DE, by adding DE to the product for each bit of A that is set. The product is a word.
Input
A The first number
DE The second number
Output
HL Product
MultiplyAByDE AC68 LD HL,$0000 Set the product so far to 00.
AC6B LD B,$08 Set the number of bits to 08.
MultiplyAByDE_Loop AC6D ADD HL,HL Double the product.
AC6E RLCA Move the next bit of the first number into the carry.
AC6F JR NC,MultiplyAByDE_Next Jump to MultiplyAByDE_Next if the bit is clear.
AC71 ADD HL,DE Add the second number to the product.
MultiplyAByDE_Next AC72 DJNZ MultiplyAByDE_Loop Decrease the bit counter and loop back until all eight bits of the first number have been used.
AC74 RET Return.
Prev: ABE5 Up: Map Next: AC75