![]()  | 
Routines | 
| Prev: 47308 | Up: Map | Next: 47349 | 
| 
 
Used by the routines at 42624, ScoreLabelFlash, MenuWriteText, PrintStringColour, 47908 and DrawRoom.
 
 
  | 
||||||||||||
| 
 
Converts a given pixel address to the associated attribute buffer address.
 
 | 
||||||||||||
| AttributeAddress | 47325 | PUSH BC | Stash BC on the stack. | |||||||||
| 47326 | LD A,L | Horizontal co-ordinate. | ||||||||||
| 47327 | RRCA | Divide by 8. | ||||||||||
| 47328 | RRCA | |||||||||||
| 47329 | RRCA | |||||||||||
| 47330 | AND %00011111 | Keep only bits 0-4 (0-31 / minimum-maximum horizontal screen values). | ||||||||||
| 47332 | LD L,A | Store this back in L. | ||||||||||
| 47333 | LD A,H | Vertical co-ordinate. | ||||||||||
| 47334 | RLCA | Multiply by 4. | ||||||||||
| 47335 | RLCA | |||||||||||
| 47336 | LD C,A | Store this in C temporarily. | ||||||||||
| 47337 | AND %11100000 | Keep only bits 5-7. | ||||||||||
| 47339 | OR L | Set the bits from L. | ||||||||||
| 47340 | LD L,A | L=A. | ||||||||||
| 47341 | LD A,C | Fetch the stored value from C. | ||||||||||
| 47342 | AND %00000011 | Keep only bits 0-1. | ||||||||||
| 47344 | OR %01011000 | Set MSB of the attribute buffer 88. This ensures our value is >= 22528. | ||||||||||
| 47346 | LD H,A | Store this back in H. | ||||||||||
| 47347 | POP BC | Restore BC from the stack. | ||||||||||
| 47348 | RET | Return. | ||||||||||
| 
 
View the equivalent code in; 
 
 | 
||||||||||||
| Prev: 47308 | Up: Map | Next: 47349 |