Prev: A9DE Up: Map Next: AAC6
AA38: Helicopter related
AB89 self modifies 8FA4 to call this.
helicopter_stuff AA38 LD A,B A = B
AA39 CP $03 Return if A != 3
AA3B RET NZ
AA3C LD A,(IY+$4F) A = IY[$4F] - IY[$4E]
AA3F SUB (IY+$4E)
AA42 LD D,$00 D = 0
AA44 LD H,D H = D -- ie HL = 0
AA45 LD L,D L = D
AA46 LD E,A E = A
AA47 LD A,($A23F) A = fast_counter
AA4A LD B,$08 B = 8
AA4C AND $E0 A &= $E0
helicopter_stuff_0 AA4E RLA
AA4F JR NC,helicopter_stuff_1 If carry HL += DE
AA51 ADD HL,DE
helicopter_stuff_1 AA52 ADD HL,HL HL <<= 1
AA53 DJNZ helicopter_stuff_0 Loop helicopter_stuff_0 while B
AA55 LD A,H A = H
AA56 RRA
AA57 LD ($AA8D),A Self modify 'LD A' @ AA8C
AA5A LD A,$00 A = <self modified> -- Self modified by AAEE
AA5C SUB (IY+$4E) A -= IY[$4E]
AA5F LD ($AA77),A Self modify 'ADD A' @ AA76
AA62 LD B,$05 B = 5 iterations
AA64 LD A,($A234) A = counter_A & 1 -- counter used for turbo smoke
AA67 AND $01
For stage 1 at least this (would) load HL with 0 or 12.
AA69 LD HL,($5D08) HL = *$5D08
AA6C JR Z,loop_aa71 If A was set
AA6E LD HL,($5D0A) HL = *$5D0A
loop_aa71 AA71 LD E,(HL) DE = wordat(HL); HL += 2
AA72 INC HL
AA73 LD D,(HL)
AA74 INC HL
AA75 LD A,(DE) A = *DE
AA76 ADD A,$00 A += <self modified> -- Self modified by AA5F
AA78 INC DE DE++
AA79 PUSH IY Preserve IY, HL, BC
AA7B PUSH HL
AA7C PUSH BC
AA7D CALL sub_AA94 Call sub_AA94
AA80 POP BC Restore IY, HL, BC
AA81 POP HL
AA82 POP IY
AA84 DJNZ loop_aa71 Loop loop_aa71 while B
AA86 LD E,(HL) DE = wordat(HL); HL++
AA87 INC HL
AA88 LD D,(HL)
AA89 XOR A A = 0
AA8A PUSH IY Preserve IY
AA8C LD A,$00 A = <self modified> -- Self modified by AA57
AA8E CALL sub_AA94 Call sub_AA94
AA91 POP IY Restore IY
AA93 RET Return
sub_AA94 AA94 LD BC,$0000 BC = <self modified> -- Self modified by AB00, move_helicopter_5 + others
AA97 NEG A = -A
AA99 LD ($933E),A Self modify 'LD D,x' @ draw_object_right_8 to load A
AA9C LD A,(DE) HL = *DE++
AA9D INC DE
AA9E LD L,A
AA9F LD H,$00
AAA1 AND A Set flags
AAA2 JP P,helicopter_stuff_2
AAA5 DEC H H--
helicopter_stuff_2 AAA6 ADD HL,BC HL += BC
AAA7 EX DE,HL
AAA8 LD B,(HL) B = *HL
AAA9 RLC B B <<= 3
AAAB RLC B
AAAD RLC B
AAAF LD A,D A = D
AAB0 AND A Set flags
AAB1 LD A,E A = E
AAB2 LD C,$00 C = 0
AAB4 JP M,helicopter_stuff_3
AAB7 RET NZ Return if non-zero
AAB8 CP $80 Jump to draw_object_right_3 if A >= 128
AABA JP NC,draw_object_right_3
AABD ADD A,B A += B
AABE JP draw_object_left_1 Jump to draw_object_left_1
helicopter_stuff_3 AAC1 ADD A,B A += B
AAC2 RET NC Return if no carry
AAC3 JP draw_object_left_1 Jump to draw_object_left_1
Prev: A9DE Up: Map Next: AAC6