Prev: 9023 Up: Map Next: 916C
9052: Draws overhead graphics.
This gets used on stage 3 when drawing the overhead structure graphics.
sampled IX=$EAB2 DE=$6F26 HL=$9052 BC=$1420 (when in stage3!)
draw_overhead 9052 PUSH IX Preserve
9054 PUSH DE
9055 PUSH BC
9056 LD A,(IX+$01) A = IX[1]
9059 AND A Set flags
905A CALL Z,draw_stretchy_object_left
905D POP BC Restore (restore DE to HL)
905E POP HL
905F POP IX
9061 INC HL HL++
9062 LD E,(HL) DE = wordat(HL); HL++
9063 INC HL
9064 LD D,(HL)
9065 INC DE DE += 2
9066 INC DE
9067 LD A,($A23F) A = fast_counter & $E0
906A AND $E0
906C LD L,A L = A
906D RRC L
906F RRC L
9071 SUB L A -= L
9072 RRC L
9074 RRC L
9076 SUB L A -= L
9077 ADD A,B A += B
9078 LD L,A L = A
9079 LD H,$E6 H = $E6
907B LD A,(IY+$00) A = IY[0] - IY[$35]
907E SUB (IY+$35)
9081 LD C,A C = A
9082 LD A,(HL) A = *HL
9083 LD L,A L = A
9084 SRL A SRL A
9086 ADD A,L A += L
9087 SUB C A -= C
9088 LD ($90F2),A Self modify 'SUB x' at $90F1
908B LD A,B A = B - 1
908C DEC A
908D CP $09
908F JR C,do_9093
9091 LD A,$09 A = $09
do_9093 9093 LD B,A B = A
9094 ADD A,A HL = A * 2 + DE
9095 LD L,A
9096 LD H,$00
9098 ADD HL,DE
9099 LD C,(HL) C = *HL
909A LD A,B A = B
909B ADD A,A HL = ((A * 2) + B + 20) + DE
909C ADD A,B
909D ADD A,$14
909F LD L,A
90A0 LD H,$00
90A2 ADD HL,DE
90A3 LD D,$01 D = 1
90A5 LD A,(IX+$01) A = IX[1]
90A8 AND A Set flags
90A9 JP M,do_90c4
90AC RET NZ
90AD LD A,(IX+$00) A = IX[0] + $18 - C
90B0 ADD A,$18
90B2 SUB C
90B3 JR C,do_90c4
90B5 SUB $08 A -= 8
90B7 JR C,do_90c4
90B9 CP $08
90BB JR C,do_90c4
90BD SRL A A >>= 3
90BF SRL A
90C1 SRL A
90C3 LD D,A D = A
do_90c4 90C4 DEC IX IX -= 2
90C6 DEC IX
90C8 LD E,$1F E = $1F
90CA LD A,(IX+$01) A = IX[1]
90CD AND A Set flags
90CE RET M
90CF JR NZ,do_90e4
90D1 LD A,(IX+$00) A = IX[0] + C
90D4 ADD A,C
90D5 JR C,do_90e4
90D7 JR Z,do_90e4
90D9 CP $F7
90DB JR NC,do_90e4
90DD SRL A A >>= 3
90DF SRL A
90E1 SRL A
90E3 LD E,A E = A
do_90e4 90E4 LD C,D C = D
90E5 LD A,E A = E * 2 - C
90E6 SUB C
90E7 ADD A,A
90E8 CPL A = ~A + $3D
90E9 ADD A,$3D
90EB LD ($9116),A *$9116 = A -- Self modify jump table target
90EE LD A,(IY+$35) A = IY[$35]
90F1 SUB $00 A -= <self modified> -- self modified by $9088
90F3 RET M
90F4 PUSH AF
90F5 INC A A++
90F6 LD B,(HL) B = *HL
90F7 SUB B A -= B
90F8 JR NC,do_90fc
90FA ADD A,B A += B
90FB LD B,A B = A
do_90fc 90FC INC HL HL++
90FD LD E,(HL) DE = wordat(HL); HL++
90FE INC HL
90FF LD D,(HL)
9100 POP AF
9101 LD L,A L = A
9102 AND $0F H = (A & $0F) + $F0
9104 ADD A,$F0
9106 LD H,A
9107 LD A,L L = (L & $70) * 2 + C
9108 AND $70
910A ADD A,A
910B ADD A,C
910C LD L,A
910D JR do_9113
do_continue 910F INC DE DE++
9110 DJNZ do_9113
9112 RET Return
do_9113 9113 LD A,(DE) A = *DE
9114 LD C,L C = L
do_9115 9115 JR do_9115 Self modified
9117 LD (HL),A *HL++ = A -- 28 times
9118 INC L
9119 LD (HL),A
911A INC L
911B LD (HL),A
911C INC L
911D LD (HL),A
911E INC L
911F LD (HL),A
9120 INC L
9121 LD (HL),A
9122 INC L
9123 LD (HL),A
9124 INC L
9125 LD (HL),A
9126 INC L
9127 LD (HL),A
9128 INC L
9129 LD (HL),A
912A INC L
912B LD (HL),A
912C INC L
912D LD (HL),A
912E INC L
912F LD (HL),A
9130 INC L
9131 LD (HL),A
9132 INC L
9133 LD (HL),A
9134 INC L
9135 LD (HL),A
9136 INC L
9137 LD (HL),A
9138 INC L
9139 LD (HL),A
913A INC L
913B LD (HL),A
913C INC L
913D LD (HL),A
913E INC L
913F LD (HL),A
9140 INC L
9141 LD (HL),A
9142 INC L
9143 LD (HL),A
9144 INC L
9145 LD (HL),A
9146 INC L
9147 LD (HL),A
9148 INC L
9149 LD (HL),A
914A INC L
914B LD (HL),A
914C INC L
914D LD (HL),A
914E INC L
914F LD (HL),A
9150 INC L
9151 LD (HL),A *HL = A
9152 LD L,C L = C -- restore
Move to next scanline
9153 LD A,H Save for checking in a moment
9154 DEC H Move to next scanline (visually upwards)
9155 AND $0F Would it have rolled over into the top nibble?
9157 JP NZ,do_continue No - continue
It rolled over
915A LD A,H Put back the bit stolen by rollover
915B ADD A,$10
915D LD H,A
915E LD A,L Move to next chunk of 16 scanlines
915F SUB $20
9161 LD L,A
9162 JP NC,do_continue Continue if it didn't roll over
9165 LD A,H Otherwise move to the next chunk of 128 scanlines (would put us outside the back buffer)
9166 SUB $10
9168 LD H,A
9169 JP do_continue Loop
Prev: 9023 Up: Map Next: 916C