Prev: 46100 Up: Map Next: 46517
46211: Update Shot
Used by the routine at UpdateShots.
Updates one of the shots that the ship has fired. Shots that have bit 7 of offset 21 set go to UpdateSpecialShot. A shot that is starting (with a length of zero at offset 14) is given a starting vertical position from ShipRow with a random step, and a random colour. Shots that are facing right continue at UpdateShot_Right and ones that are facing left at UpdateLeftShot.
Input
IX Address of the shot
UpdateShot 46211 LD A,(51436) The high byte of the ship's horizontal speed.
46214 LD (IX+7),A Write the high byte of the horizontal speed.
46217 LD A,128 A=128.
46219 LD (23589),A The shot stops on the terrain.
46222 BIT 7,(IX+21) Jump to UpdateSpecialShot if bit 7 of offset 21 of IX is set.
46226 JP NZ,UpdateSpecialShot
46229 LD A,1 A=1.
46231 LD (41431),A One row to erase.
46234 LD (41432),A One row to draw.
46237 LD A,(IX+14) The high byte of the vertical acceleration.
46240 AND A Jump to UpdateShot_Right if A is not zero.
46241 JR NZ,UpdateShot_Right
46243 LD (IX+16),0 Store 0 at offset 16 of IX.
46247 LD (IX+7),0 Store 0 at offset 7 of IX.
46251 CALL ChooseRandomStep Call ChooseRandomStep.
46254 LD A,(52410) The vertical scroll speed.
46257 NEG Negate A.
46259 ADD A,B A gains B.
46260 LD (IX+9),B Write the high byte of the vertical speed.
46263 LD B,A B=A.
46264 LD A,(23608) The ship row.
46267 ADD A,B A gains B.
46268 LD (IX+12),A Write the low byte of the horizontal acceleration.
46271 CALL ChooseRandomColour Call ChooseRandomColour.
46274 CALL MoveObject Call MoveObject.
46277 LD (IX+9),0 Store 0 at offset 9 of IX.
UpdateShot_Right 46281 BIT 7,(IX+0) Jump to UpdateLeftShot if bit 7 of offset 0 of IX is set.
46285 JP NZ,UpdateLeftShot
46288 LD DE,46042 The shot offsets.
46291 CALL AddShotOffset Call AddShotOffset.
46294 CALL FindObjectScreenAddress Call FindObjectScreenAddress.
46297 LD B,(IX+14) The high byte of the vertical acceleration.
46300 EXX Switch to the alternate registers.
46301 BIT 7,(IX+16) Jump to UpdateShot_Hit if bit 7 of offset 16 of IX is set.
46305 JR NZ,UpdateShot_Hit
46307 LD A,(IX+14) The high byte of the vertical acceleration.
46310 AND A Jump to UpdateShot_Longer if A is not zero.
46311 JR NZ,UpdateShot_Longer
46313 LD (IX+15),8 Store 8 at offset 15 of IX.
46317 LD (IX+11),136 Store 136 at offset 11 of IX.
UpdateShot_Longer 46321 LD A,16 A=16.
46323 ADD A,(IX+7) Add the byte at offset 7 of IX to A.
46326 LD (IX+7),A Write the high byte of the horizontal speed.
46329 CALL TestShotHitsGround Call TestShotHitsGround.
46332 JR Z,UpdateShot_Move Jump to UpdateShot_Move if the zero flag is set.
46334 LD A,240 A=240.
46336 ADD A,(IX+7) Add the byte at offset 7 of IX to A.
46339 LD (IX+7),A Write the high byte of the horizontal speed.
46342 SET 7,(IX+16) Set bit 7 of offset 16 of IX.
46346 SET 5,(IX+16) Set bit 5 of offset 16 of IX.
46350 JP UpdateShot_Count Jump to UpdateShot_Count.
UpdateShot_Move 46353 LD A,8 A=8.
46355 ADD A,(IX+11) Add the byte at offset 11 of IX to A.
46358 LD (IX+11),A Write the high byte of the horizontal acceleration.
46361 CP 184 Jump to UpdateShot_Length if A is not 184.
46363 JR NZ,UpdateShot_Length
46365 SET 7,(IX+16) Set bit 7 of offset 16 of IX.
UpdateShot_Length 46369 LD A,(IX+14) The high byte of the vertical acceleration.
46372 INC A Advance A.
46373 LD (IX+14),A Write the high byte of the vertical acceleration.
46376 LD A,(IX+15) The low byte of the vertical acceleration.
46379 DEC A Step A back.
46380 LD (IX+15),A Write the low byte of the vertical acceleration.
46383 JP UpdateShot_Table Jump to UpdateShot_Table.
UpdateShot_Hit 46386 BIT 5,(IX+16) Jump to UpdateShot_Stopped if bit 5 of offset 16 of IX is set.
46390 JR NZ,UpdateShot_Stopped
46392 CALL TestShotHitsGround Call TestShotHitsGround.
46395 JR Z,UpdateShot_Facing Jump to UpdateShot_Facing if the zero flag is set.
46397 SET 5,(IX+16) Set bit 5 of offset 16 of IX.
UpdateShot_Stopped 46401 LD A,(IX+7) The high byte of the horizontal speed.
46404 NEG Negate A.
46406 ADD A,(IX+11) Add the byte at offset 11 of IX to A.
46409 LD (IX+11),A Write the high byte of the horizontal acceleration.
46412 LD (IX+7),0 Store 0 at offset 7 of IX.
46416 BIT 6,(IX+16) Test bit 6 of offset 16 of IX.
46420 LD B,(IX+14) The high byte of the vertical acceleration.
46423 LD C,(IX+11) The high byte of the horizontal acceleration.
46426 JR Z,UpdateShot_Clip Jump to UpdateShot_Clip if the zero flag is set.
46428 DEC B Step B back.
46429 LD A,C A=C.
46430 ADD A,8 Add 8 to A.
46432 LD C,A C=A.
UpdateShot_Clip 46433 SLA B Shift B left.
46435 SLA B Shift B left.
46437 SLA B Shift B left.
46439 LD A,B A=B.
46440 ADD A,C A gains C.
46441 AND %11111000 Keep the bits of A that are set in 248.
46443 CP 228 Jump to UpdateShot_Facing if A is less than 228.
46445 JR C,UpdateShot_Facing
46447 CP 240 Jump to UpdateShot_Shorten if A is less than 240.
46449 JR C,UpdateShot_Shorten
46451 LD (IX+14),0 Store 0 at offset 14 of IX.
UpdateShot_Shorten 46455 LD A,(IX+14) The high byte of the vertical acceleration.
46458 DEC A Step A back.
46459 LD (IX+14),A Write the high byte of the vertical acceleration.
46462 LD A,(IX+11) The high byte of the horizontal acceleration.
46465 SUB 8 Subtract 8 from A.
46467 LD (IX+11),A Write the high byte of the horizontal acceleration.
UpdateShot_Facing 46470 BIT 6,(IX+16) Jump to UpdateShot_Count if bit 6 of offset 16 of IX is clear.
46474 JR Z,UpdateShot_Count
46476 LD A,(IX+14) The high byte of the vertical acceleration.
46479 DEC A Step A back.
46480 LD (IX+14),A Write the high byte of the vertical acceleration.
46483 LD A,(IX+11) The high byte of the horizontal acceleration.
46486 ADD A,8 Add 8 to A.
46488 LD (IX+11),A Write the high byte of the horizontal acceleration.
46491 JR UpdateShot_Table Jump to UpdateShot_Table.
UpdateShot_Count 46493 LD A,(IX+15) The low byte of the vertical acceleration.
46496 DEC A Step A back.
46497 LD (IX+15),A Write the low byte of the vertical acceleration.
46500 JR NZ,UpdateShot_Table Jump to UpdateShot_Table if the zero flag is clear.
46502 SET 6,(IX+16) Set bit 6 of offset 16 of IX.
UpdateShot_Table 46506 LD DE,46042 The shot offsets.
46509 JR UpdateShot_Offset Jump to UpdateShot_Offset.
This entry point is used by the routine at UpdateLeftShot.
UpdateShot_LeftTable 46511 LD DE,46050 The second shot offset.
UpdateShot_Offset 46514 CALL AddShotOffset Call AddShotOffset.
Prev: 46100 Up: Map Next: 46517