.ClearScreen JSR ResetScreenAddress \ Reset the address of the start of screen memory JSR ClearIconsScanner \ Clear the energy icon and scanner row at the top of \ the screen LDA #0 \ Call ConfigureBuffer with A = 0 to set up the screen JSR ConfigureBuffer \ buffer for use as a row buffer LDA #0 \ Set A = 0 to pass to FillScreen, so we clear the \ screen (as opposed to the screen buffer) LDY #24 \ Set Y = 24 to pass to FillScreen, so we clear all 24 \ character rows of the landscape view LDX #40 \ Set X = 16 to pass to FillScreen so we clear all 40 \ character columns of the landscape view JSR FillScreen \ Call FillScreen to fill the entire screen with the \ background specified in screenBackground LDA screenBackground \ If the screen background is not 3, jump to clrs2 to CMP #3 \ return from the subroutine BNE clrs2 \ If we get here then screenBackground = 3, so we now \ draw three lots of 80 stars on the screen LDA #3 \ Set a loop counter so we call the DrawStars routine STA loopCounter \ three times in the following loop, giving a total of \ 240 stars .clrs1 JSR DrawStars \ Draw 80 randomly positioned stars on the screen in \ colour 2 (white, yellow, cyan or red) DEC loopCounter \ Decrement the loop counter BNE clrs1 \ Loop back until we have called DrawStars three times .clrs2 RTS \ Return from the subroutineName: ClearScreen [Show more] Type: Subroutine Category: Graphics Summary: Clear the screen to a specified backgroundContext: See this subroutine in context in the source code References: This subroutine is called as follows: * DrawTitleView calls ClearScreen * MainGameLoop calls ClearScreen
Arguments: screenBackground The type of screen background: * 0 = fill with alternating colour 0/1 (blue/black) pixel rows, for the sky during gameplay * 1 = fill with solid colour 0 (blue) * 2 = fill with dithered pixels in colour 0 (blue) and colour 3 (e.g. green in landscape 0000) by alternating colour 3/0/3/0 and 0/3/0/3 pixel bytes * 3 = fill with solid colour 1 (black) and draw 240 randomly positioned stars on the background
[X]
Subroutine ClearIconsScanner (category: Scanner/energy row)
Clear the energy icon and scanner row at the top of the screen
[X]
Subroutine ConfigureBuffer (category: Screen buffer)
Set up the variables required to configure the screen buffer to a specific buffer type
[X]
Subroutine DrawStars (category: Graphics)
Draw 80 randomly positioned stars on the screen in colour 2 (white, yellow, cyan or red)
[X]
Subroutine FillScreen (category: Graphics)
Fill a rectangular in screen memory or the screen buffer with the specified background
[X]
Subroutine ResetScreenAddress (category: Graphics)
Reset the address of the start of screen memory
[X]
Label clrs1 is local to this routine
[X]
Label clrs2 is local to this routine
[X]
Variable loopCounter in workspace Zero page
A general-purpose loop counter
[X]
Variable screenBackground in workspace Main variable workspace
The type of screen background when clearing the screen