Prev: 26199 Up: Map Next: 26312
26200: Initialise Next Phase
Used by the routine at Update_Frame.
Picks a random letter for *Model_Letter, fills the object and target slots, then sweeps *View_Pitch and *View_Yaw before the next phase.
Pick a random letter from "A" to "G".
Initialise_Next_Phase 26200 LD A,13 Call Random_Number and clamp the maximum value to 13.
26202 CALL Random_Number
26205 SRL A Halve the result.
26207 ADD A,65 Convert the result into a letter from "A" to "G".
26209 LD (57847),A Write the letter to *Model_Letter.
Seed the background, target and object slots.
26212 CALL Initialise_Slot_Table Call Initialise_Slot_Table.
26215 LD A,21 Write 21 to *Object_Slot_Count.
26217 LD (60972),A
26220 CALL 28850 Call 28850.
26223 CALL Initialise_Object_Slots Call Initialise_Object_Slots.
Wait 25 frames.
26226 LD B,25 Set the frame counter to 25 in B.
Initialise_Next_Phase_Wait 26228 HALT Halt, and loop back to Initialise_Next_Phase_Wait until the frame counter is zero.
26229 DJNZ Initialise_Next_Phase_Wait
Sweep the view for 35 frames.
26231 LD A,150 Write 150 to *57722.
26233 LD (57722),A
26236 LD B,35 Set the frame counter to 35 in B.
26238 LD HL,60949 Point HL at 60949.
26241 PUSH HL Stash the pointer on the stack.
26242 SET 5,(HL) Set bit 5 of *60949.
Update one frame of the sweep.
Initialise_Next_Phase_Sweep 26244 PUSH BC Stash the frame counter on the stack.
26245 CALL Plot_Slot_Table Call Plot_Slot_Table.
26248 CALL Plot_Target_Slots Call Plot_Target_Slots.
26251 CALL Advance_Object_Slots Call Advance_Object_Slots.
26254 LD A,(61055) Decrease *View_Pitch by 12.
26257 SUB 12
26259 LD (61055),A
26262 LD A,(61056) Decrease *View_Yaw by 12.
26265 SUB 12
26267 LD (61056),A
26270 LD A,1 Write 1 to *Frame_Flag.
26272 LD (61141),A
26275 HALT Halt.
26276 POP BC Restore the frame counter from the stack.
26277 DJNZ Initialise_Next_Phase_Sweep Decrease the frame counter by one and loop back to Initialise_Next_Phase_Sweep until it is zero.
Restore the view bound.
26279 POP HL Restore the pointer from the stack.
26280 RES 5,(HL) Reset bit 5 of *60949.
Wait, draw the graphic, then wait again.
26282 LD A,8 Set the delay to 8 in A.
26284 CALL Wait_Slot_Frames Call Wait_Slot_Frames.
26287 LD A,1 Write 1 to *57846.
26289 LD (57846),A
26292 CALL Rotate_Coordinates_5 Call Rotate_Coordinates_5.
26295 LD A,50 Set the delay to 50 in A.
26297 CALL Wait_Slot_Frames Call Wait_Slot_Frames.
26300 CALL Process_Draw_List_41 Call Process_Draw_List_41.
26303 XOR A Write 0 to *57846.
26304 LD (57846),A
Wait 10 frames.
26307 LD A,10 Set the delay to 10 in A.
26309 JP Wait_Slot_Frames Jump to Wait_Slot_Frames.
Prev: 26199 Up: Map Next: 26312