Prev: 8EE7 Up: Map Next: 9023
8F5F: Routine at 8F5F
Used by the routines at main_loop, cpu_driver and escape_scene.
main_loop_23 8F5F LD HL,$ED28 Point HL at (something above the stack)
8F62 LD ($A9E3),HL Self modify 'LD HL' @ A9E2 to load the stack address
8F65 LD HL,$E900 Self modify 'LD HL' @ draw_hazards_16 to load $E900
8F68 LD ($AED0),HL
Add 32 to the first 21 entries of tables $E301 and $E336. If meddled with this affects the height of elements.
8F6B LD HL,$E301 HL = $E301
8F6E LD DE,$E336 DE = $E336
8F71 LD BC,$1520 B = 21 iterations, C = 32 (added to table entries)
ml23_loop 8F74 LD A,(HL) *HL += C
8F75 ADD A,C
8F76 LD (HL),A
8F77 LD A,(DE) *DE += C
8F78 ADD A,C
8F79 LD (DE),A
8F7A INC E E++
8F7B INC L L++
8F7C DJNZ ml23_loop Loop to ml23_loop while B
8F7E LD IY,$E315 IY = $E315
8F82 NOP Self modified
8F83 NOP Self modified
8F84 NOP Self modified
8F85 DEC IY IY--
8F87 LD A,($A240) Load road_buffer_offset into A
8F8A ADD A,$73 Add 115 so it's the right side objects data offset + 19
8F8C LD L,A HL = $EE00 | A
8F8D LD H,$EE
8F8F LD IX,$EAB0 IX = $EAB0
8F93 LD BC,$1420 BC = $1420
main_loop_23_0 8F96 PUSH IX Preserve IX, HL, BC
8F98 PUSH HL
8F99 PUSH BC
8F9A LD A,($A222) Load var_a222
8F9D AND A Set flags
8F9E CALL NZ,draw_hazards_16 Call if non-zero
8FA1 CALL sub_A9DE Call sub_A9DE (dust/stones stuff)
8FA4 NOP Self modified
8FA5 NOP Self modified
8FA6 NOP Self modified
8FA7 NOP Self modified
8FA8 NOP Self modified
8FA9 NOP Self modified
8FAA POP BC Restore IX, HL, BC
8FAB POP HL
8FAC POP IX
8FAE LD A,(HL) A = *HL
8FAF AND A Set flags
8FB0 JR NZ,main_loop_23_4
main_loop_23_1 8FB2 INC IX IX += 2
8FB4 INC IX
8FB6 LD A,L L += C
8FB7 ADD A,C
8FB8 LD L,A
8FB9 LD A,(HL) A = *HL
8FBA AND A Set flags
8FBB JR NZ,$9023 Exit via 9023 if non-zero
This entry point is used by the routine at 9023.
main_loop_23_2 8FBD INC IX IX += 2
8FBF INC IX
8FC1 LD A,L L -= $21
8FC2 SUB $21
8FC4 LD L,A
8FC5 DEC IY IY--
8FC7 DJNZ main_loop_23_0 Loop to $8F96 while B
8FC9 LD A,($8FA4) Load self modified instructions from earlier
8FCC AND A Set flags
8FCD RET NZ Return if non-zero (not NOP)
8FCE LD A,($A227) Return if floating_arrow is zero
8FD1 AND A
8FD2 RET Z
8FD3 LD HL,$E1DF HL = &floating_arrow_defns[0]
8FD6 LD E,$78 E = $78
8FD8 DEC A A--
8FD9 JR Z,main_loop_23_3
8FDB LD HL,$E1E4 HL = &floating_arrow_defns[1]
8FDE LD E,$80 E = $80
main_loop_23_3 8FE0 LD D,$30 D = $30
8FE2 LD C,(HL) C = *HL++
8FE3 INC HL
8FE4 LD B,(HL) B = *HL
8FE5 SRL B B >>= 1
8FE7 PUSH BC
8FE8 EXX
8FE9 POP BC
8FEA LD E,C E = C
8FEB LD C,$00 C = $00
8FED EXX
8FEE INC HL HL++
8FEF LD B,(HL) D = *HL++
8FF0 INC HL
8FF1 LD A,(HL) A = *HL++
8FF2 INC HL
8FF3 LD H,(HL) H = *HL
8FF4 LD L,A L = A
8FF5 JP sub_b67c_4 Exit via sub_b67c_4
main_loop_23_4 8FF8 LD E,A E = A
8FF9 LD A,(IX+$01) A = IX[1]
8FFC AND A Set flags
8FFD JR NZ,main_loop_23_1
8FFF PUSH IX
9001 PUSH HL
9002 PUSH BC
9003 LD A,E DE = E * 7
9004 ADD A,A
9005 ADD A,A
9006 ADD A,A
9007 SUB E
9008 LD E,A
9009 LD D,$00
900B LD HL,$901C Push return address onto stack
900E PUSH HL
900F LD HL,($5CF8)
9012 ADD HL,DE HL += DE
9013 LD E,(HL) DE = wordat(HL); HL += 2
9014 INC HL
9015 LD D,(HL)
9016 INC HL
9017 LD A,(HL) HL = wordat(HL); HL += 1
9018 INC HL
9019 LD H,(HL)
901A LD L,A
901B JP (HL) Jump to HL
901C POP BC
901D POP HL
901E POP IX
9020 JP main_loop_23_1 Jump to main_loop_23_1
Prev: 8EE7 Up: Map Next: 9023