Name:
if bit
Syntax:

Single line options:

IF variable BIT bitnumber SET/CLEAR THEN label

IF variable BIT bitnumber SET/CLEAR THEN GOTO label

IF variable BIT bitnumber SET/CLEAR THEN GOSUB label

IF variable BIT bitnumber SET/CLEAR THEN EXIT

Variable(s) - will be compared to value(s).

Bitnumber - is the bit number to check if set (1) or clear (0)

 

Multiple line/block structured options:

IF variable BIT bitnumber SET/CLEAR THEN

   {code}  

ELSEIF variable BIT bitnumber SET/CLEAR THEN

   {code}

ELSE

   {code}

ENDIF

Variable(s) - will be compared to value(s).

Bitnumber - is the bit number to check if set (1) or clear (0)

Description:
Applies To:
20X2, 28X1, 28X2, 40X1, 40X2
See Also:
Related Create:
    Share:
    Print:

    Using 'if bit set'

    This program demonstrates calling one of two subroutines depending on whether the least significant bit of 'b10' is set or not. If set the value in 'b10' is odd, if not the value is even.

    Code Example:
    main:
    	b10 = b10 + 1
    	if b10 bit 0 set then
    	  gosub oddvalue
    	else
    	  gosub evenvalue
    	end if
    	goto main
    Copy Code Submit an Example

    Using 'if bit clear'

    This program demonstrates calling one of two subroutines depending on whether the least significant bit of 'b10' is set or not. If set the value in 'b10' is odd, if not the value is even.

    Code Example:
    main:
    	b10 = b10 + 1
    	if b10 bit 0 clear then
    	  gosub evenvalue
    	else
    	  gosub oddvalue
    	end if
    	goto main
    Copy Code Submit an Example

    Submit Your Own Code!

    You must be logged in to submit code examples. Login now.

    Comments

    • Login to leave a comment.