Prev: D135 Up: Map Next: D174
D157: Attribute address of a pixel position
Used by the routines at SCENE_SPARKS, PRINT_TEXT and SHOW_CARRIED.
HL is kept. As Knight Lore's calc_attrib_addr.
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 D157 PUSH HL Kept
D158 LD A,H H = (255 - y) / 8: the character row counted from the top, plus 8
D159 CPL
D15A LD H,A
D15B SRL H
D15D SRL H
D15F SRL H
D161 SRL H Three more shifts across H and L: row * 32 + x / 8
D163 RR L
D165 SRL H
D167 RR L
D169 SRL H
D16B RR L
D16D LD DE,$5700 The attribute file less those 8 rows
D170 ADD HL,DE
D171 EX DE,HL
D172 POP HL
D173 RET
Prev: D135 Up: Map Next: D174