Skip to navigation


Version analysis of WSCAN

This code appears in the following versions (click to see it in the source code):

Code variations between these versions are shown below.

Name: WSCAN Type: Subroutine Category: Drawing the screen

Code variation 1 of 3A variation in the comments only

Tap on a block to expand it, and tap it again to revert.

Summary: Wait for the vertical sync
Summary: Implement the #wscn command (wait for the vertical sync)

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).
.WSCAN

Code variation 2 of 3Minor and very low-impact

Tap on a block to expand it, and tap it again to revert.

LDA #0 \ Set DL to 0 STA DL
STZ DL \ Set DL to 0

Code variation 3 of 3A variation in the labels only

Tap on a block to expand it, and tap it again to revert.

LDA DL \ Loop round these two instructions until DL is no BEQ P%-2 \ longer 0 (DL gets set to 30 in the LINSCN routine, \ which is run when vertical sync has occurred on the \ video system, so DL will change to a non-zero value \ at the start of each screen refresh)
{ .DELL1 \ This label is a duplicate of a label in the DELT \ routine (which is why we need to surround it with \ braces, as BeebAsm doesn't allow us to redefine \ labels, unlike BBC BASIC) LDA DL \ Loop round these two instructions until DL is no BEQ DELL1 \ longer 0 (DL gets set to 30 in the LINSCN routine, \ which is run when vertical sync has occurred on the \ video system, so DL will change to a non-zero value \ at the start of each screen refresh) }
.WSCAN1 LDA DL \ Loop round these two instructions until DL is no BEQ WSCAN1 \ longer 0 (DL gets set to 30 in the LINSCN routine, \ which is run when vertical sync has occurred on the \ video system, so DL will change to a non-zero value \ at the start of each screen refresh)
 RTS                    \ Return from the subroutine