Routines |
Prev: 9BC1 | Up: Map | Next: 9BEA |
Used by the routines at MenuWriteText, HandlerFoodItem, SetKeyPositions, SetEntityAttributes, PrintStringColour and DrawSidePanelAttrs.
|
||||||||||||
Converts a given pixel address to the associated attribute buffer address.
|
||||||||||||
AttributeAddress | 9BD2 | PUSH BC | Stash BC on the stack. | |||||||||
9BD3 | LD A,L | Horizontal co-ordinate. | ||||||||||
9BD4 | RRCA | Divide by 08. | ||||||||||
9BD5 | RRCA | |||||||||||
9BD6 | RRCA | |||||||||||
9BD7 | AND %00011111 | Keep only bits 0-4 (00-1F / minimum-maximum horizontal screen values). | ||||||||||
9BD9 | LD L,A | Store this back in L. | ||||||||||
9BDA | LD A,H | Vertical co-ordinate. | ||||||||||
9BDB | RLCA | Multiply by 04. | ||||||||||
9BDC | RLCA | |||||||||||
9BDD | LD C,A | Store this in C temporarily. | ||||||||||
9BDE | AND %11100000 | Keep only bits 5-7. | ||||||||||
9BE0 | OR L | Set the bits from L. | ||||||||||
9BE1 | LD L,A | L=A. | ||||||||||
9BE2 | LD A,C | Fetch the stored value from C. | ||||||||||
9BE3 | AND %00000011 | Keep only bits 0-1. | ||||||||||
9BE5 | OR %01011000 | Set MSB of the attribute buffer 58. This ensures our value is >= 5800. | ||||||||||
9BE7 | LD H,A | Store this back in H. | ||||||||||
9BE8 | POP BC | Restore BC from the stack. | ||||||||||
9BE9 | RET | Return. | ||||||||||
View the equivalent code in;
|
Prev: 9BC1 | Up: Map | Next: 9BEA |