![]() |
Routines |
| Prev: 86F9 | Up: Map | Next: 87AB |
|
Used by the routines at SwitchPlayer and RunGame.
Sets up the level which is being played using the table of levels at LevelSettings, which has eight bytes for each level. The colour for the level and the number of bottles to collect are stored, and four of the addresses in the table at TileTable are replaced for the level.
|
||||
| SetLevelGraphics | 876B | LD HL,$87AB | Point HL at the table of levels. | |
| 876E | LD A,($DEDF) | Fetch the number of the current level from LevelNumber. | ||
| 8771 | ADD A,A | Multiply it by eight. | ||
| 8772 | ADD A,A | |||
| 8773 | ADD A,A | |||
| 8774 | CALL AddToAddress | Add it to HL to find the entry of the level. | ||
| 8777 | LD A,(HL) | Fetch the colour of the level. | ||
| 8778 | LD ($E11E),A | Store it in the attribute of the rectangle at E11E. | ||
| 877B | INC HL | Move onto the next byte of the entry. | ||
| 877C | LD A,(HL) | Fetch the number of bottles to collect. | ||
| 877D | LD ($DEE0),A | Store it in BottlesLeft. | ||
| 8780 | INC HL | Move onto the next byte of the entry. | ||
| 8781 | LD E,(HL) | Fetch the low byte of the first address. | ||
| 8782 | INC HL | Move onto the high byte. | ||
| 8783 | LD D,(HL) | Fetch the high byte. | ||
| 8784 | INC HL | Move onto the next word of the entry. | ||
| 8785 | LD ($666E),DE | Store it in the first entry of the table at TileTable. | ||
| 8789 | LD E,(HL) | Fetch the low byte of the second address. | ||
| 878A | INC HL | Move onto the high byte. | ||
| 878B | LD D,(HL) | Fetch the high byte. | ||
| 878C | INC HL | Move onto the next word of the entry. | ||
| 878D | LD ($669C),DE | Store it in the last entry of the table at 669C. | ||
| 8791 | LD E,(HL) | Fetch the low byte of the third address. | ||
| 8792 | INC HL | Move onto the high byte. | ||
| 8793 | LD D,(HL) | Fetch the high byte. | ||
| 8794 | LD ($6670),DE | Store it in the third entry of the table at 6670. | ||
| 8798 | LD HL,$7F85 | HL is 7F85. | ||
| 879B | AND A | Clear the carry flag. | ||
| 879C | SBC HL,DE | Compare the third address with 7F85. | ||
| 879E | LD DE,$8047 | DE is 8047 the fourth address when the third address is 7F85. | ||
| 87A1 | JR Z,SetLevelGraphics_Store | Jump to SetLevelGraphics_Store if it is 7F85. | ||
| 87A3 | LD DE,$80A8 | DE is 80A8 the fourth address otherwise. | ||
| SetLevelGraphics_Store | 87A6 | LD ($6672),DE | Store it in the fourth entry of the table at 6672. | |
| 87AA | RET | Return. | ||
| Prev: 86F9 | Up: Map | Next: 87AB |