Format
number1 = ZBIT(number2,number3)
Description
This statement is used to determine if a single "bit" in an integer
variable is set to "1". Number2 represents the bit to be tested. It
should be in the range 0 to 15. Number3 represents the integer variable or
constant to be tested. The result of the test is returned to number1. If
the bit was set, number1 will be set to "1", otherwise, number1 will be set
to "0".
Example
GAMEPORT = INP(513)
TRIGGER = ZBIT(4,GAMEPORT)
IF TRIGGER = 1 THEN TRIGGERPRESSED:
In this example, the joystick port is read, and its status is placed in the
variable "GAMEPORT". The bit which represents the trigger for joystick 1
is then tested using ZBIT. If the trigger bit is set, then
the program would transfer to the label "TRIGGERPRESSED:". Note that the
above code assumes that a game card is present in the computer.
Comments
This statement is an extension over GWBASIC/BASICA, although it is possible
to perform similar tests in GWBASIC/BASICA with the boolean AND statement.
|