bas7advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
WAIT Statement Details
  Syntax  Details  Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
WAIT suspends program execution while monitoring the status of a machine
input port.
 
WAIT  portnumber, and-expression% [,xor-expression%]
 
Usage Notes
    ■ The WAIT statement is an enhanced version of the INP function;
      it suspends execution until a specified bit pattern is input
      from an input port:
 
      1.  The data byte read from the port is combined, using an XOR
          operation, with xor-expression%. If xor-expression% is omitted,
          it is assumed to be 0.
      2.  The result is combined with and-expression% using an AND
          operation.
      3.  If the result is zero, the first two steps are repeated.
      4.  If the result is nonzero, execution continues with the next
          program statement.
 
    ■ It is possible to enter an infinite loop with the WAIT statement
      if the input port fails to develop a nonzero bit pattern. In this
      case, you must manually restart the machine.
    ■ The following example program line illustrates the syntax of the
      WAIT statement:
 
        WAIT  HandShakePort, 2
 
      This statement will cause BASIC to do an AND operation on the
      bit pattern received at DOS I/O port HandShakePort with the bit
      pattern represented by 2 (00000010).