Prev: 41289 Up: Map Next: 41316
41301: Calculate Bit Address
Used by the routine at BuildFlagMask.
Divides the bit index in HL by 8.
The byte offset is left in HL and the bit number in C.
Input
HL Bit index
Output
HL Byte offset
C Bit number within the byte
CalculateBitAddress 41301 PUSH AF Stash AF on the stack.
41302 LD A,L Keep the bit number within the byte (bits 0-2 of the bit index) in C.
41303 AND %00000111
41305 LD C,A
41306 LD B,3 Divide the bit index in HL by eight (three passes, counted in B) to give the offset of the byte holding the flag.
CalculateBitAddress_0 41308 SRL H
41310 RR L
41312 DJNZ CalculateBitAddress_0
41314 POP AF Restore AF from the stack.
41315 RET Return.
Prev: 41289 Up: Map Next: 41316