![]() |
Routines |
| Prev: 30416 | Up: Map | Next: 30466 |
|
Used by the routines at PrintTileBlock, MenuWriteText, DisplayPlayerLives, PrintStringColour, PrepareOldSprite and PrepareActorSprite.
Converts the pixel co-ordinates to the address in the screen buffer of the byte which contains that pixel.
|
||||||||||||
| ScreenAddress | 30435 | LD A,L | Fetch the horizontal co-ordinate. | |||||||||
| 30436 | RRCA | Divide by 8 (to get the column). | ||||||||||
| 30437 | RRCA | |||||||||||
| 30438 | RRCA | |||||||||||
| 30439 | AND %00011111 | Keep only bits 0-4. | ||||||||||
| 30441 | LD L,A | Store the column in L. | ||||||||||
| 30442 | LD A,H | Fetch the vertical co-ordinate. | ||||||||||
| 30443 | RLCA | A=A * 4. | ||||||||||
| 30444 | RLCA | |||||||||||
| 30445 | AND %11100000 | Keep only bits 5-7. | ||||||||||
| 30447 | OR L | Combine with the column in L. | ||||||||||
| 30448 | LD L,A | Store the result in L. | ||||||||||
| 30449 | LD A,H | Fetch the vertical co-ordinate. | ||||||||||
| 30450 | AND %00000111 | Keep only bits 0-2 (the pixel row within the character cell). | ||||||||||
| 30452 | EX AF,AF' | Switch to the shadow AF register to hold the pixel row. | ||||||||||
| 30453 | LD A,H | Fetch the vertical co-ordinate. | ||||||||||
| 30454 | RRCA | Divide by 8 (to get the third of the screen). | ||||||||||
| 30455 | RRCA | |||||||||||
| 30456 | RRCA | |||||||||||
| 30457 | AND %00011000 | Keep only bits 3-4. | ||||||||||
| 30459 | OR %01000000 | Set bit 6. | ||||||||||
| 30461 | LD H,A | Store the result in H. | ||||||||||
| 30462 | EX AF,AF' | Switch to the shadow AF register to fetch the pixel row. | ||||||||||
| 30463 | OR H | Combine with H. | ||||||||||
| 30464 | LD H,A | Store the result in H. | ||||||||||
| 30465 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 30416 | Up: Map | Next: 30466 |