Prev: E556 Up: Map Next: E596
E579: The attribute buffer address of a pixel position
Used by the routines at NEW_GAME, ENDING_PIT_FRONT and COLOUR_WALL.
The attribute buffer's rows are 24 bytes, row 0 the play area's bottom character row, so the attribute of a position is at ATTR_BUFFER plus (y - 72) / 8 * 24 plus x / 8 - 2. Worked as (y / 8) * 24 plus x / 8 plus a constant, the buffer's start less 9 rows and 2 bytes. Used for the knight's colour (NEW_GAME), the buildings' (COLOUR_WALL) and the ending's pictures' (ENDING_PIT_FRONT).
Input
L x
H y
Output
HL The address in the attribute buffer
ATTR_ADDRESS E579 PUSH BC HL = y with its low three bits cleared, times three: the character row times 24
E57A LD C,L
E57B LD A,H
E57C AND $F8
E57E LD L,A
E57F LD H,$00
E581 LD A,C
E582 LD C,L
E583 LD B,H
E584 ADD HL,HL
E585 ADD HL,BC
E586 SRL A Plus x / 8
E588 SRL A
E58A SRL A
E58C LD C,A
E58D LD B,$00
E58F ADD HL,BC
E590 LD BC,$EF6A Plus the buffer's start less 9 rows and 2 bytes
E593 ADD HL,BC
E594 POP BC
E595 RET
Prev: E556 Up: Map Next: E596