Prev: D07B Up: Map Next: D0AC
D085: Steer towards the place in +15 and +16
Used by the routines at COLLECTABLE and BUCKET.
Sets the step in U to one unit towards the U in +15, and the step in V to one unit towards the V in +16. An axis already there keeps the step it had, which the callers have cleared the turn before, so the thing goes diagonally until one axis matches and then straight.
Input
IX the object record, with the target U and V in +15 and +16
HEAD_FOR_TARGET D085 LD A,(IX+$01) U: one unit down, or...
D088 CP (IX+$15)
D08B JR Z,HEAD_FOR_TARGET_1
D08D JR C,HEAD_FOR_TARGET_0
D08F LD (IX+$09),$FF
D093 JR HEAD_FOR_TARGET_1
HEAD_FOR_TARGET_0 D095 LD (IX+$09),$01 ...one unit up
HEAD_FOR_TARGET_1 D099 LD A,(IX+$02) V: one unit down, or...
D09C CP (IX+$16)
D09F RET Z
D0A0 JR C,HEAD_FOR_TARGET_2
D0A2 LD (IX+$0A),$FF
D0A6 RET
HEAD_FOR_TARGET_2 D0A7 LD (IX+$0A),$01 ...one unit up
D0AB RET
Prev: D07B Up: Map Next: D0AC