![]() |
Routines |
| Prev: D826 | Up: Map | Next: D865 |
|
Used by the routines at PrintText and DisplayObjectsCarried.
Finds the address in the attributes of the character square that holds a pixel.
|
||||||||||||||
|
Convert the pixel position into a character-square address.
|
||||||||||||||
| CalculateAttributeAddress | D848 | PUSH HL | Stash HL on the stack. | |||||||||||
| D849 | LD A,H | Invert the pixel Y coordinate, to get the line from the top. | ||||||||||||
| D84A | CPL | |||||||||||||
| D84B | LD H,A | |||||||||||||
| D84C | SRL H | Move the line into the low bits of the high byte. | ||||||||||||
| D84E | SRL H | |||||||||||||
| D850 | SRL H | |||||||||||||
| D852 | SRL H | |||||||||||||
| D854 | RR L | Move the lowest bit of the line into the low byte. | ||||||||||||
| D856 | SRL H | Move the next bit. | ||||||||||||
| D858 | RR L | |||||||||||||
| D85A | SRL H | Move the next bit, so that HL holds the number of the square. | ||||||||||||
| D85C | RR L | |||||||||||||
| D85E | LD DE,$5700 | Point DE at the attributes of the screen, less one page. | ||||||||||||
| D861 | ADD HL,DE | Add the two. | ||||||||||||
| D862 | EX DE,HL | Put the address in DE. | ||||||||||||
| D863 | POP HL | Restore HL from the stack. | ||||||||||||
| D864 | RET | Return. | ||||||||||||
| Prev: D826 | Up: Map | Next: D865 |