Prev: 53810 Up: Map Next: 53982
53812: Game Initialisation
Used by the routine at DemoEntryPoint.
Input
HL Pointer to level data
Game_Initialisation 53812 LD C,(HL) The first byte is the length of the level data, store this in C.
53813 LD A,C A=data length.
53814 LD B,0 B=0.
53816 INC HL Increment HL by one.
53817 LD DE,57522 DE=57522.
53820 LDIR LDIR.
53822 LD DE,54577 DE=54577.
53825 LD BC,18 BC=0018.
53828 LDIR LDIR.
53830 LD E,(HL) E=*HL.
53831 INC HL Increment HL by one.
53832 LD D,(HL) D=*HL.
53833 LD (54702),DE Write DE to *LevelGraphicsData.
53837 LD HL,54651 HL=54651.
53840 LD B,12 B=12.
Game_Initialisation_0 53842 LD (HL),1 Write 1 to *HL.
53844 INC HL Increment HL by one.
53845 DJNZ Game_Initialisation_0 Decrease counter by one and loop back to Game_Initialisation_0 until counter is zero.
53847 LD DE,57452 DE=57452.
53850 LD HL,54397 HL=54397.
53853 LD BC,49 BC=0049.
53856 LDIR LDIR.
53858 LD HL,57502 HL=57502.
53861 LD B,20 B=20.
53863 LD A,1 A=1.
Game_Initialisation_1 53865 LD (HL),A Write A to *HL.
53866 INC HL Increment HL by one.
53867 INC A Increment A by one.
53868 DJNZ Game_Initialisation_1 Decrease counter by one and loop back to Game_Initialisation_1 until counter is zero.
53870 LD HL,54677 HL=54677.
53873 LD DE,54596 DE=54596.
Game_Initialisation_2 53876 LD A,(HL) A=*HL.
53877 CP 255 Compare A with 255.
53879 JR Z,PopulateDefaults_Done Jump to PopulateDefaults_Done if A is equal to 255.
53881 LD B,A B=A.
53882 INC HL Increment HL by one.
53883 LD A,(HL) A=*HL.
53884 INC HL Increment HL by one.
Game_Initialisation_3 53885 LD (DE),A Write A to *DE.
53886 INC DE Increment DE by one.
53887 DJNZ Game_Initialisation_3 Decrease counter by one and loop back to Game_Initialisation_3 until counter is zero.
53889 JR Game_Initialisation_2 Jump to Game_Initialisation_2.
The computed values are done, copy the last six values over.
PopulateDefaults_Done 53891 INC HL Copy the last 0006 bytes from D888 to D84A.
53892 LD BC,6
53895 LDIR
Write three NOT random numbers between 01-20 to ...
53897 LD B,3 B=3.
Game_Initialisation_4 53899 LD A,10 Write 10 to *DE.
53901 LD (DE),A
53902 INC DE Increment DE by one.
53903 DJNZ Game_Initialisation_4 Decrease counter by one and loop back to Game_Initialisation_4 until counter is zero.
53905 LD HL,55338 Write 55338 to:
53908 LD (54639),HL
53911 LD (54641),HL
53914 LD (54643),HL
53917 LD (54645),HL
53920 LD HL,57501 HL=57501.
53923 LD BC,2000 BC=2000.
Game_Initialisation_5 53926 PUSH BC Stash BC, HL and HL on the stack.
53927 PUSH HL
53928 PUSH HL
53929 CALL 54914 Call 54914.
53932 ADD HL,BC HL+=BC.
53933 EX DE,HL Exchange the DE and HL registers.
53934 POP HL Restore HL from the stack.
53935 CALL 54914 Call 54914.
53938 ADD HL,BC HL+=BC.
53939 LD B,(HL) B=*HL.
53940 LD A,(DE) A=*DE.
53941 LD (HL),A Write A to *HL.
53942 LD A,B A=B.
53943 LD (DE),A Write A to *DE.
53944 POP HL Restore HL and BC from the stack.
53945 POP BC
53946 DEC BC Decrease BC by one.
53947 LD A,B A=B.
53948 OR C Set the bits from C.
53949 JR NZ,Game_Initialisation_5 Jump to Game_Initialisation_5 if BC is not equal to C.
Populate the level, bonus and score numbering in the dashboard.
53951 CALL 59450 Call 59450.
53954 CALL 59403 Call 59403.
53957 CALL 59423 Call 59423.
Paint the preview grid pattern.
53960 CALL Colourise_PreviewGrid Call Colourise_PreviewGrid.
Small pause...
53963 LD BC,40000 BC=40000.
Game_Initialisation_6 53966 DEC BC Decrease BC by one.
53967 LD A,B Jump to Game_Initialisation_6 until BC is equal to 0.
53968 OR C
53969 JR NZ,Game_Initialisation_6
Play the "static" animation in the preview area.
53971 CALL StaticAnimation Call StaticAnimation.
Display the current preview image.
53974 LD IX,(54702) IX=*LevelGraphicsData.
53978 CALL GeneratePicture Call GeneratePicture.
53981 RET Return.
Prev: 53810 Up: Map Next: 53982