Changes

Jump to: navigation, search

Locomotive BASIC

231 bytes added, 08:54, 14 January 2019
/* Functions */
=== Functions ===
==== <code><big><big>ABS (n)</big></big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.
</pre>
==== <code><big>ASC (s)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Returns the numeric value of the first character in the <string expression> (s).
120
</pre>
==== <code><big>ATN (n)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Calculates the Arc-TaNgent of the <numeric expression> (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.
0.785398163
</pre>
==== <code><big>BIN$ (i1,[i2])</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the <unsigned integer expression>, using the number of binary digits instruced by the second <integer expression> (in the range of 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 produced in as many digits as are required.
01000000
</pre>
==== <code><big>CHR$ (n)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Converts an <integer expression> in the range 0 to 255, to its CHaRacter $tring equivalent, using the AMSTRAD character set shown in the ASCII table or e.g. in the manual part 3.
===============================================================================
</PRE>
==== <code><big>CINT (n)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Returns the value of the <numeric expression> (n), Converting it to a rounded INTeger in the range -32768 to 32767.
2
</pre>
==== <code><big>COPYCHR$ (#stream)</big></code> ====
: : ''BASIC 1.1''
: '''FUNCTION''': COPies a CHaRacter from the current position in the stream (which MUST be specified). The below program copies a character from location 1,1 (top left), and reproduces it at location 1,20.
60 PRINT a$
</pre>
==== <code><big>COS (n)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Calculates the COSinus of the <numeric expression> (n).
0.707106781
</pre>
==== <code><big>CREAL (n)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Returns the value of the <numeric expression> (n), Converting it to REAL.
3.14159265
</pre>
==== <code><big>DEC$(n, format)</big></code> ====
: ''BASIC 1.1''
: '''FUNCTIION''': Returns a DECimal string representation of the <numeric expression> (n), using the specified <format template> to control the print format of the resulting string.
£10,000,000.00
</pre>
==== <code><big>DERR</big></code> ====
: ''BASIC 1.1''
: '''FUNCTION''': Reports the last error code returned by the disc filing system. The value of DERR may be used to ascertain the particular Disc ERRor that occurred. See the listing of error messages below.
===============================================================================
</pre>
==== <code><big>EOF</big></code> ====
: ''BASIC 1.1''
: '''FUNCTION''': Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true).
60 CLOSEIN
</pre>
==== <code><big>ERR</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Reports the number of the last ERRor encountered. See the table below of error messages. In the example below you will see that ERRor number 8 is a 'Line does not exist' error.
1050 END
</pre>
==== <code><big>EXP (i)</big></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.
968.743625
</pre>
==== <code><big>FIX (n)</big></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.
9
</pre>
==== <code><big>FRE (n/st)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE("") forces a 'GARBAGE COLLECTION' before returning a value for available space.
PRINT FRE("")
</pre>
==== <code><big>HEX$ (i1, i2)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''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.
00FF
</pre>
==== <code><big>HIMEM</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).
42619
</pre>
==== <code><big>INKEY (i)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.
==============================================================================
</pre>
==== <code><big>INKEY$</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': INterrogates the KEYboard, returning the current $tring reflecting any key that is pressed. It provides operator interaction without hitting [ENTER] after every answer. If there is a key pressed, then the function responds. If no key is pressed, INKEY$ returns an empty string.
run
</pre>
==== <code><big>INP (‹port number›)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the <port number>.
Ready
</pre>
==== <code><big>INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Searches the first <searched string> expression to find the first occurance of the <searched for string expression<, and reports the position of its occurance within the <searched string>. If the <searched for string> does not occur within the <searched string>, then 0 is reported.
run
</pre>
==== <code><big>INT (n)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Rounds the number to the nearest smaller INTeger, removing any fractional part. Returns then same value as FIX for positive number, but returns one less than FIX for negative numbers which are not already integers.
205
edits