![]() |
Routines |
| Prev: 39873 | Up: Map | Next: 39914 |
|
Used by the routines at MenuWriteText, HandlerFoodItem, SetKeyPositions, SetEntityAttributes, PrintStringColour and DrawSidePanelAttrs.
|
||||||||||||
|
Converts a given pixel address to the associated attribute buffer address.
|
||||||||||||
| AttributeAddress | 39890 | PUSH BC | Stash BC on the stack. | |||||||||
| 39891 | LD A,L | Horizontal co-ordinate. | ||||||||||
| 39892 | RRCA | Divide by 8. | ||||||||||
| 39893 | RRCA | |||||||||||
| 39894 | RRCA | |||||||||||
| 39895 | AND %00011111 | Keep only bits 0-4 (0-31 / minimum-maximum horizontal screen values). | ||||||||||
| 39897 | LD L,A | Store this back in L. | ||||||||||
| 39898 | LD A,H | Vertical co-ordinate. | ||||||||||
| 39899 | RLCA | Multiply by 4. | ||||||||||
| 39900 | RLCA | |||||||||||
| 39901 | LD C,A | Store this in C temporarily. | ||||||||||
| 39902 | AND %11100000 | Keep only bits 5-7. | ||||||||||
| 39904 | OR L | Set the bits from L. | ||||||||||
| 39905 | LD L,A | L=A. | ||||||||||
| 39906 | LD A,C | Fetch the stored value from C. | ||||||||||
| 39907 | AND %00000011 | Keep only bits 0-1. | ||||||||||
| 39909 | OR %01011000 | Set MSB of the attribute buffer 88. This ensures our value is >= 22528. | ||||||||||
| 39911 | LD H,A | Store this back in H. | ||||||||||
| 39912 | POP BC | Restore BC from the stack. | ||||||||||
| 39913 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 39873 | Up: Map | Next: 39914 |