After a little creative thinking I think this may do the trick...

code:
BREAK ON
$VAR1=577
? $VAR1
$VAR2=$VAR1 - ($VAR1 & &40)
IF $VAR1 = $VAR2 ;The bit was off
$VAR1 = $VAR1 + &40
ELSE ;The bit was on
$VAR1 = $VAR1 - &40
ENDIF
? $VAR1

Thanks for your input Howard. It put me on the road to binary bliss.

This could be setup as a UDF
code:
Function XOR($BinaryVal,$Bit)  ;&BinaryVal = Value of binary number // $Bit = Value of bit to swap
Dim $TstBit
$TstBit = $Bit
WHILE $TstBit MOD 2 = 0 AND $TstBit <> 1
$TstBit = $TstBit / 2
LOOP
IF $TstBit <> 1
? "The bit is not a power of 2!"
RETURN
ENDIF
Dim $TmpVar
$TmpVar=$BinaryVal - ($BinaryVal & $Bit)
IF $TmpVar = $BinaryVal ;The bit was off
$XOR = $BinaryVal + $Bit
ELSE ;The bit was on
$XOR = $BinaryVal - $Bit
ENDIF
EndFunction

Some method of checking $Bit to be sure it's a power of 2 would be good also.
*UPDATE* I went ahead and decided to be proactive and added a routine to check the $Bit value. It's inlcuded in the above UDF.

Thanks,
Ben

[ 13. September 2002, 15:49: Message edited by: Ben Dulaney ]