![]() |
Routines |
| Prev: A149 | Up: Map | Next: A164 |
|
Used by the routine at BuildFlagMask.
Divides the bit index in HL by 08.
The byte offset is left in HL and the bit number in C.
|
||||||||||||||
| CalculateBitAddress | A155 | PUSH AF | Stash AF on the stack. | |||||||||||
| A156 | LD A,L | Keep the bit number within the byte (bits 0-2 of the bit index) in C. | ||||||||||||
| A157 | AND %00000111 | |||||||||||||
| A159 | LD C,A | |||||||||||||
| A15A | LD B,$03 | Count three right shifts. | ||||||||||||
| CalculateBitAddress_Loop | A15C | SRL H | Shift HL right by one bit. | |||||||||||
| A15E | RR L | |||||||||||||
| A160 | DJNZ CalculateBitAddress_Loop | Decrease the counter by one and loop back to CalculateBitAddress_Loop until the counter is zero. | ||||||||||||
| A162 | POP AF | Restore AF from the stack. | ||||||||||||
| A163 | RET | Return. | ||||||||||||
| Prev: A149 | Up: Map | Next: A164 |