![]() |
Routines |
| Prev: 47219 | Up: Map | Next: 47308 |
|
Used by the routines at HallOfFame, MenuWriteText, PrintStringColour, PrepDraw23, PrepDraw2 and DrawRoom.
Converts pixel coordinates into the address of the byte in the display file that holds the pixel.
|
||||||||||||||
|
The low byte is made up of the column (bits 0-4) and the character row within the third of the screen (bits 5-7).
|
||||||||||||||
| ScreenAddress | 47277 | LD A,L | A=L. | |||||||||||
| 47278 | RRCA | Divide the X coordinate by 8 to get the column. | ||||||||||||
| 47279 | RRCA | |||||||||||||
| 47280 | RRCA | |||||||||||||
| 47281 | AND %00011111 | Keep only bits 0-4. | ||||||||||||
| 47283 | LD L,A | L=A. | ||||||||||||
| 47284 | LD A,H | A=H. | ||||||||||||
| 47285 | RLCA | Multiply the Y coordinate by 4 which moves bits 3-5 into bits 5-7. | ||||||||||||
| 47286 | RLCA | |||||||||||||
| 47287 | AND %11100000 | Keep only bits 5-7. | ||||||||||||
| 47289 | OR L | Merge in the column. | ||||||||||||
| 47290 | LD L,A | L=A. | ||||||||||||
|
The high byte is made up of the third of the screen (bits 3-4) and the pixel line within the character (bits 0-2).
|
||||||||||||||
| 47291 | LD A,H | A=H. | ||||||||||||
| 47292 | AND %00000111 | Keep only bits 0-2 (the pixel line). | ||||||||||||
| 47294 | EX AF,AF' | Store the pixel line in AF'. | ||||||||||||
| 47295 | LD A,H | A=H. | ||||||||||||
| 47296 | RRCA | Divide the Y coordinate by 8. | ||||||||||||
| 47297 | RRCA | |||||||||||||
| 47298 | RRCA | |||||||||||||
| 47299 | AND %00011000 | Keep only bits 3-4 (the third of the screen). | ||||||||||||
| 47301 | OR %01000000 | Set bit 6 to point to the display file. | ||||||||||||
| 47303 | LD H,A | H=A. | ||||||||||||
| 47304 | EX AF,AF' | Fetch the pixel line from AF'. | ||||||||||||
| 47305 | OR H | Merge in the third of the screen. | ||||||||||||
| 47306 | LD H,A | H=A. | ||||||||||||
| 47307 | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: 47219 | Up: Map | Next: 47308 |