Prev: CA35 Up: Map Next: CB41
CAF6: Check if enemy can be generated in a position
Used by the routine at CA69.
Output
A Enemy can be generated if A <> 0
CAF6 CALL $A6AB Computes into HL address position in tile type buffer based on (x,y) position on screen
CAF9 LD DE,$0060 Set HL to point under the feet of the enemy
CAFC ADD HL,DE
CAFD LD ($A22C),HL
CB00 LD A,(HL) Set A the tile type
CB01 CALL $CE17 Check if tile type is background
CB04 JP Z,$CB3F Jump if is a background tile
CB07 LD DE,$0020 Set HL to point in front the feet of the enemy
CB0A AND A
CB0B SBC HL,DE
CB0D LD A,(HL) Set A the tile type
CB0E OR A Check if tile type is background
CB0F JP NZ,$CB3F Jump if not a background tile
CB12 AND A Set HL to point in front the head of the enemy
CB13 SBC HL,DE
CB15 LD A,(HL) Set A the tile type
CB16 CALL $CE17 Check if tile type is background
CB19 JP NZ,$CB3F Jump if not a background tile
CB1C LD HL,($A22C) Recover base address under of the feet of enemy and increase pointer
CB1F INC HL
CB20 LD A,(HL) Set A the tile type
CB21 CALL $CE17 Check if tile type is background
CB24 JP Z,$CB3F Jump if is a background tile
CB27 LD DE,$0020 Set HL to point in front the feet of the enemy
CB2A AND A
CB2B SBC HL,DE
CB2D LD A,(HL) Set A the tile type
CB2E OR A Check if tile type is background
CB2F JP NZ,$CB3F Jump if not a background tile
CB32 AND A Set HL to point in front the head of the enemy
CB33 SBC HL,DE
CB35 LD A,(HL) Set A the tile type
CB36 CALL $CE17 Check if tile type is background
CB39 JP NZ,$CB3F Jump if not a background tile
CB3C LD A,$FF Return A = $FF so the enemy can be generated
CB3E RET
CB3F XOR A Return A = 0 so the enemy cannot be generated
CB40 RET
Prev: CA35 Up: Map Next: CB41