Prev: 39998 Up: Map Next: 40040
40008: Move entity at IY one step closer to home position
This routine moves an entity (whose complex state data is pointed to by IY) one character left or right, if such a move would take the x-coordinate of that entity's left edge closer to a value of 113. The entity will also be moved down by one character if the y-coordinate of its top edge is less than or equal to 111 (or the input value in A if we are entering this routine via 40010).
Used by the routine at 39776.
Input
A (Entry at 40010 only) Minimum allowed y-coordinate for entity's top edge
IY Address of complex state data for an entity
40008 LD A,111 Load A with 111 (minimum allowed y-coordinate)
This entry point is used by the routine at 39998.
40010 CP (IY+4) If y-coordinate of entity's top edge is greater than value in A...
40013 JR C,40018 ...then skip ahead to 40018
40015 CALL 39954 Move entity at IY down one character
40018 LD A,(IY+5) If x-coordinate of entity's left edge...
40021 CP 113 ...is 113...
40023 RET Z ...then return
40024 JR C,40033 ...else if greater than 113 then skip ahead to 40033
40026 DEC (IY+5) Move entity left one character...
40029 DEC (IY+7) ...
40032 RET Return
40033 INC (IY+5) Move entity right one character...
40036 INC (IY+7) ...
40039 RET Return
Prev: 39998 Up: Map Next: 40040