Prev: 53292 Up: Map Next: 53323
53310: Multiply A By DE
Multiplies A by DE.
Input
A The first number
DE The second number
Output
HL The product
Start with a product of zero, and count eight bits.
MultiplyAByDE 53310 LD HL,0 Set the product to 0.
53313 LD B,8 Set a count of 8.
Double the product, and add DE if the next bit of A is set.
MultiplyAByDE_Bit 53315 ADD HL,HL Double the product.
53316 RLCA Move the next bit of the first number into the carry flag.
53317 JR NC,MultiplyAByDE_Next Jump to MultiplyAByDE_Next if it is not set.
53319 ADD HL,DE Add the second number.
Count down the bits.
MultiplyAByDE_Next 53320 DJNZ MultiplyAByDE_Bit Jump to MultiplyAByDE_Bit until all the bits are done.
53322 RET Return.
Prev: 53292 Up: Map Next: 53323