Locomotive BASIC

from Wikipedia, the free encyclopedia

Locomotive BASIC is a BASIC dialect of the Schneider / Amstrad CPC 8-bit home computer series, contained in the ROM and at the same time intended as an operating system, in terms of development, scope of commands and by the manufacturer, Locomotive, closely related to the well-known Mallard BASIC . This language was developed by the small British company Locomotive Software .

Programming was done in the dialog on the command line, the necessary line numbering and changes to it were automated. Like most BASICs operated as an interpreter , an optional compiler was also available.

The extensive and easy-to-use language scope made it possible to program most of the applications in BASIC itself. Additional functions could be integrated into the program itself with assembler memory calls ( Z80A ). The sprites of a C64 are missing, but surfaces with up to eight dialog windows can be programmed quickly and smoothly. Overall, it's a largely balanced, well-rounded programming language with good syntax.

Cassette or floppy disk drives were used as storage media, monitors or printers were the main output, and keyboard or joystick were used as input . Like the built-in loudspeaker, they could be addressed directly. Optional, more extensive external hardware requires interfaces from the manufacturer or own programming work.

In line with the development time, however, the major approaches to structured programming are largely missing, but due to the often manageable scope of programming, they are not yet significantly missed or are skilfully implemented with other methods such as the notorious GOTOs . The programming was problem-oriented or machine-oriented, parallel processing, networking or object orientation are still in their infancy or have not yet been born.


Something simple instead of " Hello World ":

 10 REM Beispiel
 20 PRINT "Zylinderflaechenberechnung"
 30 INPUT "Bitte Zylinderhoehe eingeben ...",H
 40 INPUT "Bitte Zylinderradius eingeben ...",R
 50 A=2*PI*(R^2+R*H)
 60 PRINT "Zylinderfläche = ",A

The whole thing can of course also be simplified, implemented here from the command line:


Each command line is limited to approx. 255 characters, the German special characters are not available in BASIC itself, except as ASCII calls.


While version 1.0 or 1.1 was used for the Schneider / Amstrad CPC and the Mallard Basic from the same company or the BBC BASIC known in England was used for the PCW / Joyce and NC100, the PC-compatible was used for the DOS / GEM environment Amstrad PC1512 created the Locomotive BASIC2 version . The exact specification of the version is:

 Locomotive BASIC 2
 Version 1.12   11 Jul 86
 Copyright 1986 Locomotive Software Ltd

Locomotive Basic2 was a graphical integrated development environment in the graphical user interface GEM. The programs could deal with windows, use the mouse and generate colored graphics.

With the KC compact , the Basic reports with BASIC 1.1 .


The Locomotive Basic of the CPC is not a pure interpreter , rather a subset of the work to be carried out during compilation was already carried out when entering the program. For example, the BASIC commands such as PRINT, IF, FOR etc. were not stored letter by letter in the main memory, but were instead pre-translated into a so-called token (a byte as a numerical code for the corresponding command). This accelerated the execution of the program because the BASIC command to be executed no longer had to be determined at runtime using several characters, instead it was possible to jump directly to the corresponding routine via the token value using a table in the main memory. Special commands were available on the command line for test runs and troubleshooting. The compact lexicon of the language helped avoid typing errors, the error messages were concise. The possible variable types are limited to the most essential, their declaration is often not absolutely necessary.

Individual evidence