Routines |
Prev: 84F7 | Up: Map | Next: 851E |
Used by the routines at MenuWriteText, 8733, 890A, PrintStringColour, DrawGauge, HandlerScoreLabel, LaserBeam_Animate, 9EDC, A993, AD36 and ColourLevelsGreen.
|
||||||||||||
Converts a given pixel address to the associated attribute buffer address.
|
||||||||||||
AttributeAddress | 8506 | PUSH BC | Stash BC on the stack. | |||||||||
8507 | LD A,L | Horizontal co-ordinate. | ||||||||||
8508 | RRCA | Divide by 08. | ||||||||||
8509 | RRCA | |||||||||||
850A | RRCA | |||||||||||
850B | AND %00011111 | Keep only bits 0-4 (00-1F / minimum-maximum horizontal screen values). | ||||||||||
850D | LD L,A | Store this back in L. | ||||||||||
850E | LD A,H | Vertical co-ordinate. | ||||||||||
850F | RLCA | Multiply by 04. | ||||||||||
8510 | RLCA | |||||||||||
8511 | LD C,A | Store this in C temporarily. | ||||||||||
8512 | AND %11100000 | Keep only bits 5-7. | ||||||||||
8514 | OR L | Set the bits from L. | ||||||||||
8515 | LD L,A | L=A. | ||||||||||
8516 | LD A,C | Fetch the stored value from C. | ||||||||||
8517 | AND %00000011 | Keep only bits 0-1. | ||||||||||
8519 | OR %01011000 | Set MSB of the attribute buffer 58. This ensures our value is >= 5800. | ||||||||||
851B | LD H,A | Store this back in H. | ||||||||||
851C | POP BC | Restore BC from the stack. | ||||||||||
851D | RET | Return. | ||||||||||
Prev: 84F7 | Up: Map | Next: 851E |