![]() |
Routines |
| Prev: A115 | Up: Map | Next: A170 |
|
Used by the routines at FindBeamExtent, FadeOutPlayfield, ClearPlayfield, PrintText, SetSecondRowGroup, FindObjectScreenAddress, DrawSprites, AddToStack, BuildCarriedItemGraphic, DrawPiece, RunFrame, DrawShipTop, DrawSideFlames, DrawMainFlame, DrawBitmap, UpdateFuelGauge, FindSegmentAddress, DrawVerticalEdge and LookForGround.
Finds the address in the display file of a pixel position. The vertical position is the number of the row of pixels, counted from the top of the screen, so BF is the bottom row.
|
||||||||||||||
| GetScreenAddress | A149 | LD A,L | Fetch the horizontal position. | |||||||||||
| A14A | RRC A | Divide it by eight. | ||||||||||||
| A14C | RRC A | |||||||||||||
| A14E | RRC A | |||||||||||||
| A150 | AND %00011111 | Keep the five bits of the column. | ||||||||||||
| A152 | LD L,A | Store it in L. | ||||||||||||
| A153 | LD A,H | Fetch the vertical position. | ||||||||||||
| A154 | RLC A | Multiply it by four. | ||||||||||||
| A156 | RLC A | |||||||||||||
| A158 | AND %11100000 | Keep the bits that give the row of the cell. | ||||||||||||
| A15A | OR L | Combine them with the column. | ||||||||||||
| A15B | LD L,A | Store the low byte of the address. | ||||||||||||
| A15C | LD A,H | Fetch the vertical position. | ||||||||||||
| A15D | AND %00000111 | Keep the bits that give the pixel row within the cell. | ||||||||||||
| A15F | EX AF,AF' | Save them. | ||||||||||||
| A160 | LD A,H | Fetch the vertical position. | ||||||||||||
| A161 | RRC A | Divide it by eight. | ||||||||||||
| A163 | RRC A | |||||||||||||
| A165 | RRC A | |||||||||||||
| A167 | AND %00011000 | Keep the bits that give the third of the screen. | ||||||||||||
| A169 | OR %01000000 | Add the address of the display file. | ||||||||||||
| A16B | LD H,A | Store the high byte of the address. | ||||||||||||
| A16C | EX AF,AF' | Restore the pixel row. | ||||||||||||
| A16D | OR H | Combine it with the high byte. | ||||||||||||
| A16E | LD H,A | Store the high byte of the address. | ||||||||||||
| A16F | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: A115 | Up: Map | Next: A170 |