Routines |
Prev: 64FD | Up: Map | Next: 6563 |
Used by the routine at GameInitialisation.
|
||||
InitialiseLevel | 6500 | LD DE,$9E00 | DE=LevelBuffer. | |
6503 | LD HL,$8960 | HL=Data_Level1. | ||
6506 | CALL CopyLevelDataToBuffer | Call CopyLevelDataToBuffer. | ||
6509 | LD HL,$A101 | HL=A101. | ||
650C | LD B,$0A | B=0A. | ||
InitialiseLevel_0 | 650E | LD (HL),$00 | Write 00 to *HL. | |
6510 | DEC H | Decrease H by one. | ||
6511 | LD (HL),$00 | Write 00 to *HL. | ||
6513 | INC H | Increment H by one. | ||
6514 | INC L | Increment L by one. | ||
6515 | DJNZ InitialiseLevel_0 | Decrease counter by one and loop back to InitialiseLevel_0 until counter is zero. | ||
6517 | LD (HL),$23 | Write 23 to *HL. | ||
6519 | EXX | Switch to the shadow registers. | ||
651A | LD A,$0A | A=0A. | ||
651C | NOP | No operation. | ||
651D | LD B,A | B=A. | ||
InitialiseLevel_1 | 651E | EXX | Switch to the shadow registers. | |
651F | CALL GetRandomNumber | Call GetRandomNumber. | ||
6522 | AND %00011111 | Keep only bits 0-4. | ||
6524 | LD B,A | B=A. | ||
6525 | ADD A,A | A+=A. | ||
6526 | ADD A,A | A+=A. | ||
6527 | ADD A,B | A+=B. | ||
6528 | RRCA | RRCA. | ||
6529 | RRCA | |||
652A | RRCA | |||
652B | LD L,A | L=A. | ||
652C | AND %00011111 | Keep only bits 0-4. | ||
652E | ADD A,$8A | A+=8A. | ||
6530 | LD H,A | H=A. | ||
6531 | LD A,L | A=L. | ||
6532 | AND %11100000 | Keep only bits 5-7. | ||
6534 | LD L,A | L=A. | ||
6535 | CALL CopyLevelDataToBuffer | Call CopyLevelDataToBuffer. | ||
6538 | EXX | Switch to the shadow registers. | ||
6539 | DJNZ InitialiseLevel_1 | Decrease counter by one and loop back to InitialiseLevel_1 until counter is zero. | ||
653B | EXX | Switch to the shadow registers. | ||
653C | LD HL,$8960 | HL=Data_Level1. | ||
653F | CALL CopyLevelDataToBuffer | Call CopyLevelDataToBuffer. | ||
6542 | LD A,E | A=E. | ||
6543 | LD HL,$02F4 | HL=02F4. | ||
6546 | AND A | Jump to InitialiseLevel_2 if A is not zero. | ||
6547 | JR NZ,InitialiseLevel_2 | |||
6549 | LD H,$FE | H=FE. | ||
InitialiseLevel_2 | 654B | ADD HL,DE | HL+=DE. | |
654C | LD (HL),$22 | Write 22 to *HL. | ||
654E | LD B,$0A | B=0A. | ||
InitialiseLevel_3 | 6550 | INC L | Increment L by one. | |
6551 | LD (HL),$00 | Write 00 to *HL. | ||
6553 | DEC H | Decrease H by one. | ||
6554 | LD (HL),$00 | Write 00 to *HL. | ||
6556 | INC H | Increment H by one. | ||
6557 | DJNZ InitialiseLevel_3 | Decrease counter by one and loop back to InitialiseLevel_3 until counter is zero. | ||
6559 | CALL $6440 | Call 6440. | ||
655C | CALL $64AA | Call 64AA. | ||
655F | CALL InitialiseNewLevel | Call InitialiseNewLevel. | ||
6562 | RET | Return. |
Prev: 64FD | Up: Map | Next: 6563 |