Changes

Jump to: navigation, search

Locomotive BASIC

1,405 bytes added, 12:25, 18 July 2012
/* Operators */
=== Operators ===
: A logical status in Locomotive Basic will be represented by a "-1" for TRUE and by a "0" for FALSE.: Example:<pre>PRINT (1=1)-1PRINT (1=2)0</pre>
==== <code>AND</code> ====
: [Possible combinations with the AND Function:<pre>NPUT1 INPUT2 OUTPUT======================TRUE TRUE TRUEFALSE FALSE FALSETRUE FALSE FALSEFALSE TRUE FALSE</pre>: Example:<pre>PRINT 128 AND 640</pre>: looking at the BIT combination for a better understanding:<pre> 10000000AND 01000000================= 00000000</pre>: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR...]: first an example for a loop with an increasing counter WITHOUT an AND:<pre>10 counter=020 counter=counter+130 IF counter=32 THEN counter=040 GOTO 20</pre>: then a shorter example WITH and AND:<pre>10 counter=020 counter=(counter+1) AND 3130 GOTO 20</pre>: in the second example all more significant BITs will be deleted (a common method in assembler programming): Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127
==== <code>MOD</code> ====
: [...]
==== <code>OR</code> ====
: [...]Possible combinations with the OR Function:<pre>NPUT1 INPUT2 OUTPUT======================TRUE TRUE TRUEFALSE TRUE TRUETRUE FALSE TRUEFALSE FALSE FALSE</pre>
==== <code>XOR</code> ====
: [...]Possible combinations with the XOR Function:<pre>NPUT1 INPUT2 OUTPUT======================TRUE TRUE FALSEFALSE TRUE TRUETRUE FALSE TRUEFALSE FALSE FALSE</pre>
=== Functions ===
205
edits