Changes

Locomotive BASIC

698 bytes added, 14 January
add max variable length information
Locomotive BASIC was a [http://en.wikipedia.org/wiki/BASIC_programming_language BASIC] interpreter for the Amstrad CPC range of computers.
It was availlable directly from in-built ROMs on [[CPC old generation]] and on the [[Plus System Cartridge]] for the [[Plus]] range.[https://benchmarko.github.io/CPCBasic/ Online Interpreter]
== Description ==
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.
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.
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.
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]].
The 464 and Spanish 472 shipped with BASIC 1.0 on ROM.
The language was revised and debugged for the 472 (British), 664, 6128 and Plus machines to become BASIC 1.1. Changes were minor but significant for the programmer, and included:
* DEC$ bug removed (in BASIC 1.0, it required two opening brackets and was undocumented)
== Variables ==
Many contemporary BASIC interpreters only supported the first few characters of a variable name as a discriminator. For example <code>WATER$</code> and <code>WALDO$</code> would refer to the same variable on a Commodore 64 or Apple II. But Locomotive BASIC allowed variable names up to 40 characters in length, so <code>THEQUICKBROWNFOXJUMPEDOVERTHELAZYDOGFAST$</code> and <code>THEQUICKBROWNFOXJUMPEDOVERTHELAZYDOGFATS$</code> could be use as separate variables.
=== Real (Floating Point) Numbers ===
: Beware: it only works here with BIT/number conditions one figure smaller than 1, 3, 7, 15, 31, 63 and 127
==== <code>MOD</code> ====
: ['''MOD''' returns a (rounded) rest (Modulos) after dividen has been devided by the devisor...]::'''Example:'''<pre>32767 mod 256255</pre>: Note: only works with numbers in the range -32768 and 32767 (&8000 < 0 < &7FFF)
==== <code>NOT</code> ====
| 1 | &01 | SOH | 0-255 | PRINTS CHARACTER TO SCREEN |
| 2 | &02 | STX | NONE | TURNS TEXT CURSOR OFF |
| 3 | &03 | ETX | NONE | TURNS TEXT CURSOR ON IN IMMEDIATE || | | | | MODE |
| 4 | &04 | EOT | 0-2 | SET SCREEN MODE |
| 5 | &05 | ENQ | 0-255 | PRINT CHARACTER AT GRAPHICS CURS. |
| 17 | 145 (128+17) | File already exists. |
| 18 | 146 (128+18) | File does not exists. |
| 19 | 147 (128+19) | Direcotry Directory is full. |
| 20 | 148 (128+20) | Disc is full. |
| 21 | 149 (128+21) | Disc changed while file were open. |
20 b=&x1111:REM 15 binary
30 c$="***"
40 PRINT c$+SRSTR$(a+b)+c$
run
*** 270***
</pre>
 
==== <code><big>STRING$ (<length>,<character specifier>)</big></code> ====
: ''BASIC 1.0 & 1.1''
12
edits