Prev: 8914 Up: Map Next: 893B
8920: Is there a block at a height in a cell?
Used by the routines at MOVE_OBJECT, RISE, STEP_UP and TEST_BELOW.
Height 6 is the open sky, always empty; above it, always solid, and so is height -1 ($FF), which is how the ground holds things up. Anywhere outside the walls is empty.
Input
A The height
DE The cell: E is x, D is y
Output
F Carry set if there is a block
TEST_MAP_BIT 8920 CP $06
8922 JR NC,TEST_MAP_BIT_2
8924 INC A
8925 LD B,A
8926 BIT 7,D Outside the walls: empty.
8928 JR Z,TEST_MAP_BIT_1
892A LD A,E
892B RLA
892C RET NC
892D RR D The cell's address.
892F RRA
8930 LD E,A
8931 LD A,(DE)
TEST_MAP_BIT_0 8932 RRCA Rotate the height's bit into the carry.
8933 DJNZ TEST_MAP_BIT_0
8935 RET
TEST_MAP_BIT_1 8936 AND A
8937 RET
TEST_MAP_BIT_2 8938 RET Z Heights 6 and up.
8939 CCF
893A RET
Prev: 8914 Up: Map Next: 893B