Prev: 29385 Up: Map Next: 30052
29860: Game Intro
Used by the routine at 29385.
level-01
GameIntro 29860 CALL ClearScreen Call ClearScreen.
Don't bother with the animation if this is the demo mode.
29863 LD A,(26355) Return if *Flag_ActiveDemoMode is set.
29866 OR A
29867 RET NZ
Set the attribute buffer to all cyan.
29868 LD HL,22528 Copy CYAN to 768 bytes starting from 22528 in the attribute buffer.
29871 LD DE,22529
29874 LD BC,767
29877 LD (HL),5
29879 LDIR
29881 LD HL,27667 HL=Table_MusicData.
29884 LD B,46 Set a counter in B for 46 stars to draw.
GameIntro_StarLoop 29886 LD A,B Jump to GameIntro_MusicLoop if B is greater than or equal to 45.
29887 CP 45
29889 JR NC,GameIntro_MusicLoop
Check if the control method is the Kempson joystick?
29891 LD A,(26358) Jump to GameIntro_CheckAGF if *ControlMethod is not the Kempston joystick.
29894 CP 2
29896 JR NZ,GameIntro_CheckAGF
The control method is Kempston joystick, so test the fire button.
29898 IN A,(31) A=read from the Kempston joystick port.
29900 AND %00010000 Jump to GameIntro_Done if the fire button was pressed.
29902 JP NZ,GameIntro_Done
29905 JR GameIntro_MusicLoop Jump to GameIntro_MusicLoop.
Check if the control method is the AGF joystick?
GameIntro_CheckAGF 29907 CP 1 Jump to GameIntro_IsKeyboard if *ControlMethod is not the AGF joystick.
29909 JR NZ,GameIntro_IsKeyboard
29911 LD A,239
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
29913 JR GameIntro_CheckFireButton Jump to GameIntro_CheckFireButton.
Else, the only control option left is the keyboard.
GameIntro_IsKeyboard 29915 LD A,127
Port Number Bit
0 1 2 3 4
127 SPACE FULL-STOP M N B
GameIntro_CheckFireButton 29917 IN A,(254) Read from the keyboard.
29919 BIT 0,A Jump to GameIntro_Done if the fire button was pressed.
29921 JR Z,GameIntro_Done
GameIntro_MusicLoop 29923 PUSH BC Stash the star counter on the stack.
29924 LD C,(HL) Fetch the pitch from the music data pointer.
29925 INC HL
29926 LD B,(HL)
29927 INC HL Fetch the duration from the music data pointer.
29928 LD E,(HL)
29929 LD D,1 D=1.
29931 INC HL Move the music data pointer to the next byte.
29932 PUSH HL Stash the music data pointer on the stack.
29933 PUSH BC HL=BC (using the stack).
29934 POP HL
29935 CALL 949 Call BEEPER.
29938 DI Disable interrupts.
29939 LD HL,22495 HL=22495 (screen buffer location).
29942 LD DE,22527 DE=22527 (screen buffer location).
29945 LD C,3 C=3.
GameIntro_0 29947 LD B,8 B=8.
GameIntro_1 29949 PUSH BC Stash BC, HL and DE on the stack.
29950 PUSH HL
29951 PUSH DE
29952 LD BC,224 BC=0224.
29955 LDDR LDDR.
29957 LD C,32 C=32.
29959 LD L,255 L=255.
29961 LD A,H Jump to GameIntro_2 if H is less than 71.
29962 CP 71
29964 JR C,GameIntro_2
29966 SUB 7 Subtract 7 and store the result in H.
29968 LD H,A
29969 LDDR LDDR.
GameIntro_2 29971 POP DE Restore DE and HL from the stack.
29972 POP HL
29973 DEC D Decrease D by one.
29974 DEC H Decrease H by one.
29975 POP BC Restore BC from the stack.
29976 DJNZ GameIntro_1 Decrease counter by one and loop back to GameIntro_1 until counter is zero.
29978 DEC C Decrease C by one.
29979 JR NZ,GameIntro_0 Jump to GameIntro_0 until C is zero.
29981 LD H,64 H=64.
29983 LD B,8 B=8.
GameIntro_3 29985 PUSH BC Stash BC on the stack.
29986 LD BC,31 BC=0031.
29989 LD D,H D=H.
29990 LD L,B L=B.
29991 LD E,1 E=1.
29993 LD (HL),B Write B to *HL.
29994 LDIR LDIR.
29996 INC H Increment H by one.
29997 POP BC Restore BC from the stack.
29998 DJNZ GameIntro_3 Decrease counter by one and loop back to GameIntro_3 until counter is zero.
30000 LD HL,25051 HL=Graphics_StarLarge.
Draw two stars; one large and one small.
30003 LD B,2 Set a counter in B for the number of types of stars to draw.
GameIntro_DrawStar_Loop 30005 PUSH BC Stash the star type counter on the stack.
GameIntro_4 30006 CALL 26382 Call 26382.
30009 AND %00011111 Keep only bits 0-4.
30011 JR Z,GameIntro_4 Jump to GameIntro_4 if H is equal to 2 or A is equal to 31.
30013 CP 31
30015 JR Z,GameIntro_4
30017 LD E,A E=A.
30018 LD D,64 D=64.
30020 LD B,8 Set a line counter in B (8 lines in a UDG).
GameIntro_DrawStar_LineLoop 30022 LD A,(HL) Copy the UDG data to the screen buffer.
30023 LD (DE),A
30024 INC HL Move to the next UDG graphic data byte.
30025 INC D Move down one pixel line in the screen buffer.
30026 DJNZ GameIntro_DrawStar_LineLoop Decrease the line counter by one and loop back to GameIntro_DrawStar_LineLoop until all 8 lines of the UDG character have been drawn.
30028 LD HL,25163 HL=Graphics_StarSmall.
30031 POP BC Restore the star type counter from the stack.
30032 DJNZ GameIntro_DrawStar_Loop Decrease star type counter by one and loop back to GameIntro_DrawStar_Loop until both types of star have been drawn.
30034 POP HL Restore the music data pointer and star counter from the stack.
30035 POP BC
30036 DEC B Decrease the star counter by one.
30037 JP NZ,GameIntro_StarLoop Jump back to GameIntro_StarLoop until all the stars have been drawn.
The animation is finished.
GameIntro_Done 30040 CALL ClearScreen Call ClearScreen.
30043 LD BC,0 Set a counter in BC of 0000.
GameIntro_Done_PauseLoop 30046 DJNZ GameIntro_Done_PauseLoop Decrease the pause counter by one and loop back to GameIntro_Done_PauseLoop until the counter is zero.
30048 DEC C Decrease C by one.
30049 JR NZ,GameIntro_Done_PauseLoop Jump to GameIntro_Done_PauseLoop until C is zero.
30051 RET Return.
Prev: 29385 Up: Map Next: 30052