Routines |
Prev: 29176 | Up: Map | Next: 29370 |
Used by the routine at 25856.
|
||||
InitialiseNewLevel | 29184 | LD HL,30752 | HL=CurrentLevel. | |
29187 | LD A,(HL) | Jump to InitialiseLevel if the current level is equal to 7. After level 7 the game just repeats this level. | ||
29188 | CP 7 | |||
29190 | JR Z,InitialiseLevel | |||
Increments both CurrentLevel and A as we use this as an offset for pointing to the level data.
|
||||
29192 | INC (HL) | Increment *HL by one. | ||
29193 | INC A | Increment A by one. | ||
InitialiseLevel | 29194 | RRCA | Rotate A right two positions (bits 2 to 5 are now in positions 0 to 3) using the carry flag. | |
29195 | RRCA | |||
29196 | LD L,A | L=A. | ||
29197 | AND %00000011 | Keep only bits 0-1. | ||
29199 | ADD A,230 | A+=230. | ||
29201 | LD H,A | H=A. | ||
29202 | LD A,L | A=L. | ||
29203 | AND %11000000 | Keep only bits 6-7. | ||
29205 | LD L,A | L=A. | ||
29206 | LD A,10 | A=10 (counter). | ||
29208 | NOP | No operation. | ||
29209 | LD DE,64064 | DE=64064. | ||
InitialiseNewLevel_0 | 29212 | PUSH HL | Stash HL on the stack. | |
29213 | LD BC,64 | BC=0064. | ||
29216 | LDIR | Copy 0064 bytes of data from *HL to *DE. | ||
29218 | POP HL | Restore HL from the stack. | ||
29219 | DEC A | Decrease A by one. | ||
29220 | JR NZ,InitialiseNewLevel_0 | Jump to InitialiseNewLevel_0 until A is zero. | ||
29222 | LD H,A | H=A. | ||
29223 | LD B,8 | B=8. | ||
29225 | LD L,B | L=B. | ||
29226 | EX DE,HL | Exchange the DE and HL registers. | ||
InitialiseNewLevel_1 | 29227 | LD (HL),H | Write H to *HL. | |
29228 | ADD HL,DE | HL+=DE. | ||
29229 | DJNZ InitialiseNewLevel_1 | Decrease counter by one and loop back to InitialiseNewLevel_1 until counter is zero. | ||
29231 | LD B,E | B=E. | ||
29232 | LD H,250 | H=250. | ||
InitialiseNewLevel_2 | 29234 | LD (HL),H | Write H to *HL. | |
29235 | ADD HL,DE | HL+=DE. | ||
29236 | DJNZ InitialiseNewLevel_2 | Decrease counter by one and loop back to InitialiseNewLevel_2 until counter is zero. | ||
29238 | LD B,E | B=E. | ||
29239 | LD E,16 | E=16. | ||
InitialiseNewLevel_3 | 29241 | LD (HL),H | Write H to *HL. | |
29242 | ADD HL,DE | HL+=DE. | ||
29243 | DJNZ InitialiseNewLevel_3 | Decrease counter by one and loop back to InitialiseNewLevel_3 until counter is zero. | ||
29245 | EXX | Switch to the shadow registers. | ||
29246 | LD BC,64070 | BC'=64070. | ||
29249 | EXX | Switch back to the normal registers. | ||
29250 | LD DE,40736 | DE=40736. | ||
29253 | LD B,10 | B=10. | ||
InitialiseNewLevel_4 | 29255 | PUSH BC | Stash BC on the stack. | |
29256 | LD B,8 | B=8. | ||
InitialiseNewLevel_5 | 29258 | CALL GetRandomNumber | Call GetRandomNumber. | |
29261 | AND %00011111 | Keep only bits 0-4. | ||
29263 | CP 31 | Jump to InitialiseNewLevel_5 if A is equal to 31. | ||
29265 | JR Z,InitialiseNewLevel_5 | |||
29267 | CP 8 | Jump to InitialiseNewLevel_5 if A is lower than 8. | ||
29269 | JR C,InitialiseNewLevel_5 | |||
29271 | LD L,A | L=A. | ||
29272 | CALL GetRandomNumber | Call GetRandomNumber. | ||
29275 | AND %00000011 | Keep only bits 0-1. | ||
29277 | LD H,A | H=A. | ||
29278 | ADD HL,DE | HL+=DE. | ||
29279 | LD A,(HL) | A=*HL. | ||
29280 | DEC A | Decrease A by one. | ||
29281 | JR Z,InitialiseNewLevel_6 | Jump to InitialiseNewLevel_6 if A is zero. | ||
29283 | CP 49 | Jump to InitialiseNewLevel_5 if A is higher than 49. | ||
29285 | JR NC,InitialiseNewLevel_5 | |||
29287 | CP 45 | Jump to InitialiseNewLevel_5 if A is lower than 45. | ||
29289 | JR C,InitialiseNewLevel_5 | |||
InitialiseNewLevel_6 | 29291 | PUSH HL | Stash HL on the stack. | |
29292 | EXX | Switch to the shadow registers. | ||
29293 | LD H,B | H=B. | ||
29294 | LD L,C | L=C. | ||
29295 | POP DE | Restore DE from the stack. | ||
InitialiseNewLevel_7 | 29296 | LD A,(HL) | A=*HL. | |
29297 | AND A | Jump to InitialiseNewLevel_9 if A is zero. | ||
29298 | JR Z,InitialiseNewLevel_9 | |||
29300 | INC L | Increment L by one. | ||
29301 | CP E | Jump to InitialiseNewLevel_8 if A is not equal to E. | ||
29302 | JR NZ,InitialiseNewLevel_8 | |||
29304 | LD A,(HL) | A=*HL. | ||
29305 | CP D | Compare A with D. | ||
29306 | EXX | Switch to the shadow registers. | ||
29307 | JR Z,InitialiseNewLevel_5 | Jump to InitialiseNewLevel_5 if {} is zero. | ||
29309 | EXX | Switch to the shadow registers. | ||
InitialiseNewLevel_8 | 29310 | LD A,L | L+=7. | |
29311 | ADD A,7 | |||
29313 | LD L,A | |||
29314 | JR InitialiseNewLevel_7 | Jump to InitialiseNewLevel_7. | ||
InitialiseNewLevel_9 | 29316 | LD (HL),E | Write E to *HL. | |
29317 | INC L | Increment L by one. | ||
29318 | LD (HL),D | Write D to *HL. | ||
29319 | EXX | Switch to the shadow registers. | ||
29320 | DJNZ InitialiseNewLevel_5 | Decrease counter by one and loop back to InitialiseNewLevel_5 until counter is zero. | ||
29322 | EXX | Switch to the shadow registers. | ||
29323 | LD HL,64 | HL=0064. | ||
29326 | ADD HL,BC | HL+=BC. | ||
29327 | LD B,H | B=H. | ||
29328 | LD C,L | C=L. | ||
29329 | EXX | Switch to the shadow registers. | ||
29330 | LD A,E | E+=32. | ||
29331 | ADD A,32 | |||
29333 | LD E,A | |||
29334 | JR NZ,InitialiseNewLevel_10 | Jump to InitialiseNewLevel_10 if E is not zero. | ||
29336 | LD A,D | D+=5. | ||
29337 | ADD A,5 | |||
29339 | LD D,A | |||
InitialiseNewLevel_10 | 29340 | POP BC | Restore BC from the stack. | |
29341 | DJNZ InitialiseNewLevel_4 | Decrease counter by one and loop back to InitialiseNewLevel_4 until counter is zero. | ||
29343 | CALL PrintLevelName | Call PrintLevelName. | ||
29346 | LD HL,12928 | HL=12928. | ||
See InitialiseDemoMode.
|
||||
29349 | LD A,(30765) | Jump to InitialiseNewLevel_InDemoMode if the game is in "demo mode" (the high-order byte of ControlMethod_Pointer contains 115). | ||
29352 | CP 115 | |||
29354 | JR Z,InitialiseNewLevel_InDemoMode | |||
29356 | LD H,11 | H=11. | ||
InitialiseNewLevel_InDemoMode | 29358 | NOP | No operation. | |
29359 | NOP | |||
29360 | LD (30785),HL | Write HL to *30785. | ||
29363 | XOR A | Write 0 to *30784. | ||
29364 | LD (30784),A | |||
29367 | JP 29590 | Jump to 29590. |
Prev: 29176 | Up: Map | Next: 29370 |