Prev: E84A Up: Map Next: E93C
E86C: Update Frame
Used by the routine at Initialise_Game.
Runs the game until *Frame_Done is set, then clears frame state and returns.
Update_Frame E86C CALL Prepare_Frame Call Prepare_Frame.
Update_Frame_0 E86F CALL Reset_Phase Call Reset_Phase.
Update_Frame_1 E872 LD A,($EE7A) Jump to Update_Frame_6 if *Timeout_Flag is not zero.
E875 AND A
E876 JR NZ,Update_Frame_6
This entry point is used by the routine at Update_Heading.
Count down *Countdown.
Update_Frame_2 E878 LD BC,($EF8B) Decrease *Countdown by one.
E87C DEC BC
E87D LD ($EF8B),BC
E881 LD A,B Jump to Update_Frame_3 if *Countdown is not zero.
E882 OR C
E883 JR NZ,Update_Frame_3
E885 LD A,$01 Write 01 to *Timeout_Flag.
E887 LD ($EE7A),A
Update_Frame_3 E88A CALL Select_Target Call Select_Target.
E88D CALL Update_Phase Call Update_Phase.
E890 CALL Update_Heading Call Update_Heading.
E893 CALL Dispatch_Phase Call Dispatch_Phase.
Update_Frame_4 E896 LD A,($EF7E) Jump to Update_Frame_1 if *Frame_Done is zero.
E899 AND A
E89A JR Z,Update_Frame_1
Update_Frame_5 E89C CALL Clear_Flags Call Clear_Flags.
E89F RET Return.
*Timeout_Flag is not zero.
Update_Frame_6 E8A0 CALL Test_Object_Slots Call Test_Object_Slots.
E8A3 JR NZ,Update_Frame_3 Jump to Update_Frame_3 if a slot is occupied.
E8A5 XOR A Write 00 to *Gauge_A.
E8A6 LD ($EF7F),A
E8A9 LD A,($EF54) Fetch *Phase.
E8AC INC A Increment the phase.
E8AD LD ($EF54),A Write the phase to *Phase.
E8B0 DEC A Jump to Update_Frame_7 if the original value was not zero.
E8B1 JR NZ,Update_Frame_7
*Phase was 00.
E8B3 CALL Set_Phase_One Call Set_Phase_One.
E8B6 LD A,$01 A=01.
E8B8 CALL Pause_Transition Call Pause_Transition.
E8BB JR Update_Frame_1 Jump to Update_Frame_1.
*Phase was 01.
Update_Frame_7 E8BD DEC A Jump to Update_Frame_9 if *Phase was not 01.
E8BE JR NZ,Update_Frame_9
E8C0 LD A,($EF89) Jump to Update_Frame_8 if *Menu_Choice is zero.
E8C3 AND A
E8C4 JR Z,Update_Frame_8
E8C6 LD HL,$EF81 Point HL at Occupied_Copy.
E8C9 LD A,($EF84) Jump to Update_Frame_8 if *Status_Value is zero.
E8CC AND A
E8CD JR Z,Update_Frame_8
E8CF CP (HL) Jump to Update_Frame_8 if *Status_Value is not *Occupied_Copy.
E8D0 JR NZ,Update_Frame_8
E8D2 CALL Print_Status_Pair Call Print_Status_Pair.
Update_Frame_8 E8D5 LD A,$02 A=02.
E8D7 CALL Pause_Transition Call Pause_Transition.
E8DA CALL Reprint_Status Call Reprint_Status.
E8DD CALL Set_Phase_Two Call Set_Phase_Two.
E8E0 JR Update_Frame_1 Jump to Update_Frame_1.
*Phase was 02 or higher.
Update_Frame_9 E8E2 LD A,$03 A=03.
E8E4 CALL Pause_Transition Call Pause_Transition.
E8E7 CALL Run_Other_Phase_20 Call Run_Other_Phase_20.
E8EA LD A,($EF7E) Jump to Update_Frame_5 if *Frame_Done is not zero.
E8ED AND A
E8EE JR NZ,Update_Frame_5
E8F0 LD A,($EFFE) Jump to Update_Frame_12 if *Other_Phase_Flag is not zero.
E8F3 AND A
E8F4 JR NZ,Update_Frame_12
E8F6 LD A,($E1EE) Fetch *Control_Choice.
E8F9 LD B,A Copy *Control_Choice to B.
E8FA LD A,($EF89) Fetch *Menu_Choice.
E8FD CP B Jump to Update_Frame_10 if *Menu_Choice matches *Control_Choice.
E8FE JR Z,Update_Frame_10
E900 XOR A Clear A.
Update_Frame_10 E901 CALL Print_Status_Pair_0 Call Print_Status_Pair_0.
E904 LD A,($E179) Fetch *Status_Addend.
E907 LD HL,$EFCE Point HL at Gauge_Source_A.
E90A ADD A,(HL) Add *Gauge_Source_A.
E90B CP $A4 Jump to Update_Frame_11 if the result is less than A4.
E90D JR C,Update_Frame_11
E90F LD A,$A3 Set the result to A3.
Update_Frame_11 E911 LD (HL),A Write the result to *Gauge_Source_A.
E912 XOR A Write 00 to *Gauge_Copy.
E913 LD ($EFD0),A
E916 LD A,$04 A=04.
E918 CALL Pause_Transition Call Pause_Transition.
E91B CALL Reprint_Status Call Reprint_Status.
E91E CALL Clear_Flags Call Clear_Flags.
E921 CALL Clear_Object_Slots Call Clear_Object_Slots.
E924 CALL Initialise_Next_Phase Call Initialise_Next_Phase.
E927 CALL Set_Flag Call Set_Flag.
E92A LD HL,$EF89 Point HL at Menu_Choice.
E92D INC (HL) Increment *Menu_Choice by one.
E92E JP Update_Frame_0 Jump to Update_Frame_0.
*Other_Phase_Flag is not zero.
Update_Frame_12 E931 LD A,$05 A=05.
E933 CALL Pause_Transition Call Pause_Transition.
E936 CALL Set_Phase_Two Call Set_Phase_Two.
E939 JP Update_Frame_4 Jump to Update_Frame_4.
Prev: E84A Up: Map Next: E93C