![]() |
Routines |
| Prev: CE06 | Up: Map | Next: CE1C |
|
Used by the routine at FlipSprite.
Multiplies A by DE.
|
||||||||||||||
|
Clear the product and count the bits.
|
||||||||||||||
| MultiplyAByDE | CE0D | PUSH BC | Stash BC on the stack. | |||||||||||
| CE0E | LD HL,$0000 | Set HL to 0000. | ||||||||||||
| CE11 | LD B,$08 | Set B to 08. | ||||||||||||
|
Shift the product and add when the next bit is set.
|
||||||||||||||
| MultiplyAByDE_Loop | CE13 | ADD HL,HL | Double HL. | |||||||||||
| CE14 | RLCA | Jump to MultiplyAByDE_Next if the carry flag is not set. | ||||||||||||
| CE15 | JR NC,MultiplyAByDE_Next | |||||||||||||
| CE17 | ADD HL,DE | Add DE to HL. | ||||||||||||
| MultiplyAByDE_Next | CE18 | DJNZ MultiplyAByDE_Loop | Jump to MultiplyAByDE_Loop until B is zero. | |||||||||||
| CE1A | POP BC | Restore BC from the stack. | ||||||||||||
| CE1B | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: CE06 | Up: Map | Next: CE1C |