| ← B20D | Map | B283 → |
B269: Convert a brick's tile-map address to a screen pixel position
|
Converts a brick's tile-map address to its on-screen pixel position on the 16-pixel brick grid.
|
|||||||||||||
|
|||||||||||||
| brick_addr_to_pixel | B269 | LD DE,tilemap | Subtract the tile-map base, which leaves the cell offset in HL. | ||||||||||
| B26C | AND A | ||||||||||||
| B26D | SBC HL,DE | ||||||||||||
| B26F | LD A,L | Scale the column bits of the offset to the X pixel. A brick is 16 pixels wide. | |||||||||||
| B270 | AND $1F | ||||||||||||
| B272 | ADD A,A | ||||||||||||
| B273 | ADD A,A | ||||||||||||
| B274 | ADD A,A | ||||||||||||
| B275 | LD B,A | ||||||||||||
| B276 | SRL H | Scale the row bits of the offset to the Y pixel, 16 pixels per brick row. | |||||||||||
| B278 | RR L | ||||||||||||
| B27A | SRL H | ||||||||||||
| B27C | RR L | ||||||||||||
| B27E | LD A,L | ||||||||||||
| B27F | AND $F8 | ||||||||||||
| B281 | LD C,A | ||||||||||||
| B282 | RET | ||||||||||||
| ← B20D | Map | B283 → |
