![]() |
Routines |
| Prev: 72C9 | Up: Map | Next: 7407 |
|
Used by the routine at Handler_LevelReset.
Displays the bonus screen after completing the mothership level (phase 4).
|
||||||||||||||||
|
Only continue if;
|
||||||||||||||||
| Handler_DisplayMothershipBonus | 730D | LD A,($66A4) | Return if *Flag_Collision is equal to 01. | |||||||||||||
| 7310 | CP $01 | |||||||||||||||
| 7312 | RET Z | |||||||||||||||
| 7313 | LD A,($66F1) | Jump to Check_InitialiseLevel if *Phase is not equal to 04. | ||||||||||||||
| 7316 | CP $04 | |||||||||||||||
| 7318 | JP NZ,Check_InitialiseLevel | |||||||||||||||
| 731B | LD A,($66D3) | Return if *MothershipAlienState is zero. | ||||||||||||||
| 731E | OR A | |||||||||||||||
| 731F | RET Z | |||||||||||||||
|
Display a bonus screen with star background.
First fill the screen with the star UDG character (note they're written in INK:BLACK,
PAPER:BLACK so they're not yet visible - this is just an example in INK:CYAN,
PAPER:BLACK (BRIGHT) to show what is happening at this point).
|
||||||||||||||||
| 7320 | CALL ClearScreen | Call ClearScreen. | ||||||||||||||
| 7323 | LD DE,$61DB | DE=Graphics_StarLarge. | ||||||||||||||
| 7326 | CALL FillScreenWithUDG | Call FillScreenWithUDG. | ||||||||||||||
|
Print the bonus score text.
|
||||||||||||||||
| 7329 | LD DE,$486E | DE=486E (screen buffer location). | ||||||||||||||
| 732C | LD BC,$0445 | Printing 04 characters in INK:CYAN, PAPER:BLACK (BRIGHT). | ||||||||||||||
| 732F | LD HL,$652B | HL=BonusScoreBuffer. | ||||||||||||||
|
Calculate the bonus digit.
|
||||||||||||||||
| 7332 | LD A,($667F) | Load *AlienCount (the number of aliens in the current level) into A. | ||||||||||||||
| 7335 | SRA A | Divide by 02 and add 34 (ASCII "4"). | ||||||||||||||
| 7337 | ADD A,$34 | |||||||||||||||
| 7339 | LD (HL),A | Write the result to the score buffer. | ||||||||||||||
| 733A | CALL Configurable_PrintString | Call Configurable_PrintString. | ||||||||||||||
|
Print it again...
|
||||||||||||||||
| 733D | LD HL,$652B | HL=BonusScoreBuffer. | ||||||||||||||
| 7340 | LD E,$8E | Update the printing location to 488E. | ||||||||||||||
| 7342 | LD B,$04 | Printing 04 characters. | ||||||||||||||
| 7344 | CALL Configurable_PrintString | Call Configurable_PrintString. | ||||||||||||||
|
Smoosh the top score down:
|
||||||||||||||||
| 7347 | LD C,$04 | Set a row counter in C to 04. | ||||||||||||||
| BonusScrollTop_RowLoop | 7349 | LD HL,$4E6B | HL=4E6B (screen buffer location). | |||||||||||||
| 734C | LD DE,$4F6B | DE=4F6B (screen buffer location). | ||||||||||||||
| 734F | LD B,$08 | Set a line counter in B (08 lines in a UDG). | ||||||||||||||
| BonusScrollTop_LineLoop | 7351 | PUSH BC | Stash BC and HL on the stack. | |||||||||||||
| 7352 | PUSH HL | |||||||||||||||
| 7353 | LD BC,$000A | BC=000A. | ||||||||||||||
| 7356 | LDIR | LDIR. | ||||||||||||||
| 7358 | POP DE | Restore DE from the stack. | ||||||||||||||
| 7359 | PUSH DE | Stash DE on the stack. | ||||||||||||||
| 735A | POP HL | Restore HL from the stack. | ||||||||||||||
| 735B | DEC H | Decrease H by one. | ||||||||||||||
| 735C | POP BC | Restore BC from the stack. | ||||||||||||||
| 735D | DJNZ BonusScrollTop_LineLoop | Decrease counter by one and loop back to BonusScrollTop_LineLoop until counter is zero. | ||||||||||||||
| 735F | DEC C | Decrease C by one. | ||||||||||||||
| 7360 | JR NZ,BonusScrollTop_RowLoop | Jump to BonusScrollTop_RowLoop until C is zero. | ||||||||||||||
|
Smoosh the bottom score up:
|
||||||||||||||||
| 7362 | LD C,$04 | C=04. | ||||||||||||||
| BonusScrollBottom_RowLoop | 7364 | LD HL,$498B | HL=498B (screen buffer location). | |||||||||||||
| 7367 | LD DE,$488B | DE=488B (screen buffer location). | ||||||||||||||
| 736A | LD B,$07 | B=07. | ||||||||||||||
| BonusScrollBottom_LineLoop | 736C | PUSH BC | Stash BC and HL on the stack. | |||||||||||||
| 736D | PUSH HL | |||||||||||||||
| 736E | LD BC,$000A | BC=000A. | ||||||||||||||
| 7371 | LDIR | LDIR. | ||||||||||||||
| 7373 | POP DE | Restore DE from the stack. | ||||||||||||||
| 7374 | PUSH DE | Stash DE on the stack. | ||||||||||||||
| 7375 | POP HL | Restore HL from the stack. | ||||||||||||||
| 7376 | INC H | Increment H by one. | ||||||||||||||
| 7377 | POP BC | Restore BC from the stack. | ||||||||||||||
| 7378 | DJNZ BonusScrollBottom_LineLoop | Decrease counter by one and loop back to BonusScrollBottom_LineLoop until counter is zero. | ||||||||||||||
| 737A | DEC C | Decrease C by one. | ||||||||||||||
| 737B | JR NZ,BonusScrollBottom_RowLoop | Jump back to BonusScrollBottom_RowLoop until C is zero. | ||||||||||||||
| 737D | CALL Handler_Score | Call Handler_Score. | ||||||||||||||
|
Animate the bonus frame shimmering effect.
|
||||||||||||||||
| 7380 | LD IX,$0000 | IX=0000. | ||||||||||||||
| 7384 | LD B,$10 | Set an outer counter to 10. | ||||||||||||||
| BonusAnimation_OuterLoop | 7386 | PUSH BC | Stash the outer counter on the stack. | |||||||||||||
| 7387 | LD B,$0B | Set an inner counter to 0B. | ||||||||||||||
| BonusAnimation_InnerLoop | 7389 | PUSH BC | Stash the inner counter on the stack. | |||||||||||||
| 738A | PUSH IX | Stash IX on the stack. | ||||||||||||||
| 738C | LD HL,$594A | HL=594A (attribute buffer location). | ||||||||||||||
| 738F | LD DE,$030B | Set DE to initial frame dimensions (width=0B, height=03). | ||||||||||||||
| 7392 | LD A,$0C | B=0C-B. | ||||||||||||||
| 7394 | SUB B | |||||||||||||||
| 7395 | LD B,A | |||||||||||||||
| BonusAnimation_FrameLoop | 7396 | PUSH BC | Stash BC on the stack. | |||||||||||||
| 7397 | LD A,IXl | A=the low byte of IX. | ||||||||||||||
| 7399 | AND %00111111 | Keep only bits 0-5. | ||||||||||||||
| 739B | LD B,E | Set the horizontal counter from E (frame width). | ||||||||||||||
|
Draw the top edge of the frame (left to right).
|
||||||||||||||||
| BonusAnimation_TopEdge | 739C | LD (HL),A | Write the attribute byte to the attribute buffer. | |||||||||||||
| 739D | INC HL | Move the attribute address pointer right one block. | ||||||||||||||
| 739E | DJNZ BonusAnimation_TopEdge | Decrease the horizontal counter by one and loop back to BonusAnimation_TopEdge until the top edge of the frame has been drawn. | ||||||||||||||
| 73A0 | LD B,D | Set the vertical counter from D (frame height). | ||||||||||||||
|
Draw the right edge of the frame (top to bottom).
|
||||||||||||||||
| BonusAnimation_RightEdge | 73A1 | PUSH BC | Stash the vertical counter on the stack. | |||||||||||||
| 73A2 | LD (HL),A | Write the attribute byte to the attribute buffer. | ||||||||||||||
| 73A3 | LD BC,$0020 | Move down one row (add 0020 to the attribute address). | ||||||||||||||
| 73A6 | ADD HL,BC | |||||||||||||||
| 73A7 | POP BC | Restore the vertical counter from the stack. | ||||||||||||||
| 73A8 | DJNZ BonusAnimation_RightEdge | Decrease the vertical counter by one and loop back to BonusAnimation_RightEdge until the right edge of the frame has been drawn. | ||||||||||||||
| 73AA | LD B,E | Set the horizontal counter from E (frame width). | ||||||||||||||
|
Draw the bottom edge of the frame (right to left).
|
||||||||||||||||
| BonusAnimation_BottomEdge | 73AB | LD (HL),A | Write the attribute byte to the attribute buffer. | |||||||||||||
| 73AC | DEC HL | Move the attribute address pointer left one block. | ||||||||||||||
| 73AD | DJNZ BonusAnimation_BottomEdge | Decrease the horizontal counter by one and loop back to BonusAnimation_BottomEdge until the bottom edge of the frame has been drawn. | ||||||||||||||
| 73AF | LD B,D | Set the vertical counter from D (frame height). | ||||||||||||||
|
Draw the left edge of the frame (bottom to top).
|
||||||||||||||||
| BonusAnimation_LeftEdge | 73B0 | PUSH BC | Stash the vertical counter on the stack. | |||||||||||||
| 73B1 | LD (HL),A | Write the attribute byte to the attribute buffer. | ||||||||||||||
| 73B2 | LD BC,$0020 | Move up one row (subtract 0020 from the attribute address). | ||||||||||||||
| 73B5 | SBC HL,BC | |||||||||||||||
| 73B7 | POP BC | Restore the vertical counter from the stack. | ||||||||||||||
| 73B8 | DJNZ BonusAnimation_LeftEdge | Decrease the vertical counter by one and loop back to BonusAnimation_LeftEdge until the left edge of the frame has been drawn. | ||||||||||||||
|
Move outward to the next frame.
|
||||||||||||||||
| 73BA | LD C,$21 | Move up one row and left one block (subtract 0021 from the attribute address). | ||||||||||||||
| 73BC | SBC HL,BC | |||||||||||||||
|
Increase the frame dimensions.
|
||||||||||||||||
| 73BE | INC E | Increment frame width by two. | ||||||||||||||
| 73BF | INC E | |||||||||||||||
| 73C0 | INC D | Increment the frame height by two. | ||||||||||||||
| 73C1 | INC D | |||||||||||||||
| 73C2 | INC IX | Increment IX by one. | ||||||||||||||
| 73C4 | POP BC | Restore BC from the stack. | ||||||||||||||
| 73C5 | DJNZ BonusAnimation_FrameLoop | Decrease counter by one and loop back to BonusAnimation_FrameLoop until counter is zero. | ||||||||||||||
|
Play a sound effect for the animation.
Note this sample is the whole thing, obviously it loops round.
|
||||||||||||||||
| 73C7 | POP HL | Restore HL from the stack. | ||||||||||||||
| 73C8 | PUSH HL | Stash HL on the stack. | ||||||||||||||
| 73C9 | LD A,L | A=L. | ||||||||||||||
| 73CA | AND %00001111 | Keep only bits 0-3. | ||||||||||||||
| 73CC | LD L,A | L=A. | ||||||||||||||
| 73CD | LD H,B | H=B. | ||||||||||||||
| 73CE | ADD HL,HL | Multiply HL by 64. | ||||||||||||||
| 73CF | ADD HL,HL | |||||||||||||||
| 73D0 | ADD HL,HL | |||||||||||||||
| 73D1 | ADD HL,HL | |||||||||||||||
| 73D2 | ADD HL,HL | |||||||||||||||
| 73D3 | ADD HL,HL | |||||||||||||||
| 73D4 | LD B,$07 | Set a sound iteration counter to 07 loops. | ||||||||||||||
| BonusAnimation_SoundLoop | 73D6 | PUSH BC | Stash the sound iteration counter and pitch on the stack. | |||||||||||||
| 73D7 | PUSH HL | |||||||||||||||
| 73D8 | LD DE,$0002 | Set sound duration to 0002. | ||||||||||||||
| 73DB | CALL $03B5 | Call BEEPER. | ||||||||||||||
| 73DE | DI | Disable interrupts. | ||||||||||||||
| 73DF | POP HL | Restore the pitch value from the stack. | ||||||||||||||
| 73E0 | LD BC,$0014 | Increase the pitch value by 0014. | ||||||||||||||
| 73E3 | ADD HL,BC | |||||||||||||||
| 73E4 | POP BC | Restore the sound iteration counter from the stack. | ||||||||||||||
| 73E5 | DJNZ BonusAnimation_SoundLoop | Decrease the sound iteration counter by one and loop back to BonusAnimation_SoundLoop until the sound has played out. | ||||||||||||||
| 73E7 | POP IX | Restore IX from the stack. | ||||||||||||||
| 73E9 | DEC IX | Decrease IX by one. | ||||||||||||||
| 73EB | POP BC | Restore the inner counter from the stack. | ||||||||||||||
| 73EC | DJNZ BonusAnimation_InnerLoop | Decrease the inner counter by one and loop back to BonusAnimation_InnerLoop until the counter is zero. | ||||||||||||||
| 73EE | POP BC | Restore the outer counter from the stack. | ||||||||||||||
| 73EF | DJNZ BonusAnimation_OuterLoop | Decrease the outer counter by one and loop back to BonusAnimation_OuterLoop until the counter is zero. | ||||||||||||||
| 73F1 | CALL ClearScreen | Call ClearScreen. | ||||||||||||||
| 73F4 | LD BC,$00C8 | BC=00C8. | ||||||||||||||
| BonusDelay_Loop | 73F7 | DJNZ BonusDelay_Loop | Decrease counter by one and loop back to BonusDelay_Loop until counter is zero. | |||||||||||||
| 73F9 | DEC C | Decrease C by one. | ||||||||||||||
| 73FA | JR NZ,BonusDelay_Loop | Jump to BonusDelay_Loop until C is zero. | ||||||||||||||
|
Self-modifying code; decrease the difficulty delay so the levels play faster.
|
||||||||||||||||
| 73FC | LD HL,$6898 | HL=6898. | ||||||||||||||
| 73FF | LD A,(HL) | Jump to InitialiseLevel if the current difficulty delay is less than 04. | ||||||||||||||
| 7400 | CP $04 | |||||||||||||||
| 7402 | JR C,InitialiseLevel | |||||||||||||||
| 7404 | DEC (HL) | Decrease the difficulty delay by one. | ||||||||||||||
| 7405 | JR InitialiseLevel | Jump to InitialiseLevel. | ||||||||||||||
| Prev: 72C9 | Up: Map | Next: 7407 |