![]() |
Routines |
| Prev: BB45 | Up: Map | Next: BB7C |
|
Used by the routines at GameComplete, A207, HandlerPoems, GameOver_1UP, B12F, B1D4, B205 and HandlerGameMenu.
|
||||
|
This routine clears the top third of the screen, but only from below the banner. This is left untouched.
|
||||
| ClearPlayArea | BB5C | LD HL,$4040 | HL=4040(screen buffer). | |
|
Here D contains the value to be written (00) and E holds the number of rows of pixels to act on (the full height of a character block).
|
||||
| BB5F | LD DE,$0008 | DE=0008. | ||
|
B holds the number of columns (i.e. 20 == full width of the screen), and C is a counter for how many rows to clear (i.e. the top third would usually be 08 rows, but the banner takes up two - hence this initialises to 06).
|
||||
| BB62 | LD BC,$2006 | BC=2006. | ||
| ClearPlayArea_ClearLine | BB65 | PUSH BC | Stash BC and HL on the stack. | |
| BB66 | PUSH HL | |||
| ClearPlayArea_ClearLine_Start | BB67 | PUSH BC | Stash BC on the stack. | |
| ClearPlayArea_ClearLine_Loop | BB68 | LD (HL),D | Write 00 (D) to the screen (HL). | |
| BB69 | INC L | Move "right" onto the next column. | ||
| BB6A | DJNZ ClearPlayArea_ClearLine_Loop | Decrease the width counter by one and loop back to ClearPlayArea_ClearLine_Loop until counter is zero. | ||
|
Resets the width counter ready for the next loop.
|
||||
| BB6C | POP BC | Restore BC from the stack. | ||
| BB6D | DEC C | Decrease the number of rows counter by one. | ||
| BB6E | JR NZ,ClearPlayArea_ClearLine_Start | Jump back to ClearPlayArea_ClearLine_Start unless C is zero. | ||
|
Resets the screen buffer to where the clearing started for this loop, then moves down one character block.
|
||||
| BB70 | POP HL | Restore HL from the stack. | ||
| BB71 | INC H | Increments H by one. | ||
| BB72 | POP BC | Restore BC from the stack. | ||
| BB73 | DEC E | Decrease the pixel row counter by one. | ||
| BB74 | JR NZ,ClearPlayArea_ClearLine | Jump back to ClearPlayArea_ClearLine unless E is zero. | ||
|
Clears the other two thirds of the screen, so now the screen only contains the banner.
|
||||
| BB76 | LD HL,$4800 | HL=4800(screen buffer). | ||
| BB79 | JP ResetScreen_0 | Jump to ResetScreen_0. | ||
| Prev: BB45 | Up: Map | Next: BB7C |