Changes

Jump to: navigation, search

Locomotive BASIC

1,333 bytes added, 08:36, 10 January 2019
/* Functions */
</pre>
==== <code>FRE (n/st)</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.
: NOTE: BASIC uses only the first 64K of the memory.
</pre>
==== <code>HEX$ (i1, i2)</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.
: The <unsigned integer expression> to be converted into hexadecimal form must yield a value in the range -32768 to 65535.
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT
: '''Example''':
<pre>
PRINT HEX$(255,4)
</pre>
==== <code>HIMEM</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).
: Before resetting the highest byte of available memory using the MEMORY command, it is advisable to issue the 'command mm=HIMEM'. You will thereafter be able to return to the previous memory capacity by issuing the command: 'MEMORY mm'
: NOTE: BASIC uses only the first 64K of memory.
: Returns address of the highest memory address used by BASICAssociated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.
: '''Example''':
...on a CPC464
<pre>
PRINT HIMEM
43903
</pre>
...on a CPC6128
<pre>
PRINT HIMEM
42619
</pre>
==== <code>INKEY (i)</code> ====
: Checks ''BASIC 1.0 & 1.1'': '''FUNCTION''': INterrogates the KEYboard to see if report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.: The function is useful for spotting whether a certain key number i is being down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).: The example below detects when [SHIFT] and V (key number 55) are pressedtogether, then ends the program. Refer the manual for the key numbers.
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY
 
: '''Example''':
<pre>
10 IF INKEY(55)<>32 THEN 10
20 PRINT "You've pressed [SHIFT] and V"
30 CLEAR INPUT
run
</pre>
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the <integer expression> is identified as follows:
<pre>
Value returned [SHIFT] [CTRL] Specified key
160 down down down
</pre>
 
==== <code>INKEY$</code> ====
205
edits