Prev: B99C Up: Map Next: BA34
B9EF: See if Ted is touching anything, and if so call the collision detection routine on attributes
Used by the routines at AA65 and BB17.
Input
HL Current screen address of Ted
DE Current graphic frame for Ted
C A mask denoting which bits should be considered in a clash
B9EF LD A,($A439) Get flags
B9F2 AND $EF Turn off bit 4
B9F4 LD ($A439),A Set it
B9F7 LD B,$10 16 lines to check
B9F9 LD A,(DE) Get the graphic
B9FA AND C Turn off bits we don't want
B9FB AND (HL) Turn off bits on screen not set to anything
B9FC PUSH HL Remember HL
B9FD CALL NZ,$BA3B If we have clashing pixels, do collision detection
BA00 INC L Next character
BA01 LD A,(DE) Get the graphic
BA02 CPL Turn off bits we don't want and are not in empty space
BA03 OR C
BA04 CPL
BA05 EX AF,AF' Remember A
BA06 INC DE Next frame pixels
BA07 LD A,(DE) Get the pixels
BA08 AND (HL) Is there a clash?
BA09 CALL NZ,$BA3B Call collision detection if so
BA0C INC L Next character
BA0D EX AF,AF' Restore A
BA0E AND (HL) Is there a clash?
BA0F CALL NZ,$BA3B Call collision detection if so
BA12 INC DE Next frame line
BA13 POP HL Restore HL
BA14 INC H Next line
BA15 LD A,H Have we done 8 lines?
BA16 AND $07
BA18 JR NZ,$BA24 Move on if so
BA1A LD A,L Get first line
BA1B ADD A,$20 Add offset to get second line
BA1D LD L,A Set it
BA1E JR C,$BA24 Move on if this is on the right of the screen
BA20 LD A,H Move back to leftmost character
BA21 SUB $08
BA23 LD H,A
BA24 DJNZ $B9F9 Loop round to next line
BA26 LD A,($A439) Get flags
BA29 BIT 4,A Is bit 4 still set?
BA2B JR NZ,$BA32 Move on if not
BA2D OR $08 Set bit 3 and store it
BA2F LD ($A439),A
BA32 XOR A
BA33 RET
Prev: B99C Up: Map Next: BA34