Prev: B394 Up: Map Next: B3D3
B3B6: Attribute address of a pixel position
Used by the routines at SHOW_CARRIED and TEXT_ATTR_ADDR.
HL is kept. The same as Knight Lore's.
Input
H the pixel y, counted up from the bottom of the screen
L the pixel x
Output
DE the attribute address
CALC_ATTRIB_ADDR B3B6 PUSH HL Kept
B3B7 LD A,H H = (255 - y) / 8: the character row counted from the top, plus 8
B3B8 CPL
B3B9 LD H,A
B3BA SRL H
B3BC SRL H
B3BE SRL H
B3C0 SRL H Three more shifts across H and L: row * 32 + x / 8
B3C2 RR L
B3C4 SRL H
B3C6 RR L
B3C8 SRL H
B3CA RR L
B3CC LD DE,$5700 The attribute file less those 8 rows
B3CF ADD HL,DE
B3D0 EX DE,HL
B3D1 POP HL
B3D2 RET
Prev: B394 Up: Map Next: B3D3