![]() |
Routines |
| Prev: 76D0 | Up: Map | Next: 7702 |
|
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 | 76E3 | LD A,L | Fetch the horizontal co-ordinate. | |||||||||
| 76E4 | RRCA | Divide by 08 (to get the column). | ||||||||||
| 76E5 | RRCA | |||||||||||
| 76E6 | RRCA | |||||||||||
| 76E7 | AND %00011111 | Keep only bits 0-4. | ||||||||||
| 76E9 | LD L,A | Store the column in L. | ||||||||||
| 76EA | LD A,H | Fetch the vertical co-ordinate. | ||||||||||
| 76EB | RLCA | A=A * 04. | ||||||||||
| 76EC | RLCA | |||||||||||
| 76ED | AND %11100000 | Keep only bits 5-7. | ||||||||||
| 76EF | OR L | Combine with the column in L. | ||||||||||
| 76F0 | LD L,A | Store the result in L. | ||||||||||
| 76F1 | LD A,H | Fetch the vertical co-ordinate. | ||||||||||
| 76F2 | AND %00000111 | Keep only bits 0-2 (the pixel row within the character cell). | ||||||||||
| 76F4 | EX AF,AF' | Switch to the shadow AF register to hold the pixel row. | ||||||||||
| 76F5 | LD A,H | Fetch the vertical co-ordinate. | ||||||||||
| 76F6 | RRCA | Divide by 08 (to get the third of the screen). | ||||||||||
| 76F7 | RRCA | |||||||||||
| 76F8 | RRCA | |||||||||||
| 76F9 | AND %00011000 | Keep only bits 3-4. | ||||||||||
| 76FB | OR %01000000 | Set bit 6. | ||||||||||
| 76FD | LD H,A | Store the result in H. | ||||||||||
| 76FE | EX AF,AF' | Switch to the shadow AF register to fetch the pixel row. | ||||||||||
| 76FF | OR H | Combine with H. | ||||||||||
| 7700 | LD H,A | Store the result in H. | ||||||||||
| 7701 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 76D0 | Up: Map | Next: 7702 |