Prev: 57573 Up: Map Next: 57595
57582: Multiply A By DE
Used by the routine at FlipSprite.
Multiplies A by DE.
Input
A The first number
DE The second number
Output
HL The product
Clear the product and count the bits.
MultiplyAByDE 57582 LD HL,0 Set HL to 0000.
57585 LD B,8 Set B to 8.
Shift the product and add when the next bit is set.
MultiplyAByDE_Loop 57587 ADD HL,HL Double HL.
57588 RLCA Jump to MultiplyAByDE_Next if the carry flag is not set.
57589 JR NC,MultiplyAByDE_Next
57591 ADD HL,DE Add DE to HL.
MultiplyAByDE_Next 57592 DJNZ MultiplyAByDE_Loop Loop back until all the bits have been used.
57594 RET Return.
Prev: 57573 Up: Map Next: 57595