Prev: 890D Up: Map Next: 8970
8934: Set Falling Speed
Used by the routine at FireShot.
Gives an object a random speed and then sets its vertical acceleration.
Input
IY Address of the object
SetFallingSpeed 8934 CALL SetRandomSpeed Give the object a random speed.
8937 LD A,(IY+$09) Fetch the vertical speed.
893A AND A Test it.
893B JR Z,SetRandomSpeed_Remove Remove the object if it is zero.
893D LD A,R Fetch a random number...
893F AND %00000111 ...and keep three bits.
8941 JR NZ,SetFallingSpeed_Flags Jump to SetFallingSpeed_Flags if any are set.
8943 LD (IY+$13),$09 Occasionally change the state of the object to 09.
SetFallingSpeed_Flags 8947 LD (IY+$10),$25 Set the flags of the object to 25.
894B LD A,(IY+$00) Fetch the type of the object.
894E INC A Increment it.
894F JP Z,FireShot_Sound Jump to FireShot_Sound if the slot is free.
8952 LD A,($896E) Count down the timer at 896E.
8955 DEC A
8956 LD ($896E),A
8959 JR NZ,SetFallingSpeed_Accelerate Jump to SetFallingSpeed_Accelerate if it has not run out.
895B LD A,($F5ED) Fetch the number of ships left from F5ED.
895E ADD A,A Multiply it by four...
895F ADD A,A
8960 LD ($896E),A ...and restart the timer.
8963 LD (IY+$13),$08 Change the state of the object to 08.
SetFallingSpeed_Accelerate 8967 LD (IY+$0F),$20 Set the vertical acceleration of the object to 20.
896B JP FireShot_Sound Jump to FireShot_Sound.
896E DEFB $08
896F DEFB $00
Prev: 890D Up: Map Next: 8970