Prev: AD81 Up: Map Next: AE25
ADBE: Move Wally and animate.
Used by the routines at Wally_Handler and Demo.
Input
Output
Wally_Move ADBE CALL Energy_Countdown
ADC1 LD A,(Wally_Dir)
ADC4 CP $01
ADC6 JR Z,_Wally_MoveRight
Wally Move Left
Wally_MoveLeft ADC8 LD A,(Wally_Frame)
ADCB CALL Wally_TurnHead
ADCE CP $00
ADD0 JR NC,Wally_Move_1
Wally_Move_0 ADD2 XOR A Clear head turn flag(2)
ADD3 LD (Wally_HeadTurned),A
ADD6 XOR A
ADD7 JR Wally_Move_2
Wally_Move_1 ADD9 ADD A,$02
ADDB CP $10
ADDD JR NC,Wally_Move_0
Wally_Move_2 ADDF CALL Wally_Erase
ADE2 LD (Wally_Frame),A Store new frame.
ADE5 LD A,L Move Wally left
ADE6 SUB $02
ADE8 CP $07 Don't let him move off the left hand side of screen.
ADEA JR NC,Wally_Move_3
ADEC LD A,$07
Wally_Move_3 ADEE LD L,A Update position and draw.
ADEF LD (Wally_X),HL
ADF2 CALL Wally_Draw
ADF5 RET
Wally Move Right.
_Wally_MoveRight ADF6 LD A,(Wally_Frame)
ADF9 CALL Wally_TurnHead
ADFC CP $10
ADFE JR NC,Wally_Move_5
Wally_Move_4 AE00 XOR A
AE01 LD (Wally_HeadTurned),A
AE04 LD A,$10
AE06 JR Wally_Move_6
Wally_Move_5 AE08 ADD A,$02
AE0A CP $20
AE0C JR NC,Wally_Move_4
Wally_Move_6 AE0E CALL Wally_Erase
AE11 LD (Wally_Frame),A
AE14 LD A,L
AE15 ADD A,$02
AE17 CP $E9
AE19 JR C,Wally_Move_7
AE1B LD A,$E9
Wally_Move_7 AE1D LD L,A
AE1E LD (Wally_X),HL
AE21 CALL Wally_Draw
AE24 RET
Prev: AD81 Up: Map Next: AE25