Routines |
Prev: 55444 | Up: Map | Next: 55707 |
Used by the routine at StartGame.
|
||||
Handler_IsLevelComplete | 55678 | LD HL,57968 | HL=InGame_Tiles. | |
55681 | LD D,1 | D is used as a tile checker - so initialise it with 1 which is the "good" value of the first tile. | ||
55683 | LD B,4 | Set a row counter in B of 4 rows to check. | ||
CheckRow_Loop | 55685 | PUSH BC | Stash the row counter on the stack. | |
55686 | LD B,5 | Set a counter in B of the number of tiles to check per row. | ||
CheckTiles_Loop | 55688 | LD A,(HL) | Load the tile value into A. | |
55689 | CP D | Jump to BailOrderIncorrect if the tile value and the tile checker value don't match. | ||
55690 | JR NZ,BailOrderIncorrect | |||
55692 | INC HL | Move to the next tile. | ||
55693 | INC D | Increment the tile checker by one. | ||
55694 | 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. | ||
55696 | INC HL | Increment HL by two. | ||
55697 | INC HL | |||
55698 | POP BC | Restore the row counter from the stack. | ||
55699 | 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.
|
||||
55701 | POP BC | Housekeeping; clean up the stack. | ||
55702 | JP LevelComplete | Jump to LevelComplete. | ||
The level isn't complete, so discard the row counter on the stack and return.
|
||||
BailOrderIncorrect | 55705 | POP BC | Housekeeping; clean up the stack. | |
55706 | RET | Return. |
Prev: 55444 | Up: Map | Next: 55707 |