Changes

Jump to: navigation, search

Locomotive BASIC

1,412 bytes added, 08:55, 25 January 2019
/* Functions */
</pre>
==== <code><big>LOG (<numeric expression>)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of <numeric expression> which mustbe greater than zero.
</pre>
==== <code><big>LOG10 (<numeric expression>)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Returns the logarithm to base 10 of <numeric expression> which must be greater than zero.
</pre>
==== <code><big>LOWER$ (<string expression>)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Returns a new string expression which is a copy of the specified <string expression> but in which all alphabetic characters in the range A to Z are converted to lower case. Useful for processing input where the answers may come in mixed upper/lower case.
</pre>
==== <code><big>MAX (<list of: numeric expression>)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Returns the MAXimum value from the <list of: numeric expression>s.
run
</pre>
==== <code><big>REMAIN (i<integer expression>)</big></code> ====: ''BASIC 1.0 & 1.1'': '''FUNCTION''': Returns count REMAINing count from the delay timer specified in <integer expression> (= timer number in the range 0 to 3), and disable it. If the delay timer was not enabled zero will be returned. : '''Associated keywords''': AFTER, DI, EI, EVERY
: Returns count remaining in delay timer i (0-3) then disables it.
: For the reason that REMAIN is no normal command but a "function" it is necessary in case of a proper functionality to link the command.
: a '''example ''' in combination with an interrupt delay timer 1:
<pre>
PRINT REMAIN(1)
</pre>
: Hint: Take care of interrupts due to parallel working (the same cycle time) or if they are stopped with the BREAK key. Interrupts which were disabled for a certain time will be stored in buffer (for a maximum of 128 entries) and made up their task afterwards in the priorisation as declared.
: further '''example''':
<pre>
10 AFTER 500,1 GOSUB 40
20 AFTER 100,2 GOSUB 50
30 PRINT "program running":GOTO 30
40 REM this GOUSB-Routine will not be called as it is disabled in line 80
50 PRINT:PRINT "Timer 1 will now be ";
60 PRINT "disabled by REMAIN."
70 PRINT "Time-units remaining were:";
80 PRINT REMAIN(1)
run
</pre>
==== <code><big>RIGHT$ (<string expression>, <integer expression>)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the <integer expression> (=required length) parameter, after extracting them from the RIGHT of the <string expression>. If the <string expression> is shorter than the <integer expression>, the whole <string expression> is returned.
==== <code>RIGHT$ (se,i)</code> ==== : Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se. '''Associated keywords''': ExampleLEFT$, MID$
: '''Example''':
<pre>
10 MODE 1:a$="AMSTRAD computer"20 FOR n=1 TO 16:LOCATE 41-n,n30 PRINT RIGHT$("ABCDEFG"a$,3n) - prints EFG40 NEXT
</pre>
==== <code>RND [(<numeric expression>)]</code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Returns the next RaNDom number in sequence if the <numeric expression> has a positive value or is not specified.
: If the <numeric expression> yields a value of zero, RND returns a copy of the last random number generated.
: If the <numeric expression> yields a negative value, a new random number sequence is started, the first number of which is returned.
==== <code>RND [(n)]</code> ====: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.'''Associated keywords''': RANDOMIZE
: If n = 0, the random number generated will be the same as the last random number generated'''1.: Example''':
<pre>
PRINT RND(0)
Ready
</pre>
: '''2. Example''':
: Exampel for generating an integer random number between 1 and 1000
<pre>
30 GOTO 10
</pre>
 : Exampel : '''3. Example''' for generating a random number between a lower and higher border
<pre>
10 INPUT "Low border",low
40 PRINT A
</pre>
: '''4. Example''':<pre>10 RANDOMIZE20 FOR x=1 TO -1 STEP -130 PRINT "rnd parameter=";x40 FOR n=1 TO 650 PRINT RND(x)60 NEXT n,xrun</pre>
==== <code>ROUND (n[,i1])</code> ====
205
edits