![]() |
Routines |
| Prev: D894 | Up: Map | Next: D99B |
|
Used by the routine at StartGame.
|
||||
| Handler_IsLevelComplete | D97E | LD HL,$E270 | HL=InGame_Tiles. | |
| D981 | LD D,$01 | D is used as a tile checker - so initialise it with 01 which is the "good" value of the first tile. | ||
| D983 | LD B,$04 | Set a row counter in B of 04 rows to check. | ||
| CheckRow_Loop | D985 | PUSH BC | Stash the row counter on the stack. | |
| D986 | LD B,$05 | Set a counter in B of the number of tiles to check per row. | ||
| CheckTiles_Loop | D988 | LD A,(HL) | Load the tile value into A. | |
| D989 | CP D | Jump to BailOrderIncorrect if the tile value and the tile checker value don't match. | ||
| D98A | JR NZ,BailOrderIncorrect | |||
| D98C | INC HL | Move to the next tile. | ||
| D98D | INC D | Increment the tile checker by one. | ||
| D98E | DJNZ CheckTiles_Loop | Decrease the tile counter by one and loop back to CheckTiles_Loop until all of the tiles in this row have been checked. | ||
| D990 | INC HL | Increment HL by two. | ||
| D991 | INC HL | |||
| D992 | POP BC | Restore the row counter from the stack. | ||
| D993 | DJNZ CheckRow_Loop | Decrease the row counter by one and loop back to CheckRow_Loop until counter is zero. | ||
|
The level is complete! All tiles are in order so jump to LevelComplete.
|
||||
| D995 | POP BC | Housekeeping; clean up the stack. | ||
| D996 | JP LevelComplete | Jump to LevelComplete. | ||
|
The level isn't complete, so discard the row counter on the stack and return.
|
||||
| BailOrderIncorrect | D999 | POP BC | Housekeeping; clean up the stack. | |
| D99A | RET | Return. | ||
| Prev: D894 | Up: Map | Next: D99B |