Prev: 48459 Up: Map Next: 48514
48490: 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 48490 PUSH BC Save BC.
48491 LD A,L Divide the horizontal position by eight...
48492 RRCA
48493 RRCA
48494 RRCA
48495 AND 31 ...to find the column.
48497 LD L,A
48498 LD A,H Multiply the vertical position by four, keeping it in C.
48499 RLCA
48500 RLCA
48501 LD C,A
48502 AND 224 Combine the bits of the character row with the column and store them in L.
48504 OR L
48505 LD L,A
48506 LD A,C Find the third of the attribute file and add its base address.
48507 AND 3
48509 OR 88
48511 LD H,A
48512 POP BC Restore BC.
48513 RET Return.
View the equivalent code in;
Prev: 48459 Up: Map Next: 48514