Difference between revisions of "WAIT"

From QB64 Wiki
Jump to navigation Jump to search
imported>Cyperium
imported>Clippy
m
Line 1: Line 1:
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.
  
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:'' WAIT port, and-expression[,xor expression]
  
''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, if (and only if) the result is non-zero after this process the program continues.
+
* 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, if (and only if) the result is non-zero after this process the program continues.
  
  

Revision as of 20:26, 19 October 2009

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: 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, if (and only if) the result is non-zero after this process the program continues.


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), INP, OUT


Navigation:

Go to Keyword Reference - Alphabetical

Go to Keyword Reference - By usage