<?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=Briggsy</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=Briggsy"/>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php/Special:Contributions/Briggsy"/>
		<updated>2026-08-28T14:40:10Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.25.1</generator>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=97294</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=97294"/>
				<updated>2017-02-14T14:33:00Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: Formatting&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;
: Copies one program line to screen in edition mode.&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 10&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.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-3.5) - prints 3.5&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>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=PAL16L8&amp;diff=89488</id>
		<title>PAL16L8</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=PAL16L8&amp;diff=89488"/>
				<updated>2014-02-25T10:18:09Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The CPC6128 second bank of 64K RAM is controlled by a PAL 16L8 chip. It has the Amstrad part number 40031.&lt;br /&gt;
&lt;br /&gt;
On the CPC 6128 schematic, it is top centre: [http://www.cpcwiki.eu/imgs/4/4a/CPC6128_Schematic.png CPC6128 Schematic] however the X inputs aren't distinguished.&lt;br /&gt;
&lt;br /&gt;
The following equations were worked out by Porchy (member on CPCWiki Forum). These can be used to program replacements:&lt;br /&gt;
&lt;br /&gt;
 A15OUT = (!X2 &amp;amp; !X1 &amp;amp; A14&lt;br /&gt;
      # !X3 &amp;amp; !X2 &amp;amp; A14&lt;br /&gt;
      # A15); &lt;br /&gt;
 &lt;br /&gt;
 !X1 = (!A15 &amp;amp; D7ANDD6 &amp;amp; RESET &amp;amp; !IOWR &amp;amp; D0&lt;br /&gt;
      # !X1 &amp;amp; RESET &amp;amp; IOWR&lt;br /&gt;
      # !X1 &amp;amp; !D7ANDD6 &amp;amp; RESET&lt;br /&gt;
      # !X1 &amp;amp; A15 &amp;amp; RESET);&lt;br /&gt;
 &lt;br /&gt;
 !X2 = (!A15 &amp;amp; D7ANDD6 &amp;amp; RESET &amp;amp; !IOWR &amp;amp; D1&lt;br /&gt;
      # !X2 &amp;amp; RESET &amp;amp; IOWR&lt;br /&gt;
      # !X2 &amp;amp; !D7ANDD6 &amp;amp; RESET&lt;br /&gt;
      # !X2 &amp;amp; A15 &amp;amp; RESET);&lt;br /&gt;
 &lt;br /&gt;
 !X3 = (!A15 &amp;amp; D7ANDD6 &amp;amp; RESET &amp;amp; !IOWR &amp;amp; D2&lt;br /&gt;
      # !X3 &amp;amp; RESET &amp;amp; IOWR&lt;br /&gt;
      # !X3 &amp;amp; !D7ANDD6 &amp;amp; RESET&lt;br /&gt;
      # !X3 &amp;amp; A15 &amp;amp; RESET);&lt;br /&gt;
 &lt;br /&gt;
 !CAS1 = (X3 &amp;amp; !X1 &amp;amp; A15 &amp;amp; A14 &amp;amp; !NCAS &amp;amp; !RAMDIS &amp;amp; !CPU &amp;amp; CAS0&lt;br /&gt;
      # !X3 &amp;amp; !A15 &amp;amp; A14 &amp;amp; !NCAS &amp;amp; !RAMDIS &amp;amp; !CPU &amp;amp; CAS0&lt;br /&gt;
      # X3 &amp;amp; !X2 &amp;amp; X1 &amp;amp; !NCAS &amp;amp; !RAMDIS &amp;amp; !CPU &amp;amp; CAS0&lt;br /&gt;
      # !NCAS &amp;amp; CAS0 &amp;amp; !CAS1);&lt;br /&gt;
 &lt;br /&gt;
 !CAS0 = (X3 &amp;amp; X2 &amp;amp; X1 &amp;amp; !NCAS &amp;amp; !RAMDIS &amp;amp; CAS1&lt;br /&gt;
      # X3 &amp;amp; !X1 &amp;amp; !A15 &amp;amp; !NCAS &amp;amp; !RAMDIS &amp;amp; CAS1&lt;br /&gt;
      # !X3 &amp;amp; A15 &amp;amp; !NCAS &amp;amp; !RAMDIS &amp;amp; CAS1&lt;br /&gt;
      # !X1 &amp;amp; !A14 &amp;amp; !NCAS &amp;amp; !RAMDIS &amp;amp; CAS1&lt;br /&gt;
      # !X3 &amp;amp; !A14 &amp;amp; !NCAS &amp;amp; !RAMDIS &amp;amp; CAS1&lt;br /&gt;
      # !NCAS &amp;amp; !RAMDIS &amp;amp; CPU &amp;amp; CAS1&lt;br /&gt;
      # !NCAS &amp;amp; !CAS0 &amp;amp; CAS1);&lt;br /&gt;
 &lt;br /&gt;
 A14OUT = (A15 &amp;amp; A14&lt;br /&gt;
      # !X1 &amp;amp; A14&lt;br /&gt;
      # X3 &amp;amp; A14);&lt;br /&gt;
&lt;br /&gt;
[[File:Amstrad6128.jed]] Original JED File posted on CPCWiki Forum&lt;/div&gt;</summary>
		<author><name>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=88716</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=88716"/>
				<updated>2013-11-27T09:14:23Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: /* Type Conversions */&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;
: Copies one program line to screen in edition mode.&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 10&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&amp;lt;/code&amp;gt; ====&lt;br /&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 seperate window definitions it is possible to print out long listings, better differents 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 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 160x200 in 16 colors, MODE 1 is 320x200 4 colors, MODE 2 is 640x200 2 colors and MODE 3 is 160x200 in 4 colors.&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 EVERY or AFTER commands.&lt;br /&gt;
&lt;br /&gt;
:See also the SQ(x) 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;
&lt;br /&gt;
: Opens the specified data file for reading. It have to be an ASCII file. ( The command closein closes reading data file. )&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.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-3.5) - prints 3.5&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/se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, irrespective of the nature or value of the dummy argument inside the bracket.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(o) 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;
&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;
&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor. &lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Error codes ==&lt;br /&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;
* '''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>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=88712</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=88712"/>
				<updated>2013-11-26T09:13:52Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: /* Type Conversions */&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; 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, whereas &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down. 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;
: Copies one program line to screen in edition mode.&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 10&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&amp;lt;/code&amp;gt; ====&lt;br /&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 seperate window definitions it is possible to print out long listings, better differents 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 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 160x200 in 16 colors, MODE 1 is 320x200 4 colors, MODE 2 is 640x200 2 colors and MODE 3 is 160x200 in 4 colors.&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 EVERY or AFTER commands.&lt;br /&gt;
&lt;br /&gt;
:See also the SQ(x) 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;
&lt;br /&gt;
: Opens the specified data file for reading. It have to be an ASCII file. ( The command closein closes reading data file. )&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.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-3.5) - prints 3.5&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/se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, irrespective of the nature or value of the dummy argument inside the bracket.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(o) 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;
&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;
&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor. &lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Error codes ==&lt;br /&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;
* '''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>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=88711</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=88711"/>
				<updated>2013-11-26T08:50:42Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: &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;
&amp;lt;code&amp;gt;ROUND&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;INT&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, whereas &amp;lt;code&amp;gt;INT&amp;lt;/code&amp;gt; always rounds down. 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; keyword. 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;
&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;
: Copies one program line to screen in edition mode.&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 10&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&amp;lt;/code&amp;gt; ====&lt;br /&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 seperate window definitions it is possible to print out long listings, better differents 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 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 160x200 in 16 colors, MODE 1 is 320x200 4 colors, MODE 2 is 640x200 2 colors and MODE 3 is 160x200 in 4 colors.&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 EVERY or AFTER commands.&lt;br /&gt;
&lt;br /&gt;
:See also the SQ(x) 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;
&lt;br /&gt;
: Opens the specified data file for reading. It have to be an ASCII file. ( The command closein closes reading data file. )&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.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-3.5) - prints 3.5&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/se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, irrespective of the nature or value of the dummy argument inside the bracket.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(o) 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;
&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;
&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor. &lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Error codes ==&lt;br /&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;
* '''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>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=88710</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=88710"/>
				<updated>2013-11-25T16:45:21Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: &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.&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;
&lt;br /&gt;
=== Unsigned 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
These are defined by giving 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;
You can store values between 0 and 65,535 (&amp;amp;FFFF). &lt;br /&gt;
To convert a number into this format, you will need to use the convoluted &amp;lt;code&amp;gt;uint=VAL(&amp;quot;&amp;amp;&amp;quot;+HEX$(value))&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;
To convert to an integer from a real or another integer, 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;
: Copies one program line to screen in edition mode.&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 10&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&amp;lt;/code&amp;gt; ====&lt;br /&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 seperate window definitions it is possible to print out long listings, better differents 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 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 160x200 in 16 colors, MODE 1 is 320x200 4 colors, MODE 2 is 640x200 2 colors and MODE 3 is 160x200 in 4 colors.&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 EVERY or AFTER commands.&lt;br /&gt;
&lt;br /&gt;
:See also the SQ(x) 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;
&lt;br /&gt;
: Opens the specified data file for reading. It have to be an ASCII file. ( The command closein closes reading data file. )&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.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-3.5) - prints 3.5&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/se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, irrespective of the nature or value of the dummy argument inside the bracket.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(o) 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;
&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;
&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor. &lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Error codes ==&lt;br /&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;
* '''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>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=88709</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=88709"/>
				<updated>2013-11-25T15:05:01Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: &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.&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;
&lt;br /&gt;
=== Unsigned 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
These are defined by giving 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;
You can store values between 0 and 65,535 (&amp;amp;FFFF).&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;
To convert to an integer from a real or another integer, 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;
: Copies one program line to screen in edition mode.&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 10&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&amp;lt;/code&amp;gt; ====&lt;br /&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 seperate window definitions it is possible to print out long listings, better differents 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 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 160x200 in 16 colors, MODE 1 is 320x200 4 colors, MODE 2 is 640x200 2 colors and MODE 3 is 160x200 in 4 colors.&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 EVERY or AFTER commands.&lt;br /&gt;
&lt;br /&gt;
:See also the SQ(x) 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;
&lt;br /&gt;
: Opens the specified data file for reading. It have to be an ASCII file. ( The command closein closes reading data file. )&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.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-3.5) - prints 3.5&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/se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, irrespective of the nature or value of the dummy argument inside the bracket.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(o) 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;
&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;
&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor. &lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Error codes ==&lt;br /&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;
* '''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>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=88708</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=88708"/>
				<updated>2013-11-25T14:52:43Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: Add a section on variables and types - probably needs fixing and/or extending.&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;
&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;
&lt;br /&gt;
=== Unsigned 16-bit Integers ===&lt;br /&gt;
&lt;br /&gt;
These are defined by giving 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;
&lt;br /&gt;
== Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
To convert to an integer from a real or another integer, 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;
: Copies one program line to screen in edition mode.&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 10&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&amp;lt;/code&amp;gt; ====&lt;br /&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 seperate window definitions it is possible to print out long listings, better differents 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 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 160x200 in 16 colors, MODE 1 is 320x200 4 colors, MODE 2 is 640x200 2 colors and MODE 3 is 160x200 in 4 colors.&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 EVERY or AFTER commands.&lt;br /&gt;
&lt;br /&gt;
:See also the SQ(x) 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;
&lt;br /&gt;
: Opens the specified data file for reading. It have to be an ASCII file. ( The command closein closes reading data file. )&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.&lt;br /&gt;
&lt;br /&gt;
: Example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT ABS(-3.5) - prints 3.5&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/se)&amp;lt;/code&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
: Returns the amount of unused memory, irrespective of the nature or value of the dummy argument inside the bracket.&lt;br /&gt;
&lt;br /&gt;
: Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PRINT FRE(o) 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;
&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;
&lt;br /&gt;
: Returns the current vertical (y) position of the graphics cursor. &lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Error codes ==&lt;br /&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;
* '''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>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=CRTC&amp;diff=80029</id>
		<title>CRTC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=CRTC&amp;diff=80029"/>
				<updated>2012-07-09T17:38:01Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: /* The Internal registers of the 6845 are */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* ''This is an article about the &amp;quot;Cathode Ray Tube Controller&amp;quot; hardware unit of the Amstrad CPC. For the cpc scene member see [[ChaRleyTroniC]]''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The '''CRTC''' (Cathode Ray Tube Controller) generates the video signal of the Amstrad CPC.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
== Type 0 - HD6845SP / HD6845S / UM6845 ==&lt;br /&gt;
&lt;br /&gt;
== Type 1 - UM6845R ==&lt;br /&gt;
&lt;br /&gt;
== Type 2 - MC6845 / MC6845P ==&lt;br /&gt;
&lt;br /&gt;
== Type 3 - The ASIC ==&lt;br /&gt;
&lt;br /&gt;
== Type 4 - PreASIC ==&lt;br /&gt;
&lt;br /&gt;
== Programming the CRTC ==&lt;br /&gt;
&lt;br /&gt;
The 6845 Cathode Ray Tube Controller (CRTC)&lt;br /&gt;
Introduction&lt;br /&gt;
The 6845 Cathode Ray Tube Controller (CRTC) is a programmable IC used to generate video displays. This IC is used in a variety of computers including the Amstrad CPC, Amstrad CPC+ and KC Compact. &lt;br /&gt;
&lt;br /&gt;
CRTC in the Amstrad CPC/CPC+ and KC Compact designs&lt;br /&gt;
The CRTC was a common part available from many different manufacturers. During the life of the CPC, Amstrad sourced the CRTC from various manufacturers. &lt;br /&gt;
&lt;br /&gt;
All ICs used were based on the same design but have a different implementation. As a result they do not operate identically in all situations. This document highlights these differences. &lt;br /&gt;
&lt;br /&gt;
This table lists the known ICs used, with their part number, manufacturer and type number. &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Part number''||''Manufacturer''||''Type number (note 3)''&lt;br /&gt;
|-&lt;br /&gt;
|HD6845S||Hitachi||0&lt;br /&gt;
|-&lt;br /&gt;
|UM6845||UMC||0&lt;br /&gt;
|-&lt;br /&gt;
|UM6845R||UMC||1&lt;br /&gt;
|-&lt;br /&gt;
|MC6845||Motorola||2&lt;br /&gt;
|-&lt;br /&gt;
|AMS40489||Amstrad||3 (note 1)&lt;br /&gt;
|-&lt;br /&gt;
|???||Amstrad?||4 (note 2)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''NOTES''' &lt;br /&gt;
&lt;br /&gt;
1. The CRTC functionality is integrated into the CPC+ ASIC. This type exists only in the CPC464+,CPC6128+ and GX4000. &lt;br /&gt;
&lt;br /&gt;
2. As far as I know, this type exists only in &amp;quot;cost-down&amp;quot; CPC6128 systems. In the &amp;quot;cost-down&amp;quot; CPC6128, the CRTC functionality is integrated into a single ASIC IC. This ASIC is often refered to as the &amp;quot;Pre-ASIC&amp;quot; because it preceeded the CPC+ ASIC.&lt;br /&gt;
 &lt;br /&gt;
3. In the Amstrad community each 6845 implementation has been assigned a type number. This type identifies a group of implementations which operate in exactly the same way. &lt;br /&gt;
&lt;br /&gt;
As far as I know, the type number system was originally used by demo programmers. &lt;br /&gt;
&lt;br /&gt;
It is possible to detect the 6845 present using software methods, and this is done to: &lt;br /&gt;
&lt;br /&gt;
warn that the software was not designed for the detected 6845 and may function incorrectly, &lt;br /&gt;
to adapt the software so that it will run with the detected 6845 &lt;br /&gt;
In most cases, the type of the detected 6845 is reported. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. As far as I know, the KC compact used HD6845S only. &lt;br /&gt;
&lt;br /&gt;
The 6845 is selected when bit 14 of the I/O port address is set to &amp;quot;0&amp;quot;. Bit 1 and 0 of the I/O port address define the function to access. The remaining bits can be any value, but it is adviseable to set these to &amp;quot;1&amp;quot; to avoid conflict with other devices in the system. &lt;br /&gt;
&lt;br /&gt;
The recommended I/O port addressess are&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''I/O port address''||''Function''||''Read/Write''&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BCxx||Select 6845 register||Write only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BDxx||Write 6845 register data||Write only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BExx||(note 1)||Read only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BFxx||(note 1)||Read only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''NOTE'''&lt;br /&gt;
&lt;br /&gt;
1. The function of these I/O ports is dependant on the CRTC type &lt;br /&gt;
Signals&lt;br /&gt;
&lt;br /&gt;
The following table defines the generated memory address from the CRTC and Gate-Array signals. &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Memory Address Signal''||''Signal source''||''Signal name''&lt;br /&gt;
|-&lt;br /&gt;
|A15||6845||MA12 &lt;br /&gt;
|-&lt;br /&gt;
|A14||6845||MA11 &lt;br /&gt;
|-&lt;br /&gt;
|A13||6845||RA2 &lt;br /&gt;
|-&lt;br /&gt;
|A12||6845||RA1 &lt;br /&gt;
|-&lt;br /&gt;
|A11||6845||RA0 &lt;br /&gt;
|-&lt;br /&gt;
|A10||6845||MA9 &lt;br /&gt;
|-&lt;br /&gt;
|A9||6845||MA8 &lt;br /&gt;
|-&lt;br /&gt;
|A8||6845||MA7 &lt;br /&gt;
|-&lt;br /&gt;
|A7||6845||MA6 &lt;br /&gt;
|-&lt;br /&gt;
|A6||6845||MA5 &lt;br /&gt;
|-&lt;br /&gt;
|A5||6845||MA4 &lt;br /&gt;
|-&lt;br /&gt;
|A4||6845||MA3 &lt;br /&gt;
|-&lt;br /&gt;
|A3||6845||MA2 &lt;br /&gt;
|-&lt;br /&gt;
|A2||6845||MA1 &lt;br /&gt;
|-&lt;br /&gt;
|A1||6845||MA0&lt;br /&gt;
|-&lt;br /&gt;
|A0||Gate-Array||CCLK&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DISPTMG ==&lt;br /&gt;
&lt;br /&gt;
DISPTMG signal defines the border. When DISPTMG is &amp;quot;1&amp;quot; the border colour is output to the display. &lt;br /&gt;
&lt;br /&gt;
== HSYNC and VSYNC ==&lt;br /&gt;
&lt;br /&gt;
HSYNC and VSYNC from the CRTC are passed into the Gate-Array. The Gate-Array modifies the signals and then mixes these to form the Composite-Sync which is output to the display &lt;br /&gt;
The 6845 Design&lt;br /&gt;
Registers&lt;br /&gt;
&lt;br /&gt;
== The Internal registers of the 6845 are == &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Register Index''||''Register Name''||''Range''||''CPC Setting''||''Notes''&lt;br /&gt;
|-&lt;br /&gt;
|0||Horizontal Total||00000000||63||Width of the screen, in characters. Should always be 63 (64 characters). 1 character == 1μs.&lt;br /&gt;
|-&lt;br /&gt;
|1||Horizontal Displayed||00000000||40||Number of characters displayed. Once horizontal character count (HCC) matches this value, DISPTMG is set to 1.&lt;br /&gt;
|-&lt;br /&gt;
|2||Horizontal Sync Position||00000000||46||When to start the HSync signal.&lt;br /&gt;
|-&lt;br /&gt;
|3||Horizontal and Vertical Sync Widths||VxxxHHHH||128+14||HSync pulse up to 15 characters wide, should always be more than 8; VSync bit not present on some CRTCs.&lt;br /&gt;
|-&lt;br /&gt;
|4||Vertical Total||x0000000||38||Height of the screen, in characters.&lt;br /&gt;
|-&lt;br /&gt;
|5||Vertical Total Adjust||xxx00000||0||Measured in scanlines, can be used for smooth vertical scrolling on CPC.&lt;br /&gt;
|-&lt;br /&gt;
|6||Vertical Displayed||x0000000||25||Height of displayed screen in characters. Once vertical character count (VCC) matches this value, DISPTMG is set to 1.&lt;br /&gt;
|-&lt;br /&gt;
|7||Vertical Sync position||x0000000||30||When to start the VSync signal, in characters.&lt;br /&gt;
|-&lt;br /&gt;
|8||Interlace and Skew||xxxxxx00||0||00: No interlace; 01: Interlace Sync Raster Scan Mode; 10: No Interlace; 11: Interlace Sync and Video Raster Scan Mode&lt;br /&gt;
|-&lt;br /&gt;
|9||Maximum Raster Address||xxx00000||7||Maximum scan line address on CPC can hold between 0 and 7, higher values' upper bits are ignored&lt;br /&gt;
|-&lt;br /&gt;
|10||Cursor Start Raster||xBP00000||0||Cursor not used on CPC. B = Blink On/Off; P = Blink Period Control (Slow/Fast). Sets first raster row of character that cursor is on to invert.&lt;br /&gt;
|-&lt;br /&gt;
|11||Cursor End Raster||xxx00000||0||Sets last raster row of character that cursor is on to invert&lt;br /&gt;
|-&lt;br /&gt;
|12||Display Start Address (High)||xx000000||32&lt;br /&gt;
|-&lt;br /&gt;
|13||Display Start Address (Low)||00000000||0||Allows you to offset the start of screen memory, useful when using memory from address &amp;amp;0000.&lt;br /&gt;
|-&lt;br /&gt;
|14||Cursor Address (High)||xx000000||0&lt;br /&gt;
|-&lt;br /&gt;
|15||Cursor Address (High)||00000000||0&lt;br /&gt;
|-&lt;br /&gt;
|16||Light Pen Address (High)||xx000000||||Read Only&lt;br /&gt;
|-&lt;br /&gt;
|17||Light Pen Address (High)||00000000||||Read Only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CRTC Differences ==&lt;br /&gt;
&lt;br /&gt;
In this section I will attempt to identify all the differences between each CRTC. &lt;br /&gt;
&lt;br /&gt;
The following tables list the functions that can be accessed for each type: &lt;br /&gt;
&lt;br /&gt;
Type 0&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||-||- &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 1&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||Read Status Register||Read Only &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 2&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||-||- &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 3 and 4&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||Read from selected internal 6845 register||Read Only &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It is not possible to read from all the internal registers, this table shows the read/write status of each register for each type: &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|rowspan=2|''Register Index''||rowspan=2|''Register Name''||colspan=4|''Type'' &lt;br /&gt;
|-&lt;br /&gt;
|0||1||2||3 &lt;br /&gt;
|-&lt;br /&gt;
|0||Horizontal Total||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|1||Horizontal Displayed||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|2||Horizontal Sync Position||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|3||Horizontal and Vertical Sync Widths||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|4||Vertical Total||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|5||Vertical Total Adjust||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|6||Vertical Displayed||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|7||Vertical Sync position||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|8||Interlace and Skew||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|9||Maximum Raster Address||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|10||Cursor Start Raster||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|11||Cursor End Raster||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|12||Display Start Address (High)||Read/Write||Write Only||Write Only||Read/Write (note 2) &lt;br /&gt;
|-&lt;br /&gt;
|13||Display Start Address (Low)||Read/Write||Write Only||Write Only||Read/Write (note 2) &lt;br /&gt;
|-&lt;br /&gt;
|14||Cursor Address (High)||Read/Write||Read/Write||Read/Write||Read/Write (note 2) ***check &lt;br /&gt;
|-&lt;br /&gt;
|15||Cursor Address (Low)||Read/Write||Read/Write||Read/Write||Read/Write (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|16||Light Pen Address (High)||Read Only||Read Only||Read Only||Read Only (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|17||Light Pen Address (High)||Read Only||Read Only||Read Only||Read Only (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Notes'''&lt;br /&gt;
&lt;br /&gt;
1. On type 0 and 1, if a Write Only register is read from, &amp;quot;0&amp;quot; is returned. &lt;br /&gt;
&lt;br /&gt;
2. See the document &amp;quot;Extra CPC Plus Hardware Information&amp;quot; for more details.&lt;br /&gt;
&lt;br /&gt;
== Datasheets ==&lt;br /&gt;
&lt;br /&gt;
* [[Media:hd6845.hitachi.pdf|HD6845 (Hitachi) (aka type 0)]]&lt;br /&gt;
* [[Media:Um6845.umc.pdf|UM6845 (UMC)  (aka type 0)]]&lt;br /&gt;
* [[Media:Um6845r.umc.pdf|UM6845R (UMC)  (aka type 1)]]&lt;br /&gt;
* [[Media:Mc6845.motorola.pdf|MC6845 (Motorola) (aka type 2)]]&lt;br /&gt;
&lt;br /&gt;
* [[VHDL implementation of the 6845]]&lt;br /&gt;
&lt;br /&gt;
== Clones ==&lt;br /&gt;
* [CM607P   a Bulgarian clone made in Pravetz factory]&lt;br /&gt;
* [EF6845P  by Thomson Semiconductors]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/6845 Wikipedia on the CRTC]&lt;br /&gt;
* [http://www.grimware.org/doku.php/documentations/devices/crtc CRTCs on grimware]&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
&lt;br /&gt;
*[[Gate Array]]&lt;br /&gt;
&lt;br /&gt;
*[[ASIC]]&lt;br /&gt;
&lt;br /&gt;
*[[Video modes]]&lt;br /&gt;
&lt;br /&gt;
*[[Synchronizing with the CRTC and display]] : technic and details on the relationship between Gate Array and CRTC.&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]] [[Category:CPC Internal Components]] [[Category:Programming]] [[Category:Datasheet]] [[Category:Graphic]]&lt;/div&gt;</summary>
		<author><name>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=CRTC&amp;diff=80028</id>
		<title>CRTC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=CRTC&amp;diff=80028"/>
				<updated>2012-07-09T17:35:20Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: /* The Internal registers of the 6845 are */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* ''This is an article about the &amp;quot;Cathode Ray Tube Controller&amp;quot; hardware unit of the Amstrad CPC. For the cpc scene member see [[ChaRleyTroniC]]''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The '''CRTC''' (Cathode Ray Tube Controller) generates the video signal of the Amstrad CPC.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
== Type 0 - HD6845SP / HD6845S / UM6845 ==&lt;br /&gt;
&lt;br /&gt;
== Type 1 - UM6845R ==&lt;br /&gt;
&lt;br /&gt;
== Type 2 - MC6845 / MC6845P ==&lt;br /&gt;
&lt;br /&gt;
== Type 3 - The ASIC ==&lt;br /&gt;
&lt;br /&gt;
== Type 4 - PreASIC ==&lt;br /&gt;
&lt;br /&gt;
== Programming the CRTC ==&lt;br /&gt;
&lt;br /&gt;
The 6845 Cathode Ray Tube Controller (CRTC)&lt;br /&gt;
Introduction&lt;br /&gt;
The 6845 Cathode Ray Tube Controller (CRTC) is a programmable IC used to generate video displays. This IC is used in a variety of computers including the Amstrad CPC, Amstrad CPC+ and KC Compact. &lt;br /&gt;
&lt;br /&gt;
CRTC in the Amstrad CPC/CPC+ and KC Compact designs&lt;br /&gt;
The CRTC was a common part available from many different manufacturers. During the life of the CPC, Amstrad sourced the CRTC from various manufacturers. &lt;br /&gt;
&lt;br /&gt;
All ICs used were based on the same design but have a different implementation. As a result they do not operate identically in all situations. This document highlights these differences. &lt;br /&gt;
&lt;br /&gt;
This table lists the known ICs used, with their part number, manufacturer and type number. &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Part number''||''Manufacturer''||''Type number (note 3)''&lt;br /&gt;
|-&lt;br /&gt;
|HD6845S||Hitachi||0&lt;br /&gt;
|-&lt;br /&gt;
|UM6845||UMC||0&lt;br /&gt;
|-&lt;br /&gt;
|UM6845R||UMC||1&lt;br /&gt;
|-&lt;br /&gt;
|MC6845||Motorola||2&lt;br /&gt;
|-&lt;br /&gt;
|AMS40489||Amstrad||3 (note 1)&lt;br /&gt;
|-&lt;br /&gt;
|???||Amstrad?||4 (note 2)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''NOTES''' &lt;br /&gt;
&lt;br /&gt;
1. The CRTC functionality is integrated into the CPC+ ASIC. This type exists only in the CPC464+,CPC6128+ and GX4000. &lt;br /&gt;
&lt;br /&gt;
2. As far as I know, this type exists only in &amp;quot;cost-down&amp;quot; CPC6128 systems. In the &amp;quot;cost-down&amp;quot; CPC6128, the CRTC functionality is integrated into a single ASIC IC. This ASIC is often refered to as the &amp;quot;Pre-ASIC&amp;quot; because it preceeded the CPC+ ASIC.&lt;br /&gt;
 &lt;br /&gt;
3. In the Amstrad community each 6845 implementation has been assigned a type number. This type identifies a group of implementations which operate in exactly the same way. &lt;br /&gt;
&lt;br /&gt;
As far as I know, the type number system was originally used by demo programmers. &lt;br /&gt;
&lt;br /&gt;
It is possible to detect the 6845 present using software methods, and this is done to: &lt;br /&gt;
&lt;br /&gt;
warn that the software was not designed for the detected 6845 and may function incorrectly, &lt;br /&gt;
to adapt the software so that it will run with the detected 6845 &lt;br /&gt;
In most cases, the type of the detected 6845 is reported. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. As far as I know, the KC compact used HD6845S only. &lt;br /&gt;
&lt;br /&gt;
The 6845 is selected when bit 14 of the I/O port address is set to &amp;quot;0&amp;quot;. Bit 1 and 0 of the I/O port address define the function to access. The remaining bits can be any value, but it is adviseable to set these to &amp;quot;1&amp;quot; to avoid conflict with other devices in the system. &lt;br /&gt;
&lt;br /&gt;
The recommended I/O port addressess are&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''I/O port address''||''Function''||''Read/Write''&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BCxx||Select 6845 register||Write only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BDxx||Write 6845 register data||Write only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BExx||(note 1)||Read only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BFxx||(note 1)||Read only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''NOTE'''&lt;br /&gt;
&lt;br /&gt;
1. The function of these I/O ports is dependant on the CRTC type &lt;br /&gt;
Signals&lt;br /&gt;
&lt;br /&gt;
The following table defines the generated memory address from the CRTC and Gate-Array signals. &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Memory Address Signal''||''Signal source''||''Signal name''&lt;br /&gt;
|-&lt;br /&gt;
|A15||6845||MA12 &lt;br /&gt;
|-&lt;br /&gt;
|A14||6845||MA11 &lt;br /&gt;
|-&lt;br /&gt;
|A13||6845||RA2 &lt;br /&gt;
|-&lt;br /&gt;
|A12||6845||RA1 &lt;br /&gt;
|-&lt;br /&gt;
|A11||6845||RA0 &lt;br /&gt;
|-&lt;br /&gt;
|A10||6845||MA9 &lt;br /&gt;
|-&lt;br /&gt;
|A9||6845||MA8 &lt;br /&gt;
|-&lt;br /&gt;
|A8||6845||MA7 &lt;br /&gt;
|-&lt;br /&gt;
|A7||6845||MA6 &lt;br /&gt;
|-&lt;br /&gt;
|A6||6845||MA5 &lt;br /&gt;
|-&lt;br /&gt;
|A5||6845||MA4 &lt;br /&gt;
|-&lt;br /&gt;
|A4||6845||MA3 &lt;br /&gt;
|-&lt;br /&gt;
|A3||6845||MA2 &lt;br /&gt;
|-&lt;br /&gt;
|A2||6845||MA1 &lt;br /&gt;
|-&lt;br /&gt;
|A1||6845||MA0&lt;br /&gt;
|-&lt;br /&gt;
|A0||Gate-Array||CCLK&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DISPTMG ==&lt;br /&gt;
&lt;br /&gt;
DISPTMG signal defines the border. When DISPTMG is &amp;quot;1&amp;quot; the border colour is output to the display. &lt;br /&gt;
&lt;br /&gt;
== HSYNC and VSYNC ==&lt;br /&gt;
&lt;br /&gt;
HSYNC and VSYNC from the CRTC are passed into the Gate-Array. The Gate-Array modifies the signals and then mixes these to form the Composite-Sync which is output to the display &lt;br /&gt;
The 6845 Design&lt;br /&gt;
Registers&lt;br /&gt;
&lt;br /&gt;
== The Internal registers of the 6845 are == &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Register Index''||''Register Name''||''Range''||''CPC Setting''||''Notes''&lt;br /&gt;
|-&lt;br /&gt;
|0||Horizontal Total||00000000||63||Width of the screen, in characters. Should always be 63 (64 characters). 1 character == 1μs.&lt;br /&gt;
|-&lt;br /&gt;
|1||Horizontal Displayed||00000000||40||Number of characters displayed.&lt;br /&gt;
|-&lt;br /&gt;
|2||Horizontal Sync Position||00000000||46||When to start the HSync signal.&lt;br /&gt;
|-&lt;br /&gt;
|3||Horizontal and Vertical Sync Widths||VxxxHHHH||128+14||HSync pulse up to 15 characters wide, should always be more than 8; VSync bit not present on some CRTCs.&lt;br /&gt;
|-&lt;br /&gt;
|4||Vertical Total||x0000000||38||Height of the screen, in characters.&lt;br /&gt;
|-&lt;br /&gt;
|5||Vertical Total Adjust||xxx00000||0||Measured in scanlines, can be used for smooth vertical scrolling on CPC.&lt;br /&gt;
|-&lt;br /&gt;
|6||Vertical Displayed||x0000000||25||Height of displayed screen in characters.&lt;br /&gt;
|-&lt;br /&gt;
|7||Vertical Sync position||x0000000||30||When to start the VSync signal, in characters.&lt;br /&gt;
|-&lt;br /&gt;
|8||Interlace and Skew||xxxxxx00||0||00: No interlace; 01: Interlace Sync Raster Scan Mode; 10: No Interlace; 11: Interlace Sync and Video Raster Scan Mode&lt;br /&gt;
|-&lt;br /&gt;
|9||Maximum Raster Address||xxx00000||7||Maximum scan line address on CPC can hold between 0 and 7, higher values' upper bits are ignored&lt;br /&gt;
|-&lt;br /&gt;
|10||Cursor Start Raster||xBP00000||0||Cursor not used on CPC. B = Blink On/Off; P = Blink Period Control (Slow/Fast). Sets first raster row of character that cursor is on to invert.&lt;br /&gt;
|-&lt;br /&gt;
|11||Cursor End Raster||xxx00000||0||Sets last raster row of character that cursor is on to invert&lt;br /&gt;
|-&lt;br /&gt;
|12||Display Start Address (High)||xx000000||32&lt;br /&gt;
|-&lt;br /&gt;
|13||Display Start Address (Low)||00000000||0||Allows you to offset the start of screen memory, useful when using memory from address &amp;amp;0000.&lt;br /&gt;
|-&lt;br /&gt;
|14||Cursor Address (High)||xx000000||0&lt;br /&gt;
|-&lt;br /&gt;
|15||Cursor Address (High)||00000000||0&lt;br /&gt;
|-&lt;br /&gt;
|16||Light Pen Address (High)||xx000000||||Read Only&lt;br /&gt;
|-&lt;br /&gt;
|17||Light Pen Address (High)||00000000||||Read Only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CRTC Differences ==&lt;br /&gt;
&lt;br /&gt;
In this section I will attempt to identify all the differences between each CRTC. &lt;br /&gt;
&lt;br /&gt;
The following tables list the functions that can be accessed for each type: &lt;br /&gt;
&lt;br /&gt;
Type 0&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||-||- &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 1&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||Read Status Register||Read Only &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 2&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||-||- &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 3 and 4&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||Read from selected internal 6845 register||Read Only &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It is not possible to read from all the internal registers, this table shows the read/write status of each register for each type: &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|rowspan=2|''Register Index''||rowspan=2|''Register Name''||colspan=4|''Type'' &lt;br /&gt;
|-&lt;br /&gt;
|0||1||2||3 &lt;br /&gt;
|-&lt;br /&gt;
|0||Horizontal Total||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|1||Horizontal Displayed||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|2||Horizontal Sync Position||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|3||Horizontal and Vertical Sync Widths||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|4||Vertical Total||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|5||Vertical Total Adjust||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|6||Vertical Displayed||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|7||Vertical Sync position||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|8||Interlace and Skew||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|9||Maximum Raster Address||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|10||Cursor Start Raster||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|11||Cursor End Raster||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|12||Display Start Address (High)||Read/Write||Write Only||Write Only||Read/Write (note 2) &lt;br /&gt;
|-&lt;br /&gt;
|13||Display Start Address (Low)||Read/Write||Write Only||Write Only||Read/Write (note 2) &lt;br /&gt;
|-&lt;br /&gt;
|14||Cursor Address (High)||Read/Write||Read/Write||Read/Write||Read/Write (note 2) ***check &lt;br /&gt;
|-&lt;br /&gt;
|15||Cursor Address (Low)||Read/Write||Read/Write||Read/Write||Read/Write (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|16||Light Pen Address (High)||Read Only||Read Only||Read Only||Read Only (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|17||Light Pen Address (High)||Read Only||Read Only||Read Only||Read Only (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Notes'''&lt;br /&gt;
&lt;br /&gt;
1. On type 0 and 1, if a Write Only register is read from, &amp;quot;0&amp;quot; is returned. &lt;br /&gt;
&lt;br /&gt;
2. See the document &amp;quot;Extra CPC Plus Hardware Information&amp;quot; for more details.&lt;br /&gt;
&lt;br /&gt;
== Datasheets ==&lt;br /&gt;
&lt;br /&gt;
* [[Media:hd6845.hitachi.pdf|HD6845 (Hitachi) (aka type 0)]]&lt;br /&gt;
* [[Media:Um6845.umc.pdf|UM6845 (UMC)  (aka type 0)]]&lt;br /&gt;
* [[Media:Um6845r.umc.pdf|UM6845R (UMC)  (aka type 1)]]&lt;br /&gt;
* [[Media:Mc6845.motorola.pdf|MC6845 (Motorola) (aka type 2)]]&lt;br /&gt;
&lt;br /&gt;
* [[VHDL implementation of the 6845]]&lt;br /&gt;
&lt;br /&gt;
== Clones ==&lt;br /&gt;
* [CM607P   a Bulgarian clone made in Pravetz factory]&lt;br /&gt;
* [EF6845P  by Thomson Semiconductors]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/6845 Wikipedia on the CRTC]&lt;br /&gt;
* [http://www.grimware.org/doku.php/documentations/devices/crtc CRTCs on grimware]&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
&lt;br /&gt;
*[[Gate Array]]&lt;br /&gt;
&lt;br /&gt;
*[[ASIC]]&lt;br /&gt;
&lt;br /&gt;
*[[Video modes]]&lt;br /&gt;
&lt;br /&gt;
*[[Synchronizing with the CRTC and display]] : technic and details on the relationship between Gate Array and CRTC.&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]] [[Category:CPC Internal Components]] [[Category:Programming]] [[Category:Datasheet]] [[Category:Graphic]]&lt;/div&gt;</summary>
		<author><name>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=CRTC&amp;diff=80027</id>
		<title>CRTC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=CRTC&amp;diff=80027"/>
				<updated>2012-07-09T17:30:21Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: /* The Internal registers of the 6845 are */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* ''This is an article about the &amp;quot;Cathode Ray Tube Controller&amp;quot; hardware unit of the Amstrad CPC. For the cpc scene member see [[ChaRleyTroniC]]''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The '''CRTC''' (Cathode Ray Tube Controller) generates the video signal of the Amstrad CPC.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
== Type 0 - HD6845SP / HD6845S / UM6845 ==&lt;br /&gt;
&lt;br /&gt;
== Type 1 - UM6845R ==&lt;br /&gt;
&lt;br /&gt;
== Type 2 - MC6845 / MC6845P ==&lt;br /&gt;
&lt;br /&gt;
== Type 3 - The ASIC ==&lt;br /&gt;
&lt;br /&gt;
== Type 4 - PreASIC ==&lt;br /&gt;
&lt;br /&gt;
== Programming the CRTC ==&lt;br /&gt;
&lt;br /&gt;
The 6845 Cathode Ray Tube Controller (CRTC)&lt;br /&gt;
Introduction&lt;br /&gt;
The 6845 Cathode Ray Tube Controller (CRTC) is a programmable IC used to generate video displays. This IC is used in a variety of computers including the Amstrad CPC, Amstrad CPC+ and KC Compact. &lt;br /&gt;
&lt;br /&gt;
CRTC in the Amstrad CPC/CPC+ and KC Compact designs&lt;br /&gt;
The CRTC was a common part available from many different manufacturers. During the life of the CPC, Amstrad sourced the CRTC from various manufacturers. &lt;br /&gt;
&lt;br /&gt;
All ICs used were based on the same design but have a different implementation. As a result they do not operate identically in all situations. This document highlights these differences. &lt;br /&gt;
&lt;br /&gt;
This table lists the known ICs used, with their part number, manufacturer and type number. &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Part number''||''Manufacturer''||''Type number (note 3)''&lt;br /&gt;
|-&lt;br /&gt;
|HD6845S||Hitachi||0&lt;br /&gt;
|-&lt;br /&gt;
|UM6845||UMC||0&lt;br /&gt;
|-&lt;br /&gt;
|UM6845R||UMC||1&lt;br /&gt;
|-&lt;br /&gt;
|MC6845||Motorola||2&lt;br /&gt;
|-&lt;br /&gt;
|AMS40489||Amstrad||3 (note 1)&lt;br /&gt;
|-&lt;br /&gt;
|???||Amstrad?||4 (note 2)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''NOTES''' &lt;br /&gt;
&lt;br /&gt;
1. The CRTC functionality is integrated into the CPC+ ASIC. This type exists only in the CPC464+,CPC6128+ and GX4000. &lt;br /&gt;
&lt;br /&gt;
2. As far as I know, this type exists only in &amp;quot;cost-down&amp;quot; CPC6128 systems. In the &amp;quot;cost-down&amp;quot; CPC6128, the CRTC functionality is integrated into a single ASIC IC. This ASIC is often refered to as the &amp;quot;Pre-ASIC&amp;quot; because it preceeded the CPC+ ASIC.&lt;br /&gt;
 &lt;br /&gt;
3. In the Amstrad community each 6845 implementation has been assigned a type number. This type identifies a group of implementations which operate in exactly the same way. &lt;br /&gt;
&lt;br /&gt;
As far as I know, the type number system was originally used by demo programmers. &lt;br /&gt;
&lt;br /&gt;
It is possible to detect the 6845 present using software methods, and this is done to: &lt;br /&gt;
&lt;br /&gt;
warn that the software was not designed for the detected 6845 and may function incorrectly, &lt;br /&gt;
to adapt the software so that it will run with the detected 6845 &lt;br /&gt;
In most cases, the type of the detected 6845 is reported. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. As far as I know, the KC compact used HD6845S only. &lt;br /&gt;
&lt;br /&gt;
The 6845 is selected when bit 14 of the I/O port address is set to &amp;quot;0&amp;quot;. Bit 1 and 0 of the I/O port address define the function to access. The remaining bits can be any value, but it is adviseable to set these to &amp;quot;1&amp;quot; to avoid conflict with other devices in the system. &lt;br /&gt;
&lt;br /&gt;
The recommended I/O port addressess are&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''I/O port address''||''Function''||''Read/Write''&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BCxx||Select 6845 register||Write only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BDxx||Write 6845 register data||Write only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BExx||(note 1)||Read only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BFxx||(note 1)||Read only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''NOTE'''&lt;br /&gt;
&lt;br /&gt;
1. The function of these I/O ports is dependant on the CRTC type &lt;br /&gt;
Signals&lt;br /&gt;
&lt;br /&gt;
The following table defines the generated memory address from the CRTC and Gate-Array signals. &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Memory Address Signal''||''Signal source''||''Signal name''&lt;br /&gt;
|-&lt;br /&gt;
|A15||6845||MA12 &lt;br /&gt;
|-&lt;br /&gt;
|A14||6845||MA11 &lt;br /&gt;
|-&lt;br /&gt;
|A13||6845||RA2 &lt;br /&gt;
|-&lt;br /&gt;
|A12||6845||RA1 &lt;br /&gt;
|-&lt;br /&gt;
|A11||6845||RA0 &lt;br /&gt;
|-&lt;br /&gt;
|A10||6845||MA9 &lt;br /&gt;
|-&lt;br /&gt;
|A9||6845||MA8 &lt;br /&gt;
|-&lt;br /&gt;
|A8||6845||MA7 &lt;br /&gt;
|-&lt;br /&gt;
|A7||6845||MA6 &lt;br /&gt;
|-&lt;br /&gt;
|A6||6845||MA5 &lt;br /&gt;
|-&lt;br /&gt;
|A5||6845||MA4 &lt;br /&gt;
|-&lt;br /&gt;
|A4||6845||MA3 &lt;br /&gt;
|-&lt;br /&gt;
|A3||6845||MA2 &lt;br /&gt;
|-&lt;br /&gt;
|A2||6845||MA1 &lt;br /&gt;
|-&lt;br /&gt;
|A1||6845||MA0&lt;br /&gt;
|-&lt;br /&gt;
|A0||Gate-Array||CCLK&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DISPTMG ==&lt;br /&gt;
&lt;br /&gt;
DISPTMG signal defines the border. When DISPTMG is &amp;quot;1&amp;quot; the border colour is output to the display. &lt;br /&gt;
&lt;br /&gt;
== HSYNC and VSYNC ==&lt;br /&gt;
&lt;br /&gt;
HSYNC and VSYNC from the CRTC are passed into the Gate-Array. The Gate-Array modifies the signals and then mixes these to form the Composite-Sync which is output to the display &lt;br /&gt;
The 6845 Design&lt;br /&gt;
Registers&lt;br /&gt;
&lt;br /&gt;
== The Internal registers of the 6845 are == &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Register Index''||''Register Name''||''Range''||''CPC Setting''||''Notes''&lt;br /&gt;
|-&lt;br /&gt;
|0||Horizontal Total||00000000||63&lt;br /&gt;
|-&lt;br /&gt;
|1||Horizontal Displayed||00000000||40&lt;br /&gt;
|-&lt;br /&gt;
|2||Horizontal Sync Position||00000000||46&lt;br /&gt;
|-&lt;br /&gt;
|3||Horizontal and Vertical Sync Widths||VxxxHHHH||128+14||HSync pulse up to 15 characters wide, should always be more than 8; VSync bit not present on some CRTCs.&lt;br /&gt;
|-&lt;br /&gt;
|4||Vertical Total||x0000000||38&lt;br /&gt;
|-&lt;br /&gt;
|5||Vertical Total Adjust||xxx00000||0&lt;br /&gt;
|-&lt;br /&gt;
|6||Vertical Displayed||x0000000||25&lt;br /&gt;
|-&lt;br /&gt;
|7||Vertical Sync position||x0000000||30&lt;br /&gt;
|-&lt;br /&gt;
|8||Interlace and Skew||xxxxxx00||0||00: No interlace; 01: Interlace Sync Raster Scan Mode; 10: No Interlace; 11: Interlace Sync and Video Raster Scan Mode&lt;br /&gt;
|-&lt;br /&gt;
|9||Maximum Raster Address||xxx00000||7||Maximum scan line address on CPC can hold between 0 and 7, higher values' upper bits are ignored&lt;br /&gt;
|-&lt;br /&gt;
|10||Cursor Start Raster||xBP00000||0||Cursor not used on CPC. B = Blink On/Off; P = Blink Period Control (Slow/Fast). Sets first raster row of character that cursor is on to invert.&lt;br /&gt;
|-&lt;br /&gt;
|11||Cursor End Raster||xxx00000||0||Sets last raster row of character that cursor is on to invert&lt;br /&gt;
|-&lt;br /&gt;
|12||Display Start Address (High)||xx000000||32&lt;br /&gt;
|-&lt;br /&gt;
|13||Display Start Address (Low)||00000000||0||Allows you to offset the start of screen memory, useful when using memory from address &amp;amp;0000.&lt;br /&gt;
|-&lt;br /&gt;
|14||Cursor Address (High)||xx000000||0&lt;br /&gt;
|-&lt;br /&gt;
|15||Cursor Address (High)||00000000||0&lt;br /&gt;
|-&lt;br /&gt;
|16||Light Pen Address (High)||xx000000||||Read Only&lt;br /&gt;
|-&lt;br /&gt;
|17||Light Pen Address (High)||00000000||||Read Only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CRTC Differences ==&lt;br /&gt;
&lt;br /&gt;
In this section I will attempt to identify all the differences between each CRTC. &lt;br /&gt;
&lt;br /&gt;
The following tables list the functions that can be accessed for each type: &lt;br /&gt;
&lt;br /&gt;
Type 0&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||-||- &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 1&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||Read Status Register||Read Only &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 2&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||-||- &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 3 and 4&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||Read from selected internal 6845 register||Read Only &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It is not possible to read from all the internal registers, this table shows the read/write status of each register for each type: &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|rowspan=2|''Register Index''||rowspan=2|''Register Name''||colspan=4|''Type'' &lt;br /&gt;
|-&lt;br /&gt;
|0||1||2||3 &lt;br /&gt;
|-&lt;br /&gt;
|0||Horizontal Total||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|1||Horizontal Displayed||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|2||Horizontal Sync Position||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|3||Horizontal and Vertical Sync Widths||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|4||Vertical Total||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|5||Vertical Total Adjust||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|6||Vertical Displayed||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|7||Vertical Sync position||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|8||Interlace and Skew||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|9||Maximum Raster Address||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|10||Cursor Start Raster||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|11||Cursor End Raster||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|12||Display Start Address (High)||Read/Write||Write Only||Write Only||Read/Write (note 2) &lt;br /&gt;
|-&lt;br /&gt;
|13||Display Start Address (Low)||Read/Write||Write Only||Write Only||Read/Write (note 2) &lt;br /&gt;
|-&lt;br /&gt;
|14||Cursor Address (High)||Read/Write||Read/Write||Read/Write||Read/Write (note 2) ***check &lt;br /&gt;
|-&lt;br /&gt;
|15||Cursor Address (Low)||Read/Write||Read/Write||Read/Write||Read/Write (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|16||Light Pen Address (High)||Read Only||Read Only||Read Only||Read Only (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|17||Light Pen Address (High)||Read Only||Read Only||Read Only||Read Only (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Notes'''&lt;br /&gt;
&lt;br /&gt;
1. On type 0 and 1, if a Write Only register is read from, &amp;quot;0&amp;quot; is returned. &lt;br /&gt;
&lt;br /&gt;
2. See the document &amp;quot;Extra CPC Plus Hardware Information&amp;quot; for more details.&lt;br /&gt;
&lt;br /&gt;
== Datasheets ==&lt;br /&gt;
&lt;br /&gt;
* [[Media:hd6845.hitachi.pdf|HD6845 (Hitachi) (aka type 0)]]&lt;br /&gt;
* [[Media:Um6845.umc.pdf|UM6845 (UMC)  (aka type 0)]]&lt;br /&gt;
* [[Media:Um6845r.umc.pdf|UM6845R (UMC)  (aka type 1)]]&lt;br /&gt;
* [[Media:Mc6845.motorola.pdf|MC6845 (Motorola) (aka type 2)]]&lt;br /&gt;
&lt;br /&gt;
* [[VHDL implementation of the 6845]]&lt;br /&gt;
&lt;br /&gt;
== Clones ==&lt;br /&gt;
* [CM607P   a Bulgarian clone made in Pravetz factory]&lt;br /&gt;
* [EF6845P  by Thomson Semiconductors]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/6845 Wikipedia on the CRTC]&lt;br /&gt;
* [http://www.grimware.org/doku.php/documentations/devices/crtc CRTCs on grimware]&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
&lt;br /&gt;
*[[Gate Array]]&lt;br /&gt;
&lt;br /&gt;
*[[ASIC]]&lt;br /&gt;
&lt;br /&gt;
*[[Video modes]]&lt;br /&gt;
&lt;br /&gt;
*[[Synchronizing with the CRTC and display]] : technic and details on the relationship between Gate Array and CRTC.&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]] [[Category:CPC Internal Components]] [[Category:Programming]] [[Category:Datasheet]] [[Category:Graphic]]&lt;/div&gt;</summary>
		<author><name>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=CRTC&amp;diff=80026</id>
		<title>CRTC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=CRTC&amp;diff=80026"/>
				<updated>2012-07-09T17:16:22Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: /* The Internal registers of the 6845 are */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* ''This is an article about the &amp;quot;Cathode Ray Tube Controller&amp;quot; hardware unit of the Amstrad CPC. For the cpc scene member see [[ChaRleyTroniC]]''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The '''CRTC''' (Cathode Ray Tube Controller) generates the video signal of the Amstrad CPC.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
== Type 0 - HD6845SP / HD6845S / UM6845 ==&lt;br /&gt;
&lt;br /&gt;
== Type 1 - UM6845R ==&lt;br /&gt;
&lt;br /&gt;
== Type 2 - MC6845 / MC6845P ==&lt;br /&gt;
&lt;br /&gt;
== Type 3 - The ASIC ==&lt;br /&gt;
&lt;br /&gt;
== Type 4 - PreASIC ==&lt;br /&gt;
&lt;br /&gt;
== Programming the CRTC ==&lt;br /&gt;
&lt;br /&gt;
The 6845 Cathode Ray Tube Controller (CRTC)&lt;br /&gt;
Introduction&lt;br /&gt;
The 6845 Cathode Ray Tube Controller (CRTC) is a programmable IC used to generate video displays. This IC is used in a variety of computers including the Amstrad CPC, Amstrad CPC+ and KC Compact. &lt;br /&gt;
&lt;br /&gt;
CRTC in the Amstrad CPC/CPC+ and KC Compact designs&lt;br /&gt;
The CRTC was a common part available from many different manufacturers. During the life of the CPC, Amstrad sourced the CRTC from various manufacturers. &lt;br /&gt;
&lt;br /&gt;
All ICs used were based on the same design but have a different implementation. As a result they do not operate identically in all situations. This document highlights these differences. &lt;br /&gt;
&lt;br /&gt;
This table lists the known ICs used, with their part number, manufacturer and type number. &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Part number''||''Manufacturer''||''Type number (note 3)''&lt;br /&gt;
|-&lt;br /&gt;
|HD6845S||Hitachi||0&lt;br /&gt;
|-&lt;br /&gt;
|UM6845||UMC||0&lt;br /&gt;
|-&lt;br /&gt;
|UM6845R||UMC||1&lt;br /&gt;
|-&lt;br /&gt;
|MC6845||Motorola||2&lt;br /&gt;
|-&lt;br /&gt;
|AMS40489||Amstrad||3 (note 1)&lt;br /&gt;
|-&lt;br /&gt;
|???||Amstrad?||4 (note 2)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''NOTES''' &lt;br /&gt;
&lt;br /&gt;
1. The CRTC functionality is integrated into the CPC+ ASIC. This type exists only in the CPC464+,CPC6128+ and GX4000. &lt;br /&gt;
&lt;br /&gt;
2. As far as I know, this type exists only in &amp;quot;cost-down&amp;quot; CPC6128 systems. In the &amp;quot;cost-down&amp;quot; CPC6128, the CRTC functionality is integrated into a single ASIC IC. This ASIC is often refered to as the &amp;quot;Pre-ASIC&amp;quot; because it preceeded the CPC+ ASIC.&lt;br /&gt;
 &lt;br /&gt;
3. In the Amstrad community each 6845 implementation has been assigned a type number. This type identifies a group of implementations which operate in exactly the same way. &lt;br /&gt;
&lt;br /&gt;
As far as I know, the type number system was originally used by demo programmers. &lt;br /&gt;
&lt;br /&gt;
It is possible to detect the 6845 present using software methods, and this is done to: &lt;br /&gt;
&lt;br /&gt;
warn that the software was not designed for the detected 6845 and may function incorrectly, &lt;br /&gt;
to adapt the software so that it will run with the detected 6845 &lt;br /&gt;
In most cases, the type of the detected 6845 is reported. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. As far as I know, the KC compact used HD6845S only. &lt;br /&gt;
&lt;br /&gt;
The 6845 is selected when bit 14 of the I/O port address is set to &amp;quot;0&amp;quot;. Bit 1 and 0 of the I/O port address define the function to access. The remaining bits can be any value, but it is adviseable to set these to &amp;quot;1&amp;quot; to avoid conflict with other devices in the system. &lt;br /&gt;
&lt;br /&gt;
The recommended I/O port addressess are&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''I/O port address''||''Function''||''Read/Write''&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BCxx||Select 6845 register||Write only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BDxx||Write 6845 register data||Write only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BExx||(note 1)||Read only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BFxx||(note 1)||Read only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''NOTE'''&lt;br /&gt;
&lt;br /&gt;
1. The function of these I/O ports is dependant on the CRTC type &lt;br /&gt;
Signals&lt;br /&gt;
&lt;br /&gt;
The following table defines the generated memory address from the CRTC and Gate-Array signals. &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Memory Address Signal''||''Signal source''||''Signal name''&lt;br /&gt;
|-&lt;br /&gt;
|A15||6845||MA12 &lt;br /&gt;
|-&lt;br /&gt;
|A14||6845||MA11 &lt;br /&gt;
|-&lt;br /&gt;
|A13||6845||RA2 &lt;br /&gt;
|-&lt;br /&gt;
|A12||6845||RA1 &lt;br /&gt;
|-&lt;br /&gt;
|A11||6845||RA0 &lt;br /&gt;
|-&lt;br /&gt;
|A10||6845||MA9 &lt;br /&gt;
|-&lt;br /&gt;
|A9||6845||MA8 &lt;br /&gt;
|-&lt;br /&gt;
|A8||6845||MA7 &lt;br /&gt;
|-&lt;br /&gt;
|A7||6845||MA6 &lt;br /&gt;
|-&lt;br /&gt;
|A6||6845||MA5 &lt;br /&gt;
|-&lt;br /&gt;
|A5||6845||MA4 &lt;br /&gt;
|-&lt;br /&gt;
|A4||6845||MA3 &lt;br /&gt;
|-&lt;br /&gt;
|A3||6845||MA2 &lt;br /&gt;
|-&lt;br /&gt;
|A2||6845||MA1 &lt;br /&gt;
|-&lt;br /&gt;
|A1||6845||MA0&lt;br /&gt;
|-&lt;br /&gt;
|A0||Gate-Array||CCLK&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DISPTMG ==&lt;br /&gt;
&lt;br /&gt;
DISPTMG signal defines the border. When DISPTMG is &amp;quot;1&amp;quot; the border colour is output to the display. &lt;br /&gt;
&lt;br /&gt;
== HSYNC and VSYNC ==&lt;br /&gt;
&lt;br /&gt;
HSYNC and VSYNC from the CRTC are passed into the Gate-Array. The Gate-Array modifies the signals and then mixes these to form the Composite-Sync which is output to the display &lt;br /&gt;
The 6845 Design&lt;br /&gt;
Registers&lt;br /&gt;
&lt;br /&gt;
== The Internal registers of the 6845 are == &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Register Index''||''Register Name''||''Range''||''CPC Setting''||''Notes''&lt;br /&gt;
|-&lt;br /&gt;
|0||Horizontal Total||00000000||63&lt;br /&gt;
|-&lt;br /&gt;
|1||Horizontal Displayed||00000000||40&lt;br /&gt;
|-&lt;br /&gt;
|2||Horizontal Sync Position||00000000||46&lt;br /&gt;
|-&lt;br /&gt;
|3||Horizontal and Vertical Sync Widths||xxxxx000||&lt;br /&gt;
|-&lt;br /&gt;
|4||Vertical Total||x0000000||38&lt;br /&gt;
|-&lt;br /&gt;
|5||Vertical Total Adjust||xxx00000||0&lt;br /&gt;
|-&lt;br /&gt;
|6||Vertical Displayed||x0000000||25&lt;br /&gt;
|-&lt;br /&gt;
|7||Vertical Sync position||x0000000||30&lt;br /&gt;
|-&lt;br /&gt;
|8||Interlace and Skew||xxxxxx00||0||00: No interlace; 01: Interlace Sync Raster Scan Mode; 10: No Interlace; 11: Interlace Sync and Video Raster Scan Mode&lt;br /&gt;
|-&lt;br /&gt;
|9||Maximum Raster Address||xxx00000||7||Maximum scan line address on CPC can hold between 0 and 7, higher values' upper bits are ignored&lt;br /&gt;
|-&lt;br /&gt;
|10||Cursor Start Raster||xBP00000||0||Cursor not used on CPC. B = Blink On/Off; P = Blink Period Control (Slow/Fast). Sets first raster row of character that cursor is on to invert.&lt;br /&gt;
|-&lt;br /&gt;
|11||Cursor End Raster||xxx00000||0||Sets last raster row of character that cursor is on to invert&lt;br /&gt;
|-&lt;br /&gt;
|12||Display Start Address (High)||xx000000||32&lt;br /&gt;
|-&lt;br /&gt;
|13||Display Start Address (Low)||00000000||0||Allows you to offset the start of screen memory, useful when using memory from address &amp;amp;0000.&lt;br /&gt;
|-&lt;br /&gt;
|14||Cursor Address (High)||xx000000||0&lt;br /&gt;
|-&lt;br /&gt;
|15||Cursor Address (High)||00000000||0&lt;br /&gt;
|-&lt;br /&gt;
|16||Light Pen Address (High)||xx000000||||Read Only&lt;br /&gt;
|-&lt;br /&gt;
|17||Light Pen Address (High)||00000000||||Read Only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CRTC Differences ==&lt;br /&gt;
&lt;br /&gt;
In this section I will attempt to identify all the differences between each CRTC. &lt;br /&gt;
&lt;br /&gt;
The following tables list the functions that can be accessed for each type: &lt;br /&gt;
&lt;br /&gt;
Type 0&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||-||- &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 1&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||Read Status Register||Read Only &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 2&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||-||- &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 3 and 4&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||Read from selected internal 6845 register||Read Only &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It is not possible to read from all the internal registers, this table shows the read/write status of each register for each type: &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|rowspan=2|''Register Index''||rowspan=2|''Register Name''||colspan=4|''Type'' &lt;br /&gt;
|-&lt;br /&gt;
|0||1||2||3 &lt;br /&gt;
|-&lt;br /&gt;
|0||Horizontal Total||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|1||Horizontal Displayed||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|2||Horizontal Sync Position||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|3||Horizontal and Vertical Sync Widths||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|4||Vertical Total||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|5||Vertical Total Adjust||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|6||Vertical Displayed||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|7||Vertical Sync position||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|8||Interlace and Skew||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|9||Maximum Raster Address||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|10||Cursor Start Raster||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|11||Cursor End Raster||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|12||Display Start Address (High)||Read/Write||Write Only||Write Only||Read/Write (note 2) &lt;br /&gt;
|-&lt;br /&gt;
|13||Display Start Address (Low)||Read/Write||Write Only||Write Only||Read/Write (note 2) &lt;br /&gt;
|-&lt;br /&gt;
|14||Cursor Address (High)||Read/Write||Read/Write||Read/Write||Read/Write (note 2) ***check &lt;br /&gt;
|-&lt;br /&gt;
|15||Cursor Address (Low)||Read/Write||Read/Write||Read/Write||Read/Write (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|16||Light Pen Address (High)||Read Only||Read Only||Read Only||Read Only (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|17||Light Pen Address (High)||Read Only||Read Only||Read Only||Read Only (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Notes'''&lt;br /&gt;
&lt;br /&gt;
1. On type 0 and 1, if a Write Only register is read from, &amp;quot;0&amp;quot; is returned. &lt;br /&gt;
&lt;br /&gt;
2. See the document &amp;quot;Extra CPC Plus Hardware Information&amp;quot; for more details.&lt;br /&gt;
&lt;br /&gt;
== Datasheets ==&lt;br /&gt;
&lt;br /&gt;
* [[Media:hd6845.hitachi.pdf|HD6845 (Hitachi) (aka type 0)]]&lt;br /&gt;
* [[Media:Um6845.umc.pdf|UM6845 (UMC)  (aka type 0)]]&lt;br /&gt;
* [[Media:Um6845r.umc.pdf|UM6845R (UMC)  (aka type 1)]]&lt;br /&gt;
* [[Media:Mc6845.motorola.pdf|MC6845 (Motorola) (aka type 2)]]&lt;br /&gt;
&lt;br /&gt;
* [[VHDL implementation of the 6845]]&lt;br /&gt;
&lt;br /&gt;
== Clones ==&lt;br /&gt;
* [CM607P   a Bulgarian clone made in Pravetz factory]&lt;br /&gt;
* [EF6845P  by Thomson Semiconductors]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/6845 Wikipedia on the CRTC]&lt;br /&gt;
* [http://www.grimware.org/doku.php/documentations/devices/crtc CRTCs on grimware]&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
&lt;br /&gt;
*[[Gate Array]]&lt;br /&gt;
&lt;br /&gt;
*[[ASIC]]&lt;br /&gt;
&lt;br /&gt;
*[[Video modes]]&lt;br /&gt;
&lt;br /&gt;
*[[Synchronizing with the CRTC and display]] : technic and details on the relationship between Gate Array and CRTC.&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]] [[Category:CPC Internal Components]] [[Category:Programming]] [[Category:Datasheet]] [[Category:Graphic]]&lt;/div&gt;</summary>
		<author><name>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=CRTC&amp;diff=80025</id>
		<title>CRTC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=CRTC&amp;diff=80025"/>
				<updated>2012-07-09T17:08:48Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: /* The Internal registers of the 6845 are */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* ''This is an article about the &amp;quot;Cathode Ray Tube Controller&amp;quot; hardware unit of the Amstrad CPC. For the cpc scene member see [[ChaRleyTroniC]]''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The '''CRTC''' (Cathode Ray Tube Controller) generates the video signal of the Amstrad CPC.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
== Type 0 - HD6845SP / HD6845S / UM6845 ==&lt;br /&gt;
&lt;br /&gt;
== Type 1 - UM6845R ==&lt;br /&gt;
&lt;br /&gt;
== Type 2 - MC6845 / MC6845P ==&lt;br /&gt;
&lt;br /&gt;
== Type 3 - The ASIC ==&lt;br /&gt;
&lt;br /&gt;
== Type 4 - PreASIC ==&lt;br /&gt;
&lt;br /&gt;
== Programming the CRTC ==&lt;br /&gt;
&lt;br /&gt;
The 6845 Cathode Ray Tube Controller (CRTC)&lt;br /&gt;
Introduction&lt;br /&gt;
The 6845 Cathode Ray Tube Controller (CRTC) is a programmable IC used to generate video displays. This IC is used in a variety of computers including the Amstrad CPC, Amstrad CPC+ and KC Compact. &lt;br /&gt;
&lt;br /&gt;
CRTC in the Amstrad CPC/CPC+ and KC Compact designs&lt;br /&gt;
The CRTC was a common part available from many different manufacturers. During the life of the CPC, Amstrad sourced the CRTC from various manufacturers. &lt;br /&gt;
&lt;br /&gt;
All ICs used were based on the same design but have a different implementation. As a result they do not operate identically in all situations. This document highlights these differences. &lt;br /&gt;
&lt;br /&gt;
This table lists the known ICs used, with their part number, manufacturer and type number. &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Part number''||''Manufacturer''||''Type number (note 3)''&lt;br /&gt;
|-&lt;br /&gt;
|HD6845S||Hitachi||0&lt;br /&gt;
|-&lt;br /&gt;
|UM6845||UMC||0&lt;br /&gt;
|-&lt;br /&gt;
|UM6845R||UMC||1&lt;br /&gt;
|-&lt;br /&gt;
|MC6845||Motorola||2&lt;br /&gt;
|-&lt;br /&gt;
|AMS40489||Amstrad||3 (note 1)&lt;br /&gt;
|-&lt;br /&gt;
|???||Amstrad?||4 (note 2)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''NOTES''' &lt;br /&gt;
&lt;br /&gt;
1. The CRTC functionality is integrated into the CPC+ ASIC. This type exists only in the CPC464+,CPC6128+ and GX4000. &lt;br /&gt;
&lt;br /&gt;
2. As far as I know, this type exists only in &amp;quot;cost-down&amp;quot; CPC6128 systems. In the &amp;quot;cost-down&amp;quot; CPC6128, the CRTC functionality is integrated into a single ASIC IC. This ASIC is often refered to as the &amp;quot;Pre-ASIC&amp;quot; because it preceeded the CPC+ ASIC.&lt;br /&gt;
 &lt;br /&gt;
3. In the Amstrad community each 6845 implementation has been assigned a type number. This type identifies a group of implementations which operate in exactly the same way. &lt;br /&gt;
&lt;br /&gt;
As far as I know, the type number system was originally used by demo programmers. &lt;br /&gt;
&lt;br /&gt;
It is possible to detect the 6845 present using software methods, and this is done to: &lt;br /&gt;
&lt;br /&gt;
warn that the software was not designed for the detected 6845 and may function incorrectly, &lt;br /&gt;
to adapt the software so that it will run with the detected 6845 &lt;br /&gt;
In most cases, the type of the detected 6845 is reported. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. As far as I know, the KC compact used HD6845S only. &lt;br /&gt;
&lt;br /&gt;
The 6845 is selected when bit 14 of the I/O port address is set to &amp;quot;0&amp;quot;. Bit 1 and 0 of the I/O port address define the function to access. The remaining bits can be any value, but it is adviseable to set these to &amp;quot;1&amp;quot; to avoid conflict with other devices in the system. &lt;br /&gt;
&lt;br /&gt;
The recommended I/O port addressess are&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''I/O port address''||''Function''||''Read/Write''&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BCxx||Select 6845 register||Write only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BDxx||Write 6845 register data||Write only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BExx||(note 1)||Read only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BFxx||(note 1)||Read only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''NOTE'''&lt;br /&gt;
&lt;br /&gt;
1. The function of these I/O ports is dependant on the CRTC type &lt;br /&gt;
Signals&lt;br /&gt;
&lt;br /&gt;
The following table defines the generated memory address from the CRTC and Gate-Array signals. &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Memory Address Signal''||''Signal source''||''Signal name''&lt;br /&gt;
|-&lt;br /&gt;
|A15||6845||MA12 &lt;br /&gt;
|-&lt;br /&gt;
|A14||6845||MA11 &lt;br /&gt;
|-&lt;br /&gt;
|A13||6845||RA2 &lt;br /&gt;
|-&lt;br /&gt;
|A12||6845||RA1 &lt;br /&gt;
|-&lt;br /&gt;
|A11||6845||RA0 &lt;br /&gt;
|-&lt;br /&gt;
|A10||6845||MA9 &lt;br /&gt;
|-&lt;br /&gt;
|A9||6845||MA8 &lt;br /&gt;
|-&lt;br /&gt;
|A8||6845||MA7 &lt;br /&gt;
|-&lt;br /&gt;
|A7||6845||MA6 &lt;br /&gt;
|-&lt;br /&gt;
|A6||6845||MA5 &lt;br /&gt;
|-&lt;br /&gt;
|A5||6845||MA4 &lt;br /&gt;
|-&lt;br /&gt;
|A4||6845||MA3 &lt;br /&gt;
|-&lt;br /&gt;
|A3||6845||MA2 &lt;br /&gt;
|-&lt;br /&gt;
|A2||6845||MA1 &lt;br /&gt;
|-&lt;br /&gt;
|A1||6845||MA0&lt;br /&gt;
|-&lt;br /&gt;
|A0||Gate-Array||CCLK&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DISPTMG ==&lt;br /&gt;
&lt;br /&gt;
DISPTMG signal defines the border. When DISPTMG is &amp;quot;1&amp;quot; the border colour is output to the display. &lt;br /&gt;
&lt;br /&gt;
== HSYNC and VSYNC ==&lt;br /&gt;
&lt;br /&gt;
HSYNC and VSYNC from the CRTC are passed into the Gate-Array. The Gate-Array modifies the signals and then mixes these to form the Composite-Sync which is output to the display &lt;br /&gt;
The 6845 Design&lt;br /&gt;
Registers&lt;br /&gt;
&lt;br /&gt;
== The Internal registers of the 6845 are == &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Register Index''||''Register Name''||''Range''||''CPC Setting''||''Notes''&lt;br /&gt;
|-&lt;br /&gt;
|0||Horizontal Total||00000000||64&lt;br /&gt;
|-&lt;br /&gt;
|1||Horizontal Displayed||00000000||40&lt;br /&gt;
|-&lt;br /&gt;
|2||Horizontal Sync Position||00000000||&lt;br /&gt;
|-&lt;br /&gt;
|3||Horizontal and Vertical Sync Widths||xxxxx000||&lt;br /&gt;
|-&lt;br /&gt;
|4||Vertical Total||x0000000||&lt;br /&gt;
|-&lt;br /&gt;
|5||Vertical Total Adjust||xxx00000||&lt;br /&gt;
|-&lt;br /&gt;
|6||Vertical Displayed||x0000000||25&lt;br /&gt;
|-&lt;br /&gt;
|7||Vertical Sync position||x0000000||&lt;br /&gt;
|-&lt;br /&gt;
|8||Interlace and Skew||xxxxxx00||0||00: No interlace; 01: Interlace Sync Raster Scan Mode; 10: No Interlace; 11: Interlace Sync and Video Raster Scan Mode&lt;br /&gt;
|-&lt;br /&gt;
|9||Maximum Raster Address||xxx00000||7||Maximum scan line address on CPC can hold between 0 and 7, higher values' upper bits are ignored&lt;br /&gt;
|-&lt;br /&gt;
|10||Cursor Start Raster||xBP00000||0||Cursor not used on CPC. B = Blink On/Off; P = Blink Period Control (Slow/Fast). Sets first raster row of character that cursor is on to invert.&lt;br /&gt;
|-&lt;br /&gt;
|11||Cursor End Raster||xxx00000||0||Sets last raster row of character that cursor is on to invert&lt;br /&gt;
|-&lt;br /&gt;
|12||Display Start Address (High)||xx000000||&lt;br /&gt;
|-&lt;br /&gt;
|13||Display Start Address (Low)||00000000||0||Allows you to offset the start of screen memory, useful when using memory from address &amp;amp;0000.&lt;br /&gt;
|-&lt;br /&gt;
|14||Cursor Address (High)||xx000000||&lt;br /&gt;
|-&lt;br /&gt;
|15||Cursor Address (High)||00000000||&lt;br /&gt;
|-&lt;br /&gt;
|16||Light Pen Address (High)||xx000000||||Read Only&lt;br /&gt;
|-&lt;br /&gt;
|17||Light Pen Address (High)||00000000||||Read Only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CRTC Differences ==&lt;br /&gt;
&lt;br /&gt;
In this section I will attempt to identify all the differences between each CRTC. &lt;br /&gt;
&lt;br /&gt;
The following tables list the functions that can be accessed for each type: &lt;br /&gt;
&lt;br /&gt;
Type 0&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||-||- &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 1&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||Read Status Register||Read Only &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 2&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||-||- &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 3 and 4&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||Read from selected internal 6845 register||Read Only &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It is not possible to read from all the internal registers, this table shows the read/write status of each register for each type: &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|rowspan=2|''Register Index''||rowspan=2|''Register Name''||colspan=4|''Type'' &lt;br /&gt;
|-&lt;br /&gt;
|0||1||2||3 &lt;br /&gt;
|-&lt;br /&gt;
|0||Horizontal Total||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|1||Horizontal Displayed||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|2||Horizontal Sync Position||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|3||Horizontal and Vertical Sync Widths||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|4||Vertical Total||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|5||Vertical Total Adjust||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|6||Vertical Displayed||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|7||Vertical Sync position||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|8||Interlace and Skew||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|9||Maximum Raster Address||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|10||Cursor Start Raster||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|11||Cursor End Raster||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|12||Display Start Address (High)||Read/Write||Write Only||Write Only||Read/Write (note 2) &lt;br /&gt;
|-&lt;br /&gt;
|13||Display Start Address (Low)||Read/Write||Write Only||Write Only||Read/Write (note 2) &lt;br /&gt;
|-&lt;br /&gt;
|14||Cursor Address (High)||Read/Write||Read/Write||Read/Write||Read/Write (note 2) ***check &lt;br /&gt;
|-&lt;br /&gt;
|15||Cursor Address (Low)||Read/Write||Read/Write||Read/Write||Read/Write (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|16||Light Pen Address (High)||Read Only||Read Only||Read Only||Read Only (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|17||Light Pen Address (High)||Read Only||Read Only||Read Only||Read Only (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Notes'''&lt;br /&gt;
&lt;br /&gt;
1. On type 0 and 1, if a Write Only register is read from, &amp;quot;0&amp;quot; is returned. &lt;br /&gt;
&lt;br /&gt;
2. See the document &amp;quot;Extra CPC Plus Hardware Information&amp;quot; for more details.&lt;br /&gt;
&lt;br /&gt;
== Datasheets ==&lt;br /&gt;
&lt;br /&gt;
* [[Media:hd6845.hitachi.pdf|HD6845 (Hitachi) (aka type 0)]]&lt;br /&gt;
* [[Media:Um6845.umc.pdf|UM6845 (UMC)  (aka type 0)]]&lt;br /&gt;
* [[Media:Um6845r.umc.pdf|UM6845R (UMC)  (aka type 1)]]&lt;br /&gt;
* [[Media:Mc6845.motorola.pdf|MC6845 (Motorola) (aka type 2)]]&lt;br /&gt;
&lt;br /&gt;
* [[VHDL implementation of the 6845]]&lt;br /&gt;
&lt;br /&gt;
== Clones ==&lt;br /&gt;
* [CM607P   a Bulgarian clone made in Pravetz factory]&lt;br /&gt;
* [EF6845P  by Thomson Semiconductors]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/6845 Wikipedia on the CRTC]&lt;br /&gt;
* [http://www.grimware.org/doku.php/documentations/devices/crtc CRTCs on grimware]&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
&lt;br /&gt;
*[[Gate Array]]&lt;br /&gt;
&lt;br /&gt;
*[[ASIC]]&lt;br /&gt;
&lt;br /&gt;
*[[Video modes]]&lt;br /&gt;
&lt;br /&gt;
*[[Synchronizing with the CRTC and display]] : technic and details on the relationship between Gate Array and CRTC.&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]] [[Category:CPC Internal Components]] [[Category:Programming]] [[Category:Datasheet]] [[Category:Graphic]]&lt;/div&gt;</summary>
		<author><name>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=CRTC&amp;diff=80024</id>
		<title>CRTC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=CRTC&amp;diff=80024"/>
				<updated>2012-07-09T17:02:27Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: /* The Internal registers of the 6845 are */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* ''This is an article about the &amp;quot;Cathode Ray Tube Controller&amp;quot; hardware unit of the Amstrad CPC. For the cpc scene member see [[ChaRleyTroniC]]''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The '''CRTC''' (Cathode Ray Tube Controller) generates the video signal of the Amstrad CPC.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
== Type 0 - HD6845SP / HD6845S / UM6845 ==&lt;br /&gt;
&lt;br /&gt;
== Type 1 - UM6845R ==&lt;br /&gt;
&lt;br /&gt;
== Type 2 - MC6845 / MC6845P ==&lt;br /&gt;
&lt;br /&gt;
== Type 3 - The ASIC ==&lt;br /&gt;
&lt;br /&gt;
== Type 4 - PreASIC ==&lt;br /&gt;
&lt;br /&gt;
== Programming the CRTC ==&lt;br /&gt;
&lt;br /&gt;
The 6845 Cathode Ray Tube Controller (CRTC)&lt;br /&gt;
Introduction&lt;br /&gt;
The 6845 Cathode Ray Tube Controller (CRTC) is a programmable IC used to generate video displays. This IC is used in a variety of computers including the Amstrad CPC, Amstrad CPC+ and KC Compact. &lt;br /&gt;
&lt;br /&gt;
CRTC in the Amstrad CPC/CPC+ and KC Compact designs&lt;br /&gt;
The CRTC was a common part available from many different manufacturers. During the life of the CPC, Amstrad sourced the CRTC from various manufacturers. &lt;br /&gt;
&lt;br /&gt;
All ICs used were based on the same design but have a different implementation. As a result they do not operate identically in all situations. This document highlights these differences. &lt;br /&gt;
&lt;br /&gt;
This table lists the known ICs used, with their part number, manufacturer and type number. &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Part number''||''Manufacturer''||''Type number (note 3)''&lt;br /&gt;
|-&lt;br /&gt;
|HD6845S||Hitachi||0&lt;br /&gt;
|-&lt;br /&gt;
|UM6845||UMC||0&lt;br /&gt;
|-&lt;br /&gt;
|UM6845R||UMC||1&lt;br /&gt;
|-&lt;br /&gt;
|MC6845||Motorola||2&lt;br /&gt;
|-&lt;br /&gt;
|AMS40489||Amstrad||3 (note 1)&lt;br /&gt;
|-&lt;br /&gt;
|???||Amstrad?||4 (note 2)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''NOTES''' &lt;br /&gt;
&lt;br /&gt;
1. The CRTC functionality is integrated into the CPC+ ASIC. This type exists only in the CPC464+,CPC6128+ and GX4000. &lt;br /&gt;
&lt;br /&gt;
2. As far as I know, this type exists only in &amp;quot;cost-down&amp;quot; CPC6128 systems. In the &amp;quot;cost-down&amp;quot; CPC6128, the CRTC functionality is integrated into a single ASIC IC. This ASIC is often refered to as the &amp;quot;Pre-ASIC&amp;quot; because it preceeded the CPC+ ASIC.&lt;br /&gt;
 &lt;br /&gt;
3. In the Amstrad community each 6845 implementation has been assigned a type number. This type identifies a group of implementations which operate in exactly the same way. &lt;br /&gt;
&lt;br /&gt;
As far as I know, the type number system was originally used by demo programmers. &lt;br /&gt;
&lt;br /&gt;
It is possible to detect the 6845 present using software methods, and this is done to: &lt;br /&gt;
&lt;br /&gt;
warn that the software was not designed for the detected 6845 and may function incorrectly, &lt;br /&gt;
to adapt the software so that it will run with the detected 6845 &lt;br /&gt;
In most cases, the type of the detected 6845 is reported. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. As far as I know, the KC compact used HD6845S only. &lt;br /&gt;
&lt;br /&gt;
The 6845 is selected when bit 14 of the I/O port address is set to &amp;quot;0&amp;quot;. Bit 1 and 0 of the I/O port address define the function to access. The remaining bits can be any value, but it is adviseable to set these to &amp;quot;1&amp;quot; to avoid conflict with other devices in the system. &lt;br /&gt;
&lt;br /&gt;
The recommended I/O port addressess are&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''I/O port address''||''Function''||''Read/Write''&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BCxx||Select 6845 register||Write only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BDxx||Write 6845 register data||Write only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BExx||(note 1)||Read only&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;BFxx||(note 1)||Read only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''NOTE'''&lt;br /&gt;
&lt;br /&gt;
1. The function of these I/O ports is dependant on the CRTC type &lt;br /&gt;
Signals&lt;br /&gt;
&lt;br /&gt;
The following table defines the generated memory address from the CRTC and Gate-Array signals. &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Memory Address Signal''||''Signal source''||''Signal name''&lt;br /&gt;
|-&lt;br /&gt;
|A15||6845||MA12 &lt;br /&gt;
|-&lt;br /&gt;
|A14||6845||MA11 &lt;br /&gt;
|-&lt;br /&gt;
|A13||6845||RA2 &lt;br /&gt;
|-&lt;br /&gt;
|A12||6845||RA1 &lt;br /&gt;
|-&lt;br /&gt;
|A11||6845||RA0 &lt;br /&gt;
|-&lt;br /&gt;
|A10||6845||MA9 &lt;br /&gt;
|-&lt;br /&gt;
|A9||6845||MA8 &lt;br /&gt;
|-&lt;br /&gt;
|A8||6845||MA7 &lt;br /&gt;
|-&lt;br /&gt;
|A7||6845||MA6 &lt;br /&gt;
|-&lt;br /&gt;
|A6||6845||MA5 &lt;br /&gt;
|-&lt;br /&gt;
|A5||6845||MA4 &lt;br /&gt;
|-&lt;br /&gt;
|A4||6845||MA3 &lt;br /&gt;
|-&lt;br /&gt;
|A3||6845||MA2 &lt;br /&gt;
|-&lt;br /&gt;
|A2||6845||MA1 &lt;br /&gt;
|-&lt;br /&gt;
|A1||6845||MA0&lt;br /&gt;
|-&lt;br /&gt;
|A0||Gate-Array||CCLK&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== DISPTMG ==&lt;br /&gt;
&lt;br /&gt;
DISPTMG signal defines the border. When DISPTMG is &amp;quot;1&amp;quot; the border colour is output to the display. &lt;br /&gt;
&lt;br /&gt;
== HSYNC and VSYNC ==&lt;br /&gt;
&lt;br /&gt;
HSYNC and VSYNC from the CRTC are passed into the Gate-Array. The Gate-Array modifies the signals and then mixes these to form the Composite-Sync which is output to the display &lt;br /&gt;
The 6845 Design&lt;br /&gt;
Registers&lt;br /&gt;
&lt;br /&gt;
== The Internal registers of the 6845 are == &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''Register Index''||''Register Name''||''Range''||''CPC Setting''||''Notes''&lt;br /&gt;
|-&lt;br /&gt;
|0||Horizontal Total||00000000||64&lt;br /&gt;
|-&lt;br /&gt;
|1||Horizontal Displayed||00000000||40&lt;br /&gt;
|-&lt;br /&gt;
|2||Horizontal Sync Position||00000000||&lt;br /&gt;
|-&lt;br /&gt;
|3||Horizontal and Vertical Sync Widths||xxxxx000||&lt;br /&gt;
|-&lt;br /&gt;
|4||Vertical Total||x0000000||&lt;br /&gt;
|-&lt;br /&gt;
|5||Vertical Total Adjust||xxx00000||&lt;br /&gt;
|-&lt;br /&gt;
|6||Vertical Displayed||x0000000||25&lt;br /&gt;
|-&lt;br /&gt;
|7||Vertical Sync position||x0000000||&lt;br /&gt;
|-&lt;br /&gt;
|8||Interlace and Skew||xxxxxx00||0||00: No interlace; 01: Interlace Sync Raster Scan Mode; 10: No Interlace; 11: Interlace Sync and Video Raster Scan Mode&lt;br /&gt;
|-&lt;br /&gt;
|9||Maximum Raster Address||xxx00000||7||Maximum scan line address on CPC can hold between 0 and 7, higher values' upper bits are ignored&lt;br /&gt;
|-&lt;br /&gt;
|10||Cursor Start Raster||xBP00000||||Cursor not used on CPC. B = Blink On/Off; P = Blink Period Control (Slow/Fast)&lt;br /&gt;
|-&lt;br /&gt;
|11||Cursor End Raster||xxx00000||||&lt;br /&gt;
|-&lt;br /&gt;
|12||Display Start Address (High)||xx000000||&lt;br /&gt;
|-&lt;br /&gt;
|13||Display Start Address (Low)||00000000||&lt;br /&gt;
|-&lt;br /&gt;
|14||Cursor Address (High)||xx000000||&lt;br /&gt;
|-&lt;br /&gt;
|15||Cursor Address (High)||00000000||&lt;br /&gt;
|-&lt;br /&gt;
|16||Light Pen Address (High)||xx000000||||Read Only&lt;br /&gt;
|-&lt;br /&gt;
|17||Light Pen Address (High)||00000000||||Read Only&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== CRTC Differences ==&lt;br /&gt;
&lt;br /&gt;
In this section I will attempt to identify all the differences between each CRTC. &lt;br /&gt;
&lt;br /&gt;
The following tables list the functions that can be accessed for each type: &lt;br /&gt;
&lt;br /&gt;
Type 0&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||-||- &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 1&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||Read Status Register||Read Only &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 2&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||-||- &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Type 3 and 4&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|''b1''||''b0''||''Function''||''Read/Write'' &lt;br /&gt;
|-&lt;br /&gt;
|0||0||Select internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|0||1||Write to selected internal 6845 register||Write Only &lt;br /&gt;
|-&lt;br /&gt;
|1||0||Read from selected internal 6845 register||Read Only &lt;br /&gt;
|-&lt;br /&gt;
|1||1||Read from selected internal 6845 register||Read only &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It is not possible to read from all the internal registers, this table shows the read/write status of each register for each type: &lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable|width: 700px; font-size: 2em;}}&lt;br /&gt;
|rowspan=2|''Register Index''||rowspan=2|''Register Name''||colspan=4|''Type'' &lt;br /&gt;
|-&lt;br /&gt;
|0||1||2||3 &lt;br /&gt;
|-&lt;br /&gt;
|0||Horizontal Total||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|1||Horizontal Displayed||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|2||Horizontal Sync Position||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|3||Horizontal and Vertical Sync Widths||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|4||Vertical Total||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|5||Vertical Total Adjust||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|6||Vertical Displayed||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|7||Vertical Sync position||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|8||Interlace and Skew||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|9||Maximum Raster Address||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|10||Cursor Start Raster||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|11||Cursor End Raster||Write Only||Write Only||Write Only||(note 2) &lt;br /&gt;
|-&lt;br /&gt;
|12||Display Start Address (High)||Read/Write||Write Only||Write Only||Read/Write (note 2) &lt;br /&gt;
|-&lt;br /&gt;
|13||Display Start Address (Low)||Read/Write||Write Only||Write Only||Read/Write (note 2) &lt;br /&gt;
|-&lt;br /&gt;
|14||Cursor Address (High)||Read/Write||Read/Write||Read/Write||Read/Write (note 2) ***check &lt;br /&gt;
|-&lt;br /&gt;
|15||Cursor Address (Low)||Read/Write||Read/Write||Read/Write||Read/Write (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|16||Light Pen Address (High)||Read Only||Read Only||Read Only||Read Only (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|17||Light Pen Address (High)||Read Only||Read Only||Read Only||Read Only (note 2) **check &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Notes'''&lt;br /&gt;
&lt;br /&gt;
1. On type 0 and 1, if a Write Only register is read from, &amp;quot;0&amp;quot; is returned. &lt;br /&gt;
&lt;br /&gt;
2. See the document &amp;quot;Extra CPC Plus Hardware Information&amp;quot; for more details.&lt;br /&gt;
&lt;br /&gt;
== Datasheets ==&lt;br /&gt;
&lt;br /&gt;
* [[Media:hd6845.hitachi.pdf|HD6845 (Hitachi) (aka type 0)]]&lt;br /&gt;
* [[Media:Um6845.umc.pdf|UM6845 (UMC)  (aka type 0)]]&lt;br /&gt;
* [[Media:Um6845r.umc.pdf|UM6845R (UMC)  (aka type 1)]]&lt;br /&gt;
* [[Media:Mc6845.motorola.pdf|MC6845 (Motorola) (aka type 2)]]&lt;br /&gt;
&lt;br /&gt;
* [[VHDL implementation of the 6845]]&lt;br /&gt;
&lt;br /&gt;
== Clones ==&lt;br /&gt;
* [CM607P   a Bulgarian clone made in Pravetz factory]&lt;br /&gt;
* [EF6845P  by Thomson Semiconductors]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/6845 Wikipedia on the CRTC]&lt;br /&gt;
* [http://www.grimware.org/doku.php/documentations/devices/crtc CRTCs on grimware]&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
&lt;br /&gt;
*[[Gate Array]]&lt;br /&gt;
&lt;br /&gt;
*[[ASIC]]&lt;br /&gt;
&lt;br /&gt;
*[[Video modes]]&lt;br /&gt;
&lt;br /&gt;
*[[Synchronizing with the CRTC and display]] : technic and details on the relationship between Gate Array and CRTC.&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]] [[Category:CPC Internal Components]] [[Category:Programming]] [[Category:Datasheet]] [[Category:Graphic]]&lt;/div&gt;</summary>
		<author><name>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Lords_of_Chaos&amp;diff=63030</id>
		<title>Lords of Chaos</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Lords_of_Chaos&amp;diff=63030"/>
				<updated>2010-10-27T14:25:44Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
&lt;br /&gt;
Lords of Chaos is the follow-up to the Spectrum game 'Chaos'. It was available on all of the popular formats in 1990 (CPC, C64, Spectrum, Amiga, ST, DOS). It is very similar to [[Laser Squad]] and [[Rebelstar]].&lt;br /&gt;
&lt;br /&gt;
[http://www.cpc-power.com/index.php?page=detail&amp;amp;num=1316 CPC Power Link]&lt;/div&gt;</summary>
		<author><name>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Lords_of_Chaos&amp;diff=63029</id>
		<title>Lords of Chaos</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Lords_of_Chaos&amp;diff=63029"/>
				<updated>2010-10-27T14:21:31Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: Created page with &amp;quot;Lords of Chaos is the follow-up to the Spectrum game 'Chaos'. It was available on all of the popular formats in 1990 (CPC, C64, Spectrum, Amiga, ST, DOS). It is very similar to [...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Lords of Chaos is the follow-up to the Spectrum game 'Chaos'. It was available on all of the popular formats in 1990 (CPC, C64, Spectrum, Amiga, ST, DOS). It is very similar to [Laser Squad] and [Rebelstar].&lt;/div&gt;</summary>
		<author><name>Briggsy</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Main_Page&amp;diff=62548</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Main_Page&amp;diff=62548"/>
				<updated>2010-10-15T17:48:46Z</updated>
		
		<summary type="html">&lt;p&gt;Briggsy: /* CPC related news */  Sir Ababol&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
&lt;br /&gt;
&amp;lt;seo title=&amp;quot; - the ultimate knowledge base for Amstrad and Schneider 8-bit CPC computers.&amp;quot; metakeywords=&amp;quot;cpcwiki,cpc-wiki,Amstrad,Amstrad CPC,Schneider CPC,cpc464,cpc664,cpc6128,cpc472,cpc,8-bit,retro&amp;quot; metadescription=&amp;quot;CPCWiki is a collaborative encyclopaedia for the Amstrad CPC range of 8-bit computers, containing over 2500 articles.&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
== Welcome to the Amstrad CPC Wiki!  ==&lt;br /&gt;
This site hopes to evolve into an encyclopaedia on all things [[Amstrad|Amstrad]] [[CPC|CPC]] related. There are now '''[[Special:Allpages|{{NUMBEROFARTICLES}} articles]]''' around the CPC available.&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid rgb(223, 223, 223); padding: 5px 0px 4px; margin-top: 32px; background-color: rgb(238, 238, 238); text-align: center;&amp;quot;&amp;gt;&amp;lt;center&amp;gt;'''[[Special:Random|Random Page]] | [[#Become an Author!|Contribute]] | [[Help:Editing|Editing help]] | [http://www.cpcwiki.eu/forum Forum]'''&amp;lt;/center&amp;gt; &amp;lt;br&amp;gt;[[CPCWiki:Portal|CPCWiki Portal]] · [http://www.cpcwiki.eu/forum Forum] · [[Photo Gallery]] · [[About|About]] · [[Special:Statistics|Statistics]] · [[CPCWiki:General disclaimer|Disclaimer]]&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[http://www.cpcwiki.eu/index.php/ACU_Type_Ins http://www.cpcwiki.eu/imgs/thumb/3/39/Typeins.jpg/700px-Typeins.jpg]&amp;lt;/center&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; class=&amp;quot;FCK__ShowTableBorders&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| style=&amp;quot;vertical-align: top;&amp;quot; | &amp;lt;div style=&amp;quot;border: 1px solid rgb(255, 201, 201); margin: 0px 0px 5px; padding: 0.5em 1em; background-color: rgb(255, 243, 243);&amp;quot;&amp;gt;&lt;br /&gt;
=== CPC related news  ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Ilogical.png|thumb|right|150px|Ilogical]] [[Image:Cpc.PNG|thumb|right|150px|C.P.C.]]&lt;br /&gt;
&lt;br /&gt;
*15/10/10: [http://www.mojontwins.com/juegos_mojonos/sir-ababol-cpc/ Sir Ababol] released by Mojon Twins!&lt;br /&gt;
*11/10/10: [http://cpcwiki.eu/forum/index.php/topic,1425.new.html#new Blue Angel 69] released!!!&lt;br /&gt;
*11/10/10: [http://www.mojontwins.com/juegos_mojonos/cheril-of-the-bosque-cpc/ Cheril of the Bosque] released by Mojon Twins!&lt;br /&gt;
*11/10/10: Arnoldemu released [http://cpcwiki.eu/forum/index.php/topic,1416.msg13821 Drivetest] to help you diagnose drive problems!&lt;br /&gt;
*10/10/10: [[CPCE]] 1.94 is released.&lt;br /&gt;
*06/10/10: Impressive 4Kb demo realesed by [http://vanitycrew.free.fr/ Vanity Crew] during the Main#5 Party.&lt;br /&gt;
*07/09/10: 1st CPC emulator written in Javascript, [http://www.cpcbox.com/ CPCBox] is released!&lt;br /&gt;
*02/09/10: [[ROManager_BASIC]] is released!&lt;br /&gt;
*16/08/10: [[FilmeMacher]] updated!&lt;br /&gt;
*29/07/10: 2cdt [http://cpcwiki.eu/forum/index.php/topic,1203.msg11699 updated!!!]&lt;br /&gt;
*23/06/10: New [http://simonowen.com/samdisk/ SAMDisk] version released! Also, don't forget DevilMarkus' [http://cpc-live.com/data/download.php?type=-tool&amp;amp;fichier=DiskUtil_1_2.zip CPCXfs &amp;amp; SAMDisk GUI]!!&lt;br /&gt;
*20/06/10: [http://www.julien-nevo.com/arkos/tools.html Arkos Tracker v1.0 Beta 3] released!&lt;br /&gt;
*11/05/10: [http://www.portabledev.com/pages/ds/jeuxdev.-perso/ameds.php AmeDS], a DS CPC emulator has been released!&lt;br /&gt;
*26/04/10: [http://www.amstradcpc.info/ Amstrad Expo 2010] will take place in Coutances (France) from 25th to 27th June. &lt;br /&gt;
...[[OldNews|Older News]]...&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border-bottom: rgb(234,220,197) 1px solid; border-left: rgb(234,220,197) 1px solid; padding-bottom: 0.5em; background-color: rgb(204,255,204); margin: 0px 0px 5px; padding-left: 1em; padding-right: 1em; border-top: rgb(234,220,197) 1px solid; border-right: rgb(234,220,197) 1px solid; padding-top: 0.5em&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CPCWiki updates  ===&lt;br /&gt;
&lt;br /&gt;
*22/09/2009: The CPCWIKI moves to new domain [http://cpcwiki.eu CPCWIKI.EU]&lt;br /&gt;
*14/08/2009: The CPCWIKI moves (temporarily) to new domain [http://cpc-wiki.com CPC-WIKI.COM]&lt;br /&gt;
*22/07/09: Wiki &amp;amp; Forum moved to a new server&lt;br /&gt;
*14/07/09: Forum updated to 2.0RC1-1, Wiki updated to 1.15.1!&lt;br /&gt;
*Add the CPCWiki to '''your Homepage'''. Check out [[About#Wiki-Napping|About#Wiki-Napping]] and start napping this Wiki.&lt;br /&gt;
&amp;lt;/div&amp;gt; &amp;lt;div style=&amp;quot;border: 1px solid rgb(234, 220, 197); margin: 0px 0px 5px; padding: 0.5em 1em; background-color: rgb(255, 255, 204);&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Become an Author!  ===&lt;br /&gt;
&lt;br /&gt;
We are searching for authors of the following articles: &lt;br /&gt;
&lt;br /&gt;
* [[PDW|PDW]] (unknown what this article shall be about...) (Note: PDW is believed to be German group of programmers who wrote CPC Demos)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;createbox&amp;gt;&lt;br /&gt;
default=Enter name of article to create&lt;br /&gt;
buttonlabel=Create article!&lt;br /&gt;
width=40&lt;br /&gt;
&amp;lt;/createbox&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Top 5 Contributors from the last 60 days:&lt;br /&gt;
{{Special:ContributionScores/5/60/notools}} &lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: right;&amp;quot;&amp;gt;&amp;lt;small&amp;gt;'''All [[Special:Wantedpages|wanted articles]]''' &amp;amp;#124; [[:Category:Stub|Extendable Stubs]]&amp;lt;br&amp;gt;'''[[Special:ContributionScores|List of most active contributors]]'''&amp;lt;/small&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
| width=&amp;quot;50%&amp;quot; style=&amp;quot;vertical-align: top;&amp;quot; | &amp;lt;div style=&amp;quot;border: 1px solid rgb(228, 222, 222); margin: 0px 0px 5px; padding: 0.5em 1em; background-color: rgb(249, 249, 249);&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Did you know?  ===&lt;br /&gt;
&lt;br /&gt;
*When the 664 was being developed, Sugar was already looking (and hinting publicly!) at the 6128 &lt;br /&gt;
*The [[472|CPC 472]] was a model released in Spain with an extra unaccessible 8 KB of RAM to circumvent a spanish tax that was charged on imported machines with up to 64 KB memory.&lt;br /&gt;
*With a possible total amount of '''832 x 288 pixel''' (576 interlaced) the [[CPC|CPC]] was the 8 bit homecomputer with the highest screen resolution ever. &lt;br /&gt;
*'''OpenOffice''' for Windows/Linux is a direct descendant of [[Star-Division|StarWriter]] for the CPC. &lt;br /&gt;
*The transfer speed of the [[CPC Booster|CPC Booster +]] serial interface is faster than a standard '''DSL connection'''. &lt;br /&gt;
*[[SymbOS|SymbOS]] can handle more than '''50 times''' bigger hard discs than MS Windows 95A. &lt;br /&gt;
*[[FutureOS|FutureOS]] can load 178 KB in '''9 seconds''' from floppy disc and manages up to '''4 MB''' of RAM&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid rgb(234, 220, 197); margin: 0pt 0pt 5px; padding: 0.5em 1em; background-color: rgb(204, 255, 204);&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Donors  ===&lt;br /&gt;
&lt;br /&gt;
These people were kind enough to donate. All contributions went '''directly''' to our previous host, not our own pockets! Currently there is no need to donate. Please consider helping the CPC-Wiki in other ways, donating your time instead. Thanks!&lt;br /&gt;
&lt;br /&gt;
'''2009:''' Prodatron (€1000)&amp;lt;br&amp;gt;Nurgle (€30)&amp;lt;br&amp;gt;Serge Querné (€30)&amp;lt;br&amp;gt;Roald Strauss (€50)&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''Donators from earlier years'''&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*Bert Post Uiterweer, [[Rex|Rex]] of [[BENG!|BENG!]], [[Robcfg|Robcfg]], [[Prodatron|Prodatron]], [[User:Gryzor|Gryzor]], [[User:Ervin|Ervin]]&lt;br /&gt;
&lt;br /&gt;
Thanks so much guys!&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid rgb(234, 220, 197); margin: 0px 0px 5px; padding: 0.5em 1em; background-color: rgb(255, 204, 204);&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Where are CPC users from?  ===&lt;br /&gt;
&lt;br /&gt;
http://www4.clustrmaps.com/stats/maps-no_clusters/www.cpcwiki.com-thumb.jpg&amp;lt;br&amp;gt;(or click [http://www4.clustrmaps.com/user/7804b163 here] for the big map!) &lt;br /&gt;
&amp;lt;/div&amp;gt; &amp;lt;div style=&amp;quot;border: 1px solid rgb(234, 220, 197); margin: 0px 0px 5px; padding: 0.5em 1em; background-color: rgb(204, 255, 204);&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== What is the Amstrad CPC about?  ===&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
{{#ev:youtube|2zn3UavCpiQ|300}} &lt;br /&gt;
&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Briggsy</name></author>	</entry>

	</feed>