Prev: BD4B Up: Map Next: BD82
BD6A: Calculate Attribute Address
Finds the address in the attribute file of a pixel position.
Input
L Horizontal position in pixels
H Vertical position in pixels, from the top
Output
HL Attribute address
AttributeAddress BD6A PUSH BC Save BC.
BD6B LD A,L Divide the horizontal position by eight...
BD6C RRCA
BD6D RRCA
BD6E RRCA
BD6F AND $1F ...to find the column.
BD71 LD L,A
BD72 LD A,H Multiply the vertical position by four, keeping it in C.
BD73 RLCA
BD74 RLCA
BD75 LD C,A
BD76 AND $E0 Combine the bits of the character row with the column and store them in L.
BD78 OR L
BD79 LD L,A
BD7A LD A,C Find the third of the attribute file and add its base address.
BD7B AND $03
BD7D OR $58
BD7F LD H,A
BD80 POP BC Restore BC.
BD81 RET Return.
View the equivalent code in;
Prev: BD4B Up: Map Next: BD82