Prev: 9BC1 Up: Map Next: 9BEA
9BD2: Convert pixel coordinates to an attribute file address
The same conversion as PIXEL_TO_SCREEN, but landing in the attribute file: $5800 + (y >> 3) * 32 + (x >> 3). Preserves BC.
Input
HL On entry H = y (0-191), L = x. On exit, the attribute address of that character cell.
PIXEL_TO_ATTR 9BD2 PUSH BC
9BD3 LD A,L
9BD4 RRCA
9BD5 RRCA
9BD6 RRCA
9BD7 AND $1F
9BD9 LD L,A
9BDA LD A,H
9BDB RLCA
9BDC RLCA
9BDD LD C,A
9BDE AND $E0
9BE0 OR L
9BE1 LD L,A
9BE2 LD A,C OR $58 rather than $40 -- the only real difference from PIXEL_TO_SCREEN.
9BE3 AND $03
9BE5 OR $58
9BE7 LD H,A
9BE8 POP BC
9BE9 RET
Prev: 9BC1 Up: Map Next: 9BEA