<?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=Laurentvaucher</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=Laurentvaucher"/>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php/Special:Contributions/Laurentvaucher"/>
		<updated>2026-08-29T06:33:04Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.25.1</generator>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=User:Laurentvaucher&amp;diff=12780</id>
		<title>User:Laurentvaucher</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=User:Laurentvaucher&amp;diff=12780"/>
				<updated>2006-12-20T12:05:10Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Well, I was just a simple french CPC464 user (I'm still french and simple, but I only use CPC emulators now). I used to program in BASIC (a lot) and in assembler (for limited graphical stuff). My most memorable experience was reproducing the sound of a roulette with the cassette deck, using some subtle POKEs.&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=User:Laurentvaucher&amp;diff=12779</id>
		<title>User:Laurentvaucher</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=User:Laurentvaucher&amp;diff=12779"/>
				<updated>2006-12-20T12:04:52Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Well, I was just a simple french CPC464 user (I'm still french and simple, but I only use PC emulators now). I used to program in BASIC (a lot) and in assembler (for limited graphical stuff). My most memorable experience was reproducing the sound of a roulette with the cassette deck, using some subtle POKEs.&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=User:Laurentvaucher&amp;diff=12778</id>
		<title>User:Laurentvaucher</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=User:Laurentvaucher&amp;diff=12778"/>
				<updated>2006-12-20T12:04:38Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Well, I was just a simple french CPC464 user (I'm still french and simple, bu I only use PC emulators now). I used to program in BASIC (a lot) and in assembler (for limited graphical stuff). My most memorable experience was reproducing the sound of a roulette with the cassette deck, using some subtle POKEs.&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12776</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12776"/>
				<updated>2006-12-20T08:09:09Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* DRAWR xr, y2, [[i1][,i2]] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&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;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, yr, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: Switch to radians 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;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DEG&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE [seed] ====&lt;br /&gt;
: Resets the pseudo-random generator to the given seed. 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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM [any text]====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12775</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12775"/>
				<updated>2006-12-19T21:55:52Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* RANDOMIZE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&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;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: Switch to radians 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;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DEG&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE [seed] ====&lt;br /&gt;
: Resets the pseudo-random generator to the given seed. 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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RANDOMIZE TIME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM [any text]====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12774</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12774"/>
				<updated>2006-12-19T21:52:15Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* REM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&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;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: Switch to radians 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;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DEG&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM [any text]====&lt;br /&gt;
: Introduces a comment.&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12773</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12773"/>
				<updated>2006-12-19T21:51:07Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* Command list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&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;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: Switch to radians 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;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DEG&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12772</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12772"/>
				<updated>2006-12-19T21:50:22Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* RAD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&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;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: Switch to radians 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;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;DEG&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12771</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12771"/>
				<updated>2006-12-19T21:49:28Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* DEG */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&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;
&lt;br /&gt;
''See also:'' &amp;lt;tt&amp;gt;RAD&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12770</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12770"/>
				<updated>2006-12-19T21:42:16Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* CHR$ (n) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12769</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12769"/>
				<updated>2006-12-19T21:41:55Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* SYMBOL AFTER n */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12768</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12768"/>
				<updated>2006-12-19T21:41:09Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12767</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12767"/>
				<updated>2006-12-19T21:40:55Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* RUN [line] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12766</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12766"/>
				<updated>2006-12-19T21:40:34Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* RESTORE [line] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12765</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12765"/>
				<updated>2006-12-19T21:39:43Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* RENUM [newLine],[oldLine],[step] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12764</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12764"/>
				<updated>2006-12-19T21:39:24Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* READ variable */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12763</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12763"/>
				<updated>2006-12-19T21:39:11Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* LOCATE x,y */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12762</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12762"/>
				<updated>2006-12-19T21:38:57Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* EDIT line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
: Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12761</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12761"/>
				<updated>2006-12-19T21:38:23Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* DELETE [line] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
: Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12760</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12760"/>
				<updated>2006-12-19T21:38:14Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* DATA x1[,x2,x3...] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12759</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12759"/>
				<updated>2006-12-19T21:37:52Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* BORDER color */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
: Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12758</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12758"/>
				<updated>2006-12-19T21:37:23Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* EDIT */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT line ====&lt;br /&gt;
Copies one program line to screen in edition mode.&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12757</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12757"/>
				<updated>2006-12-19T21:35:19Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* BORDER */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER color ====&lt;br /&gt;
Changes the color of the border.&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12756</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12756"/>
				<updated>2006-12-19T21:34:33Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* DELETE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE [line] ====&lt;br /&gt;
Deletes the current program completely (without argument) or only the given line.&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12755</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12755"/>
				<updated>2006-12-19T21:24:15Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* RUN */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN [line] ====&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;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12754</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12754"/>
				<updated>2006-12-19T21:20:21Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* RESTORE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE [line] ====&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;
&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;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12753</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12753"/>
				<updated>2006-12-19T21:10:29Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* DATA x1[,x2,x3...] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12752</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12752"/>
				<updated>2006-12-19T21:10:01Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* READ variable */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12751</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12751"/>
				<updated>2006-12-19T21:08:53Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* READ variable */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&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;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12750</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12750"/>
				<updated>2006-12-19T21:08:19Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* READ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ variable ====&lt;br /&gt;
Gets the next data item (from &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; commands) and moves to the next.&lt;br /&gt;
The variable must be of the correct type.&lt;br /&gt;
&lt;br /&gt;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12749</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12749"/>
				<updated>2006-12-19T20:57:26Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* RENUM [newLine],[oldLine],[step] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&lt;br /&gt;
It is important to note that ''jumps'' (&amp;lt;tt&amp;gt;GOTO&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;GOSUB&amp;lt;/tt&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12748</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12748"/>
				<updated>2006-12-19T20:51:28Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* RENUM [newLine],[oldLine],[step] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&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;
&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;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;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;
==== RESTORE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12747</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12747"/>
				<updated>2006-12-19T20:49:42Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* RENUM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM [newLine],[oldLine],[step] ====&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.&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM Line 10&lt;br /&gt;
20 REM Line 20&lt;br /&gt;
30 REM Line 30&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
becomes, after calling &amp;lt;tt&amp;gt;RENUM 100,20,5&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 REM Line 10&lt;br /&gt;
100 REM Line 20&lt;br /&gt;
105 REM Line 30&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== RESTORE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12746</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12746"/>
				<updated>2006-12-19T20:27:37Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* LOCATE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE x,y ====&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;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RESTORE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12744</id>
		<title>Locomotive BASIC</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=Locomotive_BASIC&amp;diff=12744"/>
				<updated>2006-12-19T17:24:12Z</updated>
		
		<summary type="html">&lt;p&gt;Laurentvaucher: /* DATA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&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;
== 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;
== 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;
== Command list ==&lt;br /&gt;
&lt;br /&gt;
=== Commands and operators ===&lt;br /&gt;
&lt;br /&gt;
==== AFTER I[,t] GOSUB Ln ====&lt;br /&gt;
: Waits for i/50 seconds and then jumps to the subruotine at line Ln.&lt;br /&gt;
&lt;br /&gt;
==== AUTO [Ln, i] ====&lt;br /&gt;
: Automaticaly generates line numbers starting at line Ln with increment i between line numbers.&lt;br /&gt;
: Use [ESC to leave AUTO mode. Default value for Ln and i is 10.&lt;br /&gt;
::''Example:''&lt;br /&gt;
::AUTO 100,5 - generates line numbers 100, 105, 110...&lt;br /&gt;
&lt;br /&gt;
==== BORDER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CALL add[,list of parameters] ====&lt;br /&gt;
: Allows an externally developed subroutine to be called by BASIC&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CALL 0 - resets the computer completely&lt;br /&gt;
&lt;br /&gt;
==== CAT ====&lt;br /&gt;
: Displays the names of all existing programes on the tape or disk.&lt;br /&gt;
::'''Examples:'''&lt;br /&gt;
::CAT [ENTER] - lists all disk files in alpha-numeric order&lt;br /&gt;
::TAPE [ENTER]&lt;br /&gt;
::CAT [ENTER] - lists names of all tape files in their storage order&lt;br /&gt;
&lt;br /&gt;
==== CHAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CHAIN MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLEAR ====&lt;br /&gt;
: Clears all variables from memory, leaving the program in memory unchanged. All open files are abandoned.&lt;br /&gt;
&lt;br /&gt;
==== CLG [ink] ====&lt;br /&gt;
: Clears the graphics screen to colour specified by ink. If parameter ink is not specified them the graphics screen is cleared to the colour specified by the GRAPHICS PAPER statement.&lt;br /&gt;
&lt;br /&gt;
==== CLOSEIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLOSEOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CLS ====&lt;br /&gt;
: Clears the screen. The text cursor is moved to the upper left corner.&lt;br /&gt;
&lt;br /&gt;
==== CONT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CURSOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DATA x1[,x2,x3...]====&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;
&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;
==== DEF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEFSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DELETE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DI ====&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;
&lt;br /&gt;
==== DIM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DRAW x,y [,[i1][,i2]] ====&lt;br /&gt;
: Draws a line from the current cursor position to position x,y. i1 specifies colour, i2 is the logical colour.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i2 = 0   normal colour   i2 = 2 AND colour&lt;br /&gt;
i2 = 1   XOR colour      i2 = 3 OR colour&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
::''Example:''&lt;br /&gt;
::CLG 2&lt;br /&gt;
::DRAW 500,400,0 - draws a line from 0,0 to 500,400&lt;br /&gt;
&lt;br /&gt;
==== DRAWR xr, y2, [[i1][,i2]] ====&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;
:: Move 200,200&lt;br /&gt;
:: DRAWR 100,100,0 - draws a line from 200,200 to 300,300&lt;br /&gt;
&lt;br /&gt;
==== EDIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EI ====&lt;br /&gt;
: Enable interrupts which have been disabled by DI&lt;br /&gt;
&lt;br /&gt;
==== END ====&lt;br /&gt;
: Indicates end of program&lt;br /&gt;
&lt;br /&gt;
==== ENT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ENV ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERASE v[$(i1[,i2]) ====&lt;br /&gt;
: Clears the contents of an array that is no longer required.&lt;br /&gt;
&lt;br /&gt;
==== ERL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERROR i ====&lt;br /&gt;
: Returns the error message whose error code number is i.&lt;br /&gt;
&lt;br /&gt;
==== EVERY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FILL i ====&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;
==== FN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FOR TO STEP NEXT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRAME ====&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;
==== GOSUB i ====&lt;br /&gt;
: Jumps to subroutine which is given as argument.&lt;br /&gt;
: ''Example:''&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;
==== GOTO i ====&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;
&lt;br /&gt;
==== GRAPHICS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== IF THEN ELSE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INPUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== KEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LET ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LINE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LIST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOCATE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MASK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MEMORY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MERGE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MID$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MODE ====&lt;br /&gt;
: Changes the screen mode: MODE 0 is 160x200 in 16 colors, MODE 1 is 320x200 4 colors and MODE 2 is 640x200 2 colors.&lt;br /&gt;
&lt;br /&gt;
==== MOVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOVER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NEW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON BREAK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ON ERROR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OPENOUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ORIGIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OUT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PAPER ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PLOTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POKE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PRINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RAD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RANDOMIZE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== READ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RELEASE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RENUM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RESTORE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RESUME ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RETURN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RUN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SAVE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SOUND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SPEED ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STOP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SUB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SWAP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SYMBOL n,i1[,i2,i3,i4,i5,i6,i7,i8] ====&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;
&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;
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;
==== SYMBOL AFTER n ====&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;
==== TAB ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAGOFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TROFF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TRON ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== USING ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WAIT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WHILE WEND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WIDTH ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WINDOW ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== WRITE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ZONE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
==== AND ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MOD ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== NOT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== OR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== XOR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
==== ABS (n) ====&lt;br /&gt;
: Returns the absolute value of n by ignoring the sign value.&lt;br /&gt;
::''Example''&lt;br /&gt;
:: PRINT ABS(-3.5) - prints 3.5&lt;br /&gt;
&lt;br /&gt;
==== ASC ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ATN (n) ====&lt;br /&gt;
: Returns the arctangent of n.&lt;br /&gt;
&lt;br /&gt;
==== BIN$ (i1,[i2]) ====&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;
:: PRINT BIN$(66,8) - prints 01000010&lt;br /&gt;
&lt;br /&gt;
==== CHR$ (n)====&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;
==== CINT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COPYCHR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== COS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== CREAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DEC$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== DERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EOF ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== ERR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== EXP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FIX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== FRE ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HEX$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== HIMEM ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INKEY$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INP ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INSTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== INT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== JOY ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEFT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LEN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOG10 ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== LOWER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MAX ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== MIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PEEK ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== PI ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== POS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== REMAIN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RIGHT$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== RND [(n)] ====&lt;br /&gt;
: Generates the next random number in the current squence if n is positive or omitted. If n = 0, the random number generated will be the same as the last random number generated.&lt;br /&gt;
&lt;br /&gt;
==== ROUND (n[,i1]) ====&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;
:: PRINT ROUND(1562.357,2):PRINT ROUND(1562.375,-2) - prints 1562.36 1600&lt;br /&gt;
&lt;br /&gt;
==== SGN (n) ====&lt;br /&gt;
: Returns 1 if n is positive, 0 if n = 0, -1 if n is negative.&lt;br /&gt;
&lt;br /&gt;
==== SIN (n) ====&lt;br /&gt;
: Returns sine of n in degree or radian mode (see DEG and RAD)&lt;br /&gt;
&lt;br /&gt;
==== SPACE$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== SQ (channel) ====&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;
==== SQR (n) ====&lt;br /&gt;
: Returns the square root of n.&lt;br /&gt;
&lt;br /&gt;
==== STR$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== STRING$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TAN ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TEST ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TESTR ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== TIME ====&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;
==== UNT ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== UPPER$ ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VAL ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== VPOS (#st) ====&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;
==== XPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
==== YPOS ====&lt;br /&gt;
: [...]&lt;br /&gt;
&lt;br /&gt;
''(Please, fill in. Looks like a lot of work ;-) ...)''&lt;br /&gt;
&lt;br /&gt;
== Other Basic Dialects avaliable for the CPC ==&lt;br /&gt;
&lt;br /&gt;
[[BBC Basic]]&lt;br /&gt;
&lt;br /&gt;
== Web links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.kjthacker.f2s.com/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;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Laurentvaucher</name></author>	</entry>

	</feed>