<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://oldwiki.cpcwiki.eu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=HAL6128</id>
		<title>CPCWiki - THE Amstrad CPC encyclopedia! - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://oldwiki.cpcwiki.eu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=HAL6128"/>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php/Special:Contributions/HAL6128"/>
		<updated>2026-08-28T13:08:49Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.25.1</generator>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=108121</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=108121"/>
				<updated>2021-06-30T20:45:35Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* MOD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
With this directive you may load any file in memory&lt;br /&gt;
&lt;br /&gt;
Basic files (extension .BAS) are loaded in Basic memory, you cannot choose loading address&lt;br /&gt;
&lt;br /&gt;
Binary files are loaded to the default address location stored in the AMSDOS header but you may force loading address (&amp;amp;C000 for a screen)&lt;br /&gt;
&lt;br /&gt;
TAPE convention:&lt;br /&gt;
&lt;br /&gt;
When loading tape files, the basic display a message every block which may cause trouble. Message output may be disabled by using prefix &amp;quot;!&amp;quot; before the filename.&lt;br /&gt;
&lt;br /&gt;
It's also possible to load the next file disregarding his name using only &amp;quot;!&amp;quot; =&amp;gt; &amp;lt;code&amp;gt;LOAD &amp;quot;!&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(62,500/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED INK &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SPEED INK command defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED KEY &amp;lt;start,repeat&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SPEED KEY command defines the delay after which a key repeat (for keys that do repeat). The first parameter is the delay before the first repeat and the second parameter is the delay between further repeats. Delay is in 1/50th of seconds.&lt;br /&gt;
&lt;br /&gt;
:When using it with low values, it is common to associate a key to reset the default speed of 30,2.&lt;br /&gt;
:For example to associate the key 0 from the numpad:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
KEY 0,&amp;quot;SPEED KEY 30,2&amp;quot;+CHR$(13)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED WRITE &amp;lt;n&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SPEED WRITE defines the speed at which data is to be saved or written to a cassette unit. n=1 means 2000 baud, n=0 (default) means 1000 baud. When reading from the tape, the correct speed is automatically selected.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''MOD''' returns a (rounded) rest (Modulos) after dividen has been devided by the devisor.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
32767 mod 256&lt;br /&gt;
255&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Note: only works with numbers in the range -32768 and 32767 (&amp;amp;8000 &amp;lt; 0 &amp;lt; &amp;amp;7FFF)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
: '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PEEK (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the contents of the Z80 memory location specified in the &amp;lt;address expression&amp;gt; which should be in the range &amp;amp;0000 to &amp;amp;FFFF (0 to 65535). In all cases PEEK will return the value at the RAM address specified (not the ROM), and will be in the range &amp;amp;00 to &amp;amp;FF (0 to 255)&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POKE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: ZONE 7&lt;br /&gt;
20 WINDOW 1,40,1,2:WINDOW #1,1,40,3,25&lt;br /&gt;
30 PRINT &amp;quot;memory-address&amp;quot;&lt;br /&gt;
40 LOCATE 20,1:PRINT &amp;quot;memory-contents&amp;quot;&lt;br /&gt;
50 FOR n=1 to 65535&lt;br /&gt;
60 p=PEEK(n)&lt;br /&gt;
70 PRINT #1,n,&amp;quot;(&amp;amp;&amp;quot;;HEX$(n);&amp;quot;)&amp;quot;;&lt;br /&gt;
80 PRINT #1,TAB(20);p,&amp;quot;(&amp;amp;&amp;quot;;HEX$(p);&amp;quot;)&amp;quot;&lt;br /&gt;
90 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PI&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The value of the ratio between the circumference and the diameter of a circle.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': DEG, RAD&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT PI&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal POSition of the text cursor relative to the left edge of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
: POS(#8) reports the current horizontal carriage position for the printer, where 1 is the extreme left hand edge.&lt;br /&gt;
: POS(#9) reports the logical position in the disc file stream, i.e. the number of printing characters sent to the stream since the last carriage return.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': VPOS, WINDOW&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor left/right keys&amp;quot;&lt;br /&gt;
30 WINDOW 1,40,12,12:CURSOR 1,1&lt;br /&gt;
40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT&lt;br /&gt;
50 IF INKEY(1)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(9);&lt;br /&gt;
60 IF INKEY(8)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(8);&lt;br /&gt;
70 LOCATE #1,2,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;horizontal position = &amp;quot;;&lt;br /&gt;
100 PRINT #1,POS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;REMAIN (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns count REMAINing count from the delay timer specified in &amp;lt;integer expression&amp;gt; (= timer number in the range 0 to 3), and disable it. If the delay timer was not enabled zero will be returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': AFTER, DI, EI, EVERY&lt;br /&gt;
&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: an '''example''' in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
: further '''example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 AFTER 500,1 GOSUB 40&lt;br /&gt;
20 AFTER 100,2 GOSUB 50&lt;br /&gt;
30 PRINT &amp;quot;program running&amp;quot;:GOTO 30&lt;br /&gt;
40 REM this GOUSB-Routine will not be called as it is disabled in line 80&lt;br /&gt;
50 PRINT:PRINT &amp;quot;Timer 1 will now be &amp;quot;;&lt;br /&gt;
60 PRINT &amp;quot;disabled by REMAIN.&amp;quot;&lt;br /&gt;
70 PRINT &amp;quot;Time-units remaining were:&amp;quot;;&lt;br /&gt;
80 PRINT REMAIN(1)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RIGHT$ (&amp;lt;string expression&amp;gt;, &amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt; (=required length) parameter, after extracting them from the RIGHT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;integer expression&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LEFT$, MID$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:a$=&amp;quot;AMSTRAD computer&amp;quot;&lt;br /&gt;
20 FOR n=1 TO 16:LOCATE 41-n,n&lt;br /&gt;
30 PRINT RIGHT$(a$,n)&lt;br /&gt;
40 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RND [(&amp;lt;numeric expression&amp;gt;)]&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the next RaNDom number in sequence if the &amp;lt;numeric expression&amp;gt; has a positive value or is not specified. &lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a value of zero, RND returns a copy of the last random number generated.&lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a negative value, a new random number sequence is started, the first number of which is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': RANDOMIZE&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
: Example for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''': &lt;br /&gt;
: For generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''4. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 RANDOMIZE&lt;br /&gt;
20 FOR x=1 TO -1 STEP -1&lt;br /&gt;
30 PRINT &amp;quot;rnd parameter=&amp;quot;;x&lt;br /&gt;
40 FOR n=1 TO 6&lt;br /&gt;
50 PRINT RND(x)&lt;br /&gt;
60 NEXT n,x&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ROUND (&amp;lt;numeric expression&amp;gt;[,&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Rounds &amp;lt;numeric expression&amp;gt; to a number of decimal places or to the power of ten specified by &amp;lt;integer expression&amp;gt;. If &amp;lt;integer expression&amp;gt; less than zero, the &amp;lt;numeric expression&amp;gt; is rounded to give an absolute integer with &amp;lt;integer expression&amp;gt; number of zeros before the decimal point.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS, CINT, FIX, INT&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2),ROUND(1562.375,-2)&lt;br /&gt;
 1562.36     1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=4 TO -4 STEP -1&lt;br /&gt;
20 PRINT ROUND (1234.5678,n)&lt;br /&gt;
30 PRINT &amp;quot;with integer expression&amp;quot;;n&lt;br /&gt;
40 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SGN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: FUNCTION: Determines the SiGN of the &amp;lt;numeric expression&amp;gt;. Returns -1 if &amp;lt;numeric expression&amp;gt; is less than 0, returns 0 if &amp;lt;numeric expression&amp;gt; = 0, and returns 1 if &amp;lt;numeric expression&amp;gt; is greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=255 to -200 STEP -20&lt;br /&gt;
20 PRINT &amp;quot;SGN returns&amp;quot;;&lt;br /&gt;
30 PRINT SGN(n);&amp;quot;for a value of&amp;quot;;n&lt;br /&gt;
40 NEXT n&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SIN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Real value for the Sine of &amp;lt;numeric expression&amp;gt;, defaulting to the Radian (RAD) measure mode unless otherwise declared by a DEG command.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS:DEG:ORIGIN 0,20&lt;br /&gt;
20 FOR n=0 to 720&lt;br /&gt;
30 y=SIN(n)&lt;br /&gt;
40 PLOT n*640/720,198*y:NEXT&lt;br /&gt;
50 GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SPACE$(&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Creates a string of spaces of the given length, (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': SPC, STRING$, TAB&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1&lt;br /&gt;
20 PRINT &amp;quot;Put 9 spaces between me&amp;quot;;&lt;br /&gt;
30 PRINT SPACE$(9);&lt;br /&gt;
40 PRINT &amp;quot;and you!&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQ (&amp;lt;channel&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the state of the Sound Queue for the specified &amp;lt;channel&amp;gt; which must be an integer expression, yielding one the values:&lt;br /&gt;
: 1: for channel A&lt;br /&gt;
: 2: for channel B&lt;br /&gt;
: 4: for channel C&lt;br /&gt;
: The SQ function returns a bit significant integer, comprising the following bit settings:&lt;br /&gt;
: Bit 0,1 and 2: the number of free entries in the queue&lt;br /&gt;
: Bit 3,4 and 5: the rendezvous state at the head of this queue&lt;br /&gt;
: Bit 6        : the head of the queue is held&lt;br /&gt;
: Bit 7        : the channel is currently active&lt;br /&gt;
: ... where Bit 0 is the least significant bit, and Bit 7 is the most significant bit.&lt;br /&gt;
: It can be seen, that if Bit 6 is set, Bit 7 cannot be set at the same time, and vice versa. Similarly if Bits 3, 4, or 5 are set, Bit 6 and 7 cannot be set.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ON SQ GOSUB, SOUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,100,100&lt;br /&gt;
20 PRINT SQ(1)&lt;br /&gt;
run&lt;br /&gt;
 67&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQR (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the SQuare Root of the specified &amp;lt;numeric expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT SQR(9)&lt;br /&gt;
 3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;STR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts the &amp;lt;numeric expression&amp;gt; to a decimal STRing representation.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': BIN$, DEC$, HEX$, VAL&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''NOTE''': (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=&amp;amp;FF:REM 255 hex&lt;br /&gt;
20 b=&amp;amp;x1111:REM 15 binary&lt;br /&gt;
30 c$=&amp;quot;***&amp;quot;&lt;br /&gt;
40 PRINT c$+SR$(a+b)+c$&lt;br /&gt;
run&lt;br /&gt;
*** 270***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;STRING$ (&amp;lt;length&amp;gt;,&amp;lt;character specifier&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a string expression consisting of the &amp;lt;character specifier&amp;gt; repeated the number of time (in the range 0 to 255) specified in the &amp;lt;length&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': SPACE$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(40,&amp;quot;*&amp;quot;)&lt;br /&gt;
****************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING(40,42)&lt;br /&gt;
****************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''NOTE''': the &amp;lt;character specifier&amp;gt; 42 refers to the ASCII value of the character '*' and is also equivalent to PRINT STRING$(40,CHR$(42))&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TAN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the TANgent of the &amp;lt;numeric expression&amp;gt;, which must be in the range -200,000 to +200,000.&lt;br /&gt;
: '''NOTE''': DEG and RAD can be used to force the result of the calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''': &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT TAN(45)&lt;br /&gt;
 1.61977519&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TEST (&amp;lt;x co-ordinate&amp;gt;,&amp;lt;y co-ordinate&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Moves the graphics cursor to the absolute position specified by the &amp;lt;x&amp;gt; and &amp;lt;y co-ordinate&amp;gt;s, and reports the value of the ink at the new location.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, TESTR, XPOS, YPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Your are using pen number&amp;quot;;&lt;br /&gt;
30 PRINT TEST(10,386)&lt;br /&gt;
40 PRINT &amp;quot;Try changing PENs and MODEs&amp;quot;;&lt;br /&gt;
50 PRINT &amp;quot;....then RUN again.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TESTR (&amp;lt;x offset&amp;gt;,&amp;lt;y offset&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Moves the graphics cursor by the amount specified in the &amp;lt;x&amp;gt; and &amp;lt;y offset&amp;gt;s relative to its current position, and reports the value of the ink at the new location.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, TEST, XPOS, YPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 0:FOR x=1 TO 15:LOCATE 1,x&lt;br /&gt;
20 PEN x:PRINT STRING$(10,143);:NEXT&lt;br /&gt;
30 MOVE 200,400:PEN 1&lt;br /&gt;
40 FOR n=1 TO 23:LOCATE 12,n&lt;br /&gt;
50 PRINT &amp;quot;pen&amp;quot;;TESTR(0,-16):NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TIME&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the elapsed time since the computer was last switched-on or reset, (excluding periods when reading or writing to disc).&lt;br /&gt;
: Each second of real time is equal to the returned value = TIME/300.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': AFTER, EVERY, WEND, WHILE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS:REM clock&lt;br /&gt;
20 INPUT &amp;quot;hour&amp;quot;;hour&lt;br /&gt;
30 INPUT &amp;quot;minute&amp;quot;;minute&lt;br /&gt;
40 INPUT &amp;quot;second&amp;quot;;second&lt;br /&gt;
50 CLS:datum=INT(TIME/300)&lt;br /&gt;
60 WHILE hour&amp;lt;13&lt;br /&gt;
70 WHILE minute&amp;lt;60&lt;br /&gt;
80 WHILE tick&amp;lt;60&lt;br /&gt;
90 tick=(INT(TIME/300)-datum)+second&lt;br /&gt;
100 LOCATE 1,1&lt;br /&gt;
110 PRINT USING &amp;quot;## &amp;quot;;hour,minute,tick&lt;br /&gt;
120 WEND&lt;br /&gt;
130 tick=0:second=0:minute=minute+1&lt;br /&gt;
140 GOTO 50&lt;br /&gt;
150 WEND&lt;br /&gt;
160 minute=0:hour=hour+1&lt;br /&gt;
170 WEND&lt;br /&gt;
180 hour=1&lt;br /&gt;
190 GOTO 60&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;UNT (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Return an integer in the range -32768 to +32767 which is the twos-complement equivalent of the unsigned value of the &amp;lt;address expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, FIX, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66)&lt;br /&gt;
-154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;UPPER$(&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; but in which all alphabetic characters in the range A to Z are converted to upper case. The function is useful for processing input which may come in mixed upper / lower case.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOWER$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS: a$=&amp;quot;my, how you've grown!&amp;quot;&lt;br /&gt;
20 PRINT UPPER$(a$)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;VAL(&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the numeric VALue, (including any negative sign and decimal point) of the first character(s) in the specified &amp;lt;string expression&amp;gt;. &lt;br /&gt;
:If the first character is not a number, then 0 is returned. If the first character is a negative sign or decimal point followed by non-numeric characters, a 'Type mismatch' error (13) will be reported.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': STR$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;)&lt;br /&gt;
 -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Exception''': if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT VAL(&amp;quot;&amp;amp;amp;A&amp;quot;)&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
PRINT VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) &lt;br /&gt;
 32767&lt;br /&gt;
&lt;br /&gt;
PRINT VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) &lt;br /&gt;
-32768&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS: PRINT &amp;quot;I know my times tables!&amp;quot;&lt;br /&gt;
20 PRINT:PRINT &amp;quot;Press a key (1 to 9)&amp;quot;&lt;br /&gt;
30 a$=INKEY$:IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
40 n=VAL(a$):if n&amp;lt;1 or n&amp;gt;9 then 30&lt;br /&gt;
50 FOR x=1 to 12&lt;br /&gt;
60 PRINT n;&amp;quot;X&amp;quot;;x;&amp;quot;=&amp;quot;;n*x&lt;br /&gt;
70 NEXT:GOTO 20&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;VPOS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current vertical POSition of the text cursor relative to the top of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POS, WINDOW&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor up/down keys&amp;quot;&lt;br /&gt;
30 WINDOW 39,39,1,25:CURSOR 1,1&lt;br /&gt;
40 LOCATE 1,3&lt;br /&gt;
50 IF INKEY(0)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(11);&lt;br /&gt;
60 IF INKEY(2)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(10);&lt;br /&gt;
70 LOCATE #1,3,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;vertical position =&amp;quot;;&lt;br /&gt;
100 PRINT #1,VPOS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;XPOS&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal (X)POSition of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, ORIGIN, YPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:DRAW 320,200&lt;br /&gt;
20 PRINT &amp;quot;graphics cursor X position = &amp;quot;;&lt;br /&gt;
30 PRINT XPOS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;YPOS&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current vertical (Y)POSition of the graphic cursor.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, ORIGIN, XPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:DRAW 320,200&lt;br /&gt;
20 PRINT &amp;quot;graphics cursor Y position = &amp;quot;;&lt;br /&gt;
30 PRINT YPOS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=HAL6128&amp;diff=103775</id>
		<title>HAL6128</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=HAL6128&amp;diff=103775"/>
				<updated>2019-10-23T10:54:11Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Demos */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''HAL6128''' is a graphic artist of the german [[CPC]] scene.&lt;br /&gt;
&lt;br /&gt;
== Releases ==&lt;br /&gt;
&lt;br /&gt;
=== Games ===&lt;br /&gt;
&lt;br /&gt;
* [[Pentomino]] (2017)&lt;br /&gt;
&lt;br /&gt;
=== Demos ===&lt;br /&gt;
&lt;br /&gt;
* [[NQ!-Music Disc]] (2018)&lt;br /&gt;
* [[SCHNAPPS]] (2019)&lt;br /&gt;
&lt;br /&gt;
== Groups ==&lt;br /&gt;
&lt;br /&gt;
* [[TGS]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:CPC scene members]]&lt;br /&gt;
[[Category:Active CPC Game Developers]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Technical_information_about_Locomotive_BASIC&amp;diff=103144</id>
		<title>Technical information about Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Technical_information_about_Locomotive_BASIC&amp;diff=103144"/>
				<updated>2019-04-16T11:01:45Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Cpctech.org]]&lt;br /&gt;
&lt;br /&gt;
'''''This article originally came from Kevin Thackers' archive at [http://www.cpctech.org.uk http://www.cpctech.org.uk].''''' &lt;br /&gt;
&lt;br /&gt;
= Technical information about Locomotive BASIC  =&lt;br /&gt;
&lt;br /&gt;
The are two versions of Locomotive BASIC used in the Amstrad CPC and CPC+ computers. v1.0 is used by the CPC464, and v1.1 is used by the CPC664, CPC6128, CPC464+ and CPC6128+. &lt;br /&gt;
&lt;br /&gt;
== BASIC v1.0 only ==&lt;br /&gt;
&lt;br /&gt;
There is a region of memory between AC00-AC1B which is filled with RET instructions. The BASIC ROM calls the following locations:&lt;br /&gt;
AC01,AC04,AC07,AC0A,AC0D,AC10,AC13,AC16,AC19&lt;br /&gt;
&lt;br /&gt;
It almost looks like these were used for debugging the ROM but were left in.&lt;br /&gt;
&lt;br /&gt;
They can be used to implement new BASIC commands.&lt;br /&gt;
&lt;br /&gt;
== Passing parameters to a RSX (Resident System Extension) command or binary function  ==&lt;br /&gt;
&lt;br /&gt;
A RSX (Resident System Extension) command is accessed through BASIC with a &amp;quot;|&amp;quot; character prefix. e.g. The &amp;quot;DIR&amp;quot; RSX, is accessed by &amp;quot;|DIR&amp;quot;.  A binary function is accessed through BASIC using the &amp;quot;CALL&amp;quot; command. &lt;br /&gt;
&lt;br /&gt;
Both RSX and CALL commands work (are!) similar from the BASIC command line and invoke machine code - the only difference is: with the help of a RSX command you don't need to know the exact access address. You can pass up to 32 parameters with a CALL or RSX command. Possible parameters could be integer, floating points and strings. Just store the parameter into a variable:&lt;br /&gt;
Passing for integer:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CALL &amp;amp;4000,32,34,&amp;amp;5E,&amp;amp;x10101010&lt;br /&gt;
|RSX-command,32,34,&amp;amp;5E,&amp;amp;x10101010&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Passing for floating points&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@a!=43.375&lt;br /&gt;
CALL or |RSX-command,@a!&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; Passing a string parameter: &lt;br /&gt;
&amp;lt;br&amp;gt; BASIC v1.0 &lt;br /&gt;
&amp;lt;pre&amp;gt;a$=&amp;quot;A&amp;quot;:|DRIVE,@a$&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
BASIC v1.1: &lt;br /&gt;
&amp;lt;pre&amp;gt;|DRIVE,&amp;quot;A&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
b$=&amp;quot;test&amp;quot;&lt;br /&gt;
CALL or |RSX-command,@b$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters will be stored inside the range of Stack:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     A=n -------&amp;gt; MSB PARAM1&lt;br /&gt;
                  LSB PARAM1&lt;br /&gt;
                  MSB PARAM2&lt;br /&gt;
                  LSB PARAM2&lt;br /&gt;
                  ...&lt;br /&gt;
                  ...&lt;br /&gt;
                  ...&lt;br /&gt;
                  MSB PARAMn&lt;br /&gt;
     IX+0 ------&amp;gt; LSB PARAMn&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
with the help of that assembly code is it possible to find the parameters:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ROUT1:  CP   x          ;test register A if &amp;quot;x&amp;quot; parameters were given, e.g. x = 2&lt;br /&gt;
        RET  NZ         ; if not exactly x parameters then do not execute RSX.&lt;br /&gt;
        LD   L,(IX+0)&lt;br /&gt;
        LD   H,(IX+1)   ; HL = value of last parameter        &lt;br /&gt;
        LD   E,(IX+2)&lt;br /&gt;
        LD   D,(IX+3)   ; DE = value of next to last parameter&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
A register holds the number of parameters. IX points to each parameter. IX+0/IX+1 is the last parameter. This happens because each parameter in order is pushed onto the stack and IX then points to the last parameter pushed. Each parameter is a 16-bit value.&lt;br /&gt;
&lt;br /&gt;
If a parameter is a string, then IX holds the address of the string descriptor which point to a 3 byte block. The first byte of the string descriptor is the length. The next 2 bytes are an address that point to the string in memory.&lt;br /&gt;
&lt;br /&gt;
With the help of the variable container &amp;quot;@&amp;quot; it is also possible to get a result from an invoked mc-code back to basic.&lt;br /&gt;
In this case the parameter contains the address of the integer, floating point or string. You can modify these to give the result.&lt;br /&gt;
BASIC allocates the strings, so when you modify a string, do not write more characters than the original string.&lt;br /&gt;
&lt;br /&gt;
Hint: the first two bytes at the end of stack shows the internal return address from BASIC interpreter where it was executed.&lt;br /&gt;
&lt;br /&gt;
== Additional keywords and variables in BASIC v1.1  ==&lt;br /&gt;
&lt;br /&gt;
#BASIC v1.1 has the following additional keywords: &lt;br /&gt;
#*COPYCHR$ &lt;br /&gt;
#*CURSOR &lt;br /&gt;
#*DEC$ &lt;br /&gt;
#*FILL &lt;br /&gt;
#*FRAME &lt;br /&gt;
#*GRAPHICS &lt;br /&gt;
#*MASK &lt;br /&gt;
#BASIC v1.1 has the following additional predefined variables: &lt;br /&gt;
#*DERR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
== BASIC programs  ==&lt;br /&gt;
&lt;br /&gt;
A maximum of 255 characters can be entered for a single BASIC line.&lt;br /&gt;
&lt;br /&gt;
There are some rules for assigning names for variables:&lt;br /&gt;
: - it is not allowed to define a variable starting with a figure (the system expect then programming mode and interpret it as a program line number)&lt;br /&gt;
: - no space (or 'under' as it is common today) between variable names are allowed&lt;br /&gt;
: - BASIC keywords can't be used&lt;br /&gt;
: - different sign e.g.: a slash (doesn't depend which direction), a 'minus' sign, a 'and' sign can't be used in a variable names&lt;br /&gt;
: - after a dollar sign (for defining string variables) it is not allowed to use further signs&lt;br /&gt;
: - different defining functions together are not allowed (e.g. use '%' together with '$')&lt;br /&gt;
&lt;br /&gt;
: - you can use 40 characters for a variable name&lt;br /&gt;
: - use ! for defining a REAL value variable (like the function DEFREAL but only for the assigned variable) &amp;gt; It's also possible to omit the exlamation mark because it's the default system declaration after powering on then CPC.&lt;br /&gt;
: - use % for defining a INTEGER value variable (like the function DEFINT but only for the assigned variable)&lt;br /&gt;
: - use $ for defining a STRING variable (like the function DEFSTR but only for the assigned variable)&lt;br /&gt;
: - Minimum line number is 1. Maximum line number is 65535.&lt;br /&gt;
&lt;br /&gt;
This is converted into the tokenised BASIC program which is more compact than the line entered. The BASIC keywords are converted into &amp;quot;tokens&amp;quot;, or 1-2 byte sequences which uniquely identify each keyword. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Speeding up BASIC programs ==&lt;br /&gt;
&lt;br /&gt;
To speed up BASIC programs following rules could help:&lt;br /&gt;
: - Avoid loops or a branching program structure if possible. Internally the operating system searches for the right line number always from the beginning of the program 'listing'. Often recurring subroutines  (if necessary) should be at the beginning of RAM to speed up things.&lt;br /&gt;
: - Avoid the index variable after the &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; command/statement (although it isn't a good program style)&lt;br /&gt;
: - Avoid spaces inside program code or remarks&lt;br /&gt;
: - Put lots of statements as possible in ONE line&lt;br /&gt;
: - Use variables instead of constants. A constand has always to be converted in a binary/digital format. A variable is already converted.&lt;br /&gt;
: - Dimensioning at the beginning of the program&lt;br /&gt;
: - Dimensioning your variables &amp;amp; pre-calculate&lt;br /&gt;
: - Avoid AND/OR/XOR in IF-THEN statements. It's faster to write IF ... THEN (statement 1).. IF ... THEN (statement 2).&lt;br /&gt;
&lt;br /&gt;
== Structure of a BASIC program  ==&lt;br /&gt;
&lt;br /&gt;
A BASIC program is stored in a tokenised format. Here the keywords are represented by 1 or 2 byte unique sequences. Each line of the BASIC program has the form: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset &lt;br /&gt;
! Size &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 &lt;br /&gt;
| 2 &lt;br /&gt;
| Length of line data in bytes (note 1)&lt;br /&gt;
|-&lt;br /&gt;
| 2 &lt;br /&gt;
| 2 &lt;br /&gt;
| 16-bit decimal integer line number (note 2)&lt;br /&gt;
|-&lt;br /&gt;
| 4 &lt;br /&gt;
| n &lt;br /&gt;
| BASIC line encoded into tokens (note 3)&lt;br /&gt;
|-&lt;br /&gt;
| n+1 &lt;br /&gt;
| 1 &lt;br /&gt;
| &amp;quot;0&amp;quot; the end of line marker (note 4)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; Notes: &lt;br /&gt;
&lt;br /&gt;
#This 16-bit value has two functions: if &amp;quot;0&amp;quot; it signals the end of the BASIC program. In this case, there is no furthur BASIC program lines or data, otherwise, this value defines the length of the tokenised BASIC program line in bytes, and includes the 2 bytes defining this value, the 2 bytes defining the program line number, and the end of line marker. This number is stored in little endian notation with low byte followed by high byte.&lt;br /&gt;
#This 16-bit value defines the line number and exists if the length of line data in bytes is not &amp;quot;0&amp;quot;. A line number is a integer number in the range 1-65535. This number is stored in little endian notation with low byte followed by high byte. &lt;br /&gt;
#This data defines the tokenised BASIC program line and exists if the length of line data in bytes is not &amp;quot;0&amp;quot;. The length is dependant on the BASIC program line contents. &lt;br /&gt;
#This value defines the end of the tokenised BASIC line data and exists if the length of line data in bytes is not &amp;quot;0&amp;quot;. The BASIC interpreter looks for this token during the processing of this line, and if found, will stop execution and continue to the next line.&lt;br /&gt;
&lt;br /&gt;
== BASIC tokens  ==&lt;br /&gt;
&lt;br /&gt;
This table list the BASIC tokens with no prefix byte. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&amp;lt;br&amp;gt;(hexidecimal) &lt;br /&gt;
! BASIC keyword&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;00 &lt;br /&gt;
| end of tokenised line marker&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;01 &lt;br /&gt;
| &amp;quot;:&amp;quot; statement seperator&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;02 &lt;br /&gt;
| integer variable definition (defined with &amp;quot;%&amp;quot; suffix)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;03 &lt;br /&gt;
| string variable definition (defined with &amp;quot;$&amp;quot; suffix)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;04 &lt;br /&gt;
| floating point variable definition (defined with &amp;quot;!&amp;quot; suffix)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;05 &lt;br /&gt;
| var?&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;06 &lt;br /&gt;
| var?&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;07 &lt;br /&gt;
| var?&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;08 &lt;br /&gt;
| var?&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;09 &lt;br /&gt;
| var?&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;0a &lt;br /&gt;
| var?&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;0b &lt;br /&gt;
| variable definition (no suffix)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;0c &lt;br /&gt;
| variable definition (no suffix)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;0d &lt;br /&gt;
| variable definition (no suffix)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;0e &lt;br /&gt;
| number constant &amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;0f &lt;br /&gt;
| number constant &amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;10 &lt;br /&gt;
| number constant &amp;quot;2&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;11 &lt;br /&gt;
| number constant &amp;quot;3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;12 &lt;br /&gt;
| number constant &amp;quot;4&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;13 &lt;br /&gt;
| number constant &amp;quot;5&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;14 &lt;br /&gt;
| number constant &amp;quot;6&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;15 &lt;br /&gt;
| number constant &amp;quot;7&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;16 &lt;br /&gt;
| number constant &amp;quot;8&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;17 &lt;br /&gt;
| number constant &amp;quot;9&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;18 &lt;br /&gt;
| number constant &amp;quot;10&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;19 &lt;br /&gt;
| 8-bit integer decimal value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;1a &lt;br /&gt;
| 16-bit integer decimal value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;1b &lt;br /&gt;
| 16-bit integer binary value (with &amp;quot;&amp;amp;amp;X&amp;quot; prefix)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;1c &lt;br /&gt;
| 16-bit integer hexadecimal value (with &amp;quot;&amp;amp;amp;H&amp;quot; or &amp;quot;&amp;amp;amp;&amp;quot; prefix)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;1d &lt;br /&gt;
| 16-bit BASIC program line memory address pointer (see notes)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;1e &lt;br /&gt;
| 16-bit integer BASIC line number&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;1f &lt;br /&gt;
| floating point value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;20 &lt;br /&gt;
| &amp;quot; &amp;quot; (space) symbol&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;21 &lt;br /&gt;
| ASCII &amp;quot;!&amp;quot; symbol&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;22 &lt;br /&gt;
| quoted string value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;23-7b &lt;br /&gt;
| ASCII printable symbols&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;7c &lt;br /&gt;
| &amp;quot;&amp;amp;#124;&amp;quot; symbol; prefix for RSX commands&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;80 &lt;br /&gt;
| AFTER&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;81 &lt;br /&gt;
| AUTO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;82 &lt;br /&gt;
| BORDER&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;83 &lt;br /&gt;
| CALL&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;84 &lt;br /&gt;
| CAT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;85 &lt;br /&gt;
| CHAIN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;86 &lt;br /&gt;
| CLEAR&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;87 &lt;br /&gt;
| CLG&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;88 &lt;br /&gt;
| CLOSEIN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;89 &lt;br /&gt;
| CLOSEOUT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;8a &lt;br /&gt;
| CLS&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;8b &lt;br /&gt;
| CONT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;8c &lt;br /&gt;
| DATA&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;8d &lt;br /&gt;
| DEF&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;8e &lt;br /&gt;
| DEFINT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;8f &lt;br /&gt;
| DEFREAL&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;90 &lt;br /&gt;
| DEFSTR&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;91 &lt;br /&gt;
| DEG&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;92 &lt;br /&gt;
| DELETE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;93 &lt;br /&gt;
| DIM&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;94 &lt;br /&gt;
| DRAW&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;95 &lt;br /&gt;
| DRAWR&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;96 &lt;br /&gt;
| EDIT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;97 &lt;br /&gt;
| ELSE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;98 &lt;br /&gt;
| END&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;99 &lt;br /&gt;
| ENT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;9a &lt;br /&gt;
| ENV&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;9b &lt;br /&gt;
| ERASE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;9c &lt;br /&gt;
| ERROR&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;9d &lt;br /&gt;
| EVERY&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;9e &lt;br /&gt;
| FOR&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;9f &lt;br /&gt;
| GOSUB, GO SUB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;a0 &lt;br /&gt;
| GOTO, GO TO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;a1 &lt;br /&gt;
| IF&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;a2 &lt;br /&gt;
| INK&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;a3 &lt;br /&gt;
| INPUT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;a4 &lt;br /&gt;
| KEY&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;a5 &lt;br /&gt;
| LET&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;a6 &lt;br /&gt;
| LINE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;a7 &lt;br /&gt;
| LIST&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;a8 &lt;br /&gt;
| LOAD&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;a9 &lt;br /&gt;
| LOCATE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;aa &lt;br /&gt;
| MEMORY&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;ab &lt;br /&gt;
| MERGE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;ac &lt;br /&gt;
| MID$&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;ad &lt;br /&gt;
| MODE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;ae &lt;br /&gt;
| MOVE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;af &lt;br /&gt;
| MOVER&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;b0 &lt;br /&gt;
| NEXT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;b1 &lt;br /&gt;
| NEW&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;b2 &lt;br /&gt;
| ON&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;b3 &lt;br /&gt;
| ON BREAK&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;b4 &lt;br /&gt;
| ON ERROR GOTO, ON ERROR GO TO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;b5 &lt;br /&gt;
| SQ&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;b6 &lt;br /&gt;
| OPENIN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;b7 &lt;br /&gt;
| OPENOUT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;b8 &lt;br /&gt;
| ORIGIN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;b9 &lt;br /&gt;
| OUT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;ba &lt;br /&gt;
| PAPER&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;bb &lt;br /&gt;
| PEN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;bc &lt;br /&gt;
| PLOT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;bd &lt;br /&gt;
| PLOTR&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;be &lt;br /&gt;
| POKE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;bf &lt;br /&gt;
| PRINT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;c0 &lt;br /&gt;
| &amp;quot;'&amp;quot; symbol (same function as REM keyword)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;c1 &lt;br /&gt;
| RAD&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;c2 &lt;br /&gt;
| RANDOMIZE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;c3 &lt;br /&gt;
| READ&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;c4 &lt;br /&gt;
| RELEASE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;c5 &lt;br /&gt;
| REM&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;c6 &lt;br /&gt;
| RENUM&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;c7 &lt;br /&gt;
| RESTORE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;c8 &lt;br /&gt;
| RESUME&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;c9 &lt;br /&gt;
| RETURN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;ca &lt;br /&gt;
| RUN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;cb &lt;br /&gt;
| SAVE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;cc &lt;br /&gt;
| SOUND&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;cd &lt;br /&gt;
| SPEED&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;ce &lt;br /&gt;
| STOP&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;cf &lt;br /&gt;
| SYMBOL&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;d0 &lt;br /&gt;
| TAG&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;d1 &lt;br /&gt;
| TAGOFF&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;d2 &lt;br /&gt;
| TROFF&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;d3 &lt;br /&gt;
| TRON&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;d4 &lt;br /&gt;
| WAIT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;d5 &lt;br /&gt;
| WEND&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;d6 &lt;br /&gt;
| WHILE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;d7 &lt;br /&gt;
| WIDTH&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;d8 &lt;br /&gt;
| WINDOW&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;d9 &lt;br /&gt;
| WRITE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;da &lt;br /&gt;
| ZONE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;db &lt;br /&gt;
| DI&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;dc &lt;br /&gt;
| EI&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;dd &lt;br /&gt;
| FILL (v1.1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;de &lt;br /&gt;
| GRAPHICS (v1.1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;df &lt;br /&gt;
| MASK (v1.1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;e0 &lt;br /&gt;
| FRAME (v1.1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;e1 &lt;br /&gt;
| CURSOR (v1.1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;e2 &lt;br /&gt;
| (note 2)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;e3 &lt;br /&gt;
| ERL&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;e4 &lt;br /&gt;
| FN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;e5 &lt;br /&gt;
| SPC&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;e6 &lt;br /&gt;
| STEP&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;e7 &lt;br /&gt;
| SWAP&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;e8 &lt;br /&gt;
| (note 2)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;e9 &lt;br /&gt;
| (note 2)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;ea &lt;br /&gt;
| TAB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;eb &lt;br /&gt;
| THEN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;ec &lt;br /&gt;
| TO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;ed &lt;br /&gt;
| USING&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;ee &lt;br /&gt;
| &amp;amp;gt; (greater than)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;ef &lt;br /&gt;
| = (equal)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;f0 &lt;br /&gt;
| &amp;amp;amp;gt=, &amp;amp;gt;&amp;amp;nbsp;=, =&amp;amp;gt; (greater or equal)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;f1 &lt;br /&gt;
| &amp;amp;lt; (less than)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;f2 &lt;br /&gt;
| &amp;amp;lt;&amp;amp;amp;gt, &amp;amp;lt;&amp;amp;nbsp;&amp;amp;gt; (not equal)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;f3 &lt;br /&gt;
| =&amp;amp;lt;, &amp;amp;lt;=, &amp;amp;lt;&amp;amp;nbsp;= (less than or equal)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;f4 &lt;br /&gt;
| + (addition)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;f5 &lt;br /&gt;
| - (subtraction or unary minus)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;f6 &lt;br /&gt;
| * (multiplication)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;f7 &lt;br /&gt;
| / (division)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;f8 &lt;br /&gt;
| ^ (x to the power of y)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;f9 &lt;br /&gt;
| \ (integer division)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;fa &lt;br /&gt;
| AND&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;fb &lt;br /&gt;
| MOD&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;fc &lt;br /&gt;
| OR&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;fd &lt;br /&gt;
| XOR&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;fe &lt;br /&gt;
| NOT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;ff &lt;br /&gt;
| (prefix for additional keywords)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; Notes: &lt;br /&gt;
&lt;br /&gt;
*The &amp;amp;amp;ff code is used as a prefix for more keywords. See the table below for the list of keywords using this prefix. &lt;br /&gt;
*&amp;amp;amp;e2,&amp;amp;amp;e8 and &amp;amp;amp;e9 are not used &lt;br /&gt;
*&amp;amp;amp;7c (&amp;quot;|&amp;quot;) is a character prefix used to identify a RSX command. e.g. &amp;quot;|DIR&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
An RSX is encoded in a BASIC program using the following structure: &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset &lt;br /&gt;
! Count &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 &lt;br /&gt;
| 1 &lt;br /&gt;
| &amp;quot;&amp;amp;#124;&amp;quot; character prefix&lt;br /&gt;
|-&lt;br /&gt;
| 1 &lt;br /&gt;
| 1 &lt;br /&gt;
| 8-bit byte offset to tokens following RSX name.&lt;br /&gt;
|-&lt;br /&gt;
| 2 &lt;br /&gt;
| x &lt;br /&gt;
| RSX name. (Last character of name has bit 7 set to &amp;quot;1&amp;quot;, all other characters have bit 7 set to &amp;quot;0&amp;quot;)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
*This token identifies a integer (16-bit) number. The two bytes following this token is the number, stored low byte then high byte. e.g. &amp;amp;amp;19,&amp;amp;amp;2d,&amp;amp;amp;00 represents the integer number &amp;quot;&amp;amp;amp;002d&amp;quot;=&amp;quot;45&amp;quot;. &lt;br /&gt;
*This token (&amp;amp;amp;0B) is changed at run-time to &amp;amp;amp;0D &lt;br /&gt;
*This token identifies a integer variable. 02,00,00,var name offset to number in program setup when program RUN. The variable name is stored directly, with bit 7 of the last character set. &lt;br /&gt;
*This token identifies a string variable. offset to string in program string stored AS IS with quotes around it. &lt;br /&gt;
*This token identifies a floating point number. Immediatly following the token are 5 bytes which define the number.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset &lt;br /&gt;
! Count &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 &lt;br /&gt;
| 1 &lt;br /&gt;
| &amp;amp;amp;1f (note 1)&lt;br /&gt;
|-&lt;br /&gt;
| 1 &lt;br /&gt;
| 5 &lt;br /&gt;
| Floating point number (note 2)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
*#This byte is the BASIC token identifying a floating point number &lt;br /&gt;
*#These 5 bytes define the floating point number. &lt;br /&gt;
*The space symbol is used as a command seperator &lt;br /&gt;
*Variable definitions: &lt;br /&gt;
**The variable definition has the following structure:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset &lt;br /&gt;
! Count &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 &lt;br /&gt;
| 1 &lt;br /&gt;
| Token defining variable type&lt;br /&gt;
|-&lt;br /&gt;
| 2 &lt;br /&gt;
| 2 &lt;br /&gt;
| 16-bit Byte offset to variable value within tokenised BASIC program.&lt;br /&gt;
|-&lt;br /&gt;
| 4 &lt;br /&gt;
| x &lt;br /&gt;
| Variable name&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; The 16-bit byte offset is initially set to 0, but is setup when the program is RUN. The offset is stored in little-endian format, with low byte followed by high byte. &lt;br /&gt;
&lt;br /&gt;
**The token byte defines the variable type (i.e. string, floating point, integer) and the suffix (&amp;quot;$&amp;quot;, none and &amp;quot;%&amp;quot;). &lt;br /&gt;
**The variable name is stored in the program, with bit 7 of the last character set to &amp;quot;1&amp;quot;. e.g. The variable named &amp;quot;abc&amp;quot; will be encoded as 'a','b','c'+&amp;amp;amp;80 &lt;br /&gt;
*String values: &lt;br /&gt;
**Each string value is prefixed with &amp;amp;amp;22 token. &lt;br /&gt;
**All strings must be enclosed by double quote symbols (&amp;amp;amp;quot). This symbols define the start and end of the string value. &lt;br /&gt;
**The string value can contain any symbol except the quote (&amp;quot;). i.e. 0-&amp;amp;amp;21, and &amp;amp;amp;23-&amp;amp;amp;ff can be used. &lt;br /&gt;
&lt;br /&gt;
*After running a program, Tokens of &amp;quot;1d&amp;quot; with 16-bit BASIC program line pointers are changed to token &amp;quot;1e&amp;quot; with the 16-bit memory address of the BASIC line number in memory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; This table list the BASIC tokens with a &amp;amp;amp;ff prefix byte. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Code&amp;lt;br&amp;gt;(hexidecimal) &lt;br /&gt;
! BASIC keyword&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;00 &lt;br /&gt;
| ABS&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;01 &lt;br /&gt;
| ASC&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;02 &lt;br /&gt;
| ATN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;03 &lt;br /&gt;
| CHR$&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;04 &lt;br /&gt;
| CINT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;05 &lt;br /&gt;
| COS&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;06 &lt;br /&gt;
| CREAL&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;07 &lt;br /&gt;
| EXP&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;08 &lt;br /&gt;
| FIX&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;09 &lt;br /&gt;
| FRE&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;0a &lt;br /&gt;
| INKEY&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;0b &lt;br /&gt;
| INP&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;0c &lt;br /&gt;
| INT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;0d &lt;br /&gt;
| JOY&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;0e &lt;br /&gt;
| LEN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;0f &lt;br /&gt;
| LOG&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;10 &lt;br /&gt;
| LOG10&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;11 &lt;br /&gt;
| LOWER$&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;12 &lt;br /&gt;
| PEEK&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;13 &lt;br /&gt;
| REMAIN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;14 &lt;br /&gt;
| SGN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;15 &lt;br /&gt;
| SIN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;16 &lt;br /&gt;
| SPACE$&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;17 &lt;br /&gt;
| SQ&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;18 &lt;br /&gt;
| SQR&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;19 &lt;br /&gt;
| STR$&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;1a &lt;br /&gt;
| TAN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;1b &lt;br /&gt;
| UNT&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;1c &lt;br /&gt;
| UPPER$&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;1d &lt;br /&gt;
| VAL&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;nbsp; &lt;br /&gt;
| (note 2)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;40 &lt;br /&gt;
| EOF&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;41 &lt;br /&gt;
| ERR&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;42 &lt;br /&gt;
| HIMEM&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;43 &lt;br /&gt;
| INKEY$&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;44 &lt;br /&gt;
| PI&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;45 &lt;br /&gt;
| RND&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;46 &lt;br /&gt;
| TIME&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;47 &lt;br /&gt;
| XPOS&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;48 &lt;br /&gt;
| YPOS&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;49 &lt;br /&gt;
| DERR (v1.1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;nbsp; &lt;br /&gt;
| (note 3)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;71 &lt;br /&gt;
| BIN$&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;72 &lt;br /&gt;
| DEC$ (v1.1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;73 &lt;br /&gt;
| HEX$&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;74 &lt;br /&gt;
| INSTR&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;75 &lt;br /&gt;
| LEFT$&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;76 &lt;br /&gt;
| MAX&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;77 &lt;br /&gt;
| MIN&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;78 &lt;br /&gt;
| POS&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;79 &lt;br /&gt;
| RIGHT$&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;7a &lt;br /&gt;
| ROUND&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;7b &lt;br /&gt;
| STRING$&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;7c &lt;br /&gt;
| TEST&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;7d &lt;br /&gt;
| TESTR&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;7e &lt;br /&gt;
| COPYCHR$ (v1.1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;amp;7f &lt;br /&gt;
| VPOS&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;nbsp; &lt;br /&gt;
| (note 4)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; NOTES: &lt;br /&gt;
&lt;br /&gt;
*These codes are prefixed by &amp;amp;amp;FF. e.g. The keyword &amp;quot;ABS&amp;quot; is stored as the following sequence: &amp;lt;pre&amp;gt;&amp;amp;amp;FF,&amp;amp;amp;00&amp;lt;/pre&amp;gt; &lt;br /&gt;
*Codes &amp;amp;amp;1e...&amp;amp;amp;3f inclusive are not used &lt;br /&gt;
*Codes &amp;amp;amp;4a...&amp;amp;amp;6f inclusive are not used &lt;br /&gt;
*Codes &amp;amp;amp;80...&amp;amp;amp;ff inclusive are not used&lt;br /&gt;
&lt;br /&gt;
*When a BASIC program is in memory, the BASIC ROM can replace &amp;quot;16-bit BASIC program line number&amp;quot; tokens with &amp;quot;16-bit BASIC program line memory address pointer&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When a program is loaded or saved, there will only be &amp;quot;16-bit BASIC program line number&amp;quot; tokens followed by a 16-bit number of the line.&lt;br /&gt;
&lt;br /&gt;
When a program is running, BASIC will replace the &amp;quot;16-bit BASIC program line number&amp;quot; with the &amp;quot;16-bit BASIC program line memory address pointer&amp;quot; token, and replace the 16-bit line number with the memory address of the start of that line. &lt;br /&gt;
&lt;br /&gt;
It does this to avoid having to lookup the address of the line each time.&lt;br /&gt;
&lt;br /&gt;
* When a REM or ' is seen, the characters following it are output directly (i.e. the bytes are not tokenized) until the end of line or a ':' is seen.&lt;br /&gt;
&lt;br /&gt;
* When a BASIC program is listed each line is converted to a string (this includes the line number and the tokens converted to their strings). There is a maximum length for this string of 256 characters. This means that if the BASIC line is LISTed or EDITed, then the line will be displayed incorrectly with missing characters on the end. This is also noticed if you have a &amp;quot;10-liner&amp;quot; program that packs as much BASIC as possible into each line and renumber it so the line number has more digits.&lt;br /&gt;
&lt;br /&gt;
== Floating Point data definition  ==&lt;br /&gt;
&lt;br /&gt;
A floating point number represents a number with both an integer and fractional part. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; In Amstrad BASIC, a floating point number is stored in base-2 in a normalized form: 1 x 2&amp;lt;sup&amp;gt;&amp;amp;lt;exponent&amp;amp;gt;&amp;lt;/sup&amp;gt; The representation uses 5 bytes and is stored using the following structure: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Byte &lt;br /&gt;
! colspan=&amp;quot;8&amp;quot; | 0 &lt;br /&gt;
! colspan=&amp;quot;8&amp;quot; | 1 &lt;br /&gt;
! colspan=&amp;quot;8&amp;quot; | 2 &lt;br /&gt;
! colspan=&amp;quot;8&amp;quot; | 3 &lt;br /&gt;
! colspan=&amp;quot;8&amp;quot; | 4&lt;br /&gt;
|-&lt;br /&gt;
! Bit &lt;br /&gt;
! 7 &lt;br /&gt;
! 6 &lt;br /&gt;
! 5 &lt;br /&gt;
! 4 &lt;br /&gt;
! 3 &lt;br /&gt;
! 2 &lt;br /&gt;
! 1 &lt;br /&gt;
! 0 &lt;br /&gt;
! 7 &lt;br /&gt;
! 6 &lt;br /&gt;
! 5 &lt;br /&gt;
! 4 &lt;br /&gt;
! 3 &lt;br /&gt;
! 2 &lt;br /&gt;
! 1 &lt;br /&gt;
! 0 &lt;br /&gt;
! 7 &lt;br /&gt;
! 6 &lt;br /&gt;
! 5 &lt;br /&gt;
! 4 &lt;br /&gt;
! 3 &lt;br /&gt;
! 2 &lt;br /&gt;
! 1 &lt;br /&gt;
! 0 &lt;br /&gt;
! 7 &lt;br /&gt;
! 6 &lt;br /&gt;
! 5 &lt;br /&gt;
! 4 &lt;br /&gt;
! 3 &lt;br /&gt;
! 2 &lt;br /&gt;
! 1 &lt;br /&gt;
! 0 &lt;br /&gt;
! 7 &lt;br /&gt;
! 6 &lt;br /&gt;
! 5 &lt;br /&gt;
! 4 &lt;br /&gt;
! 3 &lt;br /&gt;
! 2 &lt;br /&gt;
! 1 &lt;br /&gt;
! 0&lt;br /&gt;
|-&lt;br /&gt;
| Function &lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | (LSB) mantissa (bits 31-24) &lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | mantissa (bits 23-16) &lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | mantissa (bits 15-8) &lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; | sign &lt;br /&gt;
| colspan=&amp;quot;7&amp;quot; | (MSB) mantissa (bits 7-0) &lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | exponent&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sign  ===&lt;br /&gt;
&lt;br /&gt;
The sign is represented by bit 7 of byte 3. The value of the sign bit indicates the sign of the floating point number. &lt;br /&gt;
&lt;br /&gt;
#*If the sign bit is &amp;quot;1&amp;quot;, then the number is negative. &lt;br /&gt;
#*If the sign bit is &amp;quot;0&amp;quot;, then the number is positive.&lt;br /&gt;
&lt;br /&gt;
=== Mantissa  ===&lt;br /&gt;
&lt;br /&gt;
The mantissa holds the normalized number. The exponent is manipulated so that the most significant bit is always 1. Since it is always 1, it is not stored. It's value is implied by the representation. &lt;br /&gt;
&lt;br /&gt;
=== Exponent  ===&lt;br /&gt;
&lt;br /&gt;
The exponent is 8-bit and is stored in byte 4. It is stored with a bias of 128. &lt;br /&gt;
&lt;br /&gt;
#*128-255 are positive exponents, &lt;br /&gt;
#*0-127 are negative exponents.&lt;br /&gt;
&lt;br /&gt;
To obtain the signed exponent, you must subtract 128 from the stored exponent. The minimum exponent is 0 and this describes a number of 2^-127. The maximum exponent is 255 and this describes a number of 2^128.&lt;br /&gt;
&lt;br /&gt;
=== BASIC Display of Floating point numbers ===&lt;br /&gt;
&lt;br /&gt;
* Numbers are displayed to 9 decimal places.&lt;br /&gt;
* If the number doesn't have a fractional part (e.g. .0) then the fractional part is not displayed.&lt;br /&gt;
* Trailing zeros (zero digits after the last digit in the fraction) are not displayed&lt;br /&gt;
* The value is rounded in the following way for display:&lt;br /&gt;
&lt;br /&gt;
If the 10th fractional digit is 5 or above, then the number is rounded up.&lt;br /&gt;
If the 10th fractional digit is 4 or below, then the number is rounded down.&lt;br /&gt;
e.g.  &lt;br /&gt;
 0.1234567891 is displayed as 0.123456789&lt;br /&gt;
 0.1234567895 is displayed as 0.12345679&lt;br /&gt;
&lt;br /&gt;
=== floating point example in RAM by MaV ===&lt;br /&gt;
&lt;br /&gt;
The initial figure = 43.375.&lt;br /&gt;
An example in BASIC:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a!=43.375&lt;br /&gt;
READY&lt;br /&gt;
PRINT a!&lt;br /&gt;
 43.375&lt;br /&gt;
PRINT @a!&lt;br /&gt;
 374&lt;br /&gt;
FOR I=0 TO 4:PRINT HEX$(PEEK(374+I),2);:NEXT I&lt;br /&gt;
0000802D86&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
the result for better readability:&amp;lt;br&amp;gt;&lt;br /&gt;
'''00 00 80 2D 86'''&amp;lt;br&amp;gt;&lt;br /&gt;
The first byte contains the least significant bits of the mantissa, and every following byte up to the fourth byte contain the bits following the first in significance and in exactly that order!&lt;br /&gt;
&lt;br /&gt;
That means that you have to turn around the first four bytes if you want to read the mantissa correctly:&lt;br /&gt;
2D800000&lt;br /&gt;
or&lt;br /&gt;
0010.1101.1000.0000.0000.0000.0000.0000&lt;br /&gt;
in binary (the stops are inserted for better readability).&lt;br /&gt;
&lt;br /&gt;
Now the highest significant bit here is 0, so the number is positive.&lt;br /&gt;
What's more, you need to clear that bit and substitute the implied highest bit (see description in the link), which is always 1 (regardless of the deleted sign bit!!!).&lt;br /&gt;
Thus you get:&lt;br /&gt;
AD800000&lt;br /&gt;
or&lt;br /&gt;
1010.1101.1000.0000.0000.0000.0000.0000&lt;br /&gt;
in binary.&lt;br /&gt;
&lt;br /&gt;
The mantissa has an implied decimal point before the number. Since the number is 2^32 bits (i.e. 4 bytes) long you have to divide by 2^32 to get the proper decimal representation.&lt;br /&gt;
&lt;br /&gt;
AD800000 (hex) = 2910846976 (dec)&lt;br /&gt;
&lt;br /&gt;
2910846976 / 2^32 = 0.677734375&lt;br /&gt;
&lt;br /&gt;
The mantissa in a decimal representation is: 0.677734375&lt;br /&gt;
&lt;br /&gt;
Now, the last byte contains the exponent: 86 (hex) or 134 (dec). You need to subtract 128 to get the real exponent, the highest bit tells you that the exponent is positive (1) or negative (0). Your exponent is 6.&lt;br /&gt;
&lt;br /&gt;
0.677734375 * 2^6 = 43.375&lt;br /&gt;
&lt;br /&gt;
'''Another example:'''&amp;lt;br&amp;gt;&lt;br /&gt;
PI is represented in memory as:&amp;lt;br&amp;gt;&lt;br /&gt;
'''A2 DA 0F 49 82'''&amp;lt;br&amp;gt;&lt;br /&gt;
The mantissa is&amp;lt;br&amp;gt;&lt;br /&gt;
490FDAA2 (highest significant bit is zero =&amp;gt; number is positive)&lt;br /&gt;
The exponent is&amp;lt;br&amp;gt;&lt;br /&gt;
82 (=positive mantissa, value=2 thus multiply mantissa with 2^2)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Delete the sign bit (which is 0 anyway), and then add the implied 1 bit:&amp;lt;br&amp;gt;&lt;br /&gt;
C90FDAA2 (hex) = 3373259426 (dec) = 1100.1001.0000.1111.1101.1010.1010.0010 (bin)&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Calculate the decimal representation of the mantissa:&amp;lt;br&amp;gt;&lt;br /&gt;
3373259426 / 2^32 = 0,7853981633670628070831298828125&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then add the exponent (82h - 80h = 2 thus 2^2)&amp;lt;br&amp;gt;&lt;br /&gt;
0,7853981633670628070831298828125 * 2^2 = 3,14159265346825122833251953125&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Voilà! The internal representation of the number PI on the CPC is: 3,14159265346825122833251953125&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you compare to a (more) correct representation of PI, you'll see that the CPC is correct up to the 9th decimal place:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CPC:&amp;lt;br&amp;gt;&lt;br /&gt;
3.14159265346825122833251953125&amp;lt;br&amp;gt;&lt;br /&gt;
more correctly:&amp;lt;br&amp;gt;&lt;br /&gt;
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986...&lt;br /&gt;
&lt;br /&gt;
== BASIC floating-point/real variables  ==&lt;br /&gt;
&lt;br /&gt;
A floating point (real) variable describes a number with integer and fractional parts. The biggest figure which can be stored correctly in RAM by a variable is 2^32-1 = 4294967295.&lt;br /&gt;
&lt;br /&gt;
#*A integer variable is defined with a &amp;quot;!&amp;quot; character postfix.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;a! = 3.141592654&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
#*A real number uses 5 bytes of memory as storage. The format is described above. &lt;br /&gt;
#*The address of a real variable can be found in BASIC by: &amp;lt;pre&amp;gt;PRINT @a!&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &amp;quot;a&amp;quot; should be replaced with the name of the variable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== BASIC integer variables  ==&lt;br /&gt;
&lt;br /&gt;
A integer variable describes a whole number. i.e. a number without any fractional part. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; NOTES: &lt;br /&gt;
&lt;br /&gt;
#*A integer variable is defined with a &amp;quot;%&amp;quot; character postfix.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;a% = 3&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
#*A integer variable has a range of -32768 to 32767 &lt;br /&gt;
#*A integer variable always uses two bytes of memory as storage with the following format:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset &lt;br /&gt;
! Length &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 &lt;br /&gt;
| 2 &lt;br /&gt;
| Integer number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
#*The address of the integer variable can be found in BASIC by: &amp;lt;pre&amp;gt;PRINT @a%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;quot;a&amp;quot; should be replaced with the name of the variable. &lt;br /&gt;
&lt;br /&gt;
== BASIC string variables  ==&lt;br /&gt;
&lt;br /&gt;
A string is a variable which contains a group of characters. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; NOTES: &lt;br /&gt;
&lt;br /&gt;
#**A string variable is defined in BASIC with a &amp;quot;$&amp;quot; character postfix.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;a$ = &amp;quot;hello&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
#**A string variable is described internally by a &amp;quot;string descriptor block&amp;quot; which has the following structure:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset &lt;br /&gt;
! Length &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 &lt;br /&gt;
| 1 &lt;br /&gt;
| Length of string in bytes/characters&lt;br /&gt;
|-&lt;br /&gt;
| 1 &lt;br /&gt;
| 2 &lt;br /&gt;
| Location of start of string&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
#**The address of the &amp;quot;string descriptor block&amp;quot; for the string variable can be found in BASIC by typing: &amp;lt;pre&amp;gt;PRINT @a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replacing &amp;quot;a$&amp;quot; with the name of the string variable. &lt;br /&gt;
&lt;br /&gt;
#**A string uses a minimum of 3 bytes of storage (a 0 character length string) and a maximum of 258 bytes of storage. 3 bytes are used by the &amp;quot;string descriptor block&amp;quot;) &lt;br /&gt;
#**A string variable can contain any ASCII character code in the range 0-255. &lt;br /&gt;
#**A string variable can store a minimum of 0 characters and a maximum of 255 characters. &lt;br /&gt;
#**The length of the string in characters is defined in the string descriptor block. The string does not have a termination character.&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=103100</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=103100"/>
				<updated>2019-03-20T10:21:23Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
: '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PEEK (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the contents of the Z80 memory location specified in the &amp;lt;address expression&amp;gt; which should be in the range &amp;amp;0000 to &amp;amp;FFFF (0 to 65535). In all cases PEEK will return the value at the RAM address specified (not the ROM), and will be in the range &amp;amp;00 to &amp;amp;FF (0 to 255)&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POKE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: ZONE 7&lt;br /&gt;
20 WINDOW 1,40,1,2:WINDOW #1,1,40,3,25&lt;br /&gt;
30 PRINT &amp;quot;memory-address&amp;quot;&lt;br /&gt;
40 LOCATE 20,1:PRINT &amp;quot;memory-contents&amp;quot;&lt;br /&gt;
50 FOR n=1 to 65535&lt;br /&gt;
60 p=PEEK(n)&lt;br /&gt;
70 PRINT #1,n,&amp;quot;(&amp;amp;&amp;quot;;HEX$(n);&amp;quot;)&amp;quot;;&lt;br /&gt;
80 PRINT #1,TAB(20);p,&amp;quot;(&amp;amp;&amp;quot;;HEX$(p);&amp;quot;)&amp;quot;&lt;br /&gt;
90 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PI&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The value of the ratio between the circumference and the diameter of a circle.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': DEG, RAD&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT PI&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal POSition of the text cursor relative to the left edge of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
: POS(#8) reports the current horizontal carriage position for the printer, where 1 is the extreme left hand edge.&lt;br /&gt;
: POS(#9) reports the logical position in the disc file stream, i.e. the number of printing characters sent to the stream since the last carriage return.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': VPOS, WINDOW&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor left/right keys&amp;quot;&lt;br /&gt;
30 WINDOW 1,40,12,12:CURSOR 1,1&lt;br /&gt;
40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT&lt;br /&gt;
50 IF INKEY(1)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(9);&lt;br /&gt;
60 IF INKEY(8)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(8);&lt;br /&gt;
70 LOCATE #1,2,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;horizontal position = &amp;quot;;&lt;br /&gt;
100 PRINT #1,POS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;REMAIN (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns count REMAINing count from the delay timer specified in &amp;lt;integer expression&amp;gt; (= timer number in the range 0 to 3), and disable it. If the delay timer was not enabled zero will be returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': AFTER, DI, EI, EVERY&lt;br /&gt;
&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: an '''example''' in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
: further '''example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 AFTER 500,1 GOSUB 40&lt;br /&gt;
20 AFTER 100,2 GOSUB 50&lt;br /&gt;
30 PRINT &amp;quot;program running&amp;quot;:GOTO 30&lt;br /&gt;
40 REM this GOUSB-Routine will not be called as it is disabled in line 80&lt;br /&gt;
50 PRINT:PRINT &amp;quot;Timer 1 will now be &amp;quot;;&lt;br /&gt;
60 PRINT &amp;quot;disabled by REMAIN.&amp;quot;&lt;br /&gt;
70 PRINT &amp;quot;Time-units remaining were:&amp;quot;;&lt;br /&gt;
80 PRINT REMAIN(1)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RIGHT$ (&amp;lt;string expression&amp;gt;, &amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt; (=required length) parameter, after extracting them from the RIGHT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;integer expression&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LEFT$, MID$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:a$=&amp;quot;AMSTRAD computer&amp;quot;&lt;br /&gt;
20 FOR n=1 TO 16:LOCATE 41-n,n&lt;br /&gt;
30 PRINT RIGHT$(a$,n)&lt;br /&gt;
40 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RND [(&amp;lt;numeric expression&amp;gt;)]&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the next RaNDom number in sequence if the &amp;lt;numeric expression&amp;gt; has a positive value or is not specified. &lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a value of zero, RND returns a copy of the last random number generated.&lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a negative value, a new random number sequence is started, the first number of which is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': RANDOMIZE&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
: Example for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''': &lt;br /&gt;
: For generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''4. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 RANDOMIZE&lt;br /&gt;
20 FOR x=1 TO -1 STEP -1&lt;br /&gt;
30 PRINT &amp;quot;rnd parameter=&amp;quot;;x&lt;br /&gt;
40 FOR n=1 TO 6&lt;br /&gt;
50 PRINT RND(x)&lt;br /&gt;
60 NEXT n,x&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ROUND (&amp;lt;numeric expression&amp;gt;[,&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Rounds &amp;lt;numeric expression&amp;gt; to a number of decimal places or to the power of ten specified by &amp;lt;integer expression&amp;gt;. If &amp;lt;integer expression&amp;gt; less than zero, the &amp;lt;numeric expression&amp;gt; is rounded to give an absolute integer with &amp;lt;integer expression&amp;gt; number of zeros before the decimal point.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS, CINT, FIX, INT&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2),ROUND(1562.375,-2)&lt;br /&gt;
 1562.36     1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=4 TO -4 STEP -1&lt;br /&gt;
20 PRINT ROUND (1234.5678,n)&lt;br /&gt;
30 PRINT &amp;quot;with integer expression&amp;quot;;n&lt;br /&gt;
40 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SGN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: FUNCTION: Determines the SiGN of the &amp;lt;numeric expression&amp;gt;. Returns -1 if &amp;lt;numeric expression&amp;gt; is less than 0, returns 0 if &amp;lt;numeric expression&amp;gt; = 0, and returns 1 if &amp;lt;numeric expression&amp;gt; is greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=255 to -200 STEP -20&lt;br /&gt;
20 PRINT &amp;quot;SGN returns&amp;quot;;&lt;br /&gt;
30 PRINT SGN(n);&amp;quot;for a value of&amp;quot;;n&lt;br /&gt;
40 NEXT n&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SIN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Real value for the Sine of &amp;lt;numeric expression&amp;gt;, defaulting to the Radian (RAD) measure mode unless otherwise declared by a DEG command.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS:DEG:ORIGIN 0,20&lt;br /&gt;
20 FOR n=0 to 720&lt;br /&gt;
30 y=SIN(n)&lt;br /&gt;
40 PLOT n*640/720,198*y:NEXT&lt;br /&gt;
50 GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SPACE$(&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Creates a string of spaces of the given length, (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': SPC, STRING$, TAB&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1&lt;br /&gt;
20 PRINT &amp;quot;Put 9 spaces between me&amp;quot;;&lt;br /&gt;
30 PRINT SPACE$(9);&lt;br /&gt;
40 PRINT &amp;quot;and you!&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQ (&amp;lt;channel&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the state of the Sound Queue for the specified &amp;lt;channel&amp;gt; which must be an integer expression, yielding one the values:&lt;br /&gt;
: 1: for channel A&lt;br /&gt;
: 2: for channel B&lt;br /&gt;
: 4: for channel C&lt;br /&gt;
: The SQ function returns a bit significant integer, comprising the following bit settings:&lt;br /&gt;
: Bit 0,1 and 2: the number of free entries in the queue&lt;br /&gt;
: Bit 3,4 and 5: the rendezvous state at the head of this queue&lt;br /&gt;
: Bit 6        : the head of the queue is held&lt;br /&gt;
: Bit 7        : the channel is currently active&lt;br /&gt;
: ... where Bit 0 is the least significant bit, and Bit 7 is the most significant bit.&lt;br /&gt;
: It can be seen, that if Bit 6 is set, Bit 7 cannot be set at the same time, and vice versa. Similarly if Bits 3, 4, or 5 are set, Bit 6 and 7 cannot be set.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ON SQ GOSUB, SOUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,100,100&lt;br /&gt;
20 PRINT SQ(1)&lt;br /&gt;
run&lt;br /&gt;
 67&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQR (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the SQuare Root of the specified &amp;lt;numeric expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT SQR(9)&lt;br /&gt;
 3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;STR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts the &amp;lt;numeric expression&amp;gt; to a decimal STRing representation.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': BIN$, DEC$, HEX$, VAL&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''NOTE''': (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=&amp;amp;FF:REM 255 hex&lt;br /&gt;
20 b=&amp;amp;x1111:REM 15 binary&lt;br /&gt;
30 c$=&amp;quot;***&amp;quot;&lt;br /&gt;
40 PRINT c$+SR$(a+b)+c$&lt;br /&gt;
run&lt;br /&gt;
*** 270***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;STRING$ (&amp;lt;length&amp;gt;,&amp;lt;character specifier&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a string expression consisting of the &amp;lt;character specifier&amp;gt; repeated the number of time (in the range 0 to 255) specified in the &amp;lt;length&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': SPACE$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(40,&amp;quot;*&amp;quot;)&lt;br /&gt;
****************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING(40,42)&lt;br /&gt;
****************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''NOTE''': the &amp;lt;character specifier&amp;gt; 42 refers to the ASCII value of the character '*' and is also equivalent to PRINT STRING$(40,CHR$(42))&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TAN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the TANgent of the &amp;lt;numeric expression&amp;gt;, which must be in the range -200,000 to +200,000.&lt;br /&gt;
: '''NOTE''': DEG and RAD can be used to force the result of the calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''': &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT TAN(45)&lt;br /&gt;
 1.61977519&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TEST (&amp;lt;x co-ordinate&amp;gt;,&amp;lt;y co-ordinate&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Moves the graphics cursor to the absolute position specified by the &amp;lt;x&amp;gt; and &amp;lt;y co-ordinate&amp;gt;s, and reports the value of the ink at the new location.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, TESTR, XPOS, YPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Your are using pen number&amp;quot;;&lt;br /&gt;
30 PRINT TEST(10,386)&lt;br /&gt;
40 PRINT &amp;quot;Try changing PENs and MODEs&amp;quot;;&lt;br /&gt;
50 PRINT &amp;quot;....then RUN again.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TESTR (&amp;lt;x offset&amp;gt;,&amp;lt;y offset&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Moves the graphics cursor by the amount specified in the &amp;lt;x&amp;gt; and &amp;lt;y offset&amp;gt;s relative to its current position, and reports the value of the ink at the new location.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, TEST, XPOS, YPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 0:FOR x=1 TO 15:LOCATE 1,x&lt;br /&gt;
20 PEN x:PRINT STRING$(10,143);:NEXT&lt;br /&gt;
30 MOVE 200,400:PEN 1&lt;br /&gt;
40 FOR n=1 TO 23:LOCATE 12,n&lt;br /&gt;
50 PRINT &amp;quot;pen&amp;quot;;TESTR(0,-16):NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TIME&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the elapsed time since the computer was last switched-on or reset, (excluding periods when reading or writing to disc).&lt;br /&gt;
: Each second of real time is equal to the returned value = TIME/300.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': AFTER, EVERY, WEND, WHILE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS:REM clock&lt;br /&gt;
20 INPUT &amp;quot;hour&amp;quot;;hour&lt;br /&gt;
30 INPUT &amp;quot;minute&amp;quot;;minute&lt;br /&gt;
40 INPUT &amp;quot;second&amp;quot;;second&lt;br /&gt;
50 CLS:datum=INT(TIME/300)&lt;br /&gt;
60 WHILE hour&amp;lt;13&lt;br /&gt;
70 WHILE minute&amp;lt;60&lt;br /&gt;
80 WHILE tick&amp;lt;60&lt;br /&gt;
90 tick=(INT(TIME/300)-datum)+second&lt;br /&gt;
100 LOCATE 1,1&lt;br /&gt;
110 PRINT USING &amp;quot;## &amp;quot;;hour,minute,tick&lt;br /&gt;
120 WEND&lt;br /&gt;
130 tick=0:second=0:minute=minute+1&lt;br /&gt;
140 GOTO 50&lt;br /&gt;
150 WEND&lt;br /&gt;
160 minute=0:hour=hour+1&lt;br /&gt;
170 WEND&lt;br /&gt;
180 hour=1&lt;br /&gt;
190 GOTO 60&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;UNT (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Return an integer in the range -32768 to +32767 which is the twos-complement equivalent of the unsigned value of the &amp;lt;address expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, FIX, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66)&lt;br /&gt;
-154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;UPPER$(&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; but in which all alphabetic characters in the range A to Z are converted to upper case. The function is useful for processing input which may come in mixed upper / lower case.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOWER$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS: a$=&amp;quot;my, how you've grown!&amp;quot;&lt;br /&gt;
20 PRINT UPPER$(a$)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;VAL(&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the numeric VALue, (including any negative sign and decimal point) of the first character(s) in the specified &amp;lt;string expression&amp;gt;. &lt;br /&gt;
:If the first character is not a number, then 0 is returned. If the first character is a negative sign or decimal point followed by non-numeric characters, a 'Type mismatch' error (13) will be reported.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': STR$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;)&lt;br /&gt;
 -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Exception''': if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT VAL(&amp;quot;&amp;amp;amp;A&amp;quot;)&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
PRINT VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) &lt;br /&gt;
 32767&lt;br /&gt;
&lt;br /&gt;
PRINT VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) &lt;br /&gt;
-32768&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS: PRINT &amp;quot;I know my times tables!&amp;quot;&lt;br /&gt;
20 PRINT:PRINT &amp;quot;Press a key (1 to 9)&amp;quot;&lt;br /&gt;
30 a$=INKEY$:IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
40 n=VAL(a$):if n&amp;lt;1 or n&amp;gt;9 then 30&lt;br /&gt;
50 FOR x=1 to 12&lt;br /&gt;
60 PRINT n;&amp;quot;X&amp;quot;;x;&amp;quot;=&amp;quot;;n*x&lt;br /&gt;
70 NEXT:GOTO 20&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;VPOS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current vertical POSition of the text cursor relative to the top of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POS, WINDOW&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor up/down keys&amp;quot;&lt;br /&gt;
30 WINDOW 39,39,1,25:CURSOR 1,1&lt;br /&gt;
40 LOCATE 1,3&lt;br /&gt;
50 IF INKEY(0)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(11);&lt;br /&gt;
60 IF INKEY(2)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(10);&lt;br /&gt;
70 LOCATE #1,3,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;vertical position =&amp;quot;;&lt;br /&gt;
100 PRINT #1,VPOS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;XPOS&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal (X)POSition of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, ORIGIN, YPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:DRAW 320,200&lt;br /&gt;
20 PRINT &amp;quot;graphics cursor X position = &amp;quot;;&lt;br /&gt;
30 PRINT XPOS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;YPOS&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current vertical (Y)POSition of the graphic cursor.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, ORIGIN, XPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:DRAW 320,200&lt;br /&gt;
20 PRINT &amp;quot;graphics cursor Y position = &amp;quot;;&lt;br /&gt;
30 PRINT YPOS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=103074</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=103074"/>
				<updated>2019-03-15T09:51:56Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
: '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PEEK (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the contents of the Z80 memory location specified in the &amp;lt;address expression&amp;gt; which should be in the range &amp;amp;0000 to &amp;amp;FFFF (0 to 65535). In all cases PEEK will return the value at the RAM address specified (not the ROM), and will be in the range &amp;amp;00 to &amp;amp;FF (0 to 255)&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POKE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: ZONE 7&lt;br /&gt;
20 WINDOW 1,40,1,2:WINDOW #1,1,40,3,25&lt;br /&gt;
30 PRINT &amp;quot;memory-address&amp;quot;&lt;br /&gt;
40 LOCATE 20,1:PRINT &amp;quot;memory-contents&amp;quot;&lt;br /&gt;
50 FOR n=1 to 65535&lt;br /&gt;
60 p=PEEK(n)&lt;br /&gt;
70 PRINT #1,n,&amp;quot;(&amp;amp;&amp;quot;;HEX$(n);&amp;quot;)&amp;quot;;&lt;br /&gt;
80 PRINT #1,TAB(20);p,&amp;quot;(&amp;amp;&amp;quot;;HEX$(p);&amp;quot;)&amp;quot;&lt;br /&gt;
90 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PI&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The value of the ratio between the circumference and the diameter of a circle.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': DEG, RAD&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT PI&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal POSition of the text cursor relative to the left edge of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
: POS(#8) reports the current horizontal carriage position for the printer, where 1 is the extreme left hand edge.&lt;br /&gt;
: POS(#9) reports the logical position in the disc file stream, i.e. the number of printing characters sent to the stream since the last carriage return.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': VPOS, WINDOW&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor left/right keys&amp;quot;&lt;br /&gt;
30 WINDOW 1,40,12,12:CURSOR 1,1&lt;br /&gt;
40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT&lt;br /&gt;
50 IF INKEY(1)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(9);&lt;br /&gt;
60 IF INKEY(8)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(8);&lt;br /&gt;
70 LOCATE #1,2,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;horizontal position = &amp;quot;;&lt;br /&gt;
100 PRINT #1,POS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;REMAIN (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns count REMAINing count from the delay timer specified in &amp;lt;integer expression&amp;gt; (= timer number in the range 0 to 3), and disable it. If the delay timer was not enabled zero will be returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': AFTER, DI, EI, EVERY&lt;br /&gt;
&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: an '''example''' in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
: further '''example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 AFTER 500,1 GOSUB 40&lt;br /&gt;
20 AFTER 100,2 GOSUB 50&lt;br /&gt;
30 PRINT &amp;quot;program running&amp;quot;:GOTO 30&lt;br /&gt;
40 REM this GOUSB-Routine will not be called as it is disabled in line 80&lt;br /&gt;
50 PRINT:PRINT &amp;quot;Timer 1 will now be &amp;quot;;&lt;br /&gt;
60 PRINT &amp;quot;disabled by REMAIN.&amp;quot;&lt;br /&gt;
70 PRINT &amp;quot;Time-units remaining were:&amp;quot;;&lt;br /&gt;
80 PRINT REMAIN(1)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RIGHT$ (&amp;lt;string expression&amp;gt;, &amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt; (=required length) parameter, after extracting them from the RIGHT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;integer expression&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LEFT$, MID$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:a$=&amp;quot;AMSTRAD computer&amp;quot;&lt;br /&gt;
20 FOR n=1 TO 16:LOCATE 41-n,n&lt;br /&gt;
30 PRINT RIGHT$(a$,n)&lt;br /&gt;
40 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RND [(&amp;lt;numeric expression&amp;gt;)]&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the next RaNDom number in sequence if the &amp;lt;numeric expression&amp;gt; has a positive value or is not specified. &lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a value of zero, RND returns a copy of the last random number generated.&lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a negative value, a new random number sequence is started, the first number of which is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': RANDOMIZE&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
: Example for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''': &lt;br /&gt;
: For generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''4. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 RANDOMIZE&lt;br /&gt;
20 FOR x=1 TO -1 STEP -1&lt;br /&gt;
30 PRINT &amp;quot;rnd parameter=&amp;quot;;x&lt;br /&gt;
40 FOR n=1 TO 6&lt;br /&gt;
50 PRINT RND(x)&lt;br /&gt;
60 NEXT n,x&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ROUND (&amp;lt;numeric expression&amp;gt;[,&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Rounds &amp;lt;numeric expression&amp;gt; to a number of decimal places or to the power of ten specified by &amp;lt;integer expression&amp;gt;. If &amp;lt;integer expression&amp;gt; less than zero, the &amp;lt;numeric expression&amp;gt; is rounded to give an absolute integer with &amp;lt;integer expression&amp;gt; number of zeros before the decimal point.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS, CINT, FIX, INT&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2),ROUND(1562.375,-2)&lt;br /&gt;
 1562.36     1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=4 TO -4 STEP -1&lt;br /&gt;
20 PRINT ROUND (1234.5678,n)&lt;br /&gt;
30 PRINT &amp;quot;with integer expression&amp;quot;;n&lt;br /&gt;
40 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SGN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: FUNCTION: Determines the SiGN of the &amp;lt;numeric expression&amp;gt;. Returns -1 if &amp;lt;numeric expression&amp;gt; is less than 0, returns 0 if &amp;lt;numeric expression&amp;gt; = 0, and returns 1 if &amp;lt;numeric expression&amp;gt; is greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=255 to -200 STEP -20&lt;br /&gt;
20 PRINT &amp;quot;SGN returns&amp;quot;;&lt;br /&gt;
30 PRINT SGN(n);&amp;quot;for a value of&amp;quot;;n&lt;br /&gt;
40 NEXT n&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SIN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Real value for the Sine of &amp;lt;numeric expression&amp;gt;, defaulting to the Radian (RAD) measure mode unless otherwise declared by a DEG command.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS:DEG:ORIGIN 0,20&lt;br /&gt;
20 FOR n=0 to 720&lt;br /&gt;
30 y=SIN(n)&lt;br /&gt;
40 PLOT n*640/720,198*y:NEXT&lt;br /&gt;
50 GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SPACE$(&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Creates a string of spaces of the given length, (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': SPC, STRING$, TAB&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1&lt;br /&gt;
20 PRINT &amp;quot;Put 9 spaces between me&amp;quot;;&lt;br /&gt;
30 PRINT SPACE$(9);&lt;br /&gt;
40 PRINT &amp;quot;and you!&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQ (&amp;lt;channel&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the state of the Sound Queue for the specified &amp;lt;channel&amp;gt; which must be an integer expression, yielding one the values:&lt;br /&gt;
: 1: for channel A&lt;br /&gt;
: 2: for channel B&lt;br /&gt;
: 4: for channel C&lt;br /&gt;
: The SQ function returns a bit significant integer, comprising the following bit settings:&lt;br /&gt;
: Bit 0,1 and 2: the number of free entries in the queue&lt;br /&gt;
: Bit 3,4 and 5: the rendezvous state at the head of this queue&lt;br /&gt;
: Bit 6        : the head of the queue is held&lt;br /&gt;
: Bit 7        : the channel is currently active&lt;br /&gt;
: ... where Bit 0 is the least significant bit, and Bit 7 is the most significant bit.&lt;br /&gt;
: It can be seen, that if Bit 6 is set, Bit 7 cannot be set at the same time, and vice versa. Similarly if Bits 3, 4, or 5 are set, Bit 6 and 7 cannot be set.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ON SQ GOSUB, SOUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,100,100&lt;br /&gt;
20 PRINT SQ(1)&lt;br /&gt;
run&lt;br /&gt;
 67&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQR (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the SQuare Root of the specified &amp;lt;numeric expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT SQR(9)&lt;br /&gt;
 3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;STR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts the &amp;lt;numeric expression&amp;gt; to a decimal STRing representation.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': BIN$, DEC$, HEX$, VAL&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''NOTE''': (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=&amp;amp;FF:REM 255 hex&lt;br /&gt;
20 b=&amp;amp;x1111:REM 15 binary&lt;br /&gt;
30 c$=&amp;quot;***&amp;quot;&lt;br /&gt;
40 PRINT c$+SR$(a+b)+c$&lt;br /&gt;
run&lt;br /&gt;
*** 270***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;STRING$ (&amp;lt;length&amp;gt;,&amp;lt;character specifier&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a string expression consisting of the &amp;lt;character specifier&amp;gt; repeated the number of time (in the range 0 to 255) specified in the &amp;lt;length&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': SPACE$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(40,&amp;quot;*&amp;quot;)&lt;br /&gt;
****************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING(40,42)&lt;br /&gt;
****************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''NOTE''': the &amp;lt;character specifier&amp;gt; 42 refers to the ASCII value of the character '*' and is also equivalent to PRINT STRING$(40,CHR$(42))&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TAN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the TANgent of the &amp;lt;numeric expression&amp;gt;, which must be in the range -200,000 to +200,000.&lt;br /&gt;
: '''NOTE''': DEG and RAD can be used to force the result of the calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''': &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT TAN(45)&lt;br /&gt;
 1.61977519&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TEST (&amp;lt;x co-ordinate&amp;gt;,&amp;lt;y co-ordinate&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Moves the graphics cursor to the absolute position specified by the &amp;lt;x&amp;gt; and &amp;lt;y co-ordinate&amp;gt;s, and reports the value of the ink at the new location.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, TESTR, XPOS, YPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Your are using pen number&amp;quot;;&lt;br /&gt;
30 PRINT TEST(10,386)&lt;br /&gt;
40 PRINT &amp;quot;Try changing PENs and MODEs&amp;quot;;&lt;br /&gt;
50 PRINT &amp;quot;....then RUN again.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TESTR (&amp;lt;x offset&amp;gt;,&amp;lt;y offset&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Moves the graphics cursor by the amount specified in the &amp;lt;x&amp;gt; and &amp;lt;y offset&amp;gt;s relative to its current position, and reports the value of the ink at the new location.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, TEST, XPOS, YPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 0:FOR x=1 TO 15:LOCATE 1,x&lt;br /&gt;
20 PEN x:PRINT STRING$(10,143);:NEXT&lt;br /&gt;
30 MOVE 200,400:PEN 1&lt;br /&gt;
40 FOR n=1 TO 23:LOCATE 12,n&lt;br /&gt;
50 PRINT &amp;quot;pen&amp;quot;;TESTR(0,-16):NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TIME&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the elapsed time since the computer was last switched-on or reset, (excluding periods when reading or writing to disc).&lt;br /&gt;
: Each second of real time is equal to the returned value = TIME/300.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': AFTER, EVERY, WEND, WHILE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS:REM clock&lt;br /&gt;
20 INPUT &amp;quot;hour&amp;quot;;hour&lt;br /&gt;
30 INPUT &amp;quot;minute&amp;quot;;minute&lt;br /&gt;
40 INPUT &amp;quot;second&amp;quot;;second&lt;br /&gt;
50 CLS:datum=INT(TIME/300)&lt;br /&gt;
60 WHILE hour&amp;lt;13&lt;br /&gt;
70 WHILE minute&amp;lt;60&lt;br /&gt;
80 WHILE tick&amp;lt;60&lt;br /&gt;
90 tick=(INT(TIME/300)-datum)+second&lt;br /&gt;
100 LOCATE 1,1&lt;br /&gt;
110 PRINT USING &amp;quot;## &amp;quot;;hour,minute,tick&lt;br /&gt;
120 WEND&lt;br /&gt;
130 tick=0:second=0:minute=minute+1&lt;br /&gt;
140 GOTO 50&lt;br /&gt;
150 WEND&lt;br /&gt;
160 minute=0:hour=hour+1&lt;br /&gt;
170 WEND&lt;br /&gt;
180 hour=1&lt;br /&gt;
190 GOTO 60&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;UNT (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Return an integer in the range -32768 to +32767 which is the twos-complement equivalent of the unsigned value of the &amp;lt;address expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, FIX, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66)&lt;br /&gt;
-154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;UPPER$(&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; but in which all alphabetic characters in the range A to Z are converted to upper case. The function is useful for processing input which may come in mixed upper / lower case.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOWER$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS: a$=&amp;quot;my, how you've grown!&amp;quot;&lt;br /&gt;
20 PRINT UPPER$(a$)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=103070</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=103070"/>
				<updated>2019-03-14T11:46:19Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
: '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PEEK (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the contents of the Z80 memory location specified in the &amp;lt;address expression&amp;gt; which should be in the range &amp;amp;0000 to &amp;amp;FFFF (0 to 65535). In all cases PEEK will return the value at the RAM address specified (not the ROM), and will be in the range &amp;amp;00 to &amp;amp;FF (0 to 255)&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POKE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: ZONE 7&lt;br /&gt;
20 WINDOW 1,40,1,2:WINDOW #1,1,40,3,25&lt;br /&gt;
30 PRINT &amp;quot;memory-address&amp;quot;&lt;br /&gt;
40 LOCATE 20,1:PRINT &amp;quot;memory-contents&amp;quot;&lt;br /&gt;
50 FOR n=1 to 65535&lt;br /&gt;
60 p=PEEK(n)&lt;br /&gt;
70 PRINT #1,n,&amp;quot;(&amp;amp;&amp;quot;;HEX$(n);&amp;quot;)&amp;quot;;&lt;br /&gt;
80 PRINT #1,TAB(20);p,&amp;quot;(&amp;amp;&amp;quot;;HEX$(p);&amp;quot;)&amp;quot;&lt;br /&gt;
90 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PI&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The value of the ratio between the circumference and the diameter of a circle.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': DEG, RAD&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT PI&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal POSition of the text cursor relative to the left edge of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
: POS(#8) reports the current horizontal carriage position for the printer, where 1 is the extreme left hand edge.&lt;br /&gt;
: POS(#9) reports the logical position in the disc file stream, i.e. the number of printing characters sent to the stream since the last carriage return.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': VPOS, WINDOW&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor left/right keys&amp;quot;&lt;br /&gt;
30 WINDOW 1,40,12,12:CURSOR 1,1&lt;br /&gt;
40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT&lt;br /&gt;
50 IF INKEY(1)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(9);&lt;br /&gt;
60 IF INKEY(8)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(8);&lt;br /&gt;
70 LOCATE #1,2,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;horizontal position = &amp;quot;;&lt;br /&gt;
100 PRINT #1,POS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;REMAIN (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns count REMAINing count from the delay timer specified in &amp;lt;integer expression&amp;gt; (= timer number in the range 0 to 3), and disable it. If the delay timer was not enabled zero will be returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': AFTER, DI, EI, EVERY&lt;br /&gt;
&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: an '''example''' in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
: further '''example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 AFTER 500,1 GOSUB 40&lt;br /&gt;
20 AFTER 100,2 GOSUB 50&lt;br /&gt;
30 PRINT &amp;quot;program running&amp;quot;:GOTO 30&lt;br /&gt;
40 REM this GOUSB-Routine will not be called as it is disabled in line 80&lt;br /&gt;
50 PRINT:PRINT &amp;quot;Timer 1 will now be &amp;quot;;&lt;br /&gt;
60 PRINT &amp;quot;disabled by REMAIN.&amp;quot;&lt;br /&gt;
70 PRINT &amp;quot;Time-units remaining were:&amp;quot;;&lt;br /&gt;
80 PRINT REMAIN(1)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RIGHT$ (&amp;lt;string expression&amp;gt;, &amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt; (=required length) parameter, after extracting them from the RIGHT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;integer expression&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LEFT$, MID$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:a$=&amp;quot;AMSTRAD computer&amp;quot;&lt;br /&gt;
20 FOR n=1 TO 16:LOCATE 41-n,n&lt;br /&gt;
30 PRINT RIGHT$(a$,n)&lt;br /&gt;
40 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RND [(&amp;lt;numeric expression&amp;gt;)]&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the next RaNDom number in sequence if the &amp;lt;numeric expression&amp;gt; has a positive value or is not specified. &lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a value of zero, RND returns a copy of the last random number generated.&lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a negative value, a new random number sequence is started, the first number of which is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': RANDOMIZE&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
: Example for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''': &lt;br /&gt;
: For generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''4. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 RANDOMIZE&lt;br /&gt;
20 FOR x=1 TO -1 STEP -1&lt;br /&gt;
30 PRINT &amp;quot;rnd parameter=&amp;quot;;x&lt;br /&gt;
40 FOR n=1 TO 6&lt;br /&gt;
50 PRINT RND(x)&lt;br /&gt;
60 NEXT n,x&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ROUND (&amp;lt;numeric expression&amp;gt;[,&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Rounds &amp;lt;numeric expression&amp;gt; to a number of decimal places or to the power of ten specified by &amp;lt;integer expression&amp;gt;. If &amp;lt;integer expression&amp;gt; less than zero, the &amp;lt;numeric expression&amp;gt; is rounded to give an absolute integer with &amp;lt;integer expression&amp;gt; number of zeros before the decimal point.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS, CINT, FIX, INT&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2),ROUND(1562.375,-2)&lt;br /&gt;
 1562.36     1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=4 TO -4 STEP -1&lt;br /&gt;
20 PRINT ROUND (1234.5678,n)&lt;br /&gt;
30 PRINT &amp;quot;with integer expression&amp;quot;;n&lt;br /&gt;
40 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SGN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: FUNCTION: Determines the SiGN of the &amp;lt;numeric expression&amp;gt;. Returns -1 if &amp;lt;numeric expression&amp;gt; is less than 0, returns 0 if &amp;lt;numeric expression&amp;gt; = 0, and returns 1 if &amp;lt;numeric expression&amp;gt; is greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=255 to -200 STEP -20&lt;br /&gt;
20 PRINT &amp;quot;SGN returns&amp;quot;;&lt;br /&gt;
30 PRINT SGN(n);&amp;quot;for a value of&amp;quot;;n&lt;br /&gt;
40 NEXT n&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SIN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Real value for the Sine of &amp;lt;numeric expression&amp;gt;, defaulting to the Radian (RAD) measure mode unless otherwise declared by a DEG command.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS:DEG:ORIGIN 0,20&lt;br /&gt;
20 FOR n=0 to 720&lt;br /&gt;
30 y=SIN(n)&lt;br /&gt;
40 PLOT n*640/720,198*y:NEXT&lt;br /&gt;
50 GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SPACE$(&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Creates a string of spaces of the given length, (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': SPC, STRING$, TAB&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1&lt;br /&gt;
20 PRINT &amp;quot;Put 9 spaces between me&amp;quot;;&lt;br /&gt;
30 PRINT SPACE$(9);&lt;br /&gt;
40 PRINT &amp;quot;and you!&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQ (&amp;lt;channel&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the state of the Sound Queue for the specified &amp;lt;channel&amp;gt; which must be an integer expression, yielding one the values:&lt;br /&gt;
: 1: for channel A&lt;br /&gt;
: 2: for channel B&lt;br /&gt;
: 4: for channel C&lt;br /&gt;
: The SQ function returns a bit significant integer, comprising the following bit settings:&lt;br /&gt;
: Bit 0,1 and 2: the number of free entries in the queue&lt;br /&gt;
: Bit 3,4 and 5: the rendezvous state at the head of this queue&lt;br /&gt;
: Bit 6        : the head of the queue is held&lt;br /&gt;
: Bit 7        : the channel is currently active&lt;br /&gt;
: ... where Bit 0 is the least significant bit, and Bit 7 is the most significant bit.&lt;br /&gt;
: It can be seen, that if Bit 6 is set, Bit 7 cannot be set at the same time, and vice versa. Similarly if Bits 3, 4, or 5 are set, Bit 6 and 7 cannot be set.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ON SQ GOSUB, SOUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,100,100&lt;br /&gt;
20 PRINT SQ(1)&lt;br /&gt;
run&lt;br /&gt;
 67&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQR (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the SQuare Root of the specified &amp;lt;numeric expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT SQR(9)&lt;br /&gt;
 3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;STR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts the &amp;lt;numeric expression&amp;gt; to a decimal STRing representation.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': BIN$, DEC$, HEX$, VAL&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''NOTE''': (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=&amp;amp;FF:REM 255 hex&lt;br /&gt;
20 b=&amp;amp;x1111:REM 15 binary&lt;br /&gt;
30 c$=&amp;quot;***&amp;quot;&lt;br /&gt;
40 PRINT c$+SR$(a+b)+c$&lt;br /&gt;
run&lt;br /&gt;
*** 270***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;STRING$ (&amp;lt;length&amp;gt;,&amp;lt;character specifier&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a string expression consisting of the &amp;lt;character specifier&amp;gt; repeated the number of time (in the range 0 to 255) specified in the &amp;lt;length&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': SPACE$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(40,&amp;quot;*&amp;quot;)&lt;br /&gt;
****************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING(40,42)&lt;br /&gt;
****************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''NOTE''': the &amp;lt;character specifier&amp;gt; 42 refers to the ASCII value of the character '*' and is also equivalent to PRINT STRING$(40,CHR$(42))&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TAN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the TANgent of the &amp;lt;numeric expression&amp;gt;, which must be in the range -200,000 to +200,000.&lt;br /&gt;
: '''NOTE''': DEG and RAD can be used to force the result of the calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''': &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT TAN(45)&lt;br /&gt;
 1.61977519&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TEST (&amp;lt;x co-ordinate&amp;gt;,&amp;lt;y co-ordinate&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Moves the graphics cursor to the absolute position specified by the &amp;lt;x&amp;gt; and &amp;lt;y co-ordinate&amp;gt;s, and reports the value of the ink at the new location.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, TESTR, XPOS, YPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Your are using pen number&amp;quot;;&lt;br /&gt;
30 PRINT TEST(10,386)&lt;br /&gt;
40 PRINT &amp;quot;Try changing PENs and MODEs&amp;quot;;&lt;br /&gt;
50 PRINT &amp;quot;....then RUN again.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TESTR (&amp;lt;x offset&amp;gt;,&amp;lt;y offset&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Moves the graphics cursor by the amount specified in the &amp;lt;x&amp;gt; and &amp;lt;y offset&amp;gt;s relative to its current position, and reports the value of the ink at the new location.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, TEST, XPOS, YPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 0:FOR x=1 TO 15:LOCATE 1,x&lt;br /&gt;
20 PEN x:PRINT STRING$(10,143);:NEXT&lt;br /&gt;
30 MOVE 200,400:PEN 1&lt;br /&gt;
40 FOR n=1 TO 23:LOCATE 12,n&lt;br /&gt;
50 PRINT &amp;quot;pen&amp;quot;;TESTR(0,-16):NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TIME&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the elapsed time since the computer was last switched-on or reset, (excluding periods when reading or writing to disc).&lt;br /&gt;
: Each second of real time is equal to the returned value = TIME/300.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': AFTER, EVERY, WEND, WHILE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS:REM clock&lt;br /&gt;
20 INPUT &amp;quot;hour&amp;quot;;hour&lt;br /&gt;
30 INPUT &amp;quot;minute&amp;quot;;minute&lt;br /&gt;
40 INPUT &amp;quot;second&amp;quot;;second&lt;br /&gt;
50 CLS:datum=INT(TIME/300)&lt;br /&gt;
60 WHILE hour&amp;lt;13&lt;br /&gt;
70 WHILE minute&amp;lt;60&lt;br /&gt;
80 WHILE tick&amp;lt;60&lt;br /&gt;
90 tick=(INT(TIME/300)-datum)+second&lt;br /&gt;
100 LOCATE 1,1&lt;br /&gt;
110 PRINT USING &amp;quot;## &amp;quot;;hour,minute,tick&lt;br /&gt;
120 WEND&lt;br /&gt;
130 tick=0:second=0:minute=minute+1&lt;br /&gt;
140 GOTO 50&lt;br /&gt;
150 WEND&lt;br /&gt;
160 minute=0:hour=hour+1&lt;br /&gt;
170 WEND&lt;br /&gt;
180 hour=1&lt;br /&gt;
190 GOTO 60&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=103069</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=103069"/>
				<updated>2019-03-12T13:14:42Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* STRING$ (,) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
: '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PEEK (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the contents of the Z80 memory location specified in the &amp;lt;address expression&amp;gt; which should be in the range &amp;amp;0000 to &amp;amp;FFFF (0 to 65535). In all cases PEEK will return the value at the RAM address specified (not the ROM), and will be in the range &amp;amp;00 to &amp;amp;FF (0 to 255)&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POKE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: ZONE 7&lt;br /&gt;
20 WINDOW 1,40,1,2:WINDOW #1,1,40,3,25&lt;br /&gt;
30 PRINT &amp;quot;memory-address&amp;quot;&lt;br /&gt;
40 LOCATE 20,1:PRINT &amp;quot;memory-contents&amp;quot;&lt;br /&gt;
50 FOR n=1 to 65535&lt;br /&gt;
60 p=PEEK(n)&lt;br /&gt;
70 PRINT #1,n,&amp;quot;(&amp;amp;&amp;quot;;HEX$(n);&amp;quot;)&amp;quot;;&lt;br /&gt;
80 PRINT #1,TAB(20);p,&amp;quot;(&amp;amp;&amp;quot;;HEX$(p);&amp;quot;)&amp;quot;&lt;br /&gt;
90 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PI&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The value of the ratio between the circumference and the diameter of a circle.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': DEG, RAD&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT PI&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal POSition of the text cursor relative to the left edge of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
: POS(#8) reports the current horizontal carriage position for the printer, where 1 is the extreme left hand edge.&lt;br /&gt;
: POS(#9) reports the logical position in the disc file stream, i.e. the number of printing characters sent to the stream since the last carriage return.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': VPOS, WINDOW&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor left/right keys&amp;quot;&lt;br /&gt;
30 WINDOW 1,40,12,12:CURSOR 1,1&lt;br /&gt;
40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT&lt;br /&gt;
50 IF INKEY(1)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(9);&lt;br /&gt;
60 IF INKEY(8)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(8);&lt;br /&gt;
70 LOCATE #1,2,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;horizontal position = &amp;quot;;&lt;br /&gt;
100 PRINT #1,POS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;REMAIN (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns count REMAINing count from the delay timer specified in &amp;lt;integer expression&amp;gt; (= timer number in the range 0 to 3), and disable it. If the delay timer was not enabled zero will be returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': AFTER, DI, EI, EVERY&lt;br /&gt;
&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: an '''example''' in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
: further '''example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 AFTER 500,1 GOSUB 40&lt;br /&gt;
20 AFTER 100,2 GOSUB 50&lt;br /&gt;
30 PRINT &amp;quot;program running&amp;quot;:GOTO 30&lt;br /&gt;
40 REM this GOUSB-Routine will not be called as it is disabled in line 80&lt;br /&gt;
50 PRINT:PRINT &amp;quot;Timer 1 will now be &amp;quot;;&lt;br /&gt;
60 PRINT &amp;quot;disabled by REMAIN.&amp;quot;&lt;br /&gt;
70 PRINT &amp;quot;Time-units remaining were:&amp;quot;;&lt;br /&gt;
80 PRINT REMAIN(1)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RIGHT$ (&amp;lt;string expression&amp;gt;, &amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt; (=required length) parameter, after extracting them from the RIGHT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;integer expression&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LEFT$, MID$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:a$=&amp;quot;AMSTRAD computer&amp;quot;&lt;br /&gt;
20 FOR n=1 TO 16:LOCATE 41-n,n&lt;br /&gt;
30 PRINT RIGHT$(a$,n)&lt;br /&gt;
40 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RND [(&amp;lt;numeric expression&amp;gt;)]&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the next RaNDom number in sequence if the &amp;lt;numeric expression&amp;gt; has a positive value or is not specified. &lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a value of zero, RND returns a copy of the last random number generated.&lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a negative value, a new random number sequence is started, the first number of which is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': RANDOMIZE&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
: Example for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''': &lt;br /&gt;
: For generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''4. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 RANDOMIZE&lt;br /&gt;
20 FOR x=1 TO -1 STEP -1&lt;br /&gt;
30 PRINT &amp;quot;rnd parameter=&amp;quot;;x&lt;br /&gt;
40 FOR n=1 TO 6&lt;br /&gt;
50 PRINT RND(x)&lt;br /&gt;
60 NEXT n,x&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ROUND (&amp;lt;numeric expression&amp;gt;[,&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Rounds &amp;lt;numeric expression&amp;gt; to a number of decimal places or to the power of ten specified by &amp;lt;integer expression&amp;gt;. If &amp;lt;integer expression&amp;gt; less than zero, the &amp;lt;numeric expression&amp;gt; is rounded to give an absolute integer with &amp;lt;integer expression&amp;gt; number of zeros before the decimal point.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS, CINT, FIX, INT&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2),ROUND(1562.375,-2)&lt;br /&gt;
 1562.36     1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=4 TO -4 STEP -1&lt;br /&gt;
20 PRINT ROUND (1234.5678,n)&lt;br /&gt;
30 PRINT &amp;quot;with integer expression&amp;quot;;n&lt;br /&gt;
40 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SGN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: FUNCTION: Determines the SiGN of the &amp;lt;numeric expression&amp;gt;. Returns -1 if &amp;lt;numeric expression&amp;gt; is less than 0, returns 0 if &amp;lt;numeric expression&amp;gt; = 0, and returns 1 if &amp;lt;numeric expression&amp;gt; is greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=255 to -200 STEP -20&lt;br /&gt;
20 PRINT &amp;quot;SGN returns&amp;quot;;&lt;br /&gt;
30 PRINT SGN(n);&amp;quot;for a value of&amp;quot;;n&lt;br /&gt;
40 NEXT n&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SIN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Real value for the Sine of &amp;lt;numeric expression&amp;gt;, defaulting to the Radian (RAD) measure mode unless otherwise declared by a DEG command.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS:DEG:ORIGIN 0,20&lt;br /&gt;
20 FOR n=0 to 720&lt;br /&gt;
30 y=SIN(n)&lt;br /&gt;
40 PLOT n*640/720,198*y:NEXT&lt;br /&gt;
50 GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SPACE$(&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Creates a string of spaces of the given length, (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': SPC, STRING$, TAB&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1&lt;br /&gt;
20 PRINT &amp;quot;Put 9 spaces between me&amp;quot;;&lt;br /&gt;
30 PRINT SPACE$(9);&lt;br /&gt;
40 PRINT &amp;quot;and you!&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQ (&amp;lt;channel&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the state of the Sound Queue for the specified &amp;lt;channel&amp;gt; which must be an integer expression, yielding one the values:&lt;br /&gt;
: 1: for channel A&lt;br /&gt;
: 2: for channel B&lt;br /&gt;
: 4: for channel C&lt;br /&gt;
: The SQ function returns a bit significant integer, comprising the following bit settings:&lt;br /&gt;
: Bit 0,1 and 2: the number of free entries in the queue&lt;br /&gt;
: Bit 3,4 and 5: the rendezvous state at the head of this queue&lt;br /&gt;
: Bit 6        : the head of the queue is held&lt;br /&gt;
: Bit 7        : the channel is currently active&lt;br /&gt;
: ... where Bit 0 is the least significant bit, and Bit 7 is the most significant bit.&lt;br /&gt;
: It can be seen, that if Bit 6 is set, Bit 7 cannot be set at the same time, and vice versa. Similarly if Bits 3, 4, or 5 are set, Bit 6 and 7 cannot be set.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ON SQ GOSUB, SOUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,100,100&lt;br /&gt;
20 PRINT SQ(1)&lt;br /&gt;
run&lt;br /&gt;
 67&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQR (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the SQuare Root of the specified &amp;lt;numeric expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT SQR(9)&lt;br /&gt;
 3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;STR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts the &amp;lt;numeric expression&amp;gt; to a decimal STRing representation.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': BIN$, DEC$, HEX$, VAL&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''NOTE''': (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=&amp;amp;FF:REM 255 hex&lt;br /&gt;
20 b=&amp;amp;x1111:REM 15 binary&lt;br /&gt;
30 c$=&amp;quot;***&amp;quot;&lt;br /&gt;
40 PRINT c$+SR$(a+b)+c$&lt;br /&gt;
run&lt;br /&gt;
*** 270***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;STRING$ (&amp;lt;length&amp;gt;,&amp;lt;character specifier&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a string expression consisting of the &amp;lt;character specifier&amp;gt; repeated the number of time (in the range 0 to 255) specified in the &amp;lt;length&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': SPACE$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(40,&amp;quot;*&amp;quot;)&lt;br /&gt;
****************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING(40,42)&lt;br /&gt;
****************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''NOTE''': the &amp;lt;character specifier&amp;gt; 42 refers to the ASCII value of the character '*' and is also equivalent to PRINT STRING$(40,CHR$(42))&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TAN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the TANgent of the &amp;lt;numeric expression&amp;gt;, which must be in the range -200,000 to +200,000.&lt;br /&gt;
: '''NOTE''': DEG and RAD can be used to force the result of the calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''': &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT TAN(45)&lt;br /&gt;
 1.61977519&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TEST (&amp;lt;x co-ordinate&amp;gt;,&amp;lt;y co-ordinate&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Moves the graphics cursor to the absolute position specified by the &amp;lt;x&amp;gt; and &amp;lt;y co-ordinate&amp;gt;s, and reports the value of the ink at the new location.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, TESTR, XPOS, YPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Your are using pen number&amp;quot;;&lt;br /&gt;
30 PRINT TEST(10,386)&lt;br /&gt;
40 PRINT &amp;quot;Try changing PENs and MODEs&amp;quot;;&lt;br /&gt;
50 PRINT &amp;quot;....then RUN again.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=103068</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=103068"/>
				<updated>2019-03-12T13:12:58Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
: '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PEEK (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the contents of the Z80 memory location specified in the &amp;lt;address expression&amp;gt; which should be in the range &amp;amp;0000 to &amp;amp;FFFF (0 to 65535). In all cases PEEK will return the value at the RAM address specified (not the ROM), and will be in the range &amp;amp;00 to &amp;amp;FF (0 to 255)&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POKE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: ZONE 7&lt;br /&gt;
20 WINDOW 1,40,1,2:WINDOW #1,1,40,3,25&lt;br /&gt;
30 PRINT &amp;quot;memory-address&amp;quot;&lt;br /&gt;
40 LOCATE 20,1:PRINT &amp;quot;memory-contents&amp;quot;&lt;br /&gt;
50 FOR n=1 to 65535&lt;br /&gt;
60 p=PEEK(n)&lt;br /&gt;
70 PRINT #1,n,&amp;quot;(&amp;amp;&amp;quot;;HEX$(n);&amp;quot;)&amp;quot;;&lt;br /&gt;
80 PRINT #1,TAB(20);p,&amp;quot;(&amp;amp;&amp;quot;;HEX$(p);&amp;quot;)&amp;quot;&lt;br /&gt;
90 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PI&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The value of the ratio between the circumference and the diameter of a circle.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': DEG, RAD&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT PI&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal POSition of the text cursor relative to the left edge of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
: POS(#8) reports the current horizontal carriage position for the printer, where 1 is the extreme left hand edge.&lt;br /&gt;
: POS(#9) reports the logical position in the disc file stream, i.e. the number of printing characters sent to the stream since the last carriage return.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': VPOS, WINDOW&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor left/right keys&amp;quot;&lt;br /&gt;
30 WINDOW 1,40,12,12:CURSOR 1,1&lt;br /&gt;
40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT&lt;br /&gt;
50 IF INKEY(1)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(9);&lt;br /&gt;
60 IF INKEY(8)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(8);&lt;br /&gt;
70 LOCATE #1,2,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;horizontal position = &amp;quot;;&lt;br /&gt;
100 PRINT #1,POS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;REMAIN (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns count REMAINing count from the delay timer specified in &amp;lt;integer expression&amp;gt; (= timer number in the range 0 to 3), and disable it. If the delay timer was not enabled zero will be returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': AFTER, DI, EI, EVERY&lt;br /&gt;
&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: an '''example''' in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
: further '''example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 AFTER 500,1 GOSUB 40&lt;br /&gt;
20 AFTER 100,2 GOSUB 50&lt;br /&gt;
30 PRINT &amp;quot;program running&amp;quot;:GOTO 30&lt;br /&gt;
40 REM this GOUSB-Routine will not be called as it is disabled in line 80&lt;br /&gt;
50 PRINT:PRINT &amp;quot;Timer 1 will now be &amp;quot;;&lt;br /&gt;
60 PRINT &amp;quot;disabled by REMAIN.&amp;quot;&lt;br /&gt;
70 PRINT &amp;quot;Time-units remaining were:&amp;quot;;&lt;br /&gt;
80 PRINT REMAIN(1)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RIGHT$ (&amp;lt;string expression&amp;gt;, &amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt; (=required length) parameter, after extracting them from the RIGHT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;integer expression&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LEFT$, MID$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:a$=&amp;quot;AMSTRAD computer&amp;quot;&lt;br /&gt;
20 FOR n=1 TO 16:LOCATE 41-n,n&lt;br /&gt;
30 PRINT RIGHT$(a$,n)&lt;br /&gt;
40 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RND [(&amp;lt;numeric expression&amp;gt;)]&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the next RaNDom number in sequence if the &amp;lt;numeric expression&amp;gt; has a positive value or is not specified. &lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a value of zero, RND returns a copy of the last random number generated.&lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a negative value, a new random number sequence is started, the first number of which is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': RANDOMIZE&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
: Example for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''': &lt;br /&gt;
: For generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''4. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 RANDOMIZE&lt;br /&gt;
20 FOR x=1 TO -1 STEP -1&lt;br /&gt;
30 PRINT &amp;quot;rnd parameter=&amp;quot;;x&lt;br /&gt;
40 FOR n=1 TO 6&lt;br /&gt;
50 PRINT RND(x)&lt;br /&gt;
60 NEXT n,x&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ROUND (&amp;lt;numeric expression&amp;gt;[,&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Rounds &amp;lt;numeric expression&amp;gt; to a number of decimal places or to the power of ten specified by &amp;lt;integer expression&amp;gt;. If &amp;lt;integer expression&amp;gt; less than zero, the &amp;lt;numeric expression&amp;gt; is rounded to give an absolute integer with &amp;lt;integer expression&amp;gt; number of zeros before the decimal point.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS, CINT, FIX, INT&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2),ROUND(1562.375,-2)&lt;br /&gt;
 1562.36     1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=4 TO -4 STEP -1&lt;br /&gt;
20 PRINT ROUND (1234.5678,n)&lt;br /&gt;
30 PRINT &amp;quot;with integer expression&amp;quot;;n&lt;br /&gt;
40 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SGN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: FUNCTION: Determines the SiGN of the &amp;lt;numeric expression&amp;gt;. Returns -1 if &amp;lt;numeric expression&amp;gt; is less than 0, returns 0 if &amp;lt;numeric expression&amp;gt; = 0, and returns 1 if &amp;lt;numeric expression&amp;gt; is greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=255 to -200 STEP -20&lt;br /&gt;
20 PRINT &amp;quot;SGN returns&amp;quot;;&lt;br /&gt;
30 PRINT SGN(n);&amp;quot;for a value of&amp;quot;;n&lt;br /&gt;
40 NEXT n&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SIN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Real value for the Sine of &amp;lt;numeric expression&amp;gt;, defaulting to the Radian (RAD) measure mode unless otherwise declared by a DEG command.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS:DEG:ORIGIN 0,20&lt;br /&gt;
20 FOR n=0 to 720&lt;br /&gt;
30 y=SIN(n)&lt;br /&gt;
40 PLOT n*640/720,198*y:NEXT&lt;br /&gt;
50 GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SPACE$(&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Creates a string of spaces of the given length, (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': SPC, STRING$, TAB&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1&lt;br /&gt;
20 PRINT &amp;quot;Put 9 spaces between me&amp;quot;;&lt;br /&gt;
30 PRINT SPACE$(9);&lt;br /&gt;
40 PRINT &amp;quot;and you!&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQ (&amp;lt;channel&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the state of the Sound Queue for the specified &amp;lt;channel&amp;gt; which must be an integer expression, yielding one the values:&lt;br /&gt;
: 1: for channel A&lt;br /&gt;
: 2: for channel B&lt;br /&gt;
: 4: for channel C&lt;br /&gt;
: The SQ function returns a bit significant integer, comprising the following bit settings:&lt;br /&gt;
: Bit 0,1 and 2: the number of free entries in the queue&lt;br /&gt;
: Bit 3,4 and 5: the rendezvous state at the head of this queue&lt;br /&gt;
: Bit 6        : the head of the queue is held&lt;br /&gt;
: Bit 7        : the channel is currently active&lt;br /&gt;
: ... where Bit 0 is the least significant bit, and Bit 7 is the most significant bit.&lt;br /&gt;
: It can be seen, that if Bit 6 is set, Bit 7 cannot be set at the same time, and vice versa. Similarly if Bits 3, 4, or 5 are set, Bit 6 and 7 cannot be set.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ON SQ GOSUB, SOUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,100,100&lt;br /&gt;
20 PRINT SQ(1)&lt;br /&gt;
run&lt;br /&gt;
 67&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQR (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the SQuare Root of the specified &amp;lt;numeric expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT SQR(9)&lt;br /&gt;
 3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;STR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts the &amp;lt;numeric expression&amp;gt; to a decimal STRing representation.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': BIN$, DEC$, HEX$, VAL&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''NOTE''': (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=&amp;amp;FF:REM 255 hex&lt;br /&gt;
20 b=&amp;amp;x1111:REM 15 binary&lt;br /&gt;
30 c$=&amp;quot;***&amp;quot;&lt;br /&gt;
40 PRINT c$+SR$(a+b)+c$&lt;br /&gt;
run&lt;br /&gt;
*** 270***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;STRING$ (&amp;lt;length&amp;gt;,&amp;lt;character specifier&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a string expression consisting of the &amp;lt;character specifier&amp;gt; repeated the number of time (in the range 0 to 255) specified in the &amp;lt;length&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': SPACE$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(40,&amp;quot;*&amp;quot;)&lt;br /&gt;
****************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&lt;br /&gt;
PRINT STRING(40,42)&lt;br /&gt;
****************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''NOTE''': the &amp;lt;character specifier&amp;gt; 42 refers to the ASCII value of the character '*' and is also equivalent to PRINT STRING$(40,CHR$(42))&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TAN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the TANgent of the &amp;lt;numeric expression&amp;gt;, which must be in the range -200,000 to +200,000.&lt;br /&gt;
: '''NOTE''': DEG and RAD can be used to force the result of the calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''': &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT TAN(45)&lt;br /&gt;
 1.61977519&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;TEST (&amp;lt;x co-ordinate&amp;gt;,&amp;lt;y co-ordinate&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Moves the graphics cursor to the absolute position specified by the &amp;lt;x&amp;gt; and &amp;lt;y co-ordinate&amp;gt;s, and reports the value of the ink at the new location.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MOVE, MOVER, TESTR, XPOS, YPOS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Your are using pen number&amp;quot;;&lt;br /&gt;
30 PRINT TEST(10,386)&lt;br /&gt;
40 PRINT &amp;quot;Try changing PENs and MODEs&amp;quot;;&lt;br /&gt;
50 PRINT &amp;quot;....then RUN again.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=103012</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=103012"/>
				<updated>2019-02-21T07:16:46Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
: '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PEEK (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the contents of the Z80 memory location specified in the &amp;lt;address expression&amp;gt; which should be in the range &amp;amp;0000 to &amp;amp;FFFF (0 to 65535). In all cases PEEK will return the value at the RAM address specified (not the ROM), and will be in the range &amp;amp;00 to &amp;amp;FF (0 to 255)&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POKE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: ZONE 7&lt;br /&gt;
20 WINDOW 1,40,1,2:WINDOW #1,1,40,3,25&lt;br /&gt;
30 PRINT &amp;quot;memory-address&amp;quot;&lt;br /&gt;
40 LOCATE 20,1:PRINT &amp;quot;memory-contents&amp;quot;&lt;br /&gt;
50 FOR n=1 to 65535&lt;br /&gt;
60 p=PEEK(n)&lt;br /&gt;
70 PRINT #1,n,&amp;quot;(&amp;amp;&amp;quot;;HEX$(n);&amp;quot;)&amp;quot;;&lt;br /&gt;
80 PRINT #1,TAB(20);p,&amp;quot;(&amp;amp;&amp;quot;;HEX$(p);&amp;quot;)&amp;quot;&lt;br /&gt;
90 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PI&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The value of the ratio between the circumference and the diameter of a circle.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': DEG, RAD&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT PI&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal POSition of the text cursor relative to the left edge of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
: POS(#8) reports the current horizontal carriage position for the printer, where 1 is the extreme left hand edge.&lt;br /&gt;
: POS(#9) reports the logical position in the disc file stream, i.e. the number of printing characters sent to the stream since the last carriage return.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': VPOS, WINDOW&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor left/right keys&amp;quot;&lt;br /&gt;
30 WINDOW 1,40,12,12:CURSOR 1,1&lt;br /&gt;
40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT&lt;br /&gt;
50 IF INKEY(1)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(9);&lt;br /&gt;
60 IF INKEY(8)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(8);&lt;br /&gt;
70 LOCATE #1,2,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;horizontal position = &amp;quot;;&lt;br /&gt;
100 PRINT #1,POS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;REMAIN (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns count REMAINing count from the delay timer specified in &amp;lt;integer expression&amp;gt; (= timer number in the range 0 to 3), and disable it. If the delay timer was not enabled zero will be returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': AFTER, DI, EI, EVERY&lt;br /&gt;
&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: an '''example''' in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
: further '''example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 AFTER 500,1 GOSUB 40&lt;br /&gt;
20 AFTER 100,2 GOSUB 50&lt;br /&gt;
30 PRINT &amp;quot;program running&amp;quot;:GOTO 30&lt;br /&gt;
40 REM this GOUSB-Routine will not be called as it is disabled in line 80&lt;br /&gt;
50 PRINT:PRINT &amp;quot;Timer 1 will now be &amp;quot;;&lt;br /&gt;
60 PRINT &amp;quot;disabled by REMAIN.&amp;quot;&lt;br /&gt;
70 PRINT &amp;quot;Time-units remaining were:&amp;quot;;&lt;br /&gt;
80 PRINT REMAIN(1)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RIGHT$ (&amp;lt;string expression&amp;gt;, &amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt; (=required length) parameter, after extracting them from the RIGHT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;integer expression&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LEFT$, MID$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:a$=&amp;quot;AMSTRAD computer&amp;quot;&lt;br /&gt;
20 FOR n=1 TO 16:LOCATE 41-n,n&lt;br /&gt;
30 PRINT RIGHT$(a$,n)&lt;br /&gt;
40 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RND [(&amp;lt;numeric expression&amp;gt;)]&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the next RaNDom number in sequence if the &amp;lt;numeric expression&amp;gt; has a positive value or is not specified. &lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a value of zero, RND returns a copy of the last random number generated.&lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a negative value, a new random number sequence is started, the first number of which is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': RANDOMIZE&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
: Example for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''': &lt;br /&gt;
: For generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''4. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 RANDOMIZE&lt;br /&gt;
20 FOR x=1 TO -1 STEP -1&lt;br /&gt;
30 PRINT &amp;quot;rnd parameter=&amp;quot;;x&lt;br /&gt;
40 FOR n=1 TO 6&lt;br /&gt;
50 PRINT RND(x)&lt;br /&gt;
60 NEXT n,x&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ROUND (&amp;lt;numeric expression&amp;gt;[,&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Rounds &amp;lt;numeric expression&amp;gt; to a number of decimal places or to the power of ten specified by &amp;lt;integer expression&amp;gt;. If &amp;lt;integer expression&amp;gt; less than zero, the &amp;lt;numeric expression&amp;gt; is rounded to give an absolute integer with &amp;lt;integer expression&amp;gt; number of zeros before the decimal point.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS, CINT, FIX, INT&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2),ROUND(1562.375,-2)&lt;br /&gt;
 1562.36     1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=4 TO -4 STEP -1&lt;br /&gt;
20 PRINT ROUND (1234.5678,n)&lt;br /&gt;
30 PRINT &amp;quot;with integer expression&amp;quot;;n&lt;br /&gt;
40 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SGN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: FUNCTION: Determines the SiGN of the &amp;lt;numeric expression&amp;gt;. Returns -1 if &amp;lt;numeric expression&amp;gt; is less than 0, returns 0 if &amp;lt;numeric expression&amp;gt; = 0, and returns 1 if &amp;lt;numeric expression&amp;gt; is greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=255 to -200 STEP -20&lt;br /&gt;
20 PRINT &amp;quot;SGN returns&amp;quot;;&lt;br /&gt;
30 PRINT SGN(n);&amp;quot;for a value of&amp;quot;;n&lt;br /&gt;
40 NEXT n&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SIN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Real value for the Sine of &amp;lt;numeric expression&amp;gt;, defaulting to the Radian (RAD) measure mode unless otherwise declared by a DEG command.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS:DEG:ORIGIN 0,20&lt;br /&gt;
20 FOR n=0 to 720&lt;br /&gt;
30 y=SIN(n)&lt;br /&gt;
40 PLOT n*640/720,198*y:NEXT&lt;br /&gt;
50 GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SPACE$(&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Creates a string of spaces of the given length, (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': SPC, STRING$, TAB&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1&lt;br /&gt;
20 PRINT &amp;quot;Put 9 spaces between me&amp;quot;;&lt;br /&gt;
30 PRINT SPACE$(9);&lt;br /&gt;
40 PRINT &amp;quot;and you!&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQ (&amp;lt;channel&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the state of the Sound Queue for the specified &amp;lt;channel&amp;gt; which must be an integer expression, yielding one the values:&lt;br /&gt;
: 1: for channel A&lt;br /&gt;
: 2: for channel B&lt;br /&gt;
: 4: for channel C&lt;br /&gt;
: The SQ function returns a bit significant integer, comprising the following bit settings:&lt;br /&gt;
: Bit 0,1 and 2: the number of free entries in the queue&lt;br /&gt;
: Bit 3,4 and 5: the rendezvous state at the head of this queue&lt;br /&gt;
: Bit 6        : the head of the queue is held&lt;br /&gt;
: Bit 7        : the channel is currently active&lt;br /&gt;
: ... where Bit 0 is the least significant bit, and Bit 7 is the most significant bit.&lt;br /&gt;
: It can be seen, that if Bit 6 is set, Bit 7 cannot be set at the same time, and vice versa. Similarly if Bits 3, 4, or 5 are set, Bit 6 and 7 cannot be set.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ON SQ GOSUB, SOUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,100,100&lt;br /&gt;
20 PRINT SQ(1)&lt;br /&gt;
run&lt;br /&gt;
 67&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SQR (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the SQuare Root of the specified &amp;lt;numeric expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT SQR(9)&lt;br /&gt;
 3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102945</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102945"/>
				<updated>2019-01-29T11:05:24Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
: '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PEEK (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the contents of the Z80 memory location specified in the &amp;lt;address expression&amp;gt; which should be in the range &amp;amp;0000 to &amp;amp;FFFF (0 to 65535). In all cases PEEK will return the value at the RAM address specified (not the ROM), and will be in the range &amp;amp;00 to &amp;amp;FF (0 to 255)&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POKE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: ZONE 7&lt;br /&gt;
20 WINDOW 1,40,1,2:WINDOW #1,1,40,3,25&lt;br /&gt;
30 PRINT &amp;quot;memory-address&amp;quot;&lt;br /&gt;
40 LOCATE 20,1:PRINT &amp;quot;memory-contents&amp;quot;&lt;br /&gt;
50 FOR n=1 to 65535&lt;br /&gt;
60 p=PEEK(n)&lt;br /&gt;
70 PRINT #1,n,&amp;quot;(&amp;amp;&amp;quot;;HEX$(n);&amp;quot;)&amp;quot;;&lt;br /&gt;
80 PRINT #1,TAB(20);p,&amp;quot;(&amp;amp;&amp;quot;;HEX$(p);&amp;quot;)&amp;quot;&lt;br /&gt;
90 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PI&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The value of the ratio between the circumference and the diameter of a circle.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': DEG, RAD&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT PI&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal POSition of the text cursor relative to the left edge of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
: POS(#8) reports the current horizontal carriage position for the printer, where 1 is the extreme left hand edge.&lt;br /&gt;
: POS(#9) reports the logical position in the disc file stream, i.e. the number of printing characters sent to the stream since the last carriage return.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': VPOS, WINDOW&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor left/right keys&amp;quot;&lt;br /&gt;
30 WINDOW 1,40,12,12:CURSOR 1,1&lt;br /&gt;
40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT&lt;br /&gt;
50 IF INKEY(1)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(9);&lt;br /&gt;
60 IF INKEY(8)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(8);&lt;br /&gt;
70 LOCATE #1,2,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;horizontal position = &amp;quot;;&lt;br /&gt;
100 PRINT #1,POS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;REMAIN (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns count REMAINing count from the delay timer specified in &amp;lt;integer expression&amp;gt; (= timer number in the range 0 to 3), and disable it. If the delay timer was not enabled zero will be returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': AFTER, DI, EI, EVERY&lt;br /&gt;
&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: an '''example''' in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
: further '''example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 AFTER 500,1 GOSUB 40&lt;br /&gt;
20 AFTER 100,2 GOSUB 50&lt;br /&gt;
30 PRINT &amp;quot;program running&amp;quot;:GOTO 30&lt;br /&gt;
40 REM this GOUSB-Routine will not be called as it is disabled in line 80&lt;br /&gt;
50 PRINT:PRINT &amp;quot;Timer 1 will now be &amp;quot;;&lt;br /&gt;
60 PRINT &amp;quot;disabled by REMAIN.&amp;quot;&lt;br /&gt;
70 PRINT &amp;quot;Time-units remaining were:&amp;quot;;&lt;br /&gt;
80 PRINT REMAIN(1)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RIGHT$ (&amp;lt;string expression&amp;gt;, &amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt; (=required length) parameter, after extracting them from the RIGHT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;integer expression&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LEFT$, MID$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:a$=&amp;quot;AMSTRAD computer&amp;quot;&lt;br /&gt;
20 FOR n=1 TO 16:LOCATE 41-n,n&lt;br /&gt;
30 PRINT RIGHT$(a$,n)&lt;br /&gt;
40 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RND [(&amp;lt;numeric expression&amp;gt;)]&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the next RaNDom number in sequence if the &amp;lt;numeric expression&amp;gt; has a positive value or is not specified. &lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a value of zero, RND returns a copy of the last random number generated.&lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a negative value, a new random number sequence is started, the first number of which is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': RANDOMIZE&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: : '''3. Example''' for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''4. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 RANDOMIZE&lt;br /&gt;
20 FOR x=1 TO -1 STEP -1&lt;br /&gt;
30 PRINT &amp;quot;rnd parameter=&amp;quot;;x&lt;br /&gt;
40 FOR n=1 TO 6&lt;br /&gt;
50 PRINT RND(x)&lt;br /&gt;
60 NEXT n,x&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ROUND (&amp;lt;numeric expression&amp;gt;[,&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Rounds &amp;lt;numeric expression&amp;gt; to a number of decimal places or to the power of ten specified by &amp;lt;integer expression&amp;gt;. If &amp;lt;integer expression&amp;gt; less than zero, the &amp;lt;numeric expression&amp;gt; is rounded to give an absolute integer with &amp;lt;integer expression&amp;gt; number of zeros before the decimal point.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS, CINT, FIX, INT&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2),ROUND(1562.375,-2)&lt;br /&gt;
 1562.36     1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=4 TO -4 STEP -1&lt;br /&gt;
20 PRINT ROUND (1234.5678,n)&lt;br /&gt;
30 PRINT &amp;quot;with integer expression&amp;quot;;n&lt;br /&gt;
40 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SGN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: FUNCTION: Determines the SiGN of the &amp;lt;numeric expression&amp;gt;. Returns -1 if &amp;lt;numeric expression&amp;gt; is less than 0, returns 0 if &amp;lt;numeric expression&amp;gt; = 0, and returns 1 if &amp;lt;numeric expression&amp;gt; is greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ABS&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR n=255 to -200 STEP -20&lt;br /&gt;
20 PRINT &amp;quot;SGN returns&amp;quot;;&lt;br /&gt;
30 PRINT SGN(n);&amp;quot;for a value of&amp;quot;;n&lt;br /&gt;
40 NEXT n&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;SIN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Real value for the Sine of &amp;lt;numeric expression&amp;gt;, defaulting to the Radian (RAD) measure mode unless otherwise declared by a DEG command.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, COS, DEG, RAD, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS:DEG:ORIGIN 0,20&lt;br /&gt;
20 FOR n=0 to 720&lt;br /&gt;
30 y=SIN(n)&lt;br /&gt;
40 PLOT n*640/720,198*y:NEXT&lt;br /&gt;
50 GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102919</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102919"/>
				<updated>2019-01-25T08:56:33Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* RND [()] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
: '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PEEK (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the contents of the Z80 memory location specified in the &amp;lt;address expression&amp;gt; which should be in the range &amp;amp;0000 to &amp;amp;FFFF (0 to 65535). In all cases PEEK will return the value at the RAM address specified (not the ROM), and will be in the range &amp;amp;00 to &amp;amp;FF (0 to 255)&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POKE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: ZONE 7&lt;br /&gt;
20 WINDOW 1,40,1,2:WINDOW #1,1,40,3,25&lt;br /&gt;
30 PRINT &amp;quot;memory-address&amp;quot;&lt;br /&gt;
40 LOCATE 20,1:PRINT &amp;quot;memory-contents&amp;quot;&lt;br /&gt;
50 FOR n=1 to 65535&lt;br /&gt;
60 p=PEEK(n)&lt;br /&gt;
70 PRINT #1,n,&amp;quot;(&amp;amp;&amp;quot;;HEX$(n);&amp;quot;)&amp;quot;;&lt;br /&gt;
80 PRINT #1,TAB(20);p,&amp;quot;(&amp;amp;&amp;quot;;HEX$(p);&amp;quot;)&amp;quot;&lt;br /&gt;
90 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PI&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The value of the ratio between the circumference and the diameter of a circle.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': DEG, RAD&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT PI&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal POSition of the text cursor relative to the left edge of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
: POS(#8) reports the current horizontal carriage position for the printer, where 1 is the extreme left hand edge.&lt;br /&gt;
: POS(#9) reports the logical position in the disc file stream, i.e. the number of printing characters sent to the stream since the last carriage return.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': VPOS, WINDOW&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor left/right keys&amp;quot;&lt;br /&gt;
30 WINDOW 1,40,12,12:CURSOR 1,1&lt;br /&gt;
40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT&lt;br /&gt;
50 IF INKEY(1)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(9);&lt;br /&gt;
60 IF INKEY(8)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(8);&lt;br /&gt;
70 LOCATE #1,2,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;horizontal position = &amp;quot;;&lt;br /&gt;
100 PRINT #1,POS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;REMAIN (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns count REMAINing count from the delay timer specified in &amp;lt;integer expression&amp;gt; (= timer number in the range 0 to 3), and disable it. If the delay timer was not enabled zero will be returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': AFTER, DI, EI, EVERY&lt;br /&gt;
&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: an '''example''' in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
: further '''example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 AFTER 500,1 GOSUB 40&lt;br /&gt;
20 AFTER 100,2 GOSUB 50&lt;br /&gt;
30 PRINT &amp;quot;program running&amp;quot;:GOTO 30&lt;br /&gt;
40 REM this GOUSB-Routine will not be called as it is disabled in line 80&lt;br /&gt;
50 PRINT:PRINT &amp;quot;Timer 1 will now be &amp;quot;;&lt;br /&gt;
60 PRINT &amp;quot;disabled by REMAIN.&amp;quot;&lt;br /&gt;
70 PRINT &amp;quot;Time-units remaining were:&amp;quot;;&lt;br /&gt;
80 PRINT REMAIN(1)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RIGHT$ (&amp;lt;string expression&amp;gt;, &amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt; (=required length) parameter, after extracting them from the RIGHT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;integer expression&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LEFT$, MID$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:a$=&amp;quot;AMSTRAD computer&amp;quot;&lt;br /&gt;
20 FOR n=1 TO 16:LOCATE 41-n,n&lt;br /&gt;
30 PRINT RIGHT$(a$,n)&lt;br /&gt;
40 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RND [(&amp;lt;numeric expression&amp;gt;)]&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the next RaNDom number in sequence if the &amp;lt;numeric expression&amp;gt; has a positive value or is not specified. &lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a value of zero, RND returns a copy of the last random number generated.&lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a negative value, a new random number sequence is started, the first number of which is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': RANDOMIZE&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: : '''3. Example''' for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''4. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 RANDOMIZE&lt;br /&gt;
20 FOR x=1 TO -1 STEP -1&lt;br /&gt;
30 PRINT &amp;quot;rnd parameter=&amp;quot;;x&lt;br /&gt;
40 FOR n=1 TO 6&lt;br /&gt;
50 PRINT RND(x)&lt;br /&gt;
60 NEXT n,x&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102918</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102918"/>
				<updated>2019-01-25T08:55:47Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* REMAIN () */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
: '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PEEK (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the contents of the Z80 memory location specified in the &amp;lt;address expression&amp;gt; which should be in the range &amp;amp;0000 to &amp;amp;FFFF (0 to 65535). In all cases PEEK will return the value at the RAM address specified (not the ROM), and will be in the range &amp;amp;00 to &amp;amp;FF (0 to 255)&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POKE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: ZONE 7&lt;br /&gt;
20 WINDOW 1,40,1,2:WINDOW #1,1,40,3,25&lt;br /&gt;
30 PRINT &amp;quot;memory-address&amp;quot;&lt;br /&gt;
40 LOCATE 20,1:PRINT &amp;quot;memory-contents&amp;quot;&lt;br /&gt;
50 FOR n=1 to 65535&lt;br /&gt;
60 p=PEEK(n)&lt;br /&gt;
70 PRINT #1,n,&amp;quot;(&amp;amp;&amp;quot;;HEX$(n);&amp;quot;)&amp;quot;;&lt;br /&gt;
80 PRINT #1,TAB(20);p,&amp;quot;(&amp;amp;&amp;quot;;HEX$(p);&amp;quot;)&amp;quot;&lt;br /&gt;
90 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PI&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The value of the ratio between the circumference and the diameter of a circle.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': DEG, RAD&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT PI&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal POSition of the text cursor relative to the left edge of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
: POS(#8) reports the current horizontal carriage position for the printer, where 1 is the extreme left hand edge.&lt;br /&gt;
: POS(#9) reports the logical position in the disc file stream, i.e. the number of printing characters sent to the stream since the last carriage return.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': VPOS, WINDOW&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor left/right keys&amp;quot;&lt;br /&gt;
30 WINDOW 1,40,12,12:CURSOR 1,1&lt;br /&gt;
40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT&lt;br /&gt;
50 IF INKEY(1)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(9);&lt;br /&gt;
60 IF INKEY(8)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(8);&lt;br /&gt;
70 LOCATE #1,2,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;horizontal position = &amp;quot;;&lt;br /&gt;
100 PRINT #1,POS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;REMAIN (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns count REMAINing count from the delay timer specified in &amp;lt;integer expression&amp;gt; (= timer number in the range 0 to 3), and disable it. If the delay timer was not enabled zero will be returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': AFTER, DI, EI, EVERY&lt;br /&gt;
&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: an '''example''' in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
: further '''example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 AFTER 500,1 GOSUB 40&lt;br /&gt;
20 AFTER 100,2 GOSUB 50&lt;br /&gt;
30 PRINT &amp;quot;program running&amp;quot;:GOTO 30&lt;br /&gt;
40 REM this GOUSB-Routine will not be called as it is disabled in line 80&lt;br /&gt;
50 PRINT:PRINT &amp;quot;Timer 1 will now be &amp;quot;;&lt;br /&gt;
60 PRINT &amp;quot;disabled by REMAIN.&amp;quot;&lt;br /&gt;
70 PRINT &amp;quot;Time-units remaining were:&amp;quot;;&lt;br /&gt;
80 PRINT REMAIN(1)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RIGHT$ (&amp;lt;string expression&amp;gt;, &amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt; (=required length) parameter, after extracting them from the RIGHT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;integer expression&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LEFT$, MID$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:a$=&amp;quot;AMSTRAD computer&amp;quot;&lt;br /&gt;
20 FOR n=1 TO 16:LOCATE 41-n,n&lt;br /&gt;
30 PRINT RIGHT$(a$,n)&lt;br /&gt;
40 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(&amp;lt;numeric expression&amp;gt;)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the next RaNDom number in sequence if the &amp;lt;numeric expression&amp;gt; has a positive value or is not specified. &lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a value of zero, RND returns a copy of the last random number generated.&lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a negative value, a new random number sequence is started, the first number of which is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': RANDOMIZE&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: : '''3. Example''' for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''4. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 RANDOMIZE&lt;br /&gt;
20 FOR x=1 TO -1 STEP -1&lt;br /&gt;
30 PRINT &amp;quot;rnd parameter=&amp;quot;;x&lt;br /&gt;
40 FOR n=1 TO 6&lt;br /&gt;
50 PRINT RND(x)&lt;br /&gt;
60 NEXT n,x&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102917</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102917"/>
				<updated>2019-01-25T08:55:00Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
: '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PEEK (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the contents of the Z80 memory location specified in the &amp;lt;address expression&amp;gt; which should be in the range &amp;amp;0000 to &amp;amp;FFFF (0 to 65535). In all cases PEEK will return the value at the RAM address specified (not the ROM), and will be in the range &amp;amp;00 to &amp;amp;FF (0 to 255)&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POKE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: ZONE 7&lt;br /&gt;
20 WINDOW 1,40,1,2:WINDOW #1,1,40,3,25&lt;br /&gt;
30 PRINT &amp;quot;memory-address&amp;quot;&lt;br /&gt;
40 LOCATE 20,1:PRINT &amp;quot;memory-contents&amp;quot;&lt;br /&gt;
50 FOR n=1 to 65535&lt;br /&gt;
60 p=PEEK(n)&lt;br /&gt;
70 PRINT #1,n,&amp;quot;(&amp;amp;&amp;quot;;HEX$(n);&amp;quot;)&amp;quot;;&lt;br /&gt;
80 PRINT #1,TAB(20);p,&amp;quot;(&amp;amp;&amp;quot;;HEX$(p);&amp;quot;)&amp;quot;&lt;br /&gt;
90 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PI&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The value of the ratio between the circumference and the diameter of a circle.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': DEG, RAD&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT PI&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal POSition of the text cursor relative to the left edge of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
: POS(#8) reports the current horizontal carriage position for the printer, where 1 is the extreme left hand edge.&lt;br /&gt;
: POS(#9) reports the logical position in the disc file stream, i.e. the number of printing characters sent to the stream since the last carriage return.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': VPOS, WINDOW&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor left/right keys&amp;quot;&lt;br /&gt;
30 WINDOW 1,40,12,12:CURSOR 1,1&lt;br /&gt;
40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT&lt;br /&gt;
50 IF INKEY(1)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(9);&lt;br /&gt;
60 IF INKEY(8)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(8);&lt;br /&gt;
70 LOCATE #1,2,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;horizontal position = &amp;quot;;&lt;br /&gt;
100 PRINT #1,POS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;REMAIN (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns count REMAINing count from the delay timer specified in &amp;lt;integer expression&amp;gt; (= timer number in the range 0 to 3), and disable it. If the delay timer was not enabled zero will be returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': AFTER, DI, EI, EVERY&lt;br /&gt;
&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a '''example''' in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
: further '''example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 AFTER 500,1 GOSUB 40&lt;br /&gt;
20 AFTER 100,2 GOSUB 50&lt;br /&gt;
30 PRINT &amp;quot;program running&amp;quot;:GOTO 30&lt;br /&gt;
40 REM this GOUSB-Routine will not be called as it is disabled in line 80&lt;br /&gt;
50 PRINT:PRINT &amp;quot;Timer 1 will now be &amp;quot;;&lt;br /&gt;
60 PRINT &amp;quot;disabled by REMAIN.&amp;quot;&lt;br /&gt;
70 PRINT &amp;quot;Time-units remaining were:&amp;quot;;&lt;br /&gt;
80 PRINT REMAIN(1)&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;RIGHT$ (&amp;lt;string expression&amp;gt;, &amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;integer expression&amp;gt; (=required length) parameter, after extracting them from the RIGHT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;integer expression&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LEFT$, MID$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1:a$=&amp;quot;AMSTRAD computer&amp;quot;&lt;br /&gt;
20 FOR n=1 TO 16:LOCATE 41-n,n&lt;br /&gt;
30 PRINT RIGHT$(a$,n)&lt;br /&gt;
40 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(&amp;lt;numeric expression&amp;gt;)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the next RaNDom number in sequence if the &amp;lt;numeric expression&amp;gt; has a positive value or is not specified. &lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a value of zero, RND returns a copy of the last random number generated.&lt;br /&gt;
: If the &amp;lt;numeric expression&amp;gt; yields a negative value, a new random number sequence is started, the first number of which is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': RANDOMIZE&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: : '''3. Example''' for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''4. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 RANDOMIZE&lt;br /&gt;
20 FOR x=1 TO -1 STEP -1&lt;br /&gt;
30 PRINT &amp;quot;rnd parameter=&amp;quot;;x&lt;br /&gt;
40 FOR n=1 TO 6&lt;br /&gt;
50 PRINT RND(x)&lt;br /&gt;
60 NEXT n,x&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102916</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102916"/>
				<updated>2019-01-24T09:33:19Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
: '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PEEK (&amp;lt;address expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the contents of the Z80 memory location specified in the &amp;lt;address expression&amp;gt; which should be in the range &amp;amp;0000 to &amp;amp;FFFF (0 to 65535). In all cases PEEK will return the value at the RAM address specified (not the ROM), and will be in the range &amp;amp;00 to &amp;amp;FF (0 to 255)&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': POKE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: ZONE 7&lt;br /&gt;
20 WINDOW 1,40,1,2:WINDOW #1,1,40,3,25&lt;br /&gt;
30 PRINT &amp;quot;memory-address&amp;quot;&lt;br /&gt;
40 LOCATE 20,1:PRINT &amp;quot;memory-contents&amp;quot;&lt;br /&gt;
50 FOR n=1 to 65535&lt;br /&gt;
60 p=PEEK(n)&lt;br /&gt;
70 PRINT #1,n,&amp;quot;(&amp;amp;&amp;quot;;HEX$(n);&amp;quot;)&amp;quot;;&lt;br /&gt;
80 PRINT #1,TAB(20);p,&amp;quot;(&amp;amp;&amp;quot;;HEX$(p);&amp;quot;)&amp;quot;&lt;br /&gt;
90 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;PI&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The value of the ratio between the circumference and the diameter of a circle.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': DEG, RAD&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT PI&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POS (#&amp;lt;stream expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Reports the current horizontal POSition of the text cursor relative to the left edge of the text window. The &amp;lt;stream expression&amp;gt; MUST be specified, and does NOT default to #0.&lt;br /&gt;
: POS(#8) reports the current horizontal carriage position for the printer, where 1 is the extreme left hand edge.&lt;br /&gt;
: POS(#9) reports the logical position in the disc file stream, i.e. the number of printing characters sent to the stream since the last carriage return.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': VPOS, WINDOW&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 1: BORDER 0:LOCATE 8,2&lt;br /&gt;
20 PRINT &amp;quot;use cursor left/right keys&amp;quot;&lt;br /&gt;
30 WINDOW 1,40,12,12:CURSOR 1,1&lt;br /&gt;
40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT&lt;br /&gt;
50 IF INKEY(1)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(9);&lt;br /&gt;
60 IF INKEY(8)&amp;lt;&amp;gt;-1 THEN PRINT CHR$(8);&lt;br /&gt;
70 LOCATE #1,2,24&lt;br /&gt;
80 PRINT #1,&amp;quot;text cursor &amp;quot;;&lt;br /&gt;
90 PRINT #1,&amp;quot;horizontal position = &amp;quot;;&lt;br /&gt;
100 PRINT #1,POS(#0):GOTO 50&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102901</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102901"/>
				<updated>2019-01-17T13:24:11Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* MIN () */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
: '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102900</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102900"/>
				<updated>2019-01-17T13:20:50Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* CHR$ () */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
 '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102899</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102899"/>
				<updated>2019-01-17T13:20:21Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Example for ERR 31 / 32''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the natural LOGarithm (base of ''e'') of &amp;lt;numeric expression&amp;gt; which mustbe greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG10&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG(9999)&lt;br /&gt;
 9.21024037&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOG10 (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the logarithm to base 10 of &amp;lt;numeric expression&amp;gt; which must be greater than zero.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': EXP, LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOG10(9999)&lt;br /&gt;
 3.99995657&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LOWER$ (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns a new string expression which is a copy of the specified &amp;lt;string expression&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': UPPER$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;AMSTRAD&amp;quot;:PRINT A$=&amp;quot;AMSTRAD&amp;quot;:PRINT LOWER$(A$)&lt;br /&gt;
Amstrad&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;SEE HOW THE LETTERS CHANGE TO ... NUMBERS 1234 NOT...&amp;quot;&lt;br /&gt;
20 PRINT LOWER$(a$+&amp;quot;LOWER CASE&amp;quot;)&lt;br /&gt;
 see how the letters change to ... numbers 1234 not... LOWER CASE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MAX (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MAXimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=66&lt;br /&gt;
20 PRINT MAX(1,n,3,6,4,3)&lt;br /&gt;
run&lt;br /&gt;
 66&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;MIN (&amp;lt;list of: numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the MINimum value from the &amp;lt;list of: numeric expression&amp;gt;s.&lt;br /&gt;
 '''Associated keywords''': MAX&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MIN (3,6,2.999.8,9,)&lt;br /&gt;
 2.999&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102896</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102896"/>
				<updated>2019-01-15T12:47:52Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* LEFT$ (, ) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example for ERR 31 / 32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102895</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102895"/>
				<updated>2019-01-15T12:46:01Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (&amp;lt;unsigned integer expression&amp;gt;,[&amp;lt;integer expression&amp;gt;])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(&amp;lt;numeric expression&amp;gt;, &amp;lt;format template&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example for ERR 31 / 32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (&amp;lt;numeric expression&amp;gt;/&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (&amp;lt;unsigned integer expression&amp;gt;, &amp;lt;field width&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: FUNCTION: Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102894</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102894"/>
				<updated>2019-01-15T12:42:16Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (s)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (i1,[i2])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(n, format)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example for ERR 31 / 32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (i)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (n/st)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (i1, i2)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (i)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (&amp;lt;numeric expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;JOY (&amp;lt;integer expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': The JOY function reads a bit significant result from the joystick in the &amp;lt;integer expression&amp;gt; (either 0 or 1).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
================================&lt;br /&gt;
|Bit       |  Value decimal    |&lt;br /&gt;
================================&lt;br /&gt;
|0(up)     |         1         |&lt;br /&gt;
|1(down)   |         2         |&lt;br /&gt;
|2(left)   |         4         |&lt;br /&gt;
|3(right)  |         8         |&lt;br /&gt;
|4(fire 2) |        16         |&lt;br /&gt;
|5(fire 1) |        32         |&lt;br /&gt;
================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEFT$ (&amp;lt;string expression&amp;gt;, &amp;lt;required length&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: FUNCTION: Returns the number of characters (in the range 0 to 255) specified in the &amp;lt;required length&amp;gt; parameter (&amp;lt;integer expression&amp;gt;), after extracting them from the LEFT of the &amp;lt;string expression&amp;gt;. If the &amp;lt;string expression&amp;gt; is shorter than the &amp;lt;required length&amp;gt;, the whole &amp;lt;string expression&amp;gt; is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': MID$, RIGHT$&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 a$=&amp;quot;AMSTRAD&amp;quot;&lt;br /&gt;
30 FOR n=1 to 7&lt;br /&gt;
40 PRINT LEFT$(a$,n)&lt;br /&gt;
50 NEXT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;LEN (&amp;lt;string expression&amp;gt;)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the total number of characters (i.e. the LENgth) of the &amp;lt;string expression&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LINE INPUT &amp;quot;Enter a phrase&amp;quot;;a$&lt;br /&gt;
20 PRINT &amp;quot;The phrase is&amp;quot;;&lt;br /&gt;
30 PRINT LEN(a$);&amp;quot;characters long.&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102893</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102893"/>
				<updated>2019-01-14T08:54:37Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ASC (s)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ATN (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;BIN$ (i1,[i2])&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CHR$ (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CINT (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COPYCHR$ (#stream)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;COS (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CREAL (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DEC$(n, format)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;DERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EOF&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ERR&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example for ERR 31 / 32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;EXP (i)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FIX (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;FRE (n/st)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HEX$ (i1, i2)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;HIMEM&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY (i)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INKEY$&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INP (‹port number›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;INT (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102892</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102892"/>
				<updated>2019-01-14T08:51:19Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;&amp;lt;big&amp;gt;ABS (n)&amp;lt;/big&amp;gt;&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example for ERR 31 / 32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹port number›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102891</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102891"/>
				<updated>2019-01-14T08:50:35Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* ABS (n) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;ABS (n)&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example for ERR 31 / 32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹port number›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102890</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102890"/>
				<updated>2019-01-14T08:47:43Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example for ERR 31 / 32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹port number›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the INPut value from the I/O address specified in the &amp;lt;port number&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OUT, WAIT&lt;br /&gt;
&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹searched string›, ‹searched for string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Searches the first &amp;lt;searched string&amp;gt; expression to find the first occurance of the &amp;lt;searched for string expression&amp;lt;, and reports the position of its occurance within the &amp;lt;searched string&amp;gt;. If the &amp;lt;searched for string&amp;gt; does not occur within the &amp;lt;searched string&amp;gt;, then 0 is reported.&lt;br /&gt;
: The position at which to start searching the &amp;lt;searched string&amp;gt; is optionally specifiable using the &amp;lt;start position&amp;gt; parameter which must yield an integer number in the range 1 to 255.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': none&lt;br /&gt;
&lt;br /&gt;
: '''1. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''2. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''3. Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 alphabet$=&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;br /&gt;
30 INPUT &amp;quot;Enter a letter&amp;quot;;a$&lt;br /&gt;
40 b$=UPPER$(a$)&lt;br /&gt;
50 PRINT b$;&amp;quot; is number&amp;quot;;&lt;br /&gt;
60 PRINT INSTR(alphabet$,b$);&lt;br /&gt;
70 PRINT &amp;quot;in the alphabet.&amp;quot;:PRINT&lt;br /&gt;
80 GOTO 40&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': CINT, FIX, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) &lt;br /&gt;
3       -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
* [[Technical_information_about_Locomotive_BASIC]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102735</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102735"/>
				<updated>2019-01-10T08:46:27Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example for ERR 31 / 32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: In the example below, lines 40 and 70 tell the program to loop back to line 30 after interrogating the keyboard string.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;Select Yes or No (Y/N)?&amp;quot;&lt;br /&gt;
30 a$=INKEY$&lt;br /&gt;
40 IF a$=&amp;quot;&amp;quot; THEN 30&lt;br /&gt;
50 IF a$=&amp;quot;y&amp;quot; OR a$=&amp;quot;Y&amp;quot; THEN 80&lt;br /&gt;
60 IF a$=&amp;quot;N&amp;quot; OR a$=&amp;quot;n&amp;quot; THEN 90&lt;br /&gt;
70 GOTO 30&lt;br /&gt;
80 PRINT &amp;quot;You have selected YES&amp;quot;: END&lt;br /&gt;
90 PRINT &amp;quot;You have selected NO&amp;quot;:&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102734</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102734"/>
				<updated>2019-01-10T08:38:54Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* INKEY (i) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example for ERR 31 / 32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
==============================================================================&lt;br /&gt;
|Value returned          |[SHIFT]        |[CTRL]       |Specified key        |&lt;br /&gt;
==============================================================================&lt;br /&gt;
|-1                      |ignored        |ignored      |up                   |&lt;br /&gt;
|0                       |up             |up           |down                 |&lt;br /&gt;
|32                      |down           |up           |down                 |&lt;br /&gt;
|128                     |up             |down         |down                 |&lt;br /&gt;
|160                     |down           |down         |down                 |&lt;br /&gt;
==============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102733</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102733"/>
				<updated>2019-01-10T08:36:18Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example for ERR 31 / 32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: '''Accociated keywords''': BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the address of the Highest byte of Memory use by BASIC, (which may altered by e.g. the MEMROY command).&lt;br /&gt;
: 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'&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of memory.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: FRE, MEMORY, SYMBOL, SYMBOL AFTER.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
...on a CPC464&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
43903&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...on a CPC6128&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HIMEM&lt;br /&gt;
42619&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': INterrogates the KEYboard to report which keys are being pressed. The keyboard is scanned every 0.02 (1/50) second.&lt;br /&gt;
: The function is useful for spotting whether a certain key is down or up, by detecting the returned value of -1 (which occurs regardless of [SHIFT] and [CONTROL] key status).&lt;br /&gt;
: The example below detects when [SHIFT] and V (key number 55) are pressed together, then ends the program. Refer the manual for the key numbers.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CLEAR INPUT, INKEY$, JOY&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 IF INKEY(55)&amp;lt;&amp;gt;32 THEN 10&lt;br /&gt;
20 PRINT &amp;quot;You've pressed [SHIFT] and V&amp;quot;&lt;br /&gt;
30 CLEAR INPUT&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: The state of [SHIFT] and [CONTROL] in conjunction with the key specified in the &amp;lt;integer expression&amp;gt; is identified as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Music_Machine&amp;diff=102732</id>
		<title>Music Machine</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Music_Machine&amp;diff=102732"/>
				<updated>2019-01-10T06:42:49Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: Undo revision 102719 by KingOfLeds (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:Rammusicmashine.jpg|thumb|right|250px|The Ram Music Machine]] &lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
A digital sound sampling and playback device. The Music Machine was designed by Flare Technology and manufactured by [[Ram Electronics|RAM Electronics]]. &lt;br /&gt;
&lt;br /&gt;
The Amstrad CPC version is almost identical to the the ZX Spectrum version, only difference was the address decoding logic. &lt;br /&gt;
&lt;br /&gt;
The Music Machine came with a simple microphone. Recording quality could be improved by using a better(and more expensive) microphone. It came with its own sound sampling software and a sequencer. &lt;br /&gt;
&lt;br /&gt;
No known emulator supports the Music Machine. There was a club advertised through the magazine Sinclare User which sent out a computer tape twice a year full of interesting software developed for the Ram Music Machine. This was contributed to by the members and included thing such as a 128k sampler, fsk syncing mods to the original software and many useful midi tools to name but a few.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Music Machine was never used for producing sound effects in [[:Category:Demos|Demos]].&lt;br /&gt;
&lt;br /&gt;
Now, thanks to Jose Leandro, the hardware specialist of the spectrum, with his famous page :&lt;br /&gt;
&lt;br /&gt;
http://trastero.speccy.org/cosas/JL/JL.htm&lt;br /&gt;
&lt;br /&gt;
We can know more about this hardware. &lt;br /&gt;
&lt;br /&gt;
== Technical Specifications  ==&lt;br /&gt;
&lt;br /&gt;
Information from the manual: &lt;br /&gt;
&lt;br /&gt;
The Music Machine incoporates two Ferranti devices for digital-to-analogue (DAC) and analogue-to-digital (ADC) conversion. The part numbers are ZN429E8 and ZN449 respectively. The circuit also include a Motorola [[6850 ACIA chip]] (Asynchronous Communications Interface Adapter) for handling the [[MIDI]] channel, two anti-alias filters (one for input and one for output), a discrete microphone amplifier and a headphone amplifier. The clock signal for the ACIA and the ZN449 is provided by a ceramic oscillator. &lt;br /&gt;
&lt;br /&gt;
The incoming signal from the microphone amplifier is sampled to an 8-bit resolution at a rate of 19.444 thousand samples per second. This yields an analogue bandwidth of approximately 9.5kHz which is in fact the cutoff frequency of the filters. &lt;br /&gt;
&lt;br /&gt;
The clock signal for the ACIA is '''unknown'''. As said above it is based one the same oscillator as used for the ZN449, however, the oscillator is probably ''whatever'' MHz (?) divided by ''whatever'' (?), and its unknown if the ACIA and ZN449 clocks are using the same divider (ie. the ZN449 samples at 19.444kHz, but the ACIA may, or may not, use another frequency).&lt;br /&gt;
&lt;br /&gt;
The Music Machine uses NMI interrupt, but it is not clear exactly what it uses it for.&lt;br /&gt;
&lt;br /&gt;
All of the devices on The Music Machine data bus are accessible to the Amstrad within its I/O space. ACIA transactions must use 16-bit IO instructions; the converters are accesible via 8-bit IO instructions. &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
| ''Port''||''Direction''||''Name''||''Description''&lt;br /&gt;
|-&lt;br /&gt;
| F8E8h || Write Only || INTERUPT_SEL&lt;br /&gt;
| Writing 01 to this port disables internal Amstrad interrupts and replaces the IRQ signal from ACIA. Writing 00 restores normality. ''(Unclear how this works exactly - the description sounds as if uses an [[External Interrupt]] (rather than a [[NMI]]), and as if it does somehow disable the CPC's internal 300Hz interrupt?)''&lt;br /&gt;
|-&lt;br /&gt;
| F8ECh || Write only|| ACIA_Control&lt;br /&gt;
| See [[6850 ACIA chip]] for details&lt;br /&gt;
|-&lt;br /&gt;
| F8EDh || Write only || ACIA_Data_write&lt;br /&gt;
| See [[6850 ACIA chip]] for details&lt;br /&gt;
|-&lt;br /&gt;
| F8EEh || Read only || ACIA_Status&lt;br /&gt;
| See [[6850 ACIA chip]] for details&lt;br /&gt;
|-&lt;br /&gt;
| F8EFh || Read only || ACIA_Data_read&lt;br /&gt;
| See [[6850 ACIA chip]] for details&lt;br /&gt;
|-&lt;br /&gt;
| F8F0h || Write only || DAC_WRITE&lt;br /&gt;
| Data can written to the DAC via this port&lt;br /&gt;
|-&lt;br /&gt;
| F8F4h || Read only || ADC_READ&lt;br /&gt;
| The contents of the A-to-D can be read via this port. Note that the A-to-D must have been startet at least 20uS before this port can be read&lt;br /&gt;
|-&lt;br /&gt;
| F8F8h || Strobe || ADC_START&lt;br /&gt;
| Reading or writing to this port will start analogue to digital conversion&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Pictures  ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt; caption=&amp;quot;The Music Machine&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Image:MusicMachine boxed.JPG| the unit in its box&lt;br /&gt;
Image:Music machine 1.jpg|&lt;br /&gt;
Image:Music machine 2.jpg|missing female connector (?)&lt;br /&gt;
Image:Music machine back.jpg|Backside&lt;br /&gt;
Image:Music machine microphone 1.jpg|The microphone&lt;br /&gt;
Image:Music machine microphone 2.jpg|The microphone&lt;br /&gt;
Image:Rammusicmashine.jpg|With female connector&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;The Music Machine Layout, thanks to Jose Leandro&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
File:Music Machine - Delante.jpg|The Music Machine - Front&lt;br /&gt;
File:Music Machine - Detras.jpg|The Music Machine - Back&lt;br /&gt;
File:Music Machine - Conectores.jpg|The Music Machine - Connectors&lt;br /&gt;
File:Music Machine - Sin Tapa.jpg|The Music Machine - Without Top&lt;br /&gt;
File:Music Machine - PCB Componentes.jpg|The Music Machine - PCB Components&lt;br /&gt;
File:Music Machine - PCB Pistas.jpg|The Music Machine - PCB Tracks&lt;br /&gt;
File:Music Machine - PCB Front.png|The Music Machine - PCB Front&lt;br /&gt;
File:Music Machine - PCB Back.png|The Music Machine - PCB Back&lt;br /&gt;
File:Music Machine - Layout.jpg|The Music Machine - Layout&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tape  ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt; caption=&amp;quot;Music Machine&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Image:Music Machine Tape - side B.jpg|Music Machine Tape side B&lt;br /&gt;
Image:Music Machine Tape - side A.jpg|Music Machine Tape side A&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/gallery&amp;gt; &lt;br /&gt;
&lt;br /&gt;
== Reviews  ==&lt;br /&gt;
&lt;br /&gt;
* [[Amstradbladet]] (1987, Issue 9, [[Media:Amstrad Bladet8709022.jpg|Page 22]], and [[Media:Amstrad Bladet8709023.jpg|Page 23]]) (Danish) &lt;br /&gt;
* [[Amstrad Computer User]] (March 1987, [[Media:Amstrad Computer User8703 064.jpg|Page 64]], [[Media:Amstrad Computer User8703 065.jpg|Page 65]], and [[Media:Amstrad Computer User8703 066.jpg|Page 66]])&lt;br /&gt;
* Review in  [[Ε.Π.Τ.Α / Η Ελληνική πλευρά του Amstrad (Greek Side Of Amstrad)]]:&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Review in Greek Side of Amstrad n.6 (May 1987)&amp;quot;&amp;gt;&lt;br /&gt;
Image:MusicMachine GSOA p1.jpg&lt;br /&gt;
Image:MusicMachine GSOA p2.jpg&lt;br /&gt;
Image:MusicMachine GSOA p3.jpg&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Advertisements ==&lt;br /&gt;
&lt;br /&gt;
[[image:MusicMachine ACU ad 1987.jpg|thumb|none]]&lt;br /&gt;
&lt;br /&gt;
== Datasheets ==&lt;br /&gt;
&lt;br /&gt;
* [[Media:MC1458.pdf|Datasheet for MC1458]] {{EN}} {{PDF}}&lt;br /&gt;
* [[Media:MC 6850.pdf|Datasheet for MC6850]] {{EN}} {{PDF}}&lt;br /&gt;
* [[Media:A6850.pdf|Datasheet for ACIA 6850]] {{EN}} {{PDF}}&lt;br /&gt;
* [[Media:1983 Ferranti Data Converters.pdf|Datasheet for Ferranti Data Converters]] {{EN}} {{PDF}}&lt;br /&gt;
* [[Media:ZN448.pdf|Datasheet for Ferranti ZN448/ZN449]] {{EN}} {{PDF}}&lt;br /&gt;
&lt;br /&gt;
== Manual  ==&lt;br /&gt;
&lt;br /&gt;
* [[Media:Music_Machine_Manual.pdf|Music Machine (RAM Electronics) Manual]] {{EN}} {{PDF}}&lt;br /&gt;
&lt;br /&gt;
== Download  ==&lt;br /&gt;
&lt;br /&gt;
* [[Media:Music Machine (tape).zip|Music Machine (tape).zip]] (CDT for Emulators &amp;amp; Exemple on MP3)&lt;br /&gt;
* [[Media:Music Machine (Eagle).zip|Music Machine (Eagle).zip]] (Music Machine files for Eagle)&lt;br /&gt;
&lt;br /&gt;
== Weblinks  ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpc-power.com/index.php?page=detail&amp;amp;num=4329 ''Music Machine'' from CPC-Power]&lt;br /&gt;
* [http://cpcrulez.fr/hardware-audio-music_machine.htm ''Music Machine'' from CPCrulez]&lt;br /&gt;
* [http://hardware.speccy.org/temp/Amstrad-MusicMachine.html  ''Music Machine'' from hardware.speccy.org]&lt;br /&gt;
* [http://www.microhobby.com/200903/hard/ram_music_machine.htm ''Music Machine'' from www.microhobby.com] &lt;br /&gt;
* [http://www.worldofspectrum.org/hardware/feat17.html Advert for the Music Machine] &lt;br /&gt;
* [http://reviews.harmony-central.com/reviews/Keyboard%2FSynth/product/RAM/Music+Machine/10/1 Review] &lt;br /&gt;
* [http://www.wacci.org.uk/magazine/136/136_10.html Data transfer via MIDI]&lt;br /&gt;
* [http://www.compeng.dit.ie/staff/tscarff/6800/6850acia/6850.htm Information about the Motorola 6850 ACIA]&lt;br /&gt;
&lt;br /&gt;
[[Category:Serial interfaces]] [[Category:Peripherals]] [[Category:Music_and_sound]] [[Category:Manual]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102726</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102726"/>
				<updated>2019-01-09T14:55:19Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example for ERR 31 / 32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates 'E' to the power given in the &amp;lt;numeric expression&amp;gt; (i), where 'E' is approximately 2,7182818-the number whose natural logarithm is 1.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOG&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(6.876)&lt;br /&gt;
 968.743625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT, INT, ROUND&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FIX(9.99999)&lt;br /&gt;
 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''FUNCTION''': Establishes how much FREe memory remains unused by BASIC. The form FRE(&amp;quot;&amp;quot;) forces a 'GARBAGE COLLECTION' before returning a value for available space.&lt;br /&gt;
: NOTE: BASIC uses only the first 64K of the memory.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': HIMEM, MEMORY&lt;br /&gt;
&lt;br /&gt;
: '''Examples''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
PRINT FRE(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Produces a $tring of HEXadecimal digits representing the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of hexadecimal digits instructed by the &amp;lt;field width&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into hexadecimal form must yield a value in the range -32768 to 65535.&lt;br /&gt;
&lt;br /&gt;
: Accociated keywords: BIN$, DEC$, STR$, UNT&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT HEX$(255,4)&lt;br /&gt;
00FF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102723</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102723"/>
				<updated>2019-01-08T11:33:09Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* ERR */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: NOTE: BASIC 1.0 (officially) describes error codes until 30 (without an attached floppy disc controller). 31 &amp;amp; 32 are floppy disc error codes.&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example for ERR 31 / 32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102722</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102722"/>
				<updated>2019-01-08T11:25:02Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
: If AMSDOS has already reported an error, then bit 7 is set, hence the value of DERR is offset by 128.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Other values returned by DERR originate from the disc controller and are bit significant, always with bit 6 set.&lt;br /&gt;
: The significance of each bit is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| BIT   | Significance                                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  0    | Address mark missing.                                               |&lt;br /&gt;
|  1    | Not writable - disc is write protected.                             |&lt;br /&gt;
|  2    | No data - can't find the sector.                                    |&lt;br /&gt;
|  3    | Drive not ready - no disc in the drive.                             |&lt;br /&gt;
|  4    | Overrun error.                                                      |&lt;br /&gt;
|  5    | Data error - CRC error.                                             |&lt;br /&gt;
|  6    | Always set to 1 to indicate error from disc controller.             |&lt;br /&gt;
|  7    | Set to 1 if error has already been reported by AMSDOS.              |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
|       |                         |If access attempted when no file was open.          |&lt;br /&gt;
|       |                         |                                                    |&lt;br /&gt;
|       |                         |If value 31 or 32 are stated, DERR could be         |&lt;br /&gt;
|       |                         |interrogate to give more detailed information.      |&lt;br /&gt;
|       |                         |(see example below.)                                |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example for ERR 31 / 32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 ON ERROR GOTO 1000&lt;br /&gt;
20 OPENOUT &amp;quot;myfile.asc&amp;quot;&lt;br /&gt;
30 WRITE #9,&amp;quot;test-data&amp;quot;&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
50 END&lt;br /&gt;
1000 amsdoserr=(DERR AND &amp;amp;7F):REM mask off bit 7&lt;br /&gt;
1010 IF ERR&amp;lt;31 THEN END&lt;br /&gt;
1020 IF ERR=31 THEN PRINT &amp;quot;are you sure you've typed line 20 correctly?&amp;quot;:END&lt;br /&gt;
1030 IF amsdoserr=20 THEN PRINT &amp;quot;disc is full, suggest you use a new data disc&amp;quot;:END&lt;br /&gt;
1040 IF amsdoserr=&amp;amp;X01001000 THEN PRINT &amp;quot;put a disc in the drive, then press a key&amp;quot;:WHILE INKEY$=&amp;quot;&amp;quot;:WEND:RESUME&lt;br /&gt;
1050 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102721</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102721"/>
				<updated>2019-01-08T11:10:44Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
========================================================================================&lt;br /&gt;
| VALUE | NAME                    | DESCRIPTION                                        |&lt;br /&gt;
========================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT          |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                         |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                         |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error             |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                         |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN        |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                         |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted           |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                         |of the last DATA.                                   |&lt;br /&gt;
|   5   |Improper Argument        |This is a general purpose error. The value of a     |&lt;br /&gt;
|       |                         |function's argument, or a command parameter is      |&lt;br /&gt;
|       |                         |invalid in some way.                                |&lt;br /&gt;
|   6   |Overflow                 |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                         |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                         |which case some operation has yielded a value       |&lt;br /&gt;
|       |                         |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                         |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                         |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|   7   |Memory full              |The current program or its variables may be simply  |&lt;br /&gt;
|       |                         |too big, or the control structure is too deeply     |&lt;br /&gt;
|       |                         |nested (nested GOUSBs, WHILEs or FORs).             |&lt;br /&gt;
|       |                         |A MEMORY command will give this error if an attempt |&lt;br /&gt;
|       |                         |is made to set the top of BASIC's memory too low, or|&lt;br /&gt;
|       |                         |to an impossible high value. Note that an open file |&lt;br /&gt;
|       |                         |has a buffer allocated to it, and that may restrict |&lt;br /&gt;
|       |                         |the values that MEMORY may use.                     |&lt;br /&gt;
|   8   |Line does not exist      |The line referenced cannot be found.                |&lt;br /&gt;
|   9   |Subcript out of range    |One of the subscripts in an array reference is too  |&lt;br /&gt;
|       |                         |big or too small.                                   |&lt;br /&gt;
|  10   |Array already dimensioned|One of the arrays in a DIM statement has already    |&lt;br /&gt;
|       |                         |been declared.                                      |&lt;br /&gt;
|  11   |Division by zero         |May occur in real division, integer division,       |&lt;br /&gt;
|       |                         |integer modulus or exponentiation.                  |&lt;br /&gt;
|  12   |Invalid direct command   |The last command attempted is not valid in direct   |&lt;br /&gt;
|       |                         |mode.                                               |&lt;br /&gt;
|  13   |Type mismatch            |A numeric value has been presented where a string   |&lt;br /&gt;
|       |                         |value is required or vice versa, or an invalidly    |&lt;br /&gt;
|       |                         |formed number has been found in READ or INPUT.      |&lt;br /&gt;
|  14   |String space full        |So many strings have been created that there is no  |&lt;br /&gt;
|       |                         |further room available, even after 'garbage         |&lt;br /&gt;
|       |                         |collection'.                                        |&lt;br /&gt;
|  15   |String too long          |Strings exceeds 255 characters in length. May be    |&lt;br /&gt;
|       |                         |generated by appending strings together.            |&lt;br /&gt;
|  16   |String expression too    |String expressions may generate a number of         |&lt;br /&gt;
|       |complex                  |intermediate string values. When the number of these|&lt;br /&gt;
|       |                         |values exceeds a reasonable limit, this error       |&lt;br /&gt;
|       |                         |results.                                            |&lt;br /&gt;
|  17   |Cannot CONTinue          |For one reason or another the current program       |&lt;br /&gt;
|       |                         |be restarted using CONT. Note that CONT is intended |&lt;br /&gt;
|       |                         |for restarting after a STOP command, [ESC][ESC],    |&lt;br /&gt;
|       |                         |or an error, and that any alteration of the         |&lt;br /&gt;
|       |                         |program in the meantime makes a restart impossible. |&lt;br /&gt;
|  18   |Unknown user function    |No DEF FN has been executed for the FN just         |&lt;br /&gt;
|       |                         |invoked.                                            |&lt;br /&gt;
|  19   |RESUME missing           |The end of the program has been encountered while   |&lt;br /&gt;
|       |                         |in error processing mode (i.e. in an ON ERROR GOTO  |&lt;br /&gt;
|       |                         |routine).                                           |&lt;br /&gt;
|  20   |Unexpected RESUME        |RESUME is only valid while in error processing mode |&lt;br /&gt;
|       |                         |(i.e. in an ON ERROR GOTO routine).                 |&lt;br /&gt;
|  21   |Direct command found     |When loading a file, a line without a line number   |&lt;br /&gt;
|       |                         |has been found.                                     |&lt;br /&gt;
|  22   |Operand missing          |BASIC has encountered an incomplete expression.     |&lt;br /&gt;
|  23   |Line too long            |A line when converted to BASIC internal-form becomes|&lt;br /&gt;
|       |                         |too big.                                            |&lt;br /&gt;
|  24   |EOF met                  |An attempt has been made to read past end of the    |&lt;br /&gt;
|       |                         |file input stream.                                  |&lt;br /&gt;
|  25   |File type error          |The file being read is not of a suitable type.      |&lt;br /&gt;
|       |                         |OPENIN is only prepared to open ASCII text files.   |&lt;br /&gt;
|       |                         |Similarly, LOAD, RUN, etc, are only prepared to     |&lt;br /&gt;
|       |                         |deal with file types produces by SAVE.              |&lt;br /&gt;
|  26   |NEXT missing             |Cannot find a NEXT to match a FOR command. A line   |&lt;br /&gt;
|       |                         |number accompanying this message indicates the FOR  |&lt;br /&gt;
|       |                         |command to which this error applies.                |&lt;br /&gt;
|  27   |File already open        |An OPENIN or OPENOUT command has been executed      |&lt;br /&gt;
|       |                         |before the previously opened file has been closed.  |&lt;br /&gt;
|  28   |Unknown command          |BASIC cannot find a taker for an external command,  |&lt;br /&gt;
|       |                         |i.e. a command preceded by a bar |.                 |&lt;br /&gt;
|  29   |WEND missing             |Cannot find a WEND to match a WHILE command.        |&lt;br /&gt;
|  30   |Unexpected WEND          |Encountered a WEND when not in a WHILE loop, or a   |&lt;br /&gt;
|       |                         |WEND that does not match the current WHILE loop.    |&lt;br /&gt;
|  31   |File not open            |(see 'Disc ERRors above).                           |&lt;br /&gt;
|  32   |Broken in                |(see 'Disc ERRors above).                           |&lt;br /&gt;
========================================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102620</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102620"/>
				<updated>2019-01-03T20:01:16Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
=================================================================================&lt;br /&gt;
| VALUE | NAME             | DESCRIPTION                                        |&lt;br /&gt;
=================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT   |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                  |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                  |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error      |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                  |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                  |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted    |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                  |of the last DATA.                                   |&lt;br /&gt;
|   5   |Overflow          |The result of an arithmetic operation has over-     |&lt;br /&gt;
|       |                  |flowed. This may be a floating point overflow, in   |&lt;br /&gt;
|       |                  |which case some operation has yielded a value       |&lt;br /&gt;
|       |                  |greater than 1.7E^38 (approx.). Alternatively, this |&lt;br /&gt;
|       |                  |may be the result of a failed attempt to change a   |&lt;br /&gt;
|       |                  |floating point number to a 16 bit signed integer.   |&lt;br /&gt;
|       |                  |                                                    |&lt;br /&gt;
|       |                  |                                                    |&lt;br /&gt;
|       |                  |                                                    |&lt;br /&gt;
|       |                  |                                                    |&lt;br /&gt;
|       |                  |                                                    |&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102618</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102618"/>
				<updated>2019-01-03T19:57:27Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | DERR value     | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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 &amp;lt;pre&amp;gt;'Line does not exist'&amp;lt;/pre&amp;gt; error&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
=================================================================================&lt;br /&gt;
| VALUE | NAME             | DESCRIPTION                                        |&lt;br /&gt;
=================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT   |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                  |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                  |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error      |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                  |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                  |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted    |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                  |of the last DATA.                                   |&lt;br /&gt;
|       |                  |                                                    |&lt;br /&gt;
|       |                  |                                                    |&lt;br /&gt;
|       |                  |                                                    |&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102617</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102617"/>
				<updated>2019-01-03T19:55:39Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: '''Associated keywords''': SGN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1'' &lt;br /&gt;
: '''FUNCTION''': Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: '''Associated keywords''': CHR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n) to a real number ranging from -PI/2 to +PI/2 of the value specified.&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: '''Associated keywords''': DEC$, HEX$, STR$&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
: '''Associated keywords''': ASC, LEFT$, RIGHT$, MID$, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: : ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': LOCATE&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''FUNCTION''': Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': CINT&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''FUNCTIION''': Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keyword''': BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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.&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: '''Table of Disc ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| '''VALUE''' | '''DERR value'''     | '''DESCRIPTION'''                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   0   | 0 or 22        | [ESC] has been pressed                             |&lt;br /&gt;
|  14   | 142 (128+14)   | The stream is not in a suitable state.             |&lt;br /&gt;
|  15   | 143 (128+15)   | Hard end of file has been reached.                 |&lt;br /&gt;
|  16   | 144 (128+16)   | Bad command, usually an incorrect filename.        |&lt;br /&gt;
|  17   | 145 (128+17)   | File already exists.                               |&lt;br /&gt;
|  18   | 146 (128+18)   | File does not exists.                              |&lt;br /&gt;
|  19   | 147 (128+19)   | Direcotry is full.                                 |&lt;br /&gt;
|  20   | 148 (128+20)   | Disc is full.                                      |&lt;br /&gt;
|  21   | 149 (128+21)   | Disc changed while file were open.                 |&lt;br /&gt;
|  22   | 150 (128+22)   | File is Read/Only.                                 |&lt;br /&gt;
|  26   | 154 (128+26)   | Soft end of file has been detected.                |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.1''&lt;br /&gt;
: '''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).&lt;br /&gt;
&lt;br /&gt;
: '''Associated keywords''': OPENIN, CLOSEIN&lt;br /&gt;
&lt;br /&gt;
: This '''example''' reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ''BASIC 1.0 &amp;amp; 1.1''&lt;br /&gt;
: '''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 &amp;lt;pre&amp;gt;'Line does not exist'&amp;lt;/pre&amp;gt; error&lt;br /&gt;
&lt;br /&gt;
: '''Example''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GOTO 500&lt;br /&gt;
Line does not exist&lt;br /&gt;
Ready&lt;br /&gt;
PRINT ERR&lt;br /&gt;
 8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: '''Table of ERRor codes''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
=================================================================================&lt;br /&gt;
| VALUE | NAME             | DESCRIPTION                                        |&lt;br /&gt;
=================================================================================&lt;br /&gt;
|   1   |Unexpected NEXT   |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                  |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                  |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error      |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                  |a construct within it is not legal.                 |&lt;br /&gt;
|   3   |Unexpected RETURN |A RETURN command has been encountered when not in a |&lt;br /&gt;
|       |                  |subroutine.                                         |&lt;br /&gt;
|   4   |DATA exhausted    |A READ command has attempted to read beyond the end |&lt;br /&gt;
|       |                  |of the last DATA.                                   |&lt;br /&gt;
|       |                  |                                                    |&lt;br /&gt;
|       |                  |                                                    |&lt;br /&gt;
|       |                  |                                                    |&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102616</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102616"/>
				<updated>2019-01-02T16:35:01Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: Associated keywords: SGN&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: Associated keywords: CHR$&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: Associated keywords: DEC$, HEX$, STR$&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: 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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: LOCATE&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: CINT&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTIION: Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: Associated keyword: BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Table of error codes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
| VALUE | NAME           | DESCRIPTION                                        |&lt;br /&gt;
===============================================================================&lt;br /&gt;
|   1   |Unexpected NEXT |A NEXT command has been encountered while not in a  |&lt;br /&gt;
|       |                |FOR loop, or the control variable in the NEXT       |&lt;br /&gt;
|       |                |command does not match that in the FOR.             |&lt;br /&gt;
|   2   |Syntax Error    |BASIC cannot understand the given line because      |&lt;br /&gt;
|       |                |a construct within it is not legal.                 |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
|       |                |                                                    |&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: This example reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the error code number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102615</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102615"/>
				<updated>2019-01-02T16:29:53Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: Associated keywords: SGN&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: Associated keywords: CHR$&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: Associated keywords: DEC$, HEX$, STR$&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#stream)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: 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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: LOCATE&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: CINT&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTIION: Returns a DECimal string representation of the &amp;lt;numeric expression&amp;gt; (n), using the specified &amp;lt;format template&amp;gt; to control the print format of the resulting string.&lt;br /&gt;
: The format template may contain ONLY the characters:&lt;br /&gt;
&lt;br /&gt;
: + - $ £ * # , . ^&lt;br /&gt;
&lt;br /&gt;
: The use of these 'format field specifiers' is described under the keyword PRINT USING.&lt;br /&gt;
&lt;br /&gt;
: Associated keyword: BIN$, HEX$, PRINT USING, STR$&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT DEC$(10^7,&amp;quot;££########,.##&amp;quot;)&lt;br /&gt;
 £10,000,000.00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: ERL, ERR, ERROR, ON ERROR GOTO, RESUME&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LOAD &amp;quot;xyz.abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XYZ .ABC not found&lt;br /&gt;
Ready&lt;br /&gt;
PRINT DERR&lt;br /&gt;
 146&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Table of error codes:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1 Unexpected NEXT: A NEXT command has been encountered while not in a FOR loop, or the control variable in the NEXT command does not match that in the FOR&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: This example reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the error code number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102614</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102614"/>
				<updated>2019-01-02T16:19:15Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: Associated keywords: SGN&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: Associated keywords: CHR$&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: Associated keywords: DEC$, HEX$, STR$&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: 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.&lt;br /&gt;
: If the character read is not recognized, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: LOCATE&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLS&lt;br /&gt;
20 PRINT &amp;quot;top corner&amp;quot;&lt;br /&gt;
30 LOCATE 1,1&lt;br /&gt;
40 a$=COPYCHR$(#0)&lt;br /&gt;
50 LOCATE 1,20&lt;br /&gt;
60 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Calculates the COSinus of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: ATN, DEG, RAD, SIN&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEG&lt;br /&gt;
PRINT COS(45)&lt;br /&gt;
 0.707106781&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to REAL.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: CINT&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a=PI&lt;br /&gt;
20 PRINT CINT(a)&lt;br /&gt;
30 PRINT CREAL(a)&lt;br /&gt;
run&lt;br /&gt;
 3&lt;br /&gt;
 3.14159265&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Retruns the decimal string representation of n, according to the specified format (see PRINT USING)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives the most recent error code number returned by [[Amsdos]].&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: This example reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the error code number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102613</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102613"/>
				<updated>2019-01-02T16:11:57Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* CINT (n) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: Associated keywords: SGN&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: Associated keywords: CHR$&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: Associated keywords: DEC$, HEX$, STR$&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns the value of the &amp;lt;numeric expression&amp;gt; (n), Converting it to a rounded INTeger in the range -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: CREAL, FIX, INT, ROUND, UNT&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 n=1.9999&lt;br /&gt;
20 PRINT CINT(n)&lt;br /&gt;
run&lt;br /&gt;
 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Copies character from current position in specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns cosine of n in degrees or radians (se DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Converts integer n to real numeric variable.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Retruns the decimal string representation of n, according to the specified format (see PRINT USING)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives the most recent error code number returned by [[Amsdos]].&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: This example reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the error code number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102600</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102600"/>
				<updated>2018-12-30T22:37:52Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: Associated keywords: SGN&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: Associated keywords: CHR$&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
: The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: Associated keywords: DEC$, HEX$, STR$&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Converts an &amp;lt;integer expression&amp;gt; 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.&lt;br /&gt;
: Note that 0 to 31 are control characters; hence the below example prints CHR$(x) in the range 32 to 255&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR X=32 to 255&lt;br /&gt;
20 PRINT X;CHR$(X);&lt;br /&gt;
30 NEXT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: A further example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
&lt;br /&gt;
: Control Codes Table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns rounded up integer value of n between -32768 and 32767.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT CINT(3.8) - print 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Copies character from current position in specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns cosine of n in degrees or radians (se DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Converts integer n to real numeric variable.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Retruns the decimal string representation of n, according to the specified format (see PRINT USING)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives the most recent error code number returned by [[Amsdos]].&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: This example reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the error code number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102599</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102599"/>
				<updated>2018-12-30T22:06:47Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Returns the ABSolute value of the given numeric expression (n). This means that negative numbers are returned as positive.&lt;br /&gt;
: Associated keywords: SGN&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns the numeric value of the first character in the &amp;lt;string expression&amp;gt; (s).&lt;br /&gt;
: Associated keywords: CHR$&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Calculates the Arc-TaNgent of the &amp;lt;numeric expression&amp;gt; (n).&lt;br /&gt;
: Note that DEG and RAD can be used to force the result of the below calculation to degrees or radians respectively.&lt;br /&gt;
&lt;br /&gt;
: Associated keywords: COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Produces a string of BINary digits respresenting the value of the &amp;lt;unsigned integer expression&amp;gt;, using the number of binary digits instruced by the second &amp;lt;integer expression&amp;gt; (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.&lt;br /&gt;
The &amp;lt;unsigned integer expression&amp;gt; to be converted into binary form must yield a value in the range -32768 to 65535.&lt;br /&gt;
: Associated keywords: DEC$, HEX$, STR$&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8)&lt;br /&gt;
01000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the character for a given index n. For instance CHR$(65) returns the character 'A'. Valid indices range from 0 (zero) to 255.&lt;br /&gt;
&lt;br /&gt;
: As an example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
:&lt;br /&gt;
:The CHR$ code between 0 and 31 will not print out a character but perform a function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns rounded up integer value of n between -32768 and 32767.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT CINT(3.8) - print 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Copies character from current position in specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns cosine of n in degrees or radians (se DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Converts integer n to real numeric variable.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Retruns the decimal string representation of n, according to the specified format (see PRINT USING)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives the most recent error code number returned by [[Amsdos]].&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: This example reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the error code number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102598</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102598"/>
				<updated>2018-12-30T15:34:53Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* ATN (n) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Returns the absolute value of n by ignoring the sign value, that means a negative value will be changed in a positive one.&lt;br /&gt;
: Similar commands: SGN&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns ASCII code number of first character of string s&lt;br /&gt;
: Similar commands: CHR$&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Returns the arctangent of n.&lt;br /&gt;
: The result can be changed into radian or angular measure with the commands DEG or RAD&lt;br /&gt;
&lt;br /&gt;
: Similar commands: COS, DEG, RAD, SIN, TAN&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ATN(1)&lt;br /&gt;
0.785398163&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns binary representation of i1 between -32768 and 65535. The number of binary digits (0s and 1s) is specified by i2 (0-16)&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the character for a given index n. For instance CHR$(65) returns the character 'A'. Valid indices range from 0 (zero) to 255.&lt;br /&gt;
&lt;br /&gt;
: As an example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
:&lt;br /&gt;
:The CHR$ code between 0 and 31 will not print out a character but perform a function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns rounded up integer value of n between -32768 and 32767.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT CINT(3.8) - print 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Copies character from current position in specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns cosine of n in degrees or radians (se DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Converts integer n to real numeric variable.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Retruns the decimal string representation of n, according to the specified format (see PRINT USING)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives the most recent error code number returned by [[Amsdos]].&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: This example reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the error code number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102597</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102597"/>
				<updated>2018-12-30T15:32:05Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* ASC (s) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Returns the absolute value of n by ignoring the sign value, that means a negative value will be changed in a positive one.&lt;br /&gt;
: Similar commands: SGN&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns ASCII code number of first character of string s&lt;br /&gt;
: Similar commands: CHR$&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ASC(&amp;quot;x&amp;quot;)&lt;br /&gt;
 120&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns binary representation of i1 between -32768 and 65535. The number of binary digits (0s and 1s) is specified by i2 (0-16)&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the character for a given index n. For instance CHR$(65) returns the character 'A'. Valid indices range from 0 (zero) to 255.&lt;br /&gt;
&lt;br /&gt;
: As an example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
:&lt;br /&gt;
:The CHR$ code between 0 and 31 will not print out a character but perform a function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns rounded up integer value of n between -32768 and 32767.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT CINT(3.8) - print 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Copies character from current position in specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns cosine of n in degrees or radians (se DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Converts integer n to real numeric variable.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Retruns the decimal string representation of n, according to the specified format (see PRINT USING)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives the most recent error code number returned by [[Amsdos]].&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: This example reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the error code number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102596</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102596"/>
				<updated>2018-12-30T15:31:21Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* ABS (n) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: FUNCTION: Returns the absolute value of n by ignoring the sign value, that means a negative value will be changed in a positive one.&lt;br /&gt;
: Similar commands: SGN&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns ASCII code number of first character of string s&lt;br /&gt;
: Relative commands: CHR$&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns binary representation of i1 between -32768 and 65535. The number of binary digits (0s and 1s) is specified by i2 (0-16)&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the character for a given index n. For instance CHR$(65) returns the character 'A'. Valid indices range from 0 (zero) to 255.&lt;br /&gt;
&lt;br /&gt;
: As an example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
:&lt;br /&gt;
:The CHR$ code between 0 and 31 will not print out a character but perform a function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns rounded up integer value of n between -32768 and 32767.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT CINT(3.8) - print 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Copies character from current position in specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns cosine of n in degrees or radians (se DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Converts integer n to real numeric variable.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Retruns the decimal string representation of n, according to the specified format (see PRINT USING)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives the most recent error code number returned by [[Amsdos]].&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: This example reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the error code number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102595</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102595"/>
				<updated>2018-12-30T15:30:26Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* ASC (s) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value, that means a negative value will be changed in a positive one.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: FUNCTION: Returns ASCII code number of first character of string s&lt;br /&gt;
: Relative commands: CHR$&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns binary representation of i1 between -32768 and 65535. The number of binary digits (0s and 1s) is specified by i2 (0-16)&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the character for a given index n. For instance CHR$(65) returns the character 'A'. Valid indices range from 0 (zero) to 255.&lt;br /&gt;
&lt;br /&gt;
: As an example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
:&lt;br /&gt;
:The CHR$ code between 0 and 31 will not print out a character but perform a function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns rounded up integer value of n between -32768 and 32767.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT CINT(3.8) - print 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Copies character from current position in specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns cosine of n in degrees or radians (se DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Converts integer n to real numeric variable.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Retruns the decimal string representation of n, according to the specified format (see PRINT USING)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives the most recent error code number returned by [[Amsdos]].&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: This example reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the error code number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102594</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=102594"/>
				<updated>2018-12-30T15:28:18Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* ABS (n) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For other BASIC language versions see the [[:Category:BASIC]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Screenshots-CPC_Start_screen.jpg|thumb|CPC Start Screen showing Locomotive copyright and BASIC version]]&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.&lt;br /&gt;
&lt;br /&gt;
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Locomotive BASIC, was one of the best and fastest BASIC implementations of the era. The language benefited both from a clean, well-thought out implementation of the core language by Locomotive, and by the excellent [[firmware]] of the CPC, which lent most of its advanced features to the BASIC.&lt;br /&gt;
&lt;br /&gt;
Unlike the competing Commodore 64, it featured a comprehensive graphic capabilities with its PLOT, DRAW, PAPER, INK, PEN, BORDER and (in BASIC 1.1) FILL commands. It had extensive sound commands, granting control of the [[AY-3-8912]] via the firmware's volume and tone envelope system. With the SOUND command, you could select channels, set envelopes, pitch, noise and volume. That was something unmatched by other computers of that era.&lt;br /&gt;
&lt;br /&gt;
Also there was simple interface for memory management, with MEMORY and LOAD commands. The latter allowed for loading of raw screen data, thus providing easy picture showing. Both through this (combined with CALL, PEEK and POKE) and the firmware's [[RSX]] system, it was easy to mix BASIC and assembly code, thereby speeding up programs by coding the slowest parts directly in machine code. Many successful programs, including games such as [[Radzone]] and applications such as [[PowerPage]], made use of this technique.&lt;br /&gt;
&lt;br /&gt;
With DEF FN, ON variable GOTO and ON variable GOSUB, Locomotive BASIC provided the rudiments of &amp;quot;structured programming&amp;quot;, though nowhere near the extent of the PROCedures of [[BBC Basic]].&lt;br /&gt;
&lt;br /&gt;
All in all, if you compare BASIC interpreters of that era, the Locomotive's seems to be the best 'all-rounder' regarding the combination of speed and complexity, and still some of its features were unmatched by others.&lt;br /&gt;
&lt;br /&gt;
If you are interested in more information about the different versions of the CPC's BASIC and the technical details, you can have a look at the article &amp;quot;[[Technical information about Locomotive BASIC]]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another helpful and further resource of information about BASIC and a similar comprehension to this is Grimware's Website about the CPC http://www.grimware.org/doku.php/documentations/software/locomotive.basic/start&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
The CPC implementation of Locomotive BASIC was developed directly from [[Locomotive Software]]'s existing Z80 BASIC. The existence of this is cited as one of the reasons Locomotive requested that [[Amstrad]] change the CPC's processor from a 6502 to a [[Z80]].&lt;br /&gt;
&lt;br /&gt;
The 464 shipped with BASIC 1.0 on ROM.&lt;br /&gt;
&lt;br /&gt;
The language was revised and debugged for the 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:&lt;br /&gt;
&lt;br /&gt;
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)&lt;br /&gt;
* Better handling of string arguments to RSXs (|DIR,&amp;quot;*.BAS&amp;quot; rather than a$=&amp;quot;*.BAS&amp;quot;:|DIR,@a$)&lt;br /&gt;
* DATA statements can appear anywhere within a line; in BASIC 1.0, they had to be at the end of a line&lt;br /&gt;
* FILL command (fill area with solid colour)&lt;br /&gt;
* COPYCHR$ function (fetch character from screen)&lt;br /&gt;
* Better garbage collection&lt;br /&gt;
* Some number-handling bugs removed (e.g. in FOR loops with negative start/end values)&lt;br /&gt;
* FRAME (CALL &amp;amp;BD19)&lt;br /&gt;
* Extra, optional 'plotting mode' parameter for DRAW/PLOT commands (supported only through control codes on BASIC 1.0)&lt;br /&gt;
* GRAPHICS PAPER, GRAPHICS PEN commands&lt;br /&gt;
* ON BREAK CONT (disable ESCape)&lt;br /&gt;
* CLEAR INPUT (flush keyboard buffer)&lt;br /&gt;
* The AUTO command show the whole line if it exist, it only printed a * on the 464&lt;br /&gt;
&lt;br /&gt;
Some parts of 'BASIC' were actually housed in the firmware ROM, but were not officially accessible to other programs. This included the line editor.&lt;br /&gt;
&lt;br /&gt;
The 'pure BASIC' parts of Locomotive BASIC - i.e. those not concerned with CPC-specific firmware and hardware features - were upgraded to become [[Mallard BASIC]], the CP/M language shipped with the [[PCW]]. This also featured exceptionally advanced random-access file handling, a feature missing from the CPC.&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
=== Real (Floating Point) Numbers ===&lt;br /&gt;
&lt;br /&gt;
This is the default type for a Locomotive BASIC variables, but can be clarified using &amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;real!=500.0&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFREAL&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory (5 bytes, as opposed to 2).&lt;br /&gt;
&lt;br /&gt;
=== Signed 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
Defined using &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;integer%=500&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFINT&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
These can store values between -32,768 and 32,767.&lt;br /&gt;
To assign a 16-bit value to a signed integer directly, you should give the number in a hexadecimal format, e.g., &amp;lt;code&amp;gt;uint=&amp;amp;c0000&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
=== Strings ===&lt;br /&gt;
&lt;br /&gt;
These are defined by using &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; after the variable name, e.g., &amp;lt;code&amp;gt;str$=&amp;quot;Hello&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
You can force all variables starting with specific letters to be this type by using the &amp;lt;code&amp;gt;DEFSTR&amp;lt;/code&amp;gt; keyword. &lt;br /&gt;
A String can be up to 255 characters long.&lt;br /&gt;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The BASIC functions &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - &amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt; rounds to nearest, &amp;lt;code&amp;gt;FIX&amp;lt;/code&amp;gt; rounds to zero, &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down, and &amp;lt;code&amp;gt;CINT&amp;lt;/code&amp;gt;rounds up. e.g., &amp;lt;code&amp;gt;value%=INT(3.14)&amp;lt;/code&amp;gt;.  Note that if you don't specify the % you will actually get a real number still.&lt;br /&gt;
&lt;br /&gt;
To convert an integer to a real number, you can use the &amp;lt;code&amp;gt;UNT&amp;lt;/code&amp;gt; function which will take the value supplied and return the two's complement number. e.g., &amp;lt;code&amp;gt;real=UNT(&amp;amp;ABCD)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w=UNT(50000)&lt;br /&gt;
Ready&lt;br /&gt;
PRINT w&lt;br /&gt;
-15536&lt;br /&gt;
Ready&lt;br /&gt;
█&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want an integer result from division, use the &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; integer division operator. e.g., &amp;lt;code&amp;gt;int=value\divisor&amp;lt;/code&amp;gt;. This is as opposed to the standard &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; division operator, that can create a real number.&lt;br /&gt;
&lt;br /&gt;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AFTER ‹time delay›[,‹timer number›] GOSUB ‹line number› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Waits for ‹time delay›/50 seconds and then jumps NON-RECURRING to the subroutine at ‹line number› (see also &amp;lt;code&amp;gt;&amp;quot;EVERY i[,t] GOSUB line&amp;quot;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;AUTO [‹line number›][,‹increment›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Automatically generates line numbers starting at ‹line number› with ‹increment› after each entered line number. Use '''[ESC]''' to leave AUTO mode. Default values for ‹line number› and ‹increment› are 10.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;AUTO 100,5 :REM generates line numbers 100, 105, 110...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BORDER ‹colour›[,‹colour›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Changes the colour of the border. If the second argument is supplied the border flashes between the two colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CALL ‹address expression›[,‹list of: parameter›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Allows a machine code routine to be called by BASIC. Variables, string values and constants can be passed to the routine. Values of any supported type can be passed back by supplying a variable with &amp;lt;code&amp;gt;@&amp;lt;/code&amp;gt; in front of it. This passes the address of the variable to the routine although it doesn't implicitly know the data type.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;CALL 0 :REM resets the computer completely&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CAT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Displays the names of the files on the tape or disc. Tape files are displayed in the order they are encountered. Disc files are sorted alphabetically by ACSII code. Only files matching the current user are displayed. Files marked as system are not displayed.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;CAT :REM lists all disc files in alpha-numeric (ASCII) order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;|TAPE :CAT :REM lists names of all tape files in their storage order&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN ‹file name›[,‹line number expression›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Enables the specified program to be loaded and RUN automatically. If the optional parameter ‹line number expression› is specified, the program execution will commence from that line.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHAIN MERGE ‹file name›[,‹line number expression› | [,[‹line number expression›],DELETE ‹line number range›]] &amp;lt;/code&amp;gt;====&lt;br /&gt;
&lt;br /&gt;
:Loads the specified program from tape or disc, merges it into the program in memory, and starts execution of the merged program. The parameter &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; ‹line number range› is used to delete part of the original program before running it, if required.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLEAR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
: The command clear inside a subroutine (&amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;... &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt;) will also clear the &amp;quot;stack pointer&amp;quot; address of the gosub heap. That means that a RETURN won't work and a GOTO has to be used instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLG [‹masked ink›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the graphics screen to colour specified by &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt;. If parameter &amp;lt;code&amp;gt;‹masked ink›&amp;lt;/code&amp;gt; is not specified then the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any input file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Closes any output file (tape or disc).&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CLS [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: Clears the window specified by ‹stream expression›. If ‹stream expression› is omitted it defaults to #0 (usually the whole screen). The text cursor of the stream is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: CONTinues program execution interrupted either by [ESC] [ESC] or as a result of STOP within a program. A program cannot be continued after being modified.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CURSOR ‹expression› &amp;lt;/code&amp;gt;====&lt;br /&gt;
: &amp;lt;code&amp;gt;‹expression›&amp;lt;/code&amp;gt; must be either 0 or 1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DATA x1[,x2,x3...]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Defines a data ''section'' to be used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls.&lt;br /&gt;
: Data values can be of any type (integer, real or string) as long as the corresponding &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt; calls use a variable of the right type.&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA &amp;quot;Hello, world!&amp;quot;, 42&lt;br /&gt;
20 READ message$:PRINT message$&lt;br /&gt;
30 READ answer:PRINT &amp;quot;The answer is:&amp;quot;;answer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:''See also:'' &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: DEF means &amp;quot;define&amp;quot; and comes along with defining a function in case of DEF FN or defining variables in case of DEFREAL, DEFINT or DEFSTR.&lt;br /&gt;
: DEF FN must come before using the statement FN.&lt;br /&gt;
: DEF with a variable declaration should come before using a variable.&lt;br /&gt;
: (see also FN)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFINT ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Forces all variables(s) starting with the specified letter(s) to be integer variables. Singular letters could be defined or a range by a minus symbol between two letters.&lt;br /&gt;
&lt;br /&gt;
:Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
20 DEFINT a-z:' sets all variables starting with an A until Z as integer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DEFINT F,S ..... (or 10 DEFINT A-Z)&lt;br /&gt;
20 FIRST=111.11:SECOND=22.2&lt;br /&gt;
30 PRINT FIRST,SECOND:' prints out 111      22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFREAL ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to a floating point figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEFSTR ‹letter range›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets the default for variable(s) with the specified first letter(s) to string(s) variables.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to degrees mode for trigonometric functions (&amp;lt;tt&amp;gt;SIN&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;COS&amp;lt;/tt&amp;gt;...).&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DELETE [first line][-[last line]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Deletes the current program completely (without arguments) or only the given line or line range. Even&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE -&amp;lt;/code&amp;gt;&lt;br /&gt;
: is legal, it has the same effect as&lt;br /&gt;
: &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;&lt;br /&gt;
: The lines specified do not have to exist, all lines matching the range will be deleted and having no matches does not cause an error.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Disables interrupts (but not[ESC]) until re-enabled by EI command or by RETURN at end of an interrupts service routine.&lt;br /&gt;
: This means that DI (if it's activated in a subroutine) is useful helping a low-priority-interrupt not to be stopped by a higher-priority-interrupt. RETURN then re-enable the interrupt without EI.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DIM a[%|!|$](d1[,d2[,...]])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates array &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; with single or multiple dimensions. You may optionally specify integer (&amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;), real (&amp;lt;code&amp;gt;!&amp;lt;/code&amp;gt;) or string (&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;) type otherwise it defaults to the current type set for the first letter of the array name. &amp;lt;code&amp;gt;d1&amp;lt;/code&amp;gt; is size of first dimension-1, &amp;lt;code&amp;gt;d2&amp;lt;/code&amp;gt; is size of second dimension-1 and so on. &amp;lt;code&amp;gt;DIM x(10)&amp;lt;/code&amp;gt; will create an array with 11 elements, &amp;lt;code&amp;gt;x(0)&amp;lt;/code&amp;gt; is the first element, &amp;lt;code&amp;gt;x(10)&amp;lt;/code&amp;gt; is the eleventh and last. You can specify as many dimensions as will fit on one 255 character line, which is a maximum of 125. Trying to create an array that already exists will generate an &amp;lt;code&amp;gt;Array already dimensioned&amp;lt;/code&amp;gt; error. If an array is not specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; before being accessed, each dimension value defaults to 10. The maximum dimensions that can be created this way is three.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DRAW x,y[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the drawing style.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CLG 2&lt;br /&gt;
DRAW 500,400,0 :REM draws a line from 0,0 to 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DRAWR xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Draws a line from current graphics cursor position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as DRAW.&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Move 200,200&lt;br /&gt;
DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EDIT ‹line›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Display 1 program line for editing. &lt;br /&gt;
&lt;br /&gt;
The following keys can be used in editing mode, or during typing in BASIC:&lt;br /&gt;
&lt;br /&gt;
 CTRL+TAB - toggle overwrite/insert mode&lt;br /&gt;
 CTRL+CURSOR LEFT or CTRL+CURSOR UP - go to start of line&lt;br /&gt;
 CTRL+CURSOR RIGHT or CTRL+CURSOR DOWN - go to end of line&lt;br /&gt;
 CURSOR LEFT - move left one character&lt;br /&gt;
 CURSOR RIGHT - move right one character&lt;br /&gt;
 ESC - quit editing and do not accept changes&lt;br /&gt;
 ENTER/RETURN - quit editing and accept changes&lt;br /&gt;
 SHIFT + CURSOR UP/DOWN/LEFT/RIGHT - enter copy mode. You can move the cursor to where you want to copy from. Hold SHIFT and cursors to move copy cursor. &lt;br /&gt;
 COPY - copy character covered by copy cursor.&lt;br /&gt;
 DEL - delete character and go back a char&lt;br /&gt;
 CLR - delete character under cursor&lt;br /&gt;
 CTRL + CAPS LOCK - toggle shift lock.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;END&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENT ‹tone envelope number›[,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›][,‹tone env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENT command define the TONE shape of a sound which means manipulating the frequency in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENT NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ENV ‹volume envelope number›[,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›][,‹volume env. section›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:The ENV command define the VOLUME shape of a sound which means manipulating the loudness in a certain range.&lt;br /&gt;
:The command could looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV NUMBER,STEPS?,VERTICAL?,HORIZONTAL?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:It is possible to define 15 different envelope shapes. So '''NUMBER''' could be 1-15.&lt;br /&gt;
&lt;br /&gt;
:Each '''?''' stands for up to five sections (1-5), where each STEP&amp;lt;&amp;gt;VERTICAL&amp;lt;&amp;gt;HORIZONTAL with the same '''?''' are belong together.&lt;br /&gt;
&lt;br /&gt;
:'''STEP:''' means how many steps in each section (0-127) &amp;gt; one step is 1/100 of a second!&lt;br /&gt;
:'''VERTICAL''': means how big is the step size from bottom to top (-128 to 127)&lt;br /&gt;
:'''HORIZONTAL''': means how big is the step size from left to right (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERASE v1[% | ! | $][,v2[% | ! | $][,...]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Erases the specified array(s) and frees the memory used. Must specify existing array(s) or an &amp;lt;code&amp;gt;Improper argument&amp;lt;/code&amp;gt; error will be generated.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERL&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the line number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERROR i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EVERY i[,t] GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: BASIC branches to the subroutine at line ln EVERY (reccuring) i/50 seconds. (see also &amp;quot;AFTER i[,t] GOSUB line&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
: There are 4 delay timers from 0 to 3 which can be specified with ‹timer number›. If omitted ‹timer number› defaults to 0.&lt;br /&gt;
: In the case of parallel task has 3 the highest and 0 the lowest priority.&lt;br /&gt;
: With DI or EI you can disable or enable the timing interrupt. With REMAIN &amp;lt;timer number&amp;gt; you can also disable an AFTER or EVERY construct and stores the &amp;quot;remaining&amp;quot; time (&amp;gt; REMAIN)&lt;br /&gt;
: Interrupts run as long as the main loop / program runs, even the main programm is paused &amp;gt; press ESC only '''once''' not twice for a break.&lt;br /&gt;
: It is important to know or realise that low-priority-interrupts which occurs simultanously to higher-priority-interrupts are not lost. Their task remains or handled again after finishing the higher-prio interrupt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM &amp;gt; interrupts&lt;br /&gt;
20 EVERY 50,0 GOSUB 100: REM &amp;gt; lowest priority&lt;br /&gt;
30 EVERY 100,1 GOSUB 200&lt;br /&gt;
40 EVERY 200,2 GOSUB 300:&lt;br /&gt;
50 AFTER 1000,3 GOSUB 400: REM &amp;gt; highest priority&lt;br /&gt;
60 WHILE flag=0&lt;br /&gt;
70 a=a+1:print a&lt;br /&gt;
80 WEND&lt;br /&gt;
90 END&lt;br /&gt;
100 REM #0&lt;br /&gt;
110 PEN 2:PRINT &amp;quot;timer 0&amp;quot;:PEN 1&lt;br /&gt;
120 RETURN&lt;br /&gt;
200 REM #1&lt;br /&gt;
210 PEN 2:PRINT &amp;quot;timer 1&amp;quot;:PEN 1&lt;br /&gt;
220 RETURN&lt;br /&gt;
300 REM #2&lt;br /&gt;
310 PEN 2:PRINT &amp;quot;timer 2&amp;quot;:PEN 1&lt;br /&gt;
320 RETURN&lt;br /&gt;
400 REM #3&lt;br /&gt;
410 flag=1:PEN 2:PRINT &amp;quot;no more interrupts...&amp;quot;&lt;br /&gt;
420 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Hint: Timing with interrupts is important, especially if more than one interrupts run. If the interval of a subroutine driven by an interrupt is too long than the processor can never get back to deal the main program again. Work out timing by measuring the subroutine or by trial and error.&lt;br /&gt;
: There are system internal interrupts (highest level) which cannot be influenced by BASIC interrupts (e.g. keyboard scan &amp;gt; BREAK key.)&lt;br /&gt;
: The next level of sytem internal interrupts CAN be influenced by BASIC interrupts. For example the sound queue which will be created by &amp;quot;ON SQ &amp;lt;chanel&amp;gt; GOSUB &amp;lt;line&amp;gt;&amp;quot;. Those sound interrupts have an independent time tricker but their priority is parallel to the second priority times of BASICs interrupts. Therefore interrupts with timer 3 could &amp;quot;interrupt&amp;quot; them.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FILL i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Fills an area of a graphics screen i colour i (0-15). Default value of i is the current graphics pen colour. Only available in Basic 1.1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the&lt;br /&gt;
:program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN&lt;br /&gt;
:command should be written in part of the program outside the execution loop.&lt;br /&gt;
&lt;br /&gt;
:Syntax : &amp;lt;code&amp;gt;DEF FN&amp;lt;name&amp;gt;[(&amp;lt;formal parameters&amp;gt;)]=&amp;lt;general expression&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Example: ''&amp;quot;with the definition of...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 gn=9.80665&lt;br /&gt;
20 DEF FNgrv=s0+v0*t+0.5*gn*t^2&lt;br /&gt;
30 s0=0:v0=0:t=5&lt;br /&gt;
40 PRINT &amp;quot;...after&amp;quot;;t;&amp;quot;seconds your dropped stone falls&amp;quot;;FNgrv;&amp;quot;metres&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:''&amp;quot;the results are...&amp;quot;''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:...after 5 seconds your dropped stone falls 122.58315 metres&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FOR TO STEP NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.&lt;br /&gt;
: The loop consists of of following specifications:&lt;br /&gt;
&lt;br /&gt;
: 1. FOR&lt;br /&gt;
: 2. ''a control variable''&lt;br /&gt;
: 3. =&lt;br /&gt;
: 4. ''starting value''&lt;br /&gt;
: 5. TO&lt;br /&gt;
: 6. ''target value''&lt;br /&gt;
: 7. STEP [optional]&lt;br /&gt;
: 8. ''increment / step size''&lt;br /&gt;
: ''... instructions between''&lt;br /&gt;
: 9. NEXT&lt;br /&gt;
: 10. ''control variable'' [optional]&lt;br /&gt;
&lt;br /&gt;
: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.&lt;br /&gt;
: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time.&lt;br /&gt;
: The default STEP value - if not specified - is one (1).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FOR I=1 TO 10&lt;br /&gt;
20 PRINT I;&lt;br /&gt;
30 NEXT I&lt;br /&gt;
40 PRINT I&lt;br /&gt;
RUN&lt;br /&gt;
1   2   3   4   5   6   7   8   9   10   11&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRAME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Smooths character and graphics movement and reduces flicker (waits for a VSYNC signal). Only available in Basic 1.1. On a CPC 464 you can use CALL &amp;amp;BD19 instead.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOSUB i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;Calling subroutine&amp;quot;&lt;br /&gt;
20 GOSUB 100&lt;br /&gt;
30 PRINT &amp;quot;Back from subroutine&amp;quot;&lt;br /&gt;
40 END&lt;br /&gt;
100 REM Begin of the subroutine&lt;br /&gt;
110 PRINT &amp;quot;Subroutine started&amp;quot;&lt;br /&gt;
120 RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GOTO i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Jumps to the line number which is given as argument.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
20 REM not executed&lt;br /&gt;
30 REM not executed&lt;br /&gt;
100 PRINT &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: GOTO is the simplest form of a jump or creating a loop '''without''' condition controll.&lt;br /&gt;
: ''Example: (unconditional and endless loop)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;#&amp;quot;;&lt;br /&gt;
20 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Combine the GOTO command with an IF...THEN...ELSE instruction for creating a condition-controlled loop with the '''test at the end'''. Helpful because the Locomotive Basic has no practical DO...WHILE... loop.&lt;br /&gt;
: ''Example: (condition at the end)''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 I=1&lt;br /&gt;
20 PRINT I&lt;br /&gt;
30 I=I+1&lt;br /&gt;
40 IF I&amp;lt;25 THEN GOTO 20&lt;br /&gt;
50 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;GRAPHICS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...works only in combination with the command &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt; to set the plotting/drawing pen or background colour.&lt;br /&gt;
: If the &amp;lt;code&amp;gt;TAG&amp;lt;/code&amp;gt; command is used to set text at the graphics cursor &amp;lt;code&amp;gt;GRAPHICS PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GRAPHICS PAPER&amp;lt;/code&amp;gt; instead of the regular &amp;lt;code&amp;gt;PEN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;PAPER&amp;lt;/code&amp;gt;is necessary to colour the text.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;IF THEN ELSE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Asks for a choice with the '''IF...THEN...ELSE''' statement.&lt;br /&gt;
: '''IF''' compares the entry condition in a logical way&lt;br /&gt;
: '''THEN''' contains instruction if the comparison is true&lt;br /&gt;
: '''ELSE''' contains instruction if it's false.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In case of nested choices there's a possibility to that with an IF...THEN instruction but not very recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;guess a figure:&amp;quot;,f&lt;br /&gt;
20 IF f=10 THEN PRINT &amp;quot;right&amp;quot;: END: ELSE IF f&amp;lt;10 THEN PRINT &amp;quot;too small&amp;quot; ELSE PRINT &amp;quot;too big&amp;quot;&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Other nested structures like IF...THEN...'''ELSE...ELSE''' won't work first because the Locomotive Basic only looks after the first ELSE instruction found and can't execute more single commands as a block for a certain condition in comparision to e.g. &amp;quot;PASCAL&amp;quot; &amp;gt; begin...end-block, &amp;quot;C&amp;quot; &amp;gt; {...}-block.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INK ‹pen›,‹colour›,[‹second colour›]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to set the colour palette for each of the 16 available inks.&lt;br /&gt;
: pen specifies the pen slot to use.&lt;br /&gt;
: colour specifies the system colour to use (0..27.)&lt;br /&gt;
: if the second colour is provided, Locomotive Basic will blink between the colour and second colour.&lt;br /&gt;
: In MODE 0, all 16 pens are available. In MODE 1, only 4 pens are available (0..3). In MODE 2, only 2 pens are available (0..1.)&lt;br /&gt;
: By default, pen 0 is the background colour and pen 1 is the foreground/text colour.&lt;br /&gt;
: Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 INK 0,3: REM Set background colour to red&lt;br /&gt;
30 INK 1,26: REM Set foreground/text colour to white&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INPUT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;KEY&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LET&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Used to define variables. You don't need to use the ''LET'' command because it is just a command which was added for compatibility reasons.&lt;br /&gt;
: ''Example:''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 LET a$ = &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 PRINT a$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LINE INPUT [#‹stream expression›][,]‹variable›[,‹variable›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LIST [‹line number›][-[‹line number›]], [#‹stream expression›]&amp;lt;/code&amp;gt;====&lt;br /&gt;
: A command for listing the Basic program code.&lt;br /&gt;
: Possibility for manipulating display is using line numbers with a minus symbol.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line after line number 100.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST -100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line until line number 100 has reached.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 100-200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: List every line between line number 100 and 200 included&lt;br /&gt;
&lt;br /&gt;
: With the help of separate window definitions it is possible to print out long listings, better differentiate parts / slices of it into different window predefined&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LIST 1000-1100,#1&lt;br /&gt;
LIST 3000-3100,#2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...prints out two parts of one program out into two windows (if they are defined well)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOAD ‹file name›[,‹address›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOCATE[#‹stream expression›][,] x,y&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the text cursor to the x,y location. &lt;br /&gt;
&lt;br /&gt;
: x starts at 1 on the left and goes up to 20 (in mode 0), 40 (in mode 1) or 80 (in mode 2).&lt;br /&gt;
&lt;br /&gt;
: y starts at 1 at the top and ends at 25 at the bottom.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MASK [i1][,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Sets bits in each adjacent group of 8 pixel on (1) or off (0) according to binary value of i1 (0-255). i2 determines whether the first point of the line is to plotted (1) or not (0).&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 CLG 2:MASK 1:MOVE 0,0:DRAW 500,400&lt;br /&gt;
20 MASK 15:MOVE 0,0:DRAW 500,400&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MEMORY ‹memory address›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allocates the amount of memory to be used by BASIC by setting the [[Locomotive_BASIC#HIMEM|address of the highest byte]] it may use.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MID$ (‹string›,‹start position›[,‹length of substring›])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: With the MID$ command there are two applications possible:&lt;br /&gt;
&lt;br /&gt;
: 1. MID$ creates a new substring out of the give ‹string› and starts at the defined position ‹start position› and print the number of given characters by ‹length of substring›.&lt;br /&gt;
: If no length is defined every character from ‹start position› will be printed out.&lt;br /&gt;
: If a higher value of ‹start position› or ‹length of substring› than the real length of the initial string is defined a blank string will be printed.&lt;br /&gt;
: The range of ‹start position› or ‹length of substring› is from 0 up to 255 characters.&lt;br /&gt;
&lt;br /&gt;
: 2. With MID$ you're able to manipulates given strings by inserting a new string.&lt;br /&gt;
: Take care of the two different applications and using in BASIC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: Example for the 1. application:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 PRINT MID$(a$,2,2)&lt;br /&gt;
run&lt;br /&gt;
el&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:&lt;br /&gt;
: Example for the 2. application&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 a$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
20 MID$(a$,2,3)=&amp;quot;ipp&amp;quot;&lt;br /&gt;
30 PRINT a$&lt;br /&gt;
run&lt;br /&gt;
Hippo&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MODE&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160×200 in 16 colours, MODE 1 is 320×200 4 colours, MODE 2 is 640×200 2 colours and MODE 3 is 160×200 in 4 colours.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVE x,y [[,i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphic cursor to position x,y. The parameter i1 may be used to change the pen (drawing) colour. The parameter i2 specifies the logical colour, as in DRAW.&lt;br /&gt;
&lt;br /&gt;
: 4 drawing styles: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0 normal colour&lt;br /&gt;
i2 = 1 XOR colour&lt;br /&gt;
i2 = 2 AND colour&lt;br /&gt;
i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOVER xr,yr[,[i1][,i2]]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: moves the graphic cursor (relative) from current position to current cursor x position + xr, current cursor y position + yr. i1 and i2 as in MOVE.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NEW&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Clears BASIC RAM which means program and variables. Keeps symbol defintion (if defined) and screen mode without clearing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK CONT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Prevents the interruption of program execution by the ESC key.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK GOSUB ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes control to subroutine at line ln when ESC ESC pressed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON BREAK STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Restores normal function of ESC key during program execution.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON ERROR GOTO ln&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Passes the control to line ln if an error is detected in the program.&lt;br /&gt;
&lt;br /&gt;
: ON ERROR GOTO 0, Turns of the error trap, and restores normal error processing.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOTO ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices '''ON variable GOTO ln x1, x2, x3, x4, ...''' points to a table with the jumping target.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOTO 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:END&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:END&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON variable GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: In case of passing more choices targeting to SUBROUTINES '''ON variable GOSUB ln x1, x2, x3, x4, ...''' points to a jumping table.&lt;br /&gt;
: '''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 PRINT &amp;quot;1. LOAD - 2. SAVE - 3. EXIT&amp;quot;&lt;br /&gt;
20 INPUT choice&lt;br /&gt;
30 ON choice GOSUB 1000, 2000, 3000&lt;br /&gt;
40 CLS: GOTO 10&lt;br /&gt;
1000 PRINT &amp;quot;1. LOAD&amp;quot;:RETURN&lt;br /&gt;
2000 PRINT &amp;quot;2. SAVE&amp;quot;:RETURN&lt;br /&gt;
3000 END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:In case that the variable ''choice'' won't fullfil the condition (in a range between line 0 and 65535) the next instruction will be executed (here: Line 40). If &amp;quot;choice&amp;quot; is smaller than 0 an error will occur.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ON SQ(x) GOSUB ln x1, x2, x3, x4, ...&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:ON SQ(x) can trigger an interrupt when e.g. a space or free channel in queue.&lt;br /&gt;
:Using that command is a one way interrupt trigger and shouldn't be mixed with &amp;lt;code&amp;gt;EVERY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AFTER&amp;lt;/code&amp;gt; commands.&lt;br /&gt;
&lt;br /&gt;
:See also the &amp;lt;code&amp;gt;SQ(x)&amp;lt;/code&amp;gt; command for more details.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENIN ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for reading. It has to be an ASCII file. ( The command &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; closes reading data file. )&lt;br /&gt;
: Read from the file using &amp;lt;code&amp;gt;INPUT #9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OPENOUT ‹filename›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Opens the specified data file for writing. It writes an ASCII file. (To close writing use the command closein.)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ORIGIN x,y[,l,r,t,b]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The command defines the origin ('world reference point') for the graphics coordinate system. Normally the reference origin is in the left, bottom corner of the default screen and has 0,0. So the most left coordinate value could be by default 639 and the most top value 399. Independent from the actual modus (2, 1 or 0) the range for the x coordinate are always 640 points and for the y coordinate 400 points. In theory you are able to address 256,000 pixel but only 128,000 are visible due to the maximal resolution of the hardware.&lt;br /&gt;
: &amp;lt;code&amp;gt;x,y&amp;lt;/code&amp;gt; are the the new coordinates for the 'world reference '.&lt;br /&gt;
: &amp;lt;code&amp;gt;l,r,t,b&amp;lt;/code&amp;gt; are optional and set the borders for the new graphical window (works in the same way like the &amp;lt;code&amp;gt;WINDOW&amp;lt;/code&amp;gt; command for a text window). l,r,t,b means left, right, tob and bottom coordinates.&lt;br /&gt;
: If a new graphical window (borders) is defined every point or drawn line won't be plotted (clipped internally).  &lt;br /&gt;
&lt;br /&gt;
: Example (the line drawn will be cutted):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ORIGIN 320,200,250,450,100,300&lt;br /&gt;
DRAW 0,200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OUT ‹address›,‹value›&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Outputs a value (range of 0-255) to a specific I/O address.&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PAPER[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEN[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PLOTR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POKE add&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Alters contents of memory location add to value i (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PRINT[#‹stream expression›][,]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RAD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Switch to radians mode for trigonometric functions (&amp;lt;code&amp;gt;SIN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;COS&amp;lt;/code&amp;gt;...).&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;code&amp;gt;DEG&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RANDOMIZE [seed]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the pseudo-random generator to the given seed (starting value of the 'random' series). What is strange is that if no seed is given, one is interactively prompted for.&lt;br /&gt;
&lt;br /&gt;
: A common idiom to have a ''random'' random seed is to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;RANDOMIZE TIME&amp;lt;/code&amp;gt; isn't still a 'real' random number but to hit the same series again is pretty hard due to the time elapsed.&lt;br /&gt;
: The algorithm used for randomizing is the following: the generator starts with the seed, adds 1, multiplies by 75 (fiddle factor), divides by 65537 and then uses the remainder -1.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;READ variable&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands), stores it in the given variable and moves to the next item.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;RESTORE&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RELEASE chanel&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Releases a sound which was hold on (by a SOUND command) before. It uses the same bit matrix like the SOUND command for the first parameter&lt;br /&gt;
# (&amp;amp;x00000001) releases chanel A&lt;br /&gt;
# (&amp;amp;x00000010) releases chanel B&lt;br /&gt;
# (&amp;amp;x00000011) releases chanel A and B&lt;br /&gt;
# (&amp;amp;x00000100) releases chanel C&lt;br /&gt;
# (&amp;amp;x00000101) releases chanel A and C&lt;br /&gt;
# (&amp;amp;x00000110) releases chanel B and C&lt;br /&gt;
# (&amp;amp;x00000111) releases chanel A, B and C&lt;br /&gt;
&lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 SOUND 65,1000,100&lt;br /&gt;
20 PRINT&amp;quot;PRESS R TO LET IT SOUND&amp;quot;&lt;br /&gt;
30 IF INKEY(50)=-1 THEN 30&lt;br /&gt;
40 RELEASE 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REM [any text]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RENUM [‹newLine›][,‹oldLine› | ,[‹oldLine›],‹step›] &amp;lt;/code&amp;gt;====&lt;br /&gt;
: Renumbers the lines of the current program.&lt;br /&gt;
&lt;br /&gt;
: By default, the whole program is renumbered starting at line 10 with multiples of ten. Any parameter that is left out defaults to 10. It is important to note that ''jumps'' (&amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; and the like) are automatically converted to the new line numbers.&lt;br /&gt;
&lt;br /&gt;
: The whole set of parameters can be used to renumber only the last part of a program.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 20&lt;br /&gt;
20 GOTO 30&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: becomes, after calling &amp;lt;code&amp;gt;RENUM 100,20,5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 GOTO 100&lt;br /&gt;
100 GOTO 105&lt;br /&gt;
105 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESTORE [line]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Resets the data pointer used by &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;. When used without parameters, resets the pointer to the first data in the program. Otherwise, resets the pointer to the given line number.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 DATA 10,11,12,13,14&lt;br /&gt;
20 DATA 20&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 11&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 10&lt;br /&gt;
Ready&lt;br /&gt;
RESTORE 20&lt;br /&gt;
Ready&lt;br /&gt;
READ i:PRINT i&lt;br /&gt;
 20&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: ''See also:'' &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;READ&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RESUME [line] or NEXT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command causes the program to resume after an error code  and if it is interrupted by an '''ON ERROR GOTO''' jump&lt;br /&gt;
: So it can either resume&lt;br /&gt;
*(if there's no line number stated) at the same line after error code (and if there are more statements in one line)&lt;br /&gt;
or&lt;br /&gt;
* at the line number stated (optional)&lt;br /&gt;
or&lt;br /&gt;
* with the NEXT parameter (optional) ... at the line followed by the error line&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Terminates a subroutine and returns control to the line following the GOSUB call (see GOSUB)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RUN [line] or &amp;quot;filename&amp;quot;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
:Runs the current program, optionally starting at a given line. If no line number is given, starts at the first line.&lt;br /&gt;
&lt;br /&gt;
:If a string is used after RUN command a programm will be loaded and executed from storage medium (e.g. Tape, Disc). With that command protected BASIC programs can be executed.&lt;br /&gt;
&lt;br /&gt;
:Exampel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUN&amp;quot;disc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SAVE &amp;quot;filename&amp;quot; [,filetype][,paramter1,parameter2,parameter3]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Command saves the current BASIC program / content from RAM onto a storage medium (e.g. Tape, Disc)&lt;br /&gt;
&lt;br /&gt;
: Filetype could be:&lt;br /&gt;
* ''',A''' for a ASCII file&lt;br /&gt;
* ''',B''' for a binary file (store RAM content as it is)&lt;br /&gt;
* ''',P''' for a regular, ''protected'' BASIC file&lt;br /&gt;
: without that parameter the content will be stored as a regular BASIC file&lt;br /&gt;
&lt;br /&gt;
:The three parameters after filetype could be used in combination with the binary filetype (,B).&lt;br /&gt;
* '''''parameter1''''' defines the starting address of memory range&lt;br /&gt;
* '''''parameter2''''' defines the length (range of memory)&lt;br /&gt;
* '''''parameter3''''' defines the entry point (optional)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SOUND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: the SOUND command has following shape:&lt;br /&gt;
: SOUND '''C'''hannel,'''P'''eriod,'''D'''uration,'''V'''olume,Volume-'''Env'''elope,'''T'''one-'''En'''velope,'''N'''oise&lt;br /&gt;
&lt;br /&gt;
:'''C:''' Selecting channel is done bitwise (combinations are possible of course):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 0) &amp;amp;x00000001 = 1 = channel A (middle)&lt;br /&gt;
(Bit 1) &amp;amp;x00000010 = 2 = channel B (left)&lt;br /&gt;
(Bit 2) &amp;amp;x00000100 = 4 = channel C (right)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:more function about channel are&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Bit 3) &amp;amp;x00001000 = 8 = Rendezvous with channel A&lt;br /&gt;
(Bit 4) &amp;amp;x00010000 = 16 = Rendesvous with channel B&lt;br /&gt;
(Bit 5) &amp;amp;x00100000 = 32 = Rendesvous with channel C&lt;br /&gt;
(Bit 6) &amp;amp;x01000000 = 64 = Hold&lt;br /&gt;
(Bit 7) &amp;amp;x10000000 = 128 = Flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:'''P:''' the period number can be a figure between 0 and 4095 (2^12-1... 12 means that we have 12 tones (inclusive half-tones) in nine octaves on the CPC in sum and their distance between is the twelves square root of two), where 8 octaves are available. E.g. Octave 0 starts on middle C with number 478.&lt;br /&gt;
: To calculate the period you can use following formula: '''period=1,000,000/(16*frequency)''' or in short '''period=(65,000/frequency)'''&lt;br /&gt;
: (e.g. the note &amp;quot;A&amp;quot; with the frequency 440 Hz has the period 142 on the CPC)&lt;br /&gt;
&lt;br /&gt;
:'''D:''' the duration of the note is measured in 1/100th of a second and can be any positive number in the range 1-32,767. 0 and negative number are in combination with ENT and ENV commands usefull. A negative number means repititions.&lt;br /&gt;
&lt;br /&gt;
:'''V:''' the volume number range from 0-7 on a CPC 464 (BASIC 1.0) or 0-15 on a CPC664/6128 (BASIC 1.1)&lt;br /&gt;
&lt;br /&gt;
:'''ENV:''' and '''ENT:''' For shaping the sound ENV (Volume) and ENT (Frequency) commands are available. The relation between SOUND and those commands comes with a figure between 1 to 15 for ENV (5th parameter) and 1 to 15 for ENT (6th parameter).&lt;br /&gt;
&lt;br /&gt;
:'''N:''' the seventh parameter can be used for blending in noise between the range of 0-15 (BASIC 1.0) or 0-30 (BASIC 1.1). The higher the number the 'deeper' or 'dirty' is the noise.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPC &amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: in conjunction with PRINT the SPC command prints out a certain number (n) of spaces.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT &amp;quot;Hello&amp;quot;;SPC(10);&amp;quot;World&amp;quot;;&lt;br /&gt;
Hello          World&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPEED &amp;lt;n1,n2&amp;gt; &amp;lt;/code&amp;gt; ====&lt;br /&gt;
: ...in conjunction with the INK command SPEED defines the frequency of colour changes if a colour change was defined. The duration is calculated by n1=... or n2 =duration/50 seconds.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1,2,3, = A, B, C&lt;br /&gt;
&lt;br /&gt;
:Bits 0,1 and 2     Number of free entries in the queue&lt;br /&gt;
:Bits 3,4 and 5     Redezvous state at head of the queue&lt;br /&gt;
:Bit 6              Head of the queue is held&lt;br /&gt;
:Bit 7              Channel is currently active&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Breaks program execution at line containing the STOP statement. The message '''BREAK in''' is output with the line number.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SWAP&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: SWAP works only in combination with the window command. Every error or status messages from the operating system will be displayed normaly on WINDOW#0 (=''main'' window). WINDOW SWAP changes the ''main'' window to the desired target window.&lt;br /&gt;
: Example (if a window with number 4 was defined before...):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WINDOW SWAP 0,4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Redefines the appearance of the character at index n.&lt;br /&gt;
: Each of the following eight integers defines the contents of one pixel row, starting at the top of the character.&lt;br /&gt;
: Each character fits in an 8x8 pixel grid.&lt;br /&gt;
: Missing lines are considered as empty.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYMBOL 255,255,129,129,129,129,129,129,255&lt;br /&gt;
PRINT CHR$(255)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Defines character 255 to look like an empty square and prints it.&lt;br /&gt;
&lt;br /&gt;
: Initially, only characters with indices ranging from 240 to 255 can be redefined.&lt;br /&gt;
: See also &amp;lt;tt&amp;gt;SYMBOL AFTER&amp;lt;/tt&amp;gt; to allow redefinition of arbitrary characters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SYMBOL AFTER n&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Allows the redefinition of character symbols from index n included. &lt;br /&gt;
&lt;br /&gt;
: Symbol redefinitions are made using the SYMBOL command above.&lt;br /&gt;
: Initially, only symbols from index 240 to 255 can be redefined. This initial situation can be restored with &amp;lt;tt&amp;gt;SYMBOL AFTER 240&amp;lt;/tt&amp;gt;. Symbol previously redefined are restored to their original appearance.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAB&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAG [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Allows text to print at graphics cursor position.&lt;br /&gt;
: see TAGOFF&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAGOFF [#st]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Directs text to stream st printing it at previous text cursor position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TROFF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns off the program flow trace (see TRON)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TRON&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Turns on the program flow trace for debugging. Causes the line number of each statement executed to be displayed.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;USING&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: The USING assignement defines the format of the PRINT output. Its appointment happens by characters where each has a certain meaning.&lt;br /&gt;
&lt;br /&gt;
'''Numbers / Figures'''&lt;br /&gt;
: the character: &lt;br /&gt;
:'''#''' stands for a figure between 0 - 9&lt;br /&gt;
:'''.''' stands for a decimal point&lt;br /&gt;
:'''+''' generates a positive sign if the value is positive&lt;br /&gt;
:'''-''' generates a negative sign if the value is nagative&lt;br /&gt;
:'''**''' generates a asterix for each empty &amp;quot;location&amp;quot; before the printed character&lt;br /&gt;
:'''$$''' generates a Dollar characters before the printed character (the same with the pound note)&lt;br /&gt;
:''',''' generates a comma every each three decimals (thousands per figure) and has to be set before the decimal point or at the end if without a decimal point.&lt;br /&gt;
:^ generates a scientific notation (with exponents) and a the end of the format appointment&lt;br /&gt;
&lt;br /&gt;
'''Strings'''&lt;br /&gt;
: the character:&lt;br /&gt;
:'''!''' prints out only the first character&lt;br /&gt;
:'''\xxx\''' prints out only with x-numbers defined length of the string (from left to right). x means a blank sign made with the space bar&lt;br /&gt;
:'''&amp;amp;''' the whole string is printed out as given (unknown function)&lt;br /&gt;
&lt;br /&gt;
: a print output (numbers) with &amp;quot;%&amp;quot; in the beginning shows that not enough positions has to be declared (at all or before the decimal point).&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 figure=123456789&lt;br /&gt;
20 word$=&amp;quot;Hello&amp;quot;&lt;br /&gt;
30 print using &amp;quot;+**,##########&amp;quot;;figure&lt;br /&gt;
40 print using &amp;quot;\   \&amp;quot;;word$&lt;br /&gt;
&lt;br /&gt;
creates following output:&lt;br /&gt;
&lt;br /&gt;
*****+12,345,679&lt;br /&gt;
Hel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WAIT add, i1[,i2]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Waits until the I/O port at add returns a value (0-255). The value returned is XORed with i2 and the ANDed with i1. This is repeated until a non-zero result occurs.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WHILE WEND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WIDTH&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WINDOW[#‹stream expression›],[L],[R],[T],[B]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: It is possible to define in BASIC eight (8) independent windows for text output. Overlapping is possible.&lt;br /&gt;
&lt;br /&gt;
: #STREAM: eight window are possible. No. zero (0) is the main window where error or status messages were put out by default.&lt;br /&gt;
: each position is included inside the window&lt;br /&gt;
: L = left column / R = right column (dependent of the mode 0 = 20 / 1 = 40 / 2 = 80)&lt;br /&gt;
: T = top row / B = bottom row (always from 1 to 25)&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MODE 1&lt;br /&gt;
WINDOW#1,1,40,1,6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: ...defines the first top quarter of the screen for window No. 1&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;WRITE [#st,] v[$], v[$]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Writes the values of the specified variable to the specified stream.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENOUT &amp;quot;DUMMY&amp;quot;&lt;br /&gt;
20 INPUT A$,A&lt;br /&gt;
30 WRITE #9,A$,A&lt;br /&gt;
40 CLOSEOUT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ZONE i&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Changes the width of the print zone. Default is 13.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 MODE 2&lt;br /&gt;
20 PRINT&amp;quot;normal zone (13)&amp;quot;&lt;br /&gt;
30 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
normal zone(13)&lt;br /&gt;
1           2            3            4&lt;br /&gt;
READY&lt;br /&gt;
20 PRINT&amp;quot;now with different zone(5)&amp;quot;&lt;br /&gt;
30 ZONE 5&lt;br /&gt;
40 PRINT 1,2,3,4&lt;br /&gt;
RUN&lt;br /&gt;
now with different zone(5)&lt;br /&gt;
1     2     3     4&lt;br /&gt;
READY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
: A logical status in Locomotive Basic will be represented by a &amp;quot;-1&amp;quot; for TRUE and by a &amp;quot;0&amp;quot; for FALSE.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT (1=1)&lt;br /&gt;
-1&lt;br /&gt;
PRINT (1=2)&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the AND Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
TRUE	FALSE	FALSE&lt;br /&gt;
FALSE	TRUE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT 128 AND 64&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: looking at the BIT combination for a better understanding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	10000000&lt;br /&gt;
AND	01000000&lt;br /&gt;
================&lt;br /&gt;
=	00000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: even in BASIC it is possible to manipulate single BITs although there are no special commands but AND, OR and XOR.&lt;br /&gt;
: first an example for a loop with an increasing counter WITHOUT an AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=counter+1&lt;br /&gt;
30 IF counter=32 THEN counter=0&lt;br /&gt;
40 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: then a shorter example WITH and AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 counter=0&lt;br /&gt;
20 counter=(counter+1) AND 31&lt;br /&gt;
30 GOTO 20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: in the second example all more significant BITs will be deleted (a common method in assembler programming)&lt;br /&gt;
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127&lt;br /&gt;
==== &amp;lt;code&amp;gt;MOD&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;NOT&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: '''NOT''' executes a bit for bit '''negation''' of the current value. The output is a 16-Bit-Word.&lt;br /&gt;
:&lt;br /&gt;
:'''Example:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 value2=NOT value1&lt;br /&gt;
30 PRINT value2&lt;br /&gt;
run&lt;br /&gt;
-2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:for a better understanding...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 value1=1&lt;br /&gt;
20 PRINT HEX$(value1):PRINT BIN$(value1,8)&lt;br /&gt;
30 value2=NOT value1&lt;br /&gt;
40 PRINT HEX$(value2):PRINT BIN$(value2,8)&lt;br /&gt;
run&lt;br /&gt;
1&lt;br /&gt;
00000001&lt;br /&gt;
FFFE&lt;br /&gt;
1111111111111110&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the OR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	TRUE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== &amp;lt;code&amp;gt;XOR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Possible combinations with the XOR Function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NPUT1	INPUT2	OUTPUT&lt;br /&gt;
======================&lt;br /&gt;
TRUE	TRUE	FALSE&lt;br /&gt;
FALSE	TRUE	TRUE&lt;br /&gt;
TRUE	FALSE	TRUE&lt;br /&gt;
FALSE	FALSE	FALSE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ABS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value, that means a negative value will be changed in a positive one.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-67.98)&lt;br /&gt;
 67.98&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ASC (s)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns ASCII code number of first character of string s&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ATN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;BIN$ (i1,[i2])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns binary representation of i1 between -32768 and 65535. The number of binary digits (0s and 1s) is specified by i2 (0-16)&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CHR$ (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the character for a given index n. For instance CHR$(65) returns the character 'A'. Valid indices range from 0 (zero) to 255.&lt;br /&gt;
&lt;br /&gt;
: As an example, try the following basic program :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;10 print chr$(208+rnd(2));:goto 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: It will draw a random maze with characters 208 and 209, which are an horizontal and a vertical bar.&lt;br /&gt;
:&lt;br /&gt;
:The CHR$ code between 0 and 31 will not print out a character but perform a function:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===============================================================================&lt;br /&gt;
|  VALUE    | NAME   | PARAMETERS   | EFFECT                                  |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| DEC | HEX |        |              |                                         |&lt;br /&gt;
===============================================================================&lt;br /&gt;
| 0   | &amp;amp;00 | NUL    | NONE         | DOES NOTHING                            |&lt;br /&gt;
| 1   | &amp;amp;01 | SOH    | 0-255        | PRINTS CHARACTER TO SCREEN              |&lt;br /&gt;
| 2   | &amp;amp;02 | STX    | NONE         | TURNS TEXT CURSOR OFF                   |&lt;br /&gt;
| 3   | &amp;amp;03 | ETX    | NONE         | TURNS TEXT CURSOR ON IN IMMEDIATE       |&lt;br /&gt;
|     |     |        |              | MODE                                    |&lt;br /&gt;
| 4   | &amp;amp;04 | EOT    | 0-2          | SET SCREEN MODE                         |&lt;br /&gt;
| 5   | &amp;amp;05 | ENQ    | 0-255        | PRINT CHARACTER AT GRAPHICS CURS.       |&lt;br /&gt;
| 6   | &amp;amp;06 | ACK    | NONE         | TURNS ON TEXT SCREEN (SEE ALSO CHR$(21))|&lt;br /&gt;
| 7   | &amp;amp;07 | BEL    | NONE         | MAKE A SHORT BEEP                       |&lt;br /&gt;
| 8   | &amp;amp;08 | BS     | NONE         | MOVES TEXT CURSOR BACK ONE CHARACTER    |&lt;br /&gt;
| 9   | &amp;amp;09 | TAB    | NONE         | MOVES TEXT CURSOR FORWARD ONE CHARACTER |&lt;br /&gt;
| 10  | &amp;amp;0A | LF     | NONE         | MOVES TEXT CURSOR DOWN ONE CHARACTER    |&lt;br /&gt;
| 11  | &amp;amp;0B | VT     | NONE         | MOVES TEXT CURSOR UP ONE CHARACTER      |&lt;br /&gt;
| 12  | &amp;amp;0C | FF     | NONE         | CLEARS SCREEN OR WINDOWS (= CLS)        |&lt;br /&gt;
| 13  | &amp;amp;0D | CR     | NONE         | MOVES CURSOR TO LEFT EDGE OF WINDOW ON  |&lt;br /&gt;
|     |     |        |              | CURRENT LINE                            |&lt;br /&gt;
| 14  | &amp;amp;0E | SO     | 0-15         | SETS PAPER COLOUR                       |&lt;br /&gt;
| 15  | &amp;amp;0F | SI     | 0-15         | SETS PEN COLOUR                         |&lt;br /&gt;
| 16  | &amp;amp;10 | DLE    | NONE         | DELETES CHARACTER UNDER TEXT CURSOR     |&lt;br /&gt;
| 17  | &amp;amp;11 | DC1    | NONE         | CLEARS LINE FROM LEFT OF WINDOW UP TO   |&lt;br /&gt;
|     |     |        |              | AND INCLUDING CURRENT CHARACTER         |&lt;br /&gt;
| 18  | &amp;amp;12 | DC2    | NONE         | CLEARS FROM CURRENT CHARACTER TO RIGHT  |&lt;br /&gt;
|     |     |        |              | EDGE OF THE WINDOW                      |&lt;br /&gt;
| 19  | &amp;amp;13 | DC3    | NONE         | CLEARS FROM START OF WINDOW UP TO AND   |&lt;br /&gt;
|     |     |        |              | INCLUDING CURRENT CHARACTER             |&lt;br /&gt;
| 20  | &amp;amp;14 | DC4    | NONE         | CLEARS FROM CURRENT CHARACTER TO END OF |&lt;br /&gt;
|     |     |        |              | WINDOW                                  |&lt;br /&gt;
| 21  | &amp;amp;15 | NAK    | NONE         | TURNS OFF TEXT SCREEN (SEE ALSO CHR$(6))|&lt;br /&gt;
| 22  | &amp;amp;16 | SYN    | 0 AND 1      | TURNS TRANSPARENT OPTION OFF AND ON     |&lt;br /&gt;
| 23  | &amp;amp;17 | ETB    | 0-3          | SET GRPAHICS PLOTTING MODE              |&lt;br /&gt;
| 24  | &amp;amp;18 | CAN    | NONE         | CHANGE TO INVERSE CHARACTER DISPLAYING  |&lt;br /&gt;
| 25  | &amp;amp;19 | EM     | NINE PARAM.  | DEFINES A CHARACTER (= SAME AS SYMBOL)  |&lt;br /&gt;
|     |     |        | EACH 0-255   |                                         |&lt;br /&gt;
| 26  | &amp;amp;1A | SUB    | FOUR PARAM.  | DEFINES A TEXT WINDOW (=SAME AS WINDOW) |&lt;br /&gt;
|     |     |        | 1-80, 1-80   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
|     |     |        | 1-25, 1-25   | FROM LEFT, RIGHT, TOP TO BOTTOM         |&lt;br /&gt;
| 27  | &amp;amp;1B | ESC    | NONE         | DOES NOTHING ON SCREEN (PRINTER SIGNAL) |&lt;br /&gt;
| 28  | &amp;amp;1C | FS     | THREE PARAM. | SETS INK COLOUR TO FLASH BETWEEN TWO    |&lt;br /&gt;
|     |     |        | 0-15, 0-32   | INK NO, COLOUR 1, COLOUR 2              |&lt;br /&gt;
|     |     |        | 0-32         |                                         |&lt;br /&gt;
| 29  | &amp;amp;1D | GS     | TWO PARAM.   | SETS BORDER COLOUR TO FLASH BETWEEN TWO |&lt;br /&gt;
|     |     |        | 0-31, 0-31   | COLOURS                                 |&lt;br /&gt;
| 30  | &amp;amp;1E | RS     | NONE         | HOMES CURSOR TO TOP LEFT OF SCREEN      |&lt;br /&gt;
| 31  | &amp;amp;1F | US     | TWO PARAM.   | MOVES CURSOR TO CELL SPECIFIED BY TWO   |&lt;br /&gt;
|     |     |        | 1-80, 1-25   | PARAMETERS (=SAME AS LOCATE)            |&lt;br /&gt;
===============================================================================&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CINT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns rounded up integer value of n between -32768 and 32767.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT CINT(3.8) - print 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COPYCHR$ (st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Copies character from current position in specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;COS (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns cosine of n in degrees or radians (se DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;CREAL (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Converts integer n to real numeric variable.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DEC$(n, format)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Retruns the decimal string representation of n, according to the specified format (see PRINT USING)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;DERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives the most recent error code number returned by [[Amsdos]].&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EOF&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checks to see if end of specified file has been reached during input. Returns 0 (false) until the end of file, then -1 (true)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: This example reads a file from disc and print it out on screen. Like the &amp;quot;TYPE&amp;quot; command in CP/M or &amp;quot;|TYPE,file&amp;quot; of the UTOPIA-ROM.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 OPENIN &amp;quot;text.txt&amp;quot;&lt;br /&gt;
20 WHILE NOT EOF&lt;br /&gt;
30 LINE INPUT#9,a$&lt;br /&gt;
40 PRINT a$&lt;br /&gt;
50 WEND&lt;br /&gt;
60 CLOSEIN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the error code number of the last error encountered.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;EXP (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the result of calculating e to the power i.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT EXP(1) - prints 2.71828183&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FIX (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Removes the fractional part of n (see INT)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;FRE (n/st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, if the argument in brackets is a string, BASIC also performs a memory cleanup.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(0) or PRINT FRE(&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HEX$ (i1, i2)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a string hexadecimal digit representation of i1 (0-65535). The number of hex digits in the string is given by i2 (0-15)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;HIMEM&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns address of the highest memory address used by BASIC.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Checks to see if key number i is being pressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Value returned          [SHIFT]        [CTRL]       Specified key&lt;br /&gt;
-1                      ignored        ignored      up&lt;br /&gt;
0                       up             up           down&lt;br /&gt;
32                      down           up           down&lt;br /&gt;
128                     up             down         down&lt;br /&gt;
160                     down           down         down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INKEY$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Checkts the keyboard and returns the string character of the key pressed. The string character returned is normally assigned to a string variable. If no key pressed, a null string is returned.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INP (‹address›)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a value read from the defined I/O address&lt;br /&gt;
: Watch out http://cpcwiki.eu/index.php/I/O_Port_Summary&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INP(&amp;amp;FF00)&lt;br /&gt;
255&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INSTR ([‹startposition›,]‹explored string›,‹seeking string›)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
: This function looks inside &amp;quot;explored string&amp;quot; after &amp;quot;seeking string&amp;quot; and return a number where the found string appear for the first time.&lt;br /&gt;
: Returns zero if not successfull.&lt;br /&gt;
: Startposition could be a figure between 1 and 255.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;ABCD&amp;quot;:PRINT INSTR(a$,&amp;quot;C&amp;quot;) &lt;br /&gt;
3&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 2. Example&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a$=&amp;quot;Hello&amp;quot;:IF INSTR(a$,&amp;quot;i&amp;quot;)&amp;lt;&amp;gt;0 THEN PRINT &amp;quot;no&amp;quot; else a$&lt;br /&gt;
no&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;INT (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: As in FIX if n is positive; if n is negative, it rounds it down.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT INT(3.99), INT(-3.99) - prints 3                      -4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;JOY (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns bit-significant value from specified joystick. i = 0 or 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bit             Value returned&lt;br /&gt;
0(up)                  1&lt;br /&gt;
1(down)                2&lt;br /&gt;
2(left)                4&lt;br /&gt;
3(right)               8&lt;br /&gt;
4(fire 2)              16&lt;br /&gt;
5(fire 1)              32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEFT$ (se, i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of se. The substring begins at the left-most character of se and contains i characters.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A$=&amp;quot;ABCDEFG&amp;quot;:PRINT LEFT$(A$,3) - prints ABC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LEN (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the number of characters in se (0 - 255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the natural logarithm (to base e) of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOG10 (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the logarithm to base 10 of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;LOWER$ (se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a copy of se in which all alphabetical characters are converted to lower case (see also UPPER)&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT LOWER$(&amp;quot;A1B2c3&amp;quot;) - print a1b2c3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MAX (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the maximum value from the given list.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT MAX(3,8,25,1,2,9) - prints 25&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;MIN (list of n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the minimum value from the given list (see MAX)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PEEK (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the contents of the specified memory location (0-65535)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;PI&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns value of PI (3.14159265)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;POS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns column number of print position relative to left edge of text window on stream st. st must be  specified.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT POS(#0) - prints 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;REMAIN (i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns count remaining in delay timer i (0-3) then disables it.&lt;br /&gt;
: For the reason that REMAIN is no normal command but a &amp;quot;function&amp;quot; it is necessary in case of a proper functionality to link the command.&lt;br /&gt;
: a example in combination with an interrupt delay timer 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT REMAIN(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or to stop several/all interrupts at the same time...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=REMAIN(0)=REMAIN(1)=REMAIN(2)=REMAIN(3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RIGHT$ (se,i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns a substring of length i (0-255) characters from se, ending at the rightmost character of se.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RIGHT$(&amp;quot;ABCDEFG&amp;quot;,3) - prints EFG&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;RND [(n)]&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Generates the next random number between 0 and 1 (exklusiv) in the current squence if n is positive or omitted.&lt;br /&gt;
&lt;br /&gt;
: If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.536703827&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(1)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
PRINT RND(0)&lt;br /&gt;
 0.271940658&lt;br /&gt;
Ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating an integer random number between 1 and 1000&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 A=INT((RND(1)*1000)+1)&lt;br /&gt;
20 PRINT A&lt;br /&gt;
30 GOTO 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Exampel for generating a random number between a lower and higher border&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 INPUT &amp;quot;Low border&amp;quot;,low&lt;br /&gt;
20 INPUT &amp;quot;High border&amp;quot;,high&lt;br /&gt;
30 A=INT(RND(1)*(high-low))+low&lt;br /&gt;
40 PRINT A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ROUND (n[,i1])&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Rounds n to a number of decimal places or to the power of ten specified by i. If i is negative, the n is rounded to give an absolute integer with i zeros before the decimal point.&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SGN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SIN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SPACE$(i)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Creates a string containing i spaces (0-255)&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQ (channel)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns a bit significant integer showing state of the sound queue for specified channel where channel 1, 2, 3 = A, B, C.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bits 0,1 and 2     number of free entries in the queue&lt;br /&gt;
Bits 3,4 and 5     redezvous state at head of the queue&lt;br /&gt;
Bit 6              head of the queue is held&lt;br /&gt;
Bit 7              channel is currently active&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;SQR (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STR$(n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the string representation of number n.&lt;br /&gt;
: Useful for converting a number to a string in case of string manipulation. E.g. after converting a figure to a string then the most left character holds the sign: a minus in case the figure is negative and a space in case the figure is positiv.&lt;br /&gt;
: Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 FIGURE=-1599&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
-1599&lt;br /&gt;
&lt;br /&gt;
10 FIGURE=1769&lt;br /&gt;
20 FIGURE$=STR$(FIGURE)&lt;br /&gt;
30 PRINT FIGURE$&lt;br /&gt;
 1769&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (there's a blank on the left-hand of the number &amp;quot;1769&amp;quot;)&lt;br /&gt;
: If you want to add e.g. zero before the figure in case of a high score with fix digit-number then you're able to add zero(s) in front of a string instead of a figure.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;STRING$&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns i copies of the string character specified by s.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT STRING$(3,&amp;quot;*&amp;quot;) - prints ***&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TAN (n)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the tangent of n. The DEG and RAD commands can be used to force the result to either mode.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TEST (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y and returns the value of the ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TESTR (x,y)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Moves the graphics cursor by x and y relative to its current position and returns the value of ink at that position.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;TIME&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns time elapsed since the computer was switched on or reset.&lt;br /&gt;
: One second = TIME/300.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UNT (add)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns an integer(-32768 to 32767) which is the two's complement of add.&lt;br /&gt;
&lt;br /&gt;
: Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT UNT(&amp;amp;FF66) - prints -154&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;UPPER$(se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Gives copy of se with all alphabetic characters in upper case.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VAL(se)&amp;lt;/code&amp;gt;  ====&lt;br /&gt;
&lt;br /&gt;
:Returns the numeric value (including signs) of first numeric character(s) in se. Returns 0 if se starts with a non-number. &lt;br /&gt;
:Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT VAL(&amp;quot;-12.34x&amp;quot;),VAL(&amp;quot;A-12&amp;quot;) - prints -12.34     0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:Exception: if &amp;lt;se&amp;gt; starts with &amp;quot;&amp;amp;amp;&amp;quot; + character (and it's between &amp;quot;A&amp;quot; and &amp;quot;F&amp;quot;) the whole character will be handled like a hexadezimal numeric character (...often used in DATA Loaders). The returning numeric value is a &amp;amp;nbsp;signed&amp;amp;nbsp;integer (16-Bit Word). &lt;br /&gt;
&amp;lt;pre&amp;gt;PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;A&amp;quot;) - returns a 10&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;7FFF&amp;quot;) - returns a 32767&lt;br /&gt;
&lt;br /&gt;
PRINT&amp;amp;nbsp;VAL(&amp;quot;&amp;amp;amp;8000&amp;quot;) - returns a -32768&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;VPOS (#st)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Reports the current row (line) position of the text cursor relative to the top of the text windows of the specified stream.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;XPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current horizontal (x) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;YPOS&amp;lt;/code&amp;gt; ====&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;Error codes &amp;lt;/code&amp;gt; ====&lt;br /&gt;
# '''Unexpected NEXT''' - &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; encountered without matching &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Syntax Error''' - Typing error or incorrect punctuation.&lt;br /&gt;
# '''Unexpected RETURN''' - &amp;lt;code&amp;gt;RETURN&amp;lt;/code&amp;gt; encountered when there was no active &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''DATA exhaused''' - Trying to &amp;lt;code&amp;gt;READ&amp;lt;/code&amp;gt; data when data pointer has reached end of data.&lt;br /&gt;
# '''Improper argument''' - The argument for a function is not legal (e.g. &amp;lt;code&amp;gt;PRINT SQR(-10)&amp;lt;/code&amp;gt;).&lt;br /&gt;
# '''Overflow''' - The computer cannot handle integers smaller than -32768 (signed) or larger than 65535 (unsigned) or floating point numbers greater than &amp;amp;plusmn;1.7E38.&lt;br /&gt;
# '''Memory full''' - Not enough free RAM available to complete the operation. Program too big or control structures too deeply nested.&lt;br /&gt;
# '''Line does not exist''' - Attempt to &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;GOTO&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GOSUB&amp;lt;/code&amp;gt; a non-existent line number.&lt;br /&gt;
# '''Subscript out of range''' - Value of a subscript in an array is outside of range specified by &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt; declaration or wrong number of dimensions supplied.&lt;br /&gt;
# '''Array already dimensioned''' - Arrays can only be &amp;lt;code&amp;gt;DIM&amp;lt;/code&amp;gt;ensioned once within a program.&lt;br /&gt;
# '''Division by zero''' - Trying to divide a number by zero.&lt;br /&gt;
# '''Invalid direct command''' - Using a statement as a direct command which is not allowed outside a program, e.g. &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Type mismatch''' - Wrong data type encountered, string data instead of numeric value or vice versa.&lt;br /&gt;
# '''String space full''' - String memory area is full.&lt;br /&gt;
# '''String too long''' - String may not exceed 256 characters.&lt;br /&gt;
# '''String expression too complex''' - A string expression needs to be broken down into smaller expressions.&lt;br /&gt;
# '''Cannot CONTinue''' - &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; can only be used if program was stopped by [ESC] or a &amp;lt;code&amp;gt;STOP&amp;lt;/code&amp;gt; in program - not after END. If the program is modified before issuing &amp;lt;code&amp;gt;CONT&amp;lt;/code&amp;gt; you will also get this error.&lt;br /&gt;
# '''Unknown user function''' - A &amp;lt;code&amp;gt;DEF FN&amp;lt;/code&amp;gt; must be executed before calling an &amp;lt;code&amp;gt;FN&amp;lt;/code&amp;gt; function.&lt;br /&gt;
# '''RESUME missing''' - End of program has been reached while in error processing mode. Use &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''Unexpected RESUME''' - &amp;lt;code&amp;gt;RESUME&amp;lt;/code&amp;gt; is only used in error processing mode, &amp;lt;code&amp;gt;ON ERROR GOTO&amp;lt;/code&amp;gt; statement must be used first.&lt;br /&gt;
# '''Direct Command found''' - A line without a line number has found while loading a file.&lt;br /&gt;
# '''Operand missing''' - An incomplete expression has been found.&lt;br /&gt;
# '''Line too long''' - The line contains too many statements.&lt;br /&gt;
# '''EOF met''' - Trying to input data beyond end of data file.&lt;br /&gt;
# '''FILE type error''' - Using a program file instead of a data file to read or write (or vice versa).&lt;br /&gt;
# '''NEXT missing''' - The &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; of a &amp;lt;code&amp;gt;FOR&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;NEXT&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''File already open''' - Trying to open an open file. Use &amp;lt;code&amp;gt;CLOSEIN&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLOSEOUT&amp;lt;/code&amp;gt; first.&lt;br /&gt;
# '''Unknown command''' - Given when an unknown command follows a &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;. e.g. &amp;lt;code&amp;gt;|DISC&amp;lt;/code&amp;gt; on a CPC464 without AMSDOS installed.&lt;br /&gt;
# '''WEND missing''' - The &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; part of the &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt; ... &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; loop is missing.&lt;br /&gt;
# '''Unexpected WEND''' - &amp;lt;code&amp;gt;WEND&amp;lt;/code&amp;gt; encountered without a corresponding active &amp;lt;code&amp;gt;WHILE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# '''File not open''' - Attempting to read from or write to a file without &amp;lt;code&amp;gt;OPEN&amp;lt;/code&amp;gt;ing it first.&lt;br /&gt;
# '''Broken in''' - During handling with files (read, write, change etc.) different problems could appear. BASIC reacts with Error code 32 due to it. You have to mask the DERR code with AND &amp;amp;7F (mask Bit 7) and compare the result with the following table to get explained what happened:&lt;br /&gt;
:Decimal (binary) number:&lt;br /&gt;
*14 (0000 1110) Stream in an unclear condition&lt;br /&gt;
*15 (0000 1111) reached End of File (hard eof&lt;br /&gt;
*16 (0001 0000) &amp;gt; unknown command or filename&lt;br /&gt;
*17 (0001 0001) &amp;gt; there's already a file existing with the same name&lt;br /&gt;
*18 (0001 0010) &amp;gt; there's no file with that name&lt;br /&gt;
*19 (0001 0011) &amp;gt; full directory20 (0001 0100) &amp;gt; full disc&lt;br /&gt;
*21 (0001 0101) &amp;gt; disc was removed during reading&lt;br /&gt;
*22 (0001 0110) &amp;gt; only readable&lt;br /&gt;
*26 (0001 1010) &amp;gt; reached End of File (soft end)&lt;br /&gt;
:Does AMSDOS has already given out a failure then Bit 7 will be set. That means add 128 decimal to DERR code.&lt;br /&gt;
* '''Unknown error''' - Executing &amp;lt;code&amp;gt;ERROR&amp;lt;/code&amp;gt; command with any other legal error code number (up to 255).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects available for the CPC ==&lt;br /&gt;
&lt;br /&gt;
*[[BBC Basic]]&lt;br /&gt;
*[[C BASIC Compiler|CBASIC]]&lt;br /&gt;
*[[BASIC-E]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.cpctech.org.uk/docs/bastech.html Technical information at the Unofficial Amstrad WWW Resource]&lt;br /&gt;
* [http://www.sean.co.uk/books/amstrad/bforbasic.shtm Locomotive Basic Tutorial by Sean McManus]&lt;br /&gt;
* [http://rosettacode.org/wiki/Category:Locomotive_Basic Code examples at Rosetta Code]&lt;br /&gt;
&lt;br /&gt;
*  [http://cpctech.cpc-live.com/docs/basic.asm Disassembly of Locomotive BASIC v1.1]&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:BASIC| ]]&lt;br /&gt;
[[Category:CPC Internal Components]]&lt;br /&gt;
[[Category:Operating System| ]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Programming software| ]]&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=V9990&amp;diff=102250</id>
		<title>V9990</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=V9990&amp;diff=102250"/>
				<updated>2018-10-11T09:02:06Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==V9990==&lt;br /&gt;
&lt;br /&gt;
The V9990 E-VDP-III or 'Graphics 9000' is a Video Display Processor (VDP) by Yamaha which is based on an unreleased VDP (V9978) that was intended for the unreleased MSX3.&lt;br /&gt;
&lt;br /&gt;
This chip is available on graphics cards for the MSX and CPC.&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
Programming Documentation Manual for the V9990 VDP from Yamaha as a PDF.&lt;br /&gt;
&lt;br /&gt;
[[File:Yamaha v9990.pdf|thumbnail|Yamaha V9990 Manual]]&lt;br /&gt;
&lt;br /&gt;
==Technical==&lt;br /&gt;
&lt;br /&gt;
The official 'Application Manual' describes the V9990 ports, registers and commands. These additional notes apply to the V9990 used in the CPC Powergraph video board and explain details that are not clearly described or are omitted from the manual.&lt;br /&gt;
&lt;br /&gt;
* In the following &amp;quot;databus&amp;quot; means that the v9990 doesn't assert the bus, it doesn't provide data, so the value read is &amp;quot;floating-bus&amp;quot; or the value on the z80 databus at the time. More commonly on CPC it's &amp;amp;ff, but there are some configurations of CPC where this differs.&lt;br /&gt;
&lt;br /&gt;
* Reading from the Kanji ROM ports without a Kanji ROM returns databus values&lt;br /&gt;
&lt;br /&gt;
* Reading from the write only ports (or unused ports) returns databus values.&lt;br /&gt;
&lt;br /&gt;
* Palette red data has a mask of &amp;amp;9F (bits red and color key bit), blue and green have a mask of 0x01f.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,0&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 LD A,&amp;amp;FF ;; &amp;lt;- reading this component back returns &amp;amp;9F&lt;br /&gt;
 OUT (C),A &lt;br /&gt;
 LD A,&amp;amp;FF ;; &amp;lt;- reading this component back returns &amp;amp;1F&lt;br /&gt;
 OUT (C),A &lt;br /&gt;
 LD A,&amp;amp;FF ;; &amp;lt;- reading this component back returns &amp;amp;1F&lt;br /&gt;
 OUT (C),A &lt;br /&gt;
&lt;br /&gt;
* Bits 1,0 of R14 define a ternary counter. If counter is set to 3 then reads will return 0 and writes are ignored. If auto increment is enabled, it will increment as normal. When ternary counter is 2 or 3, then palette index will increment and ternary counter will go to 0.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,3&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 LD A,&amp;amp;FF &lt;br /&gt;
 OUT (C),A ;; write is not done.&lt;br /&gt;
&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,3&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 IN A,(C)  ;; read returns last value written to port&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,2&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 LD A,&amp;amp;FF &lt;br /&gt;
 OUT (C),A  ;; palette index will be 1, and ternary counter is 0.&lt;br /&gt;
&lt;br /&gt;
* If a command transfers data, and it requests data to be written to the command data port, then you can't use a read of this port to clear the data request. It must be a write. Similarly, if a command requests data to be read then you can use a write to clear the data request.&lt;br /&gt;
&lt;br /&gt;
* If you read from a write-only register you will see data-bus value because the V9990 doesn't assert data on the bus.&lt;br /&gt;
&lt;br /&gt;
* After reset (including software reset using the control port), all registers are reset to 0. In addition the selected register (port 4) is set to 0 and read and write increment are not inhibited.&lt;br /&gt;
&lt;br /&gt;
* If using software reset and the reset is held, then reading from ports will cause the CPC to hang. I believe it's asserting /WAIT, but I can't confirm.&lt;br /&gt;
&lt;br /&gt;
* Some registers have additional bits which are not documented. The mask describes which bits are read/write and which are unchanged.&lt;br /&gt;
Where the mask has a '1' bit, this bit is read/write. Where the mask has a '0' bit this bit remains at 0 and can't be changed.&lt;br /&gt;
   - Register 7 (SCREEN MODE): Mask is &amp;amp;FF.&lt;br /&gt;
   - Register 9 (INTERRUPT READ/WRITE): Mask is &amp;amp;87&lt;br /&gt;
   - Register 15 (BACK DROP COLOR): Mask is &amp;amp;FF &lt;br /&gt;
   - Register 22 (SCROLL CONTROL): Mask is &amp;amp;C1&lt;br /&gt;
   - Register 25 (SPRITE PATTERN GENERATOR TABLE BASE ADDRESS): Mask is &amp;amp;CF&lt;br /&gt;
   - Register 26 (LCD CONTROL): Mask is &amp;amp;FF&lt;br /&gt;
   - Register 27 (PRIORITY CONTROL): Mask is &amp;amp;FF&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=V9990&amp;diff=102249</id>
		<title>V9990</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=V9990&amp;diff=102249"/>
				<updated>2018-10-11T09:01:31Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: /* Documentation= */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==V9990==&lt;br /&gt;
&lt;br /&gt;
The V9990 E-VDP-III or 'Graphics 9000' is a Video Display Processor (VDP) by Yamaha which is based on an unreleased VDP (V9978) that was intended for the unreleased MSX3.&lt;br /&gt;
&lt;br /&gt;
This chip is available on graphics cards for the MSX and CPC.&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
Manual for the V9990 VDP from Yamaha as a PDF.&lt;br /&gt;
&lt;br /&gt;
[[File:Yamaha v9990.pdf|thumbnail|Yamaha V9990 Manual]]&lt;br /&gt;
&lt;br /&gt;
==Technical==&lt;br /&gt;
&lt;br /&gt;
The official 'Application Manual' describes the V9990 ports, registers and commands. These additional notes apply to the V9990 used in the CPC Powergraph video board and explain details that are not clearly described or are omitted from the manual.&lt;br /&gt;
&lt;br /&gt;
* In the following &amp;quot;databus&amp;quot; means that the v9990 doesn't assert the bus, it doesn't provide data, so the value read is &amp;quot;floating-bus&amp;quot; or the value on the z80 databus at the time. More commonly on CPC it's &amp;amp;ff, but there are some configurations of CPC where this differs.&lt;br /&gt;
&lt;br /&gt;
* Reading from the Kanji ROM ports without a Kanji ROM returns databus values&lt;br /&gt;
&lt;br /&gt;
* Reading from the write only ports (or unused ports) returns databus values.&lt;br /&gt;
&lt;br /&gt;
* Palette red data has a mask of &amp;amp;9F (bits red and color key bit), blue and green have a mask of 0x01f.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,0&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 LD A,&amp;amp;FF ;; &amp;lt;- reading this component back returns &amp;amp;9F&lt;br /&gt;
 OUT (C),A &lt;br /&gt;
 LD A,&amp;amp;FF ;; &amp;lt;- reading this component back returns &amp;amp;1F&lt;br /&gt;
 OUT (C),A &lt;br /&gt;
 LD A,&amp;amp;FF ;; &amp;lt;- reading this component back returns &amp;amp;1F&lt;br /&gt;
 OUT (C),A &lt;br /&gt;
&lt;br /&gt;
* Bits 1,0 of R14 define a ternary counter. If counter is set to 3 then reads will return 0 and writes are ignored. If auto increment is enabled, it will increment as normal. When ternary counter is 2 or 3, then palette index will increment and ternary counter will go to 0.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,3&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 LD A,&amp;amp;FF &lt;br /&gt;
 OUT (C),A ;; write is not done.&lt;br /&gt;
&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,3&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 IN A,(C)  ;; read returns last value written to port&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,2&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 LD A,&amp;amp;FF &lt;br /&gt;
 OUT (C),A  ;; palette index will be 1, and ternary counter is 0.&lt;br /&gt;
&lt;br /&gt;
* If a command transfers data, and it requests data to be written to the command data port, then you can't use a read of this port to clear the data request. It must be a write. Similarly, if a command requests data to be read then you can use a write to clear the data request.&lt;br /&gt;
&lt;br /&gt;
* If you read from a write-only register you will see data-bus value because the V9990 doesn't assert data on the bus.&lt;br /&gt;
&lt;br /&gt;
* After reset (including software reset using the control port), all registers are reset to 0. In addition the selected register (port 4) is set to 0 and read and write increment are not inhibited.&lt;br /&gt;
&lt;br /&gt;
* If using software reset and the reset is held, then reading from ports will cause the CPC to hang. I believe it's asserting /WAIT, but I can't confirm.&lt;br /&gt;
&lt;br /&gt;
* Some registers have additional bits which are not documented. The mask describes which bits are read/write and which are unchanged.&lt;br /&gt;
Where the mask has a '1' bit, this bit is read/write. Where the mask has a '0' bit this bit remains at 0 and can't be changed.&lt;br /&gt;
   - Register 7 (SCREEN MODE): Mask is &amp;amp;FF.&lt;br /&gt;
   - Register 9 (INTERRUPT READ/WRITE): Mask is &amp;amp;87&lt;br /&gt;
   - Register 15 (BACK DROP COLOR): Mask is &amp;amp;FF &lt;br /&gt;
   - Register 22 (SCROLL CONTROL): Mask is &amp;amp;C1&lt;br /&gt;
   - Register 25 (SPRITE PATTERN GENERATOR TABLE BASE ADDRESS): Mask is &amp;amp;CF&lt;br /&gt;
   - Register 26 (LCD CONTROL): Mask is &amp;amp;FF&lt;br /&gt;
   - Register 27 (PRIORITY CONTROL): Mask is &amp;amp;FF&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=V9990&amp;diff=102248</id>
		<title>V9990</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=V9990&amp;diff=102248"/>
				<updated>2018-10-11T09:01:20Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==V9990==&lt;br /&gt;
&lt;br /&gt;
The V9990 E-VDP-III or 'Graphics 9000' is a Video Display Processor (VDP) by Yamaha which is based on an unreleased VDP (V9978) that was intended for the unreleased MSX3.&lt;br /&gt;
&lt;br /&gt;
This chip is available on graphics cards for the MSX and CPC.&lt;br /&gt;
&lt;br /&gt;
==Documentation===&lt;br /&gt;
&lt;br /&gt;
Manual for the V9990 VDP from Yamaha as a PDF.&lt;br /&gt;
&lt;br /&gt;
[[File:Yamaha v9990.pdf|thumbnail|Yamaha V9990 Manual]]&lt;br /&gt;
&lt;br /&gt;
==Technical==&lt;br /&gt;
&lt;br /&gt;
The official 'Application Manual' describes the V9990 ports, registers and commands. These additional notes apply to the V9990 used in the CPC Powergraph video board and explain details that are not clearly described or are omitted from the manual.&lt;br /&gt;
&lt;br /&gt;
* In the following &amp;quot;databus&amp;quot; means that the v9990 doesn't assert the bus, it doesn't provide data, so the value read is &amp;quot;floating-bus&amp;quot; or the value on the z80 databus at the time. More commonly on CPC it's &amp;amp;ff, but there are some configurations of CPC where this differs.&lt;br /&gt;
&lt;br /&gt;
* Reading from the Kanji ROM ports without a Kanji ROM returns databus values&lt;br /&gt;
&lt;br /&gt;
* Reading from the write only ports (or unused ports) returns databus values.&lt;br /&gt;
&lt;br /&gt;
* Palette red data has a mask of &amp;amp;9F (bits red and color key bit), blue and green have a mask of 0x01f.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,0&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 LD A,&amp;amp;FF ;; &amp;lt;- reading this component back returns &amp;amp;9F&lt;br /&gt;
 OUT (C),A &lt;br /&gt;
 LD A,&amp;amp;FF ;; &amp;lt;- reading this component back returns &amp;amp;1F&lt;br /&gt;
 OUT (C),A &lt;br /&gt;
 LD A,&amp;amp;FF ;; &amp;lt;- reading this component back returns &amp;amp;1F&lt;br /&gt;
 OUT (C),A &lt;br /&gt;
&lt;br /&gt;
* Bits 1,0 of R14 define a ternary counter. If counter is set to 3 then reads will return 0 and writes are ignored. If auto increment is enabled, it will increment as normal. When ternary counter is 2 or 3, then palette index will increment and ternary counter will go to 0.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,3&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 LD A,&amp;amp;FF &lt;br /&gt;
 OUT (C),A ;; write is not done.&lt;br /&gt;
&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,3&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 IN A,(C)  ;; read returns last value written to port&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,2&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 LD A,&amp;amp;FF &lt;br /&gt;
 OUT (C),A  ;; palette index will be 1, and ternary counter is 0.&lt;br /&gt;
&lt;br /&gt;
* If a command transfers data, and it requests data to be written to the command data port, then you can't use a read of this port to clear the data request. It must be a write. Similarly, if a command requests data to be read then you can use a write to clear the data request.&lt;br /&gt;
&lt;br /&gt;
* If you read from a write-only register you will see data-bus value because the V9990 doesn't assert data on the bus.&lt;br /&gt;
&lt;br /&gt;
* After reset (including software reset using the control port), all registers are reset to 0. In addition the selected register (port 4) is set to 0 and read and write increment are not inhibited.&lt;br /&gt;
&lt;br /&gt;
* If using software reset and the reset is held, then reading from ports will cause the CPC to hang. I believe it's asserting /WAIT, but I can't confirm.&lt;br /&gt;
&lt;br /&gt;
* Some registers have additional bits which are not documented. The mask describes which bits are read/write and which are unchanged.&lt;br /&gt;
Where the mask has a '1' bit, this bit is read/write. Where the mask has a '0' bit this bit remains at 0 and can't be changed.&lt;br /&gt;
   - Register 7 (SCREEN MODE): Mask is &amp;amp;FF.&lt;br /&gt;
   - Register 9 (INTERRUPT READ/WRITE): Mask is &amp;amp;87&lt;br /&gt;
   - Register 15 (BACK DROP COLOR): Mask is &amp;amp;FF &lt;br /&gt;
   - Register 22 (SCROLL CONTROL): Mask is &amp;amp;C1&lt;br /&gt;
   - Register 25 (SPRITE PATTERN GENERATOR TABLE BASE ADDRESS): Mask is &amp;amp;CF&lt;br /&gt;
   - Register 26 (LCD CONTROL): Mask is &amp;amp;FF&lt;br /&gt;
   - Register 27 (PRIORITY CONTROL): Mask is &amp;amp;FF&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=V9990&amp;diff=102247</id>
		<title>V9990</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=V9990&amp;diff=102247"/>
				<updated>2018-10-11T09:00:42Z</updated>
		
		<summary type="html">&lt;p&gt;HAL6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==V9990==&lt;br /&gt;
&lt;br /&gt;
The V9990 E-VDP-III or 'Graphics 9000' is a Video Display Processor (VDP) by Yamaha which is based on an unreleased VDP (V9978) that was intended for the unreleased MSX3.&lt;br /&gt;
&lt;br /&gt;
This chip is available on graphics cards for the MSX and CPC.&lt;br /&gt;
&lt;br /&gt;
Manual for the V9990 VDP from Yamaha as a PDF.&lt;br /&gt;
[[File:Yamaha v9990.pdf|thumbnail|Yamaha V9990 Manual]]&lt;br /&gt;
&lt;br /&gt;
==Technical==&lt;br /&gt;
&lt;br /&gt;
The official 'Application Manual' describes the V9990 ports, registers and commands. These additional notes apply to the V9990 used in the CPC Powergraph video board and explain details that are not clearly described or are omitted from the manual.&lt;br /&gt;
&lt;br /&gt;
* In the following &amp;quot;databus&amp;quot; means that the v9990 doesn't assert the bus, it doesn't provide data, so the value read is &amp;quot;floating-bus&amp;quot; or the value on the z80 databus at the time. More commonly on CPC it's &amp;amp;ff, but there are some configurations of CPC where this differs.&lt;br /&gt;
&lt;br /&gt;
* Reading from the Kanji ROM ports without a Kanji ROM returns databus values&lt;br /&gt;
&lt;br /&gt;
* Reading from the write only ports (or unused ports) returns databus values.&lt;br /&gt;
&lt;br /&gt;
* Palette red data has a mask of &amp;amp;9F (bits red and color key bit), blue and green have a mask of 0x01f.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,0&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 LD A,&amp;amp;FF ;; &amp;lt;- reading this component back returns &amp;amp;9F&lt;br /&gt;
 OUT (C),A &lt;br /&gt;
 LD A,&amp;amp;FF ;; &amp;lt;- reading this component back returns &amp;amp;1F&lt;br /&gt;
 OUT (C),A &lt;br /&gt;
 LD A,&amp;amp;FF ;; &amp;lt;- reading this component back returns &amp;amp;1F&lt;br /&gt;
 OUT (C),A &lt;br /&gt;
&lt;br /&gt;
* Bits 1,0 of R14 define a ternary counter. If counter is set to 3 then reads will return 0 and writes are ignored. If auto increment is enabled, it will increment as normal. When ternary counter is 2 or 3, then palette index will increment and ternary counter will go to 0.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,3&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 LD A,&amp;amp;FF &lt;br /&gt;
 OUT (C),A ;; write is not done.&lt;br /&gt;
&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,3&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 IN A,(C)  ;; read returns last value written to port&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
 LD BC,&amp;amp;FF64&lt;br /&gt;
 LD A,14&lt;br /&gt;
 OUT (C),C&lt;br /&gt;
 LD BC,&amp;amp;FF63&lt;br /&gt;
 LD A,2&lt;br /&gt;
 OUT (C),A&lt;br /&gt;
 &lt;br /&gt;
 LD BC,&amp;amp;FF61&lt;br /&gt;
 LD A,&amp;amp;FF &lt;br /&gt;
 OUT (C),A  ;; palette index will be 1, and ternary counter is 0.&lt;br /&gt;
&lt;br /&gt;
* If a command transfers data, and it requests data to be written to the command data port, then you can't use a read of this port to clear the data request. It must be a write. Similarly, if a command requests data to be read then you can use a write to clear the data request.&lt;br /&gt;
&lt;br /&gt;
* If you read from a write-only register you will see data-bus value because the V9990 doesn't assert data on the bus.&lt;br /&gt;
&lt;br /&gt;
* After reset (including software reset using the control port), all registers are reset to 0. In addition the selected register (port 4) is set to 0 and read and write increment are not inhibited.&lt;br /&gt;
&lt;br /&gt;
* If using software reset and the reset is held, then reading from ports will cause the CPC to hang. I believe it's asserting /WAIT, but I can't confirm.&lt;br /&gt;
&lt;br /&gt;
* Some registers have additional bits which are not documented. The mask describes which bits are read/write and which are unchanged.&lt;br /&gt;
Where the mask has a '1' bit, this bit is read/write. Where the mask has a '0' bit this bit remains at 0 and can't be changed.&lt;br /&gt;
   - Register 7 (SCREEN MODE): Mask is &amp;amp;FF.&lt;br /&gt;
   - Register 9 (INTERRUPT READ/WRITE): Mask is &amp;amp;87&lt;br /&gt;
   - Register 15 (BACK DROP COLOR): Mask is &amp;amp;FF &lt;br /&gt;
   - Register 22 (SCROLL CONTROL): Mask is &amp;amp;C1&lt;br /&gt;
   - Register 25 (SPRITE PATTERN GENERATOR TABLE BASE ADDRESS): Mask is &amp;amp;CF&lt;br /&gt;
   - Register 26 (LCD CONTROL): Mask is &amp;amp;FF&lt;br /&gt;
   - Register 27 (PRIORITY CONTROL): Mask is &amp;amp;FF&lt;/div&gt;</summary>
		<author><name>HAL6128</name></author>	</entry>

	</feed>