Prev: CDD2 Up: Map Next: CE22
CDF5: Check if a tile is a wall or a background
Check if a tile is a wall. Used by the routines at C3C1, C433, C503, C691, CDB8, CDD2 and CE74.
Input
HL Address pointer of tile in the tile type buffer
Output
F Return Z:1 if tile type is in the list Z:0 if tile type is not in the list
A Return A=<tile type> if found ; A=0 if not found
CDF5 PUSH HL Save HL and BC
CDF6 PUSH BC
CDF7 LD A,(HL) Set A to the tile type pointed by HL
CDF8 LD B,$05 Set B to the number of tiles of type 'wall'
CDFA LD HL,$CE22 Set HL to the address pointer of the list of tiles 'wall'
Check if the tile type in A is in the list of B elements pointed by HL
CDFD LD C,$FF Check if A is equal to (HL)
CDFF CPI
CE01 JP Z,$CE0E Jump if so
CE04 DJNZ $CDFF Jump back and check next element
is not in the list
CE06 POP BC Restore BC
CE07 POP HL Restore HL
CE08 LD A,$01 Set flag Z=0
CE0A OR A
CE0B LD A,$00 Set A = $00
CE0D RET
is in the list
CE0E XOR A Set flag Z=1
CE0F DEC HL Set A to the tile type found
CE10 LD A,(HL)
CE11 LD ($A25D),A Set A25D the tile type found
CE14 POP BC Restore BC and HL
CE15 POP HL
CE16 RET
Check into the list of background tiles. Used by the routines at B694, BC48, C721, CAF6 and CEE5.
CE17 PUSH HL Save HL and BC
CE18 PUSH BC
CE19 LD A,(HL) Set A to the tile type pointed by HL
CE1A LD B,$09 Set B to the number of tiles of type 'background'
CE1C LD HL,$CE27 Set HL to the address pointer of the list of tiles 'background'
CE1F JP $CDFD Jump to check tile
Prev: CDD2 Up: Map Next: CE22