Prev: D9EB Up: Map Next: DAB7
DA7A: The update routine for the knight's legs (graphics 16-21, 24-29)
The knight's own routine. At a new life ARRIVING counts up from 40 by two a turn while he appears; at 76 it is set to 112 and he is here. Until then he cannot move, and the sound of his arrival (ARRIVE_SOUND) plays. Once here: the faster walk counts down, and when it runs out his top speed is 10 again and his speed 8; then the controls are read (READ_CONTROLS) and acted on in turn -- turning the town round (TURN_TOWN), turning (TURN_KNIGHT), walking or coming to a stop (KNIGHT_WALKS) and throwing (KNIGHT_THROWS). E holds the controls through all of it.
Input
IX The legs' record (KNIGHT)
UPDATE_KNIGHT DA7A RES 0,(IX+$07) Clear the wall flag
DA7E LD HL,ARRIVING Still appearing?
DA81 LD A,(HL)
DA82 ADD A,$02
DA84 LD (HL),A
DA85 CP $4C
DA87 JR C,UPDATE_KNIGHT_1
DA89 LD (HL),$70 He is here
DA8B LD HL,SPEED_TIME Count the faster walk down, if there is one
DA8E LD A,(HL)
DA8F AND A
DA90 JR Z,UPDATE_KNIGHT_0
DA92 DEC (HL)
DA93 JR NZ,UPDATE_KNIGHT_0
DA95 LD A,$0A Run out: top speed 10, speed 8
DA97 LD (TOP_SPEED),A
DA9A LD (IX+$05),$08
UPDATE_KNIGHT_0 DA9E CALL READ_CONTROLS E: the controls
DAA1 LD E,C
DAA2 CALL TURN_TOWN Turn the town round?
DAA5 CALL TURN_KNIGHT Turn, or with directional control face the stick's way
DAA8 PUSH DE Walk, or come to a stop on the grid
DAA9 CALL KNIGHT_WALKS
DAAC POP DE
DAAD CALL KNIGHT_THROWS Throw?
DAB0 RET
UPDATE_KNIGHT_1 DAB1 CALL SET_KNIGHT_LOOK Appearing: his picture for his facing, and the sound
DAB4 JP ARRIVE_SOUND
Prev: D9EB Up: Map Next: DAB7