Prev: 39589 Up: Map Next: 39610
39597: Multiply A By DE
Used by the routines at DrawChicken and FindLastRow.
Multiplies A by DE.
Input
A The first number
DE The second number
Output
HL The result
MultiplyAByDE 39597 LD HL,0 HL=0000.
39600 LD B,8 B=8 (the number of bits in the first number).
MultiplyAByDE_Loop 39602 ADD HL,HL Shift the result left.
39603 RLCA Rotate the next bit of A into the carry flag.
39604 JR NC,MultiplyAByDE_Next Jump to MultiplyAByDE_Next if it was not set.
39606 ADD HL,DE Add DE to the result.
MultiplyAByDE_Next 39607 DJNZ MultiplyAByDE_Loop Decrease the bit counter by one and loop back to MultiplyAByDE_Loop until every bit of the first number has been used.
39609 RET Return.
Prev: 39589 Up: Map Next: 39610