.WSCAN PHA ; Store A on the stack so we can preserve it .WSC1 LDA RASTCT ; Wait until RASTCT is non-zero, which indicates that BEQ WSC1 ; the VIC-II is now drawing the dashboard .WSC2 LDA RASTCT ; Wait until RASTCT is zero, which indicates that the BNE WSC2 ; VIC-II is now drawing the top line of the visible ; screen PLA ; Restore A from the stack so it is unchanged RTS ; Return from the subroutineName: WSCAN [Show more] Type: Subroutine Category: Drawing the screen Summary: Wait for the vertical syncContext: See this subroutine in context in the source code References: This subroutine is called as follows: * DELAY calls WSCAN * DK4 calls WSCAN * TT16 calls WSCAN
Wait for vertical sync to occur on the video system - in other words, wait for the screen to start its refresh cycle, which it does 50 times a second (50Hz) on PAL systems, or 60 times a second (60Hz) on NTSC systems. We do this by monitoring the value of RASTCT, which is updated by the interrupt routine at COMIRQ1 as it draws the two different parts of the screen (the upper part containing the space view, and the lower part containing the dashboard).
[X]
Variable RASTCT (category: Drawing the screen)
The current raster count, which flips between 0 and 1 on each call to the COMIRQ1 interrupt handler (0 = space view, 1 = dashboard)
[X]
Label WSC1 is local to this routine
[X]
Label WSC2 is local to this routine