Changes

Jump to: navigation, search

Locomotive BASIC

1,150 bytes added, 14:55, 9 January 2019
/* Functions */
67.98
</pre>
 
==== <code>ASC (s)</code> ====
: ''BASIC 1.0 & 1.1''
120
</pre>
 
==== <code>ATN (n)</code> ====
: ''BASIC 1.0 & 1.1''
0.785398163
</pre>
 
==== <code>BIN$ (i1,[i2])</code> ====
: ''BASIC 1.0 & 1.1''
: '''Associated keywords''': DEC$, HEX$, STR$
: '''Example''':
 
<pre>
PRINT BIN$(66,8)
01000000
</pre>
 
==== <code>CHR$ (n)</code> ====
: ''BASIC 1.0 & 1.1''
30 NEXT
</pre>
 
: A further example, try the following basic program :
 
<pre>10 print chr$(208+rnd(2));:goto 10</pre>
===============================================================================
</PRE>
 
==== <code>CINT (n)</code> ====
: ''BASIC 1.0 & 1.1''
: '''Example''':
 
<pre>
10 n=1.9999
2
</pre>
 
==== <code>COPYCHR$ (#stream)</code> ====
: : ''BASIC 1.1''
60 PRINT a$
</pre>
 
==== <code>COS (n)</code> ====
: ''BASIC 1.0 & 1.1''
0.707106781
</pre>
 
==== <code>CREAL (n)</code> ====
: ''BASIC 1.0 & 1.1''
3.14159265
</pre>
 
==== <code>DEC$(n, format)</code> ====
: ''BASIC 1.1''
£10,000,000.00
</pre>
 
==== <code>DERR</code> ====
: ''BASIC 1.1''
146
</pre>
 
: '''Table of Disc ERRor codes''':
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.
| 7 | Set to 1 if error has already been reported by AMSDOS. |
===============================================================================
 
</pre>
==== <code>EOF</code> ====
60 CLOSEIN
</pre>
 
==== <code>ERR</code> ====
: ''BASIC 1.0 & 1.1''
1050 END
</pre>
 
==== <code>EXP (i)</code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Calculates 'E' to the power given in the <numeric expression> (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.
: Returns the result of calculating e to the power i. : Example'''Associated keywords''':LOG
: '''Example''':
<pre>
PRINT EXP(16.876) - prints 2 968.71828183743625
</pre>
 
==== <code>FIX (n)</code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Unlike CINT, FIX merely removes the part of the numeric expression, to the right of the decimal point, and leaves an integer result, rounding towards zero.
: Removes the fractional part of n (see '''Associated keywords''': CINT, INT), ROUND
: '''Example''':
<pre>
PRINT FIX(9.99999)
9
</pre>
==== <code>FRE (n/st)</code> ====
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE("") forces a 'GARBAGE COLLECTION' before returning a value for available space.
: NOTE: BASIC uses only the first 64K of the memory.
: Returns the amount of unused memory'''Associated keywords''': HIMEM, if the argument in brackets is a string, BASIC also performs a memory cleanup. : Examples:MEMORY
: '''Examples''':
<pre>
PRINT FRE(0) or PRINT FRE("hello")
PRINT FRE("")
</pre>
 
==== <code>HEX$ (i1, i2)</code> ====
: FUNCTION: Produces a $tring of HEXadecimal digits representing the value of the <unsigned integer expression>, using the number of hexadecimal digits instructed by the <field width> (in the range 0 to 16). If the number of digits instructed is too great, the resulting expression will be filled with leading zeros; if the number of digits instructed is too small, the resulting expression will NOT be shortened to the instructed number of digits, but will be produced in as many digits as are required.
: The <unsigned integer expression> to be converted into hexadecimal form must yield a value in the range -32768 to 65535.
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)Accociated keywords: BIN$, DEC$, STR$, UNT
: Example:
<pre>
PRINT HEX$(255,4)
00FF
</pre>
==== <code>HIMEM</code> ====
205
edits