BASIC Stamp II Manual 0.94 • Parallax, Inc. • (916) 624-8333 • Page 25
BASIC Stamp II
sqr 50000
~ in0
Binary operators take two terms and go between variables, constants,
or expressions. They are as follows:
& Bitwise AND
| Bitwise OR
^ Bitwise XOR
MIN Limit value to minimum
MAX Limit value to maximum
+ Addition
- Subtraction
* Multiply
** Multiply and return high 16-bits of result
*/ Multiply and return middle 16-bits of result
(use to simultaneously multiply by a whole and a part;
ie. ‘value */ $0180’ multiplies by 1 and a half)
/ Divide
// Divide and return remainder
DIG Return decimal digit; ‘12345 dig 3’ returns 2
<< Shift left
>> Shift right
REV Reverse order of bits, lsb-justified; ‘%100110 rev 6’
yields %011001
Examples:
ypos * xsize + xpos
randword // 20
countacc min 200 - 200 / 200
Parentheses can be placed to special-order the pattern of expression
resolution. Though unary operators have highest priority and binary
operators have secondary priority, and with those rules expressions