Prev: C9CA Up: Map Next: CB52
CB03: Check if enemy can be generated in a position
Used by the routines at CA13 and CA71.
Output
A Enemy can be generated if A <> 0
CB03 CALL $A503 Computes into HL address position in tile type buffer based on (x,y) position on screen
CB06 LD DE,$0061 Set HL to point in front-under the feet of the enemy
CB09 ADD HL,DE
CB0A LD ($A093),HL
CB0D LD A,(HL) Set A the tile type
CB0E CALL $D08B Check if tile type is background
CB11 JP Z,$CB50 Jump if not a background tile
CB14 LD DE,$0020 Set HL to point in front the feet of the enemy
CB17 AND A
CB18 SBC HL,DE
CB1A LD A,(HL) Set A the tile type
CB1B CALL $D08B Check if tile type is background
CB1E JP NZ,$CB50 Jump if not a background tile
CB21 AND A Set HL to point in front the head of the enemy
CB22 SBC HL,DE
CB24 LD A,(HL) Set A the tile type
CB25 CALL $D08B Check if tile type is background
CB28 JP NZ,$CB50 Jump if not a background tile
CB2B LD HL,($A093) Recover base address in front-under of the feet of enemy and increase pointer
CB2E INC HL
CB2F LD A,(HL) Set A the tile type
CB30 CALL $D08B Check if tile type is background
CB33 JP Z,$CB50 Jump if not a background tile
CB36 LD DE,$0020 Set HL to point in front the feet of the enemy
CB39 AND A
CB3A SBC HL,DE
CB3C LD A,(HL) Set A the tile type
CB3D CALL $D08B Check if tile type is background
CB40 JP NZ,$CB50 Jump if not a background tile
CB43 AND A Set HL to point in front the head of the enemy
CB44 SBC HL,DE
CB46 LD A,(HL) Set A the tile type
CB47 CALL $D08B Check if tile type is background
CB4A JP NZ,$CB50 Jump if not a background tile
CB4D LD A,$FF Return A = $FF so the enemy can be generated
CB4F RET
CB50 XOR A Return A = 0 so the enemy cannot be generated
CB51 RET
Prev: C9CA Up: Map Next: CB52