Quote:
Originally posted by Steve Shade
So in your expression, this is what is really evaluated: ~(((p1_y>127) & p2_y) > 127)
|
Not quite. The PBASIC compiler is smart enough to do comparisons (>, =, etc) after regular stuff. Here's an example straight from the BASIC Stamp Manual:
Code:
number1 con 99
number2 con 30
if number1=number2 * 4 - 21 then equal
debug "not equal"
stop
equal:
debug "equal"
stop
This will evaluate each side of the expression before comparing them with =, so it will print "equal" because (30*4-21) is 99.
Also, true is not necessarily 1. Like most processors, the basic stamp interprets 0 to mean false, and ANYTHING else to be true. Therefore, always make sure to use the logic operators (AND, NOT, OR, XOR) instead of the bitwise equivalents (&, ~, |, ^).