Prev: A127 Up: Map Next: A144
A12D: Try Move
Moves an entity in the direction that it is heading, using MoveEntity, and then tests whether it has been blocked. An entity that is blocked by a cell of type 0F is allowed to carry on.
Input
B Number of steps that can still be taken
DE X position
HL Y position
Output
A The type of the cell that is blocking the entity
F The zero flag is set if the entity can carry on
TryMove A12D CALL MoveEntity Move using MoveEntity, and return if the entity can carry on.
A130 RET Z
A131 PUSH HL Save the Y position.
A132 LD HL,($962E) Fetch the address of the cell that blocked the entity...
A135 LD A,(HL) ...and fetch its type.
A136 AND $0F Keep the current type of the cell.
A138 POP HL Restore the Y position.
A139 CP $0F Return if the cell is not type 0F.
A13B RET NZ
A13C LD HL,($9655) Otherwise restore the Y position that the entity had before the move...
A13F LD DE,($9653) ...and the X position.
A143 RET Return with the zero flag set.
Prev: A127 Up: Map Next: A144