Prev: 9AA5 Up: Map Next: 9ABA
9AAD: 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 9AAD LD HL,$0000 HL=0000.
9AB0 LD B,$08 B=08 (the number of bits in the first number).
MultiplyAByDE_Loop 9AB2 ADD HL,HL Shift the result left.
9AB3 RLCA Rotate the next bit of A into the carry flag.
9AB4 JR NC,MultiplyAByDE_Next Jump to MultiplyAByDE_Next if it was not set.
9AB6 ADD HL,DE Add DE to the result.
MultiplyAByDE_Next 9AB7 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.
9AB9 RET Return.
Prev: 9AA5 Up: Map Next: 9ABA