Prev: 52955 Up: Map Next: 53046
53012: Test Attribute Address
Used by the routines at PaintOneColumn, PaintTwoColumns and PaintThreeColumns.
Tests the attribute address after the one in HL. The top three rows of attributes and the last row are not part of the area where the terrain is drawn.
Input
HL Attribute address
Output
F Zero if the next address is outside the area of the terrain
TestAttributeAddress 53012 INC HL Advance HL.
53013 LD A,H A=H.
53014 CP 88 Jump to TestAttributeAddress_Rows if A is not 88.
53016 JR NZ,TestAttributeAddress_Rows
53018 LD A,L A=L.
53019 AND %11100000 Keep the bits of A that are set in 224.
53021 CP 96 Jump to TestAttributeAddress_Outside if A is less than 96.
53023 JR C,TestAttributeAddress_Outside
TestAttributeAddress_Inside 53025 DEC HL Step HL back.
53026 OR %11111111 Set the bits of A that are set in 255.
53028 RET Return.
TestAttributeAddress_Outside 53029 DEC HL Step HL back.
53030 XOR A Clear A.
53031 RET Return.
TestAttributeAddress_Rows 53032 LD A,H A=H.
53033 CP 90 Jump to TestAttributeAddress_Inside if A is not 90.
53035 JR NZ,TestAttributeAddress_Inside
53037 LD A,L A=L.
53038 AND %11100000 Keep the bits of A that are set in 224.
53040 CP 224 Jump to TestAttributeAddress_Outside if A is 224 or more.
53042 JR NC,TestAttributeAddress_Outside
53044 JR TestAttributeAddress_Inside Jump to TestAttributeAddress_Inside.
Prev: 52955 Up: Map Next: 53046