Prev: CEDB Up: Map Next: CF36
CF14: 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 CF14 INC HL Advance HL.
CF15 LD A,H A=H.
CF16 CP $58 Jump to TestAttributeAddress_Rows if A is not 58.
CF18 JR NZ,TestAttributeAddress_Rows
CF1A LD A,L A=L.
CF1B AND %11100000 Keep the bits of A that are set in E0.
CF1D CP $60 Jump to TestAttributeAddress_Outside if A is less than 60.
CF1F JR C,TestAttributeAddress_Outside
TestAttributeAddress_Inside CF21 DEC HL Step HL back.
CF22 OR %11111111 Set the bits of A that are set in FF.
CF24 RET Return.
TestAttributeAddress_Outside CF25 DEC HL Step HL back.
CF26 XOR A Clear A.
CF27 RET Return.
TestAttributeAddress_Rows CF28 LD A,H A=H.
CF29 CP $5A Jump to TestAttributeAddress_Inside if A is not 5A.
CF2B JR NZ,TestAttributeAddress_Inside
CF2D LD A,L A=L.
CF2E AND %11100000 Keep the bits of A that are set in E0.
CF30 CP $E0 Jump to TestAttributeAddress_Outside if A is E0 or more.
CF32 JR NC,TestAttributeAddress_Outside
CF34 JR TestAttributeAddress_Inside Jump to TestAttributeAddress_Inside.
Prev: CEDB Up: Map Next: CF36