WAIT

The WAIT command is used to halt the program until the contents of a memory location changes in a specific way.

Syntax

WAIT <address>, <mask> [, <trig>]

The contents of the memory location are first exciusive-ORed with <trig> (if present), and then logically ANDed with <mask>. If the result is zero, the program goes back to that memory location and checks again. When the result is nonzero, the program continues with the next statement.

Please read this comprehensive article from Compute! Magazine for more information.