← B20D Detonate the bomb prize: clear the eight slots around the hit slot Map B283 → Score an ordinary brick, but not a revealed prize glyph
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.
Input
HL the brick's tile-map address
Output
B the brick's screen X position in pixels
C the brick's screen Y position in pixels
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 Detonate the bomb prize: clear the eight slots around the hit slot Map B283 → Score an ordinary brick, but not a revealed prize glyph
Fork me on GitHub