Prev: AAC6 Up: Map Next: AB9A
AB33: Helicopter
Used by the routine at main_loop.
helicopter AB33 LD A,($A224) Return if helicopter_control is zero
AB36 AND A
AB37 RET Z
AB38 DEC A Jump to hc_1 if helicopter_control is one
AB39 JR Z,hc_1
AB3B DEC A Jump to hc_pick_direction if helicopter_control >= 3
AB3C JR NZ,hc_pick_direction
Otherwise helicopter_control is 2.
AB3E LD A,($AA96) Read from 'LD BC' @ sub_AA94
AB41 AND A Set flags
AB42 RET Z Return if zero
AB43 XOR A A = 0 -- NOP
AB44 LD D,A DE = 0 -- NOPs
AB45 LD E,A
AB46 EX AF,AF'
AB47 XOR A A = 0
AB48 JR hc_3 Jump to hc_3
hc_1 AB4A LD HL,$FFC8 HL = $FFC8
AB4D LD A,$02 New value for helicopter_control is 2
AB4F JR hc_2 Jump to hc_2
hc_pick_direction AB51 DEC A A--
AB52 LD HL,$98A9 Point HL at pilot "turn left" messages
AB55 JR Z,hc_chatter Jump to hc_chatter if A now zero (helicopter_control == 3)
AB57 DEC A A--
AB58 RET NZ Return if A now non-zero
AB59 LD HL,$98B3 Point HL at pilot "turn right" messages (helicopter_control == 4)
hc_chatter AB5C LD DE,($A26C) Self modify 'LD BC' @ AAF6 to load road_pos
AB60 LD ($AAF7),DE
AB64 LD DE,$FFE8 Self modify 'LD BC' @ sub_AA94 to load $FFE8
AB67 LD ($AA95),DE
AB6B XOR A Self modify 'LD A' @ AAD7 to load zero
AB6C LD ($AAD8),A
AB6F LD ($AAE9),A Self modify 'ADD A' @ move_helicopter_1 to load zero
AB72 INC A Self modify 'LD A' @ AADF to load one
AB73 LD ($AAE0),A
AB76 LD A,$0F Call chatter (priority 15)
AB78 CALL chatter
AB7B LD HL,$0070 HL = $0070
AB7E LD A,$85 Self modify 'LD A' @ AACB to load $85
AB80 LD ($AACC),A
AB83 LD A,$05 New value for helicopter_control is 5
hc_2 AB85 EX AF,AF' Preserve AF
AB86 LD ($AB07),HL Self modify 'LD DE' @ AB06 to load $0070, or $FFC8
AB89 LD DE,$AA38 Address of helicopter_stuff
AB8C LD A,$CD Opcode for CALL
hc_3 AB8E LD ($8FA4),A Self modify 8FA4 to be CALL helicopter_stuff, or NOPs
AB91 LD ($8FA5),DE
AB95 EX AF,AF' Restore AF
AB96 LD ($A224),A helicopter_control = A
AB99 RET Return
Prev: AAC6 Up: Map Next: AB9A