Prev: D232 Up: Map Next: D2DE
D234: Game Initialisation
Used by the routine at DemoEntryPoint.
Input
HL Pointer to level data
Game_Initialisation D234 LD C,(HL) The first byte is the length of the level data, store this in C.
D235 LD A,C A=data length.
D236 LD B,$00 B=00.
D238 INC HL Increment HL by one.
D239 LD DE,$E0B2 DE=E0B2.
D23C LDIR LDIR.
D23E LD DE,$D531 DE=D531.
D241 LD BC,$0012 BC=0012.
D244 LDIR LDIR.
D246 LD E,(HL) E=*HL.
D247 INC HL Increment HL by one.
D248 LD D,(HL) D=*HL.
D249 LD ($D5AE),DE Write DE to *LevelGraphicsData.
D24D LD HL,$D57B HL=D57B.
D250 LD B,$0C B=0C.
Game_Initialisation_0 D252 LD (HL),$01 Write 01 to *HL.
D254 INC HL Increment HL by one.
D255 DJNZ Game_Initialisation_0 Decrease counter by one and loop back to Game_Initialisation_0 until counter is zero.
D257 LD DE,$E06C DE=E06C.
D25A LD HL,$D47D HL=D47D.
D25D LD BC,$0031 BC=0031.
D260 LDIR LDIR.
D262 LD HL,$E09E HL=E09E.
D265 LD B,$14 B=14.
D267 LD A,$01 A=01.
Game_Initialisation_1 D269 LD (HL),A Write A to *HL.
D26A INC HL Increment HL by one.
D26B INC A Increment A by one.
D26C DJNZ Game_Initialisation_1 Decrease counter by one and loop back to Game_Initialisation_1 until counter is zero.
D26E LD HL,$D595 HL=D595.
D271 LD DE,$D544 DE=D544.
Game_Initialisation_2 D274 LD A,(HL) A=*HL.
D275 CP $FF Compare A with FF.
D277 JR Z,PopulateDefaults_Done Jump to PopulateDefaults_Done if A is equal to FF.
D279 LD B,A B=A.
D27A INC HL Increment HL by one.
D27B LD A,(HL) A=*HL.
D27C INC HL Increment HL by one.
Game_Initialisation_3 D27D LD (DE),A Write A to *DE.
D27E INC DE Increment DE by one.
D27F DJNZ Game_Initialisation_3 Decrease counter by one and loop back to Game_Initialisation_3 until counter is zero.
D281 JR Game_Initialisation_2 Jump to Game_Initialisation_2.
The computed values are done, copy the last six values over.
PopulateDefaults_Done D283 INC HL Copy the last 0006 bytes from D888 to D84A.
D284 LD BC,$0006
D287 LDIR
Write three NOT random numbers between 01-20 to ...
D289 LD B,$03 B=03.
Game_Initialisation_4 D28B LD A,$0A Write 0A to *DE.
D28D LD (DE),A
D28E INC DE Increment DE by one.
D28F DJNZ Game_Initialisation_4 Decrease counter by one and loop back to Game_Initialisation_4 until counter is zero.
D291 LD HL,$D82A Write D82A to:
D294 LD ($D56F),HL
D297 LD ($D571),HL
D29A LD ($D573),HL
D29D LD ($D575),HL
D2A0 LD HL,$E09D HL=E09D.
D2A3 LD BC,$07D0 BC=07D0.
Game_Initialisation_5 D2A6 PUSH BC Stash BC, HL and HL on the stack.
D2A7 PUSH HL
D2A8 PUSH HL
D2A9 CALL $D682 Call D682.
D2AC ADD HL,BC HL+=BC.
D2AD EX DE,HL Exchange the DE and HL registers.
D2AE POP HL Restore HL from the stack.
D2AF CALL $D682 Call D682.
D2B2 ADD HL,BC HL+=BC.
D2B3 LD B,(HL) B=*HL.
D2B4 LD A,(DE) A=*DE.
D2B5 LD (HL),A Write A to *HL.
D2B6 LD A,B A=B.
D2B7 LD (DE),A Write A to *DE.
D2B8 POP HL Restore HL and BC from the stack.
D2B9 POP BC
D2BA DEC BC Decrease BC by one.
D2BB LD A,B A=B.
D2BC OR C Set the bits from C.
D2BD 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.
D2BF CALL $E83A Call E83A.
D2C2 CALL $E80B Call E80B.
D2C5 CALL $E81F Call E81F.
Paint the preview grid pattern.
D2C8 CALL Colourise_PreviewGrid Call Colourise_PreviewGrid.
Small pause...
D2CB LD BC,$9C40 BC=9C40.
Game_Initialisation_6 D2CE DEC BC Decrease BC by one.
D2CF LD A,B Jump to Game_Initialisation_6 until BC is equal to 00.
D2D0 OR C
D2D1 JR NZ,Game_Initialisation_6
Play the "static" animation in the preview area.
D2D3 CALL StaticAnimation Call StaticAnimation.
Display the current preview image.
D2D6 LD IX,($D5AE) IX=*LevelGraphicsData.
D2DA CALL GeneratePicture Call GeneratePicture.
D2DD RET Return.
Prev: D232 Up: Map Next: D2DE