![]() |
Routines |
| Prev: 41386 | Up: Map | Next: 41416 |
|
||||||||||||||||
| BuildFlagMask | 41396 | PUSH DE | Stash DE and BC on the stack. | |||||||||||||
| 41397 | PUSH BC | |||||||||||||||
| 41398 | EX DE,HL | Switch the flag table base into DE so HL can hold the bit index. | ||||||||||||||
| 41399 | LD L,A | Put the bit index into HL. | ||||||||||||||
| 41400 | LD H,0 | |||||||||||||||
| 41402 | CALL CalculateBitAddress | Call CalculateBitAddress to split the bit index into a byte offset (HL) and a bit number (C). | ||||||||||||||
| 41405 | ADD HL,DE | Point HL at the flag byte holding this bit. | ||||||||||||||
| 41406 | LD B,C | Use the bit number as the rotate count. | ||||||||||||||
| 41407 | INC B | Count one extra rotate so the mask lands on this bit. | ||||||||||||||
| 41408 | XOR A | Start the mask with no bits set. | ||||||||||||||
| 41409 | SCF | Seed a single set bit for the mask. | ||||||||||||||
| BuildFlagMask_0 | 41410 | RLA | Build the mask for this flag bit. | |||||||||||||
| 41411 | DJNZ BuildFlagMask_0 | Keep rotating until the set bit reaches this flag's position. | ||||||||||||||
| 41413 | POP BC | Restore BC and DE from the stack. | ||||||||||||||
| 41414 | POP DE | |||||||||||||||
| 41415 | RET | Return. | ||||||||||||||
| Prev: 41386 | Up: Map | Next: 41416 |