in BASIC ROM:
|List of all BASIC keywords|
Type: Boolean/bit-wise operator General Programming-Syntax: <Boolean/integer term> OR <Boolean/integer term>
OR performs two different functions:
- In boolean expressions (such as the condition in an IF/THEN construct), OR yields the boolean value "true" (numerical: −1) if either or both of the terms preceding and trailing the OR keyword, evaluates to "true".
- In bitwise operations, a bit in the resulting integer is set if either or both the corresponding bits in the integer terms, are set.
Use of non-numerical terms in conjunction with OR causes a ?TYPE MISMATCH ERROR IN line. In the case of bitwise AND operations, both terms are evaluated as 16-bit signed integers, and thus cannot exceed the range of −32768 thru 32767, or −$8000 thru $7FFF in hexadecimal — terms outside of this range will raise an ?ILLEGAL QUANTITY ERROR IN line. If either of the terms are absent, a ?SYNTAX ERROR IN line will occur.
Note that in BASIC on the C-64, the boolean value "true" is represented by the integer −1, which is all bits set in the 16-bit signed format, while the value "false" is represented by the value 0, or all bits clear.
PRINT 3<2 OR 5<6 -1 meaning "true" ready. PRINT 3=2 OR 3<2 0 meaning "false" ready. POKE 53265,PEEK (53265) OR 64 Bitwise operation to turn on ready. a single bit in a register
PRINT 0 OR 0 (Result: 0; false) PRINT 1 OR 0 (Result: 1; true) PRINT 0 OR 1 (Result: 1; true) PRINT 1 OR 1 (Result: 1; true)