![]() |
Routines |
| Prev: 30230 | Up: Map | Next: 31591 |
|
Used by the routines at TitleScreen and StartGame.
|
||||
| Handler_AlienExplosions | 31154 | LD A,(26261) | Return if bit 0 of *Bullet_RateLimiter is not set. | |
| 31157 | AND %00000001 | |||
| 31159 | RET Z | |||
| 31160 | LD HL,26325 | HL=Table_AlienExplosions. | ||
| 31163 | LD B,6 | Set a counter in B for checking 6 explosion slots. | ||
| AlienExplosions_Loop | 31165 | LD A,(HL) | Jump to AlienExplosions_IsActive if this explosion slot is already active. | |
| 31166 | OR A | |||
| 31167 | JR NZ,AlienExplosions_IsActive | |||
| 31169 | PUSH BC | Stash the explosion slot counter on the stack. | ||
| 31170 | LD B,200 | Set a delay loop counter in B of 200 iterations. | ||
| AlienExplosions_DelayLoop | 31172 | DJNZ AlienExplosions_DelayLoop | Decrease the delay loop counter by one and loop back to AlienExplosions_DelayLoop until the counter is zero. | |
| 31174 | POP BC | Restore the explosion slot counter from the stack. | ||
| 31175 | JP AlienExplosions_NextSlot | Jump to AlienExplosions_NextSlot. | ||
|
Process the active explosion.
|
||||
| AlienExplosions_IsActive | 31178 | PUSH AF | Stash AF, BC and HL on the stack. | |
| 31179 | PUSH BC | |||
| 31180 | PUSH HL | |||
|
Play a sound when the explosion is active (but not in demo mode).
|
||||
| 31181 | LD A,(26355) | Jump to AlienExplosions_UpdatePosition if *Flag_ActiveDemoMode is active. | ||
| 31184 | OR A | |||
| 31185 | JR NZ,AlienExplosions_UpdatePosition | |||
|
Play the explosion sound effect based on the current phase.
|
||||
| 31187 | LD A,(26353) | Jump to AlienExplosions_Sound_02 if bit 1 of *Phase is not zero. | ||
| 31190 | AND %00000010 | |||
| 31192 | JR Z,AlienExplosions_Sound_02 | |||
|
Play explosion sound 1.
|
||||
| 31194 | LD A,(HL) | DE=*HL*8. | ||
| 31195 | ADD A,A | |||
| 31196 | ADD A,A | |||
| 31197 | ADD A,A | |||
| 31198 | LD E,A | |||
| 31199 | LD D,0 | |||
| 31201 | LD HL,242 | HL=0242+DE. | ||
| 31204 | ADD HL,DE | |||
| 31205 | LD B,3 | B=3. | ||
| AlienExplosions_Sound_01 | 31207 | PUSH BC | Stash BC and HL on the stack. | |
| 31208 | PUSH HL | |||
| 31209 | LD DE,2 | DE=0002. | ||
| 31212 | CALL 949 | Call BEEPER. | ||
| 31215 | DI | Disable interrupts. | ||
| 31216 | POP HL | Restore HL from the stack. | ||
| 31217 | INC HL | Increment HL by two. | ||
| 31218 | INC HL | |||
| 31219 | POP BC | Restore BC from the stack. | ||
| 31220 | DJNZ AlienExplosions_Sound_01 | Decrease counter by one and loop back to AlienExplosions_Sound_01 until counter is zero. | ||
| 31222 | JR AlienExplosions_UpdatePosition | Jump to AlienExplosions_UpdatePosition. | ||
|
Play explosion sound 2.
|
||||
| AlienExplosions_Sound_02 | 31224 | LD A,(HL) | Jump to AlienExplosions_UpdatePosition if the explosion type is not 1. | |
| 31225 | CP 1 | |||
| 31227 | JR NZ,AlienExplosions_UpdatePosition | |||
|
|
||||
| 31229 | LD B,18 | Set a counter in B for 18 explosion sound loops. | ||
| 31231 | LD HL,100 | Set the initial pitch to 0100. | ||
| AlienExplosions_Sound_02_Loop | 31234 | PUSH BC | Stash the explosion sound loops counter and pitch on the stack. | |
| 31235 | PUSH HL | |||
| 31236 | LD A,100 | Calculate the delay counter: 100 - (B × 2). | ||
| 31238 | SUB B | |||
| 31239 | SUB B | |||
| 31240 | LD B,A | |||
| 31241 | LD A,16 | Enable the speaker (bit 4). | ||
| 31243 | DI | Disable interrupts. | ||
| AlienExplosions_Sound_02_DelayLoop | 31244 | OUT (254),A | Decrease the delay counter by one and loop back to AlienExplosions_Sound_02_DelayLoop until the delay counter is zero. | |
| 31246 | DJNZ AlienExplosions_Sound_02_DelayLoop | |||
| 31248 | LD DE,1 | Set the sound duration to 0001. | ||
| 31251 | CALL 949 | Call BEEPER. | ||
| 31254 | DI | Disable interrupts. | ||
| 31255 | POP HL | Restore the pitch from the stack. | ||
| 31256 | LD BC,8 | Increase the pitch by 0008. | ||
| 31259 | ADD HL,BC | |||
| 31260 | POP BC | Restore the explosion sound loops counter from the stack. | ||
| 31261 | DJNZ AlienExplosions_Sound_02_Loop | Decrease the explosion sound loops counter by one and loop back to AlienExplosions_Sound_02_Loop until the explosion sound has finished playing. | ||
|
Update the explosion position and check for scoring.
|
||||
| AlienExplosions_UpdatePosition | 31263 | POP HL | Restore HL, BC and AF from the stack. | |
| 31264 | POP BC | |||
| 31265 | POP AF | |||
| 31266 | PUSH BC | Stash BC and HL on the stack. | ||
| 31267 | PUSH HL | |||
| 31268 | INC HL | Increment HL by one. | ||
| 31269 | LD E,(HL) | E=*HL. | ||
| 31270 | INC HL | Increment HL by one. | ||
| 31271 | LD D,(HL) | D=*HL. | ||
| 31272 | LD C,A | C=A. | ||
| 31273 | LD A,(26353) | A=*Phase. | ||
| 31276 | AND %00000010 | Keep only bit 1. | ||
| 31278 | LD A,C | A=C. | ||
| 31279 | JR NZ,Handler_AlienExplosions_6 | Jump to Handler_AlienExplosions_6 if bit 1 of *Phase was set. | ||
| 31281 | CP 1 | Jump to Handler_AlienExplosions_0 if A is not equal to 1. | ||
| 31283 | JR NZ,Handler_AlienExplosions_0 | |||
| 31285 | PUSH DE | Stash DE and AF on the stack. | ||
| 31286 | PUSH AF | |||
| 31287 | EX DE,HL | Exchange the DE and HL registers. | ||
| 31288 | CALL ConvertAttributeToScreenBufferAddress | Call ConvertAttributeToScreenBufferAddress. | ||
| 31291 | EX DE,HL | Exchange the DE and HL registers. | ||
| 31292 | CALL ClearSpriteArea | Call ClearSpriteArea. | ||
| 31295 | POP AF | Restore AF and DE from the stack. | ||
| 31296 | POP DE | |||
| Handler_AlienExplosions_0 | 31297 | CP 4 | Jump to Handler_AlienExplosions_2 if A is not equal to 4. | |
| 31299 | JR NZ,Handler_AlienExplosions_2 | |||
| 31301 | PUSH DE | Stash DE and AF on the stack. | ||
| 31302 | PUSH AF | |||
| 31303 | LD HL,25901 | HL=25901. | ||
| 31306 | LD (HL),56 | Write 56 to *HL. | ||
| 31308 | LD A,D | Jump to Handler_AlienExplosions_1 if D is equal to 90. | ||
| 31309 | CP 90 | |||
| 31311 | JR Z,Handler_AlienExplosions_1 | |||
| 31313 | LD (HL),50 | Write 50 to *HL. | ||
| 31315 | INC HL | Increment HL by one. | ||
| 31316 | LD (HL),53 | Write 53 to *HL. | ||
| Handler_AlienExplosions_1 | 31318 | CALL Handler_Score | Call Handler_Score. | |
| 31321 | CALL PrintScore | Call PrintScore. | ||
| 31324 | CALL PrintLives | Call PrintLives. | ||
| 31327 | POP AF | Restore AF and DE from the stack. | ||
| 31328 | POP DE | |||
| Handler_AlienExplosions_2 | 31329 | CP 7 | Compare A with 7. | |
| 31331 | LD BC,836 | BC=836. | ||
| 31334 | JR C,Handler_AlienExplosions_3 | Jump to Handler_AlienExplosions_3 if A is less than 7. | ||
| 31336 | LD HL,25909 | HL=Table_ExplosionUDGs_03. | ||
| 31339 | CP 9 | Jump to Handler_AlienExplosions_5 if A is less than 9. | ||
| 31341 | JR C,Handler_AlienExplosions_5 | |||
| 31343 | LD C,3 | C=3. | ||
| 31345 | JR Handler_AlienExplosions_5 | Jump to Handler_AlienExplosions_5. | ||
| Handler_AlienExplosions_3 | 31347 | INC C | Increment C by one. | |
| 31348 | CP 4 | Jump to Handler_AlienExplosions_4 if A is less than 4. | ||
| 31350 | JR C,Handler_AlienExplosions_4 | |||
| 31352 | LD HL,25906 | HL=Table_ExplosionUDGs_02. | ||
| 31355 | JR Handler_AlienExplosions_5 | Jump to Handler_AlienExplosions_5. | ||
| Handler_AlienExplosions_4 | 31357 | LD C,71 | C=71. | |
| 31359 | LD HL,25903 | HL=Table_ExplosionUDGs_01. | ||
| Handler_AlienExplosions_5 | 31362 | PUSH DE | Stash DE on the stack. | |
| 31363 | EX DE,HL | Exchange the DE and HL registers. | ||
| 31364 | CALL ConvertAttributeToScreenBufferAddress | Call ConvertAttributeToScreenBufferAddress. | ||
| 31367 | PUSH HL | Stash HL and BC on the stack. | ||
| 31368 | PUSH BC | |||
| 31369 | LD BC,20672 | HL-=20672. | ||
| 31372 | AND A | |||
| 31373 | SBC HL,BC | |||
| 31375 | POP BC | Restore BC and HL from the stack. | ||
| 31376 | POP HL | |||
| 31377 | EX DE,HL | Exchange the DE and HL registers. | ||
| 31378 | CALL C,CustomFont_PrintString | Call CustomFont_PrintString if A is less than 0. | ||
| 31381 | POP DE | Restore DE from the stack. | ||
| 31382 | JP Handler_AlienExplosions_14 | Jump to Handler_AlienExplosions_14. | ||
| Handler_AlienExplosions_6 | 31385 | CP 1 | Jump to Handler_AlienExplosions_7 if A is not equal to 1. | |
| 31387 | JR NZ,Handler_AlienExplosions_7 | |||
| 31389 | PUSH DE | Stash DE and AF on the stack. | ||
| 31390 | PUSH AF | |||
| 31391 | EX DE,HL | Exchange the DE and HL registers. | ||
| 31392 | CALL ConvertAttributeToScreenBufferAddress | Call ConvertAttributeToScreenBufferAddress. | ||
| 31395 | EX DE,HL | Exchange the DE and HL registers. | ||
| 31396 | CALL ClearSpriteArea | Call ClearSpriteArea. | ||
| 31399 | POP AF | Restore AF and DE from the stack. | ||
| 31400 | POP DE | |||
| 31401 | INC DE | Increment DE by one. | ||
| 31402 | LD (DE),A | Write A to *DE. | ||
| 31403 | DEC DE | Decrease DE by one. | ||
| 31404 | JR Handler_AlienExplosions_10 | Jump to Handler_AlienExplosions_10. | ||
| Handler_AlienExplosions_7 | 31406 | CP 2 | Jump to Handler_AlienExplosions_10 if A is not equal to 2. | |
| 31408 | JR NZ,Handler_AlienExplosions_10 | |||
| 31410 | PUSH AF | Stash AF and DE on the stack. | ||
| 31411 | PUSH DE | |||
| 31412 | LD HL,25900 | HL=25900. | ||
| 31415 | PUSH HL | Stash HL on the stack. | ||
| 31416 | LD (HL),49 | Write 49 to *HL. | ||
| 31418 | LD A,(26257) | Jump to Handler_AlienExplosions_9 if *26257 is zero. | ||
| 31421 | OR A | |||
| 31422 | JR Z,Handler_AlienExplosions_9 | |||
| 31424 | LD A,D | Jump to Handler_AlienExplosions_8 if D is less than 89. | ||
| 31425 | CP 89 | |||
| 31427 | JR C,Handler_AlienExplosions_8 | |||
| 31429 | LD (HL),50 | Write 50 to *HL. | ||
| 31431 | JR Z,Handler_AlienExplosions_9 | Jump to Handler_AlienExplosions_9 if A is equal to 89. | ||
| Handler_AlienExplosions_8 | 31433 | INC HL | Increment HL by one. | |
| 31434 | LD (HL),53 | Write 53 to *HL. | ||
| Handler_AlienExplosions_9 | 31436 | EX DE,HL | Exchange the DE and HL registers. | |
| 31437 | CALL ConvertAttributeToScreenBufferAddress | Call ConvertAttributeToScreenBufferAddress. | ||
| 31440 | PUSH HL | Stash HL on the stack. | ||
| 31441 | LD BC,20672 | HL-=20672. | ||
| 31444 | AND A | |||
| 31445 | SBC HL,BC | |||
| 31447 | POP HL | Restore HL from the stack. | ||
| 31448 | EX DE,HL | Exchange the DE and HL registers. | ||
| 31449 | POP HL | Restore HL from the stack. | ||
| 31450 | LD BC,837 | BC=837. | ||
| 31453 | CALL C,Configurable_PrintString | Call Configurable_PrintString if A is less than 0. | ||
| 31456 | CALL Handler_Score | Call Handler_Score. | ||
| 31459 | CALL PrintScore | Call PrintScore. | ||
| 31462 | CALL PrintLives | Call PrintLives. | ||
| 31465 | POP DE | Restore DE and AF from the stack. | ||
| 31466 | POP AF | |||
| Handler_AlienExplosions_10 | 31467 | PUSH DE | Stash DE on the stack. | |
| 31468 | LD C,A | C=A. | ||
| 31469 | LD A,E | A=E. | ||
| 31470 | INC A | Increment A by one. | ||
| 31471 | AND %00011111 | Keep only bits 0-4. | ||
| 31473 | SUB C | A-=C. | ||
| 31474 | JR C,Handler_AlienExplosions_12 | Jump to Handler_AlienExplosions_12 if A is less than A. | ||
| 31476 | PUSH BC | Stash BC and AF on the stack. | ||
| 31477 | PUSH AF | |||
| 31478 | LD A,E | E-=C. | ||
| 31479 | SUB C | |||
| 31480 | LD E,A | |||
| 31481 | INC E | Increment E by one. | ||
| 31482 | CALL Handler_Mask | Call Handler_Mask. | ||
| 31485 | DEC E | Decrease E by one. | ||
| 31486 | POP AF | Restore AF from the stack. | ||
| 31487 | JR Z,Handler_AlienExplosions_11 | Jump to Handler_AlienExplosions_11 until E is zero. | ||
| 31489 | POP BC | Restore BC from the stack. | ||
| 31490 | PUSH BC | Stash BC on the stack. | ||
| 31491 | LD A,C | Jump to Handler_AlienExplosions_11 if C is equal to 16. | ||
| 31492 | CP 16 | |||
| 31494 | JR Z,Handler_AlienExplosions_11 | |||
| 31496 | CALL Handler_EggsplosionLeft | Call Handler_EggsplosionLeft. | ||
| Handler_AlienExplosions_11 | 31499 | POP BC | Restore BC and DE from the stack. | |
| Handler_AlienExplosions_12 | 31500 | POP DE | ||
| 31501 | PUSH DE | Stash DE on the stack. | ||
| 31502 | INC E | Increment E by one. | ||
| 31503 | LD A,E | A=E. | ||
| 31504 | AND %00011111 | Keep only bits 0-4. | ||
| 31506 | ADD A,C | A+=C. | ||
| 31507 | CP 32 | Jump to Handler_AlienExplosions_13 if A is greater than or equal to 32. | ||
| 31509 | JR NC,Handler_AlienExplosions_13 | |||
| 31511 | PUSH BC | Stash BC on the stack. | ||
| 31512 | CP 31 | Compare A with 31. | ||
| 31514 | PUSH AF | Stash AF on the stack. | ||
| 31515 | LD A,E | E+=C. | ||
| 31516 | ADD A,C | |||
| 31517 | LD E,A | |||
| 31518 | DEC DE | Decrease DE by one. | ||
| 31519 | CALL Handler_Mask | Call Handler_Mask. | ||
| 31522 | INC DE | Increment DE by one. | ||
| 31523 | POP AF | Restore AF and BC from the stack. | ||
| 31524 | POP BC | |||
| 31525 | JR Z,Handler_AlienExplosions_13 | Jump to Handler_AlienExplosions_13 if ??? is zero. | ||
| 31527 | LD A,C | Jump to Handler_AlienExplosions_13 if C is equal to 16. | ||
| 31528 | CP 16 | |||
| 31530 | JR Z,Handler_AlienExplosions_13 | |||
| 31532 | CALL Handler_EggsplosionRight | Call Handler_EggsplosionRight. | ||
| Handler_AlienExplosions_13 | 31535 | POP DE | Restore DE and HL from the stack. | |
| Handler_AlienExplosions_14 | 31536 | POP HL | ||
| 31537 | INC (HL) | Increment *HL by one. | ||
|
The number of frames the explosion persists for varies between the phases, presumably because some phases allow the ship to make "quick shots" and the number of slots may be at risk when the player can fire more rapidly.
|
||||
| 31538 | LD A,(26353) | A=*Phase. | ||
| 31541 | AND %00000010 | Keep only bit 1. | ||
| 31543 | LD A,11 | Set the frame limit in A to 11 frames. | ||
| 31545 | JR Z,AlienExplosions_CheckComplete | Jump to AlienExplosions_CheckComplete if bit 1 of *Phase was not set. | ||
| 31547 | LD A,17 | Set the frame limit in A to 17 frames. | ||
| AlienExplosions_CheckComplete | 31549 | CP (HL) | Jump to AlienExplosions_Continue if *HL is not equal to the frame limit. | |
| 31550 | JR NZ,AlienExplosions_Continue | |||
| 31552 | LD (HL),0 | Clear the current explosion slot (set to 0). | ||
| 31554 | PUSH HL | Stash the explosion slot pointer on the stack. | ||
| 31555 | EX DE,HL | Exchange the DE and HL registers. | ||
| 31556 | CALL ConvertAttributeToScreenBufferAddress | Call ConvertAttributeToScreenBufferAddress. | ||
| 31559 | PUSH HL | Stash HL on the stack. | ||
| 31560 | LD BC,20672 | HL-=20672. | ||
| 31563 | AND A | |||
| 31564 | SBC HL,BC | |||
| 31566 | POP HL | Restore HL from the stack. | ||
| 31567 | EX DE,HL | Exchange the DE and HL registers. | ||
|
Prints
|
||||
| 31568 | LD HL,16155 | HL=16155. | ||
| 31571 | LD BC,768 | BC=0768. | ||
| 31574 | CALL C,SpectrumFont_PrintString | Call SpectrumFont_PrintString if ?? is less than 0. | ||
| 31577 | LD HL,26239 | Decrease *AlienCount by one. | ||
| 31580 | DEC (HL) | |||
| 31581 | POP HL | Restore the explosion slot pointer from the stack. | ||
| AlienExplosions_Continue | 31582 | POP BC | Restore the explosion slot counter from the stack. | |
|
Move to the next explosion slot.
|
||||
| AlienExplosions_NextSlot | 31583 | INC HL | Move the explosion slot pointer to the next explosion slot. | |
| 31584 | INC HL | |||
| 31585 | INC HL | |||
| 31586 | DEC B | Decrease the explosion slot counter by one. | ||
| 31587 | JP NZ,AlienExplosions_Loop | Jump back to AlienExplosions_Loop until all explosion slots have been processed. | ||
| 31590 | RET | Return. | ||
| Prev: 30230 | Up: Map | Next: 31591 |