![]() |
Routines |
| Prev: 30085 | Up: Map | Next: 30137 |
|
Used by the routines at MenuWriteText, UpdateFlower, DisplayPlayerLives, PrintStringColour and SetUpPreviousSprite.
Converts a pixel position into an address in the screen buffer.
|
||||||||||||||
| ScreenAddress | 30106 | LD A,L | A=the X position. | |||||||||||
| 30107 | RRCA | Divide by 8 (to give the character column). | ||||||||||||
| 30108 | RRCA | |||||||||||||
| 30109 | RRCA | |||||||||||||
| 30110 | AND %00011111 | Keep only bits 0-4. | ||||||||||||
| 30112 | LD L,A | Store the column in L. | ||||||||||||
| 30113 | LD A,H | A=the Y position. | ||||||||||||
| 30114 | RLCA | Multiply by 4 so that bits 3-5 of the Y position are in bits 5-7. | ||||||||||||
| 30115 | RLCA | |||||||||||||
| 30116 | AND %11100000 | Keep only bits 5-7 (the character row within the third). | ||||||||||||
| 30118 | OR L | Combine with the column. | ||||||||||||
| 30119 | LD L,A | Store the result in L. | ||||||||||||
| 30120 | LD A,H | A=the Y position. | ||||||||||||
| 30121 | AND %00000111 | Keep only bits 0-2 (the pixel row within the character cell). | ||||||||||||
| 30123 | EX AF,AF' | Switch to the shadow AF register to keep the result. | ||||||||||||
| 30124 | LD A,H | A=the Y position. | ||||||||||||
| 30125 | RRCA | Divide by 8. | ||||||||||||
| 30126 | RRCA | |||||||||||||
| 30127 | RRCA | |||||||||||||
| 30128 | AND %00011000 | Keep only bits 3-4 (the third of the screen). | ||||||||||||
| 30130 | OR %01000000 | Set bit 6 to point at the screen buffer. | ||||||||||||
| 30132 | LD H,A | Store the result in H. | ||||||||||||
| 30133 | EX AF,AF' | Switch back to the saved pixel row. | ||||||||||||
| 30134 | OR H | Combine with the third of the screen. | ||||||||||||
| 30135 | LD H,A | Store the result in H. | ||||||||||||
| 30136 | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: 30085 | Up: Map | Next: 30137 |