Difference between revisions of "WAIT"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
imported>Cyperium
Line 1: Line 1:
The '''WAIT''' statement either waits for the monitor's vertical retrace to begin or end.
+
The '''WAIT''' statement suspends program execution while monitoring a port.
  
 +
The '''WAIT''' statement is often used to wait for the monitor's vertical retrace and either waits for the monitor's vertical retrace to begin or end.
  
''Syntax:''
+
 
 +
 
 +
''General syntax:'' WAIT port, and-expression[,xor expression]
 +
 
 +
The and-expression is combined with the data at the port using the operational AND and only if the result is non-zero is the next statement executed.
 +
 
 +
if the xor-expression is used it is combined with the data from the port using the operational XOR, and then the result is combined using the value from the and-expression using operational AND.
 +
 
 +
 
 +
''Syntax for vertical retrace:''
  
 
:WAIT &H3DA, 8 ' finishes whenever the screen isn't being written to
 
:WAIT &H3DA, 8 ' finishes whenever the screen isn't being written to

Revision as of 17:48, 19 October 2009

The WAIT statement suspends program execution while monitoring a port.

The WAIT statement is often used to wait for the monitor's vertical retrace and either waits for the monitor's vertical retrace to begin or end.


General syntax: WAIT port, and-expression[,xor expression]

The and-expression is combined with the data at the port using the operational AND and only if the result is non-zero is the next statement executed.

if the xor-expression is used it is combined with the data from the port using the operational XOR, and then the result is combined using the value from the and-expression using operational AND.


Syntax for vertical retrace:

WAIT &H3DA, 8 ' finishes whenever the screen isn't being written to
WAIT &H3DA, 8, 8 ' finishes whenever the screen is being written to


  • Either statement can be used to try to reduce screen flickering.
  • If both statements are used, try changing the order.


See also: Scancodes(demo)


Navigation:

Go to Keyword Reference - Alphabetical

Go to Keyword Reference - By usage