![]() |
Routines |
| Prev: A164 | Up: Map | Next: A181 |
|
Used by the routine at GetRoomPointer.
HL=HL*DE. GetRoomPointer uses it to turn the current room number into an offset of 06 bytes per room in Table_RoomMap.
|
||||||||||||||
| MultiplyWords | A16D | PUSH BC | Stash BC on the stack. | |||||||||||
| A16E | LD B,$10 | Count 10 bits. | ||||||||||||
| A170 | LD A,H | Hold the first number in A and C. | ||||||||||||
| A171 | LD C,L | |||||||||||||
| A172 | LD HL,$0000 | HL=0000. | ||||||||||||
| MultiplyWords_Loop | A175 | ADD HL,HL | Shift the running total left by one bit. | |||||||||||
|
Test the next bit of the first number. When it is set, add the second number into the total.
|
||||||||||||||
| A176 | AND A | Clear the carry, then shift the next bit of the first number into it. Jump to MultiplyWords_Next when that bit is clear. | ||||||||||||
| A177 | RL C | |||||||||||||
| A179 | RLA | |||||||||||||
| A17A | JR NC,MultiplyWords_Next | |||||||||||||
| A17C | ADD HL,DE | Add the second number into the total. | ||||||||||||
| MultiplyWords_Next | A17D | DJNZ MultiplyWords_Loop | Decrease the bit counter by one and loop back to MultiplyWords_Loop until the counter is zero. | |||||||||||
| A17F | POP BC | Restore BC from the stack. | ||||||||||||
| A180 | RET | Return. | ||||||||||||
| Prev: A164 | Up: Map | Next: A181 |