Prev: 26785 Up: Map Next: 26918
26808: Transition Effect
Used by the routines at InitialiseLevel, GameEntryPoint and TitleScreen.
Creates a transition effect where a rectangular frame grows outwards from the center of the screen, the colour varies depending on the current phase. Once the frame fills the whole screen, it then "erases" from the center outwards again.
This animation is also present in Phoenix, the arcade game this game is based on.
Demonstrating the transition using INK:MAGENTA, PAPER:BLACK (BRIGHT):
First Animation
Frame 0 Frame 1 Frame 2 Frame 3
transition-0 transition-1 transition-2 transition-3
Frame 4 Frame 5 Frame 6 Frame 7
transition-4 transition-5 transition-6 transition-7
Frame 8 Frame 9 Frame 10 Frame 11
transition-8 transition-9 transition-10 transition-11
Second Animation
Frame 0 Frame 1 Frame 2 Frame 3
transition-12 transition-13 transition-14 transition-15
Frame 4 Frame 5 Frame 6 Frame 7
transition-16 transition-17 transition-18 transition-19
Frame 8 Frame 9 Frame 10 Frame 11
transition-20 transition-21 transition-22 transition-23
Which create the following animation:
transition-animation
TransitionEffect 26808 LD B,2 Set an iteration counter in B for 2 animations.
TransitionEffect_Loop 26810 PUSH BC Stash the iteration counter on the stack.
26811 LD DE,265 Set DE to initial frame dimensions (width=9, height=1).
26814 LD HL,22891 HL=22891 (starting attribute buffer location).
Determine the attribute color for this iteration.
26817 LD A,B Check if this is iteration 1?
26818 CP 1
The second time this loops around, the rectangular frame "erases" itself (which is just achieved by doing the same thing again but in BLACK).
26820 LD A,0 Set the iteration colour to: INK:BLACK, PAPER:BLACK.
26822 JR Z,TransitionEffect_DrawFrame Jump to TransitionEffect_DrawFrame if this is iteration 1.
Else, this is the first loop - so set the INK based on the current phase.
Phase Colour
0 INK:MAGENTA, PAPER:BLACK
1 INK:GREEN, PAPER:BLACK
2 INK:CYAN, PAPER:BLACK
3 INK:YELLOW, PAPER:BLACK
4 INK:MAGENTA, PAPER:BLACK (BRIGHT)
26824 LD A,(26353) Set the iteration colour to: *Phase+3.
26827 ADD A,3
26829 CP 7 Jump to TransitionEffect_DrawFrame unless the colour is WHITE (for phase 4).
26831 JR NZ,TransitionEffect_DrawFrame
Phase 4 uses INK:MAGENTA, PAPER:BLACK (BRIGHT) instead of WHITE.
26833 LD A,67 Set the iteration colour to: INK:MAGENTA, PAPER:BLACK (BRIGHT).
There are 12 frames to fill the whole screen.
TransitionEffect_DrawFrame 26835 LD B,12 Set a counter in B for 12 frames.
TransitionEffect_FrameLoop 26837 PUSH BC Stash the frame counter on the stack.
26838 LD B,E Set the horizontal counter from E (frame width).
Draw the top edge of the frame (left to right).
TransitionEffect_TopEdge 26839 LD (HL),A Write the attribute byte to the attribute buffer.
26840 CALL Print_Asterisk Call Print_Asterisk.
26843 INC HL Move the attribute address pointer right one block.
26844 DJNZ TransitionEffect_TopEdge Decrease the horizontal counter by one and loop back to TransitionEffect_TopEdge until the top edge of the frame has been drawn.
26846 LD B,D Set the vertical counter from D (frame height).
Draw the right edge of the frame (top to bottom).
TransitionEffect_RightEdge 26847 PUSH BC Stash the vertical counter on the stack.
26848 LD (HL),A Write the attribute byte to the attribute buffer.
26849 CALL Print_Asterisk Call Print_Asterisk.
26852 LD BC,32 Move down one row (add 0032 to the attribute address).
26855 ADD HL,BC
26856 POP BC Restore the vertical counter from the stack.
26857 DJNZ TransitionEffect_RightEdge Decrease the vertical counter by one and loop back to TransitionEffect_RightEdge until the right edge of the frame has been drawn.
26859 LD B,E Set the horizontal counter from E (frame width).
Draw the bottom edge of the frame (right to left).
TransitionEffect_BottomEdge 26860 LD (HL),A Write the attribute byte to the attribute buffer.
26861 CALL Print_Asterisk Call Print_Asterisk.
26864 DEC HL Move the attribute address pointer left one block.
26865 DJNZ TransitionEffect_BottomEdge Decrease the horizontal counter by one and loop back to TransitionEffect_BottomEdge until the bottom edge of the frame has been drawn.
26867 LD B,D Set the vertical counter from D (frame height).
Draw the left edge of the frame (bottom to top).
TransitionEffect_LeftEdge 26868 PUSH BC Stash the vertical counter on the stack.
26869 LD (HL),A Write the attribute byte to the attribute buffer.
26870 CALL Print_Asterisk Call Print_Asterisk.
26873 LD BC,32 Move up one row (subtract 0032 from the attribute address).
26876 AND A
26877 SBC HL,BC
26879 POP BC Restore the vertical counter from the stack.
26880 DJNZ TransitionEffect_LeftEdge Decrease the vertical counter by one and loop back to TransitionEffect_LeftEdge until the left edge of the frame has been drawn.
Move outward to the next frame.
26882 LD C,33 Move up one row and left one block (subtract 0033 from the attribute address).
26884 SBC HL,BC
Increase the frame dimensions.
26886 INC E Increment frame width by two.
26887 INC E
26888 INC D Increment the frame height by two.
26889 INC D
Action a delay between the frames.
26890 PUSH AF Stash the attribute byte on the stack.
26891 LD BC,10 Set a frame delay counter in BC to 0256*10 loops.
TransitionEffect_FrameDelay 26894 DJNZ TransitionEffect_FrameDelay Decrease the inner loop counter by one and loop back to TransitionEffect_FrameDelay until the inner loop counter is zero.
26896 DEC C Decrease the outer loop counter by one.
26897 JR NZ,TransitionEffect_FrameDelay Jump back to TransitionEffect_FrameDelay until the outer loop counter is zero.
Process the next frame loop (or pass through when it's completed).
26899 POP AF Restore the attribute byte and frame counter from the stack.
26900 POP BC
26901 DJNZ TransitionEffect_FrameLoop Decrease the frame counter by one and loop back to TransitionEffect_FrameLoop until the counter is zero.
Action a delay between the iterations.
26903 LD BC,50 Set an iteration delay counter in BC to 0256*50 loops.
TransitionEffect_DelayLoop 26906 DJNZ TransitionEffect_DelayLoop Decrease the inner loop counter by one and loop back to TransitionEffect_DelayLoop until the inner loop counter is zero.
26908 DEC C Decrease the outer loop counter by one.
26909 JR NZ,TransitionEffect_DelayLoop Jump back to TransitionEffect_DelayLoop until the outer loop counter is zero.
Process the next iteration animation (or pass through and end).
26911 POP BC Restore the iteration counter from the stack.
26912 DJNZ TransitionEffect_Loop Decrease the iteration counter by one and loop back to TransitionEffect_Loop until the animation is complete.
All done, clear the screen and return.
26914 CALL ClearScreen Call ClearScreen.
26917 RET Return.
Prev: 26785 Up: Map Next: 26918